[med-svn] [aghermann] 03/85: tabs to spaces

andrei zavada hmmr-guest at alioth.debian.org
Thu Sep 26 23:46:21 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 0453af650c471b38487059ab96b240665168c601
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Mon Sep 2 00:22:54 2013 +0300

    tabs to spaces
---
 upstream/src/aghermann/expdesign/expdesign.cc      |  724 +++----
 upstream/src/aghermann/expdesign/expdesign.hh      |  420 ++--
 upstream/src/aghermann/expdesign/forward-decls.hh  |    2 +-
 upstream/src/aghermann/expdesign/loadsave.cc       |  178 +-
 upstream/src/aghermann/expdesign/profile.hh        |  210 +-
 upstream/src/aghermann/expdesign/recording.cc      |  484 ++---
 upstream/src/aghermann/expdesign/recording.hh      |  434 ++---
 upstream/src/aghermann/expdesign/subject.cc        |  104 +-
 upstream/src/aghermann/expdesign/subject.hh        |  280 +--
 upstream/src/aghermann/expdesign/tree-scanner.cc   |  626 +++---
 upstream/src/aghermann/globals.cc                  |   34 +-
 upstream/src/aghermann/globals.hh                  |    2 +-
 upstream/src/aghermann/ica/ica.hh                  |  130 +-
 upstream/src/aghermann/main.cc                     |  188 +-
 upstream/src/aghermann/model/achermann-siman.cc    |  192 +-
 upstream/src/aghermann/model/achermann-tunable.cc  |  278 +--
 upstream/src/aghermann/model/achermann-tunable.hh  |  212 +--
 upstream/src/aghermann/model/achermann.cc          |  368 ++--
 upstream/src/aghermann/model/achermann.hh          |  140 +-
 upstream/src/aghermann/model/beersma.hh            |  162 +-
 upstream/src/aghermann/model/borbely.cc            |  230 +--
 upstream/src/aghermann/model/forward-decls.hh      |   28 +-
 upstream/src/aghermann/model/ultradian-cycle.cc    |  272 +--
 upstream/src/aghermann/patterns/patterns.cc        |  282 +--
 upstream/src/aghermann/patterns/patterns.hh        |  258 +--
 upstream/src/aghermann/patterns/patterns.ii        |  162 +-
 upstream/src/aghermann/print_version.cc            |    4 +-
 upstream/src/aghermann/rk1968/rk1968.cc            |   60 +-
 upstream/src/aghermann/rk1968/rk1968.hh            |   14 +-
 upstream/src/aghermann/ui/forward-decls.hh         |    2 +-
 upstream/src/aghermann/ui/globals.cc               |   14 +-
 upstream/src/aghermann/ui/globals.hh               |   14 +-
 upstream/src/aghermann/ui/mf/mf-construct.cc       |  250 +--
 upstream/src/aghermann/ui/mf/mf.cc                 |  576 +++---
 upstream/src/aghermann/ui/mf/mf.hh                 |  174 +-
 upstream/src/aghermann/ui/mf/mf_cb.cc              |  554 +++---
 upstream/src/aghermann/ui/mf/mf_cb.hh              |    2 +-
 upstream/src/aghermann/ui/misc.cc                  |   98 +-
 upstream/src/aghermann/ui/misc.hh                  |   12 +-
 upstream/src/aghermann/ui/mw/admit-one.cc          |  352 ++--
 upstream/src/aghermann/ui/mw/admit-one_cb.cc       |  148 +-
 upstream/src/aghermann/ui/mw/construct.cc          | 1244 ++++++------
 upstream/src/aghermann/ui/mw/loadsave.cc           |  240 +--
 upstream/src/aghermann/ui/mw/mainmenu_cb.cc        |  628 +++---
 upstream/src/aghermann/ui/mw/measurements.cc       |  542 +++---
 upstream/src/aghermann/ui/mw/measurements_cb.cc    |  366 ++--
 upstream/src/aghermann/ui/mw/mw.cc                 |  806 ++++----
 upstream/src/aghermann/ui/mw/mw.hh                 |  598 +++---
 upstream/src/aghermann/ui/mw/mw_cb.cc              |  470 ++---
 upstream/src/aghermann/ui/mw/mw_cb.hh              |    2 +-
 upstream/src/aghermann/ui/mw/populate.cc           | 1044 +++++-----
 upstream/src/aghermann/ui/mw/settings_cb.cc        |  366 ++--
 upstream/src/aghermann/ui/mw/simulations.cc        |  198 +-
 upstream/src/aghermann/ui/mw/simulations_cb.cc     |  312 +--
 upstream/src/aghermann/ui/mw/splash.cc             |  208 +-
 upstream/src/aghermann/ui/mw/widgets.hh            |  674 +++----
 upstream/src/aghermann/ui/sf/channel.cc            |  790 ++++----
 upstream/src/aghermann/ui/sf/construct.cc          |  658 +++----
 upstream/src/aghermann/ui/sf/controls_cb.cc        |  180 +-
 .../src/aghermann/ui/sf/d/artifacts-construct.cc   |  108 +-
 .../ui/sf/d/artifacts-simple-construct.cc          |   24 +-
 upstream/src/aghermann/ui/sf/d/artifacts-simple.cc |   16 +-
 upstream/src/aghermann/ui/sf/d/artifacts-simple.hh |   32 +-
 upstream/src/aghermann/ui/sf/d/artifacts.cc        |   64 +-
 upstream/src/aghermann/ui/sf/d/artifacts.hh        |  132 +-
 upstream/src/aghermann/ui/sf/d/artifacts_cb.cc     |  354 ++--
 .../src/aghermann/ui/sf/d/filters-construct.cc     |   50 +-
 upstream/src/aghermann/ui/sf/d/filters.cc          |   18 +-
 upstream/src/aghermann/ui/sf/d/filters.hh          |   50 +-
 upstream/src/aghermann/ui/sf/d/filters_cb.cc       |   26 +-
 .../src/aghermann/ui/sf/d/patterns-construct.cc    |  240 +--
 upstream/src/aghermann/ui/sf/d/patterns-draw.cc    |  380 ++--
 .../src/aghermann/ui/sf/d/patterns-profiles.cc     |  252 +--
 .../src/aghermann/ui/sf/d/patterns-profiles_cb.cc  |  214 +--
 upstream/src/aghermann/ui/sf/d/patterns.cc         |  304 +--
 upstream/src/aghermann/ui/sf/d/patterns.hh         |  280 +--
 upstream/src/aghermann/ui/sf/d/patterns_cb.cc      |  622 +++---
 .../src/aghermann/ui/sf/d/phasediff-construct.cc   |  100 +-
 upstream/src/aghermann/ui/sf/d/phasediff.cc        |  324 ++--
 upstream/src/aghermann/ui/sf/d/phasediff.hh        |   88 +-
 upstream/src/aghermann/ui/sf/d/phasediff_cb.cc     |  202 +-
 upstream/src/aghermann/ui/sf/d/rk1968.hh           |  282 +--
 upstream/src/aghermann/ui/sf/hypnogram.cc          |  266 +--
 upstream/src/aghermann/ui/sf/hypnogram_cb.cc       |  150 +-
 upstream/src/aghermann/ui/sf/ica.cc                |  510 ++---
 upstream/src/aghermann/ui/sf/ica_cb.cc             |  330 ++--
 upstream/src/aghermann/ui/sf/mainmenu_cb.cc        |  308 +--
 upstream/src/aghermann/ui/sf/montage-overlays.cc   |  684 +++----
 upstream/src/aghermann/ui/sf/montage.cc            | 1378 +++++++-------
 upstream/src/aghermann/ui/sf/montage_cb.cc         | 2000 ++++++++++----------
 upstream/src/aghermann/ui/sf/sf.cc                 | 1132 +++++------
 upstream/src/aghermann/ui/sf/sf.hh                 | 1000 +++++-----
 upstream/src/aghermann/ui/sf/sf_cb.cc              |   16 +-
 upstream/src/aghermann/ui/sf/sf_cb.hh              |    2 +-
 upstream/src/aghermann/ui/sf/widgets.hh            |  358 ++--
 upstream/src/aghermann/ui/sm/sm-construct.cc       |  138 +-
 upstream/src/aghermann/ui/sm/sm.cc                 |  426 ++---
 upstream/src/aghermann/ui/sm/sm.hh                 |  120 +-
 upstream/src/aghermann/ui/sm/sm_cb.cc              |  264 +--
 upstream/src/aghermann/ui/sm/sm_cb.hh              |    2 +-
 upstream/src/aghermann/ui/ui++.cc                  |   44 +-
 upstream/src/aghermann/ui/ui++.hh                  |  372 ++--
 upstream/src/aghermann/ui/ui.cc                    |  340 ++--
 upstream/src/aghermann/ui/ui.hh                    |   84 +-
 upstream/src/libmetrics/mc-artifacts.ii            |   68 +-
 upstream/src/libsigproc/ext-filters.ii             |   96 +-
 upstream/src/libsigproc/sigproc.ii                 |  360 ++--
 107 files changed, 16305 insertions(+), 16305 deletions(-)

diff --git a/upstream/src/aghermann/expdesign/expdesign.cc b/upstream/src/aghermann/expdesign/expdesign.cc
index c6e5f07..b5e31d4 100644
--- a/upstream/src/aghermann/expdesign/expdesign.cc
+++ b/upstream/src/aghermann/expdesign/expdesign.cc
@@ -27,112 +27,112 @@ using namespace std;
 using agh::confval::SValidator;
 
 const char
-	*const agh::CExpDesign::FreqBandNames[metrics::TBand::TBand_total] = {
-	"Delta", "Theta", "Alpha", "Beta", "Gamma",
+        *const agh::CExpDesign::FreqBandNames[metrics::TBand::TBand_total] = {
+        "Delta", "Theta", "Alpha", "Beta", "Gamma",
 };
 
 double
-	agh::CExpDesign::freq_bands[metrics::TBand::TBand_total][2] = {
-	{  1.5,  4.0 },
-	{  4.0,  8.0 },
-	{  8.0, 12.0 },
-	{ 15.0, 30.0 },
-	{ 30.0, 40.0 },
+        agh::CExpDesign::freq_bands[metrics::TBand::TBand_total][2] = {
+        {  1.5,  4.0 },
+        {  4.0,  8.0 },
+        {  8.0, 12.0 },
+        { 15.0, 30.0 },
+        { 30.0, 40.0 },
 };
 
 
 
 agh::CExpDesign::
 CExpDesign (const string& session_dir_,
-	    TMsmtCollectProgressIndicatorFun progress_fun)
+            TMsmtCollectProgressIndicatorFun progress_fun)
       : num_threads (0),
-	af_dampen_window_type (sigproc::TWinType::welch),
-	af_dampen_factor (.95),
-	tunables0 (tstep, tlo, thi), // only references here, don't worry
-	req_percent_scored (80.),
-	swa_laden_pages_before_SWA_0 (3),
-	strict_subject_id_checks (false),
-	_id_pool (0),
-	config_keys_g ({
-		SValidator<double>("ctl_param.step_size",	&ctl_params0.siman_params.step_size),
-		SValidator<double>("ctl_param.boltzmann_k",	&ctl_params0.siman_params.k,			SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
-		SValidator<double>("ctl_param.t_initial",	&ctl_params0.siman_params.t_initial,		SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
-		SValidator<double>("ctl_param.damping_mu",	&ctl_params0.siman_params.mu_t,			SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
-		SValidator<double>("ctl_param.t_min",		&ctl_params0.siman_params.t_min,		SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
-		SValidator<double>("profile.req_scored_pc",	&req_percent_scored,				SValidator<double>::SVFRangeIn( 80., 100.)),
-		SValidator<double>("fft_param.pagesize",	&fft_params.pagesize,				SValidator<double>::SVFRangeIn( 4., 120.)),
-		SValidator<double>("fft_param.binsize",		&fft_params.binsize,				SValidator<double>::SVFRangeIn( .125, 1.)),
-		SValidator<double>("artifacts.dampen_factor",	&af_dampen_factor,				SValidator<double>::SVFRangeIn( 0., 1.)),
-		SValidator<double>("mc_param.mc_gain",		&mc_params.mc_gain,				SValidator<double>::SVFRangeIn( 0., 100.)),
-		SValidator<double>("mc_param.f0fc",		&mc_params.f0fc,				SValidator<double>::SVFRangeEx( 0., 80.)),
-		SValidator<double>("mc_param.bandwidth",	&mc_params.bandwidth,				SValidator<double>::SVFRangeIn( 0.125, 2.)),
-		SValidator<double>("mc_param.iir_backpolate",	&mc_params.iir_backpolate,			SValidator<double>::SVFRangeIn( 0., 1.)),
-		SValidator<double>("swu_param.min_upswing_duration",
-								&swu_params.min_upswing_duration,		SValidator<double>::SVFRangeIn( 0.01, 1.)),
-	}),
-	config_keys_d ({
-		SValidator<int>("fft_param.welch_window_type",	(int*)&fft_params.welch_window_type,		SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType_total - 1)),
-		SValidator<int>("fft_param.plan_type",		(int*)&fft_params.plan_type,			SValidator<int>::SVFRangeIn( 0, (int)metrics::psd::TFFTWPlanType_total - 1)),
-		SValidator<int>("artifacts.dampen_window_type",	(int*)&af_dampen_window_type,			SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType_total - 1)),
-		SValidator<int>("ctl_param.iters_fixed_t",	&ctl_params0.siman_params.iters_fixed_T,	SValidator<int>::SVFRangeIn( 1, 1000000)),
-		SValidator<int>("ctl_param.n_tries",		&ctl_params0.siman_params.n_tries,		SValidator<int>::SVFRangeIn( 1, 10000)),
-	}),
-	config_keys_z ({
-		SValidator<size_t>("smp.num_threads",		&num_threads,					SValidator<size_t>::SVFRangeIn( 0, 20)),
-		SValidator<size_t>("mc_params.n_bins",		&mc_params.n_bins,				SValidator<size_t>::SVFRangeIn( 1, 100)),
-		SValidator<size_t>("profile.swa_laden_pages_before_SWA_0",
-								&swa_laden_pages_before_SWA_0,			SValidator<size_t>::SVFRangeIn( 1, 100)),
-		SValidator<size_t>("mc_param.smooth_side",	&mc_params.smooth_side,				SValidator<size_t>::SVFRangeIn( 0, 5)),
-	}),
-	config_keys_b ({
-		SValidator<bool>("ctl_param.DBAmendment1",	&ctl_params0.DBAmendment1),
-		SValidator<bool>("ctl_param.DBAmendment2",	&ctl_params0.DBAmendment2),
-		SValidator<bool>("ctl_param.AZAmendment1",	&ctl_params0.AZAmendment1),
-		SValidator<bool>("ctl_param.AZAmendment2",	&ctl_params0.AZAmendment2),
-		SValidator<bool>("profile.score_unscored_as_wake",
-				  				&score_unscored_as_wake),
-		SValidator<bool>("StrictSubjectIdChecks",	&strict_subject_id_checks),
-	}),
-	config_keys_s ({
-		SValidator<string>("LastUsedVersion",		&last_used_version),
-	})
+        af_dampen_window_type (sigproc::TWinType::welch),
+        af_dampen_factor (.95),
+        tunables0 (tstep, tlo, thi), // only references here, don't worry
+        req_percent_scored (80.),
+        swa_laden_pages_before_SWA_0 (3),
+        strict_subject_id_checks (false),
+        _id_pool (0),
+        config_keys_g ({
+                SValidator<double>("ctl_param.step_size",        &ctl_params0.siman_params.step_size),
+                SValidator<double>("ctl_param.boltzmann_k",        &ctl_params0.siman_params.k,                        SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
+                SValidator<double>("ctl_param.t_initial",        &ctl_params0.siman_params.t_initial,                SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
+                SValidator<double>("ctl_param.damping_mu",        &ctl_params0.siman_params.mu_t,                        SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
+                SValidator<double>("ctl_param.t_min",                &ctl_params0.siman_params.t_min,                SValidator<double>::SVFRangeEx( DBL_MIN, 1e9)),
+                SValidator<double>("profile.req_scored_pc",        &req_percent_scored,                                SValidator<double>::SVFRangeIn( 80., 100.)),
+                SValidator<double>("fft_param.pagesize",        &fft_params.pagesize,                                SValidator<double>::SVFRangeIn( 4., 120.)),
+                SValidator<double>("fft_param.binsize",                &fft_params.binsize,                                SValidator<double>::SVFRangeIn( .125, 1.)),
+                SValidator<double>("artifacts.dampen_factor",        &af_dampen_factor,                                SValidator<double>::SVFRangeIn( 0., 1.)),
+                SValidator<double>("mc_param.mc_gain",                &mc_params.mc_gain,                                SValidator<double>::SVFRangeIn( 0., 100.)),
+                SValidator<double>("mc_param.f0fc",                &mc_params.f0fc,                                SValidator<double>::SVFRangeEx( 0., 80.)),
+                SValidator<double>("mc_param.bandwidth",        &mc_params.bandwidth,                                SValidator<double>::SVFRangeIn( 0.125, 2.)),
+                SValidator<double>("mc_param.iir_backpolate",        &mc_params.iir_backpolate,                        SValidator<double>::SVFRangeIn( 0., 1.)),
+                SValidator<double>("swu_param.min_upswing_duration",
+                                                                &swu_params.min_upswing_duration,                SValidator<double>::SVFRangeIn( 0.01, 1.)),
+        }),
+        config_keys_d ({
+                SValidator<int>("fft_param.welch_window_type",        (int*)&fft_params.welch_window_type,                SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType_total - 1)),
+                SValidator<int>("fft_param.plan_type",                (int*)&fft_params.plan_type,                        SValidator<int>::SVFRangeIn( 0, (int)metrics::psd::TFFTWPlanType_total - 1)),
+                SValidator<int>("artifacts.dampen_window_type",        (int*)&af_dampen_window_type,                        SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType_total - 1)),
+                SValidator<int>("ctl_param.iters_fixed_t",        &ctl_params0.siman_params.iters_fixed_T,        SValidator<int>::SVFRangeIn( 1, 1000000)),
+                SValidator<int>("ctl_param.n_tries",                &ctl_params0.siman_params.n_tries,                SValidator<int>::SVFRangeIn( 1, 10000)),
+        }),
+        config_keys_z ({
+                SValidator<size_t>("smp.num_threads",                &num_threads,                                        SValidator<size_t>::SVFRangeIn( 0, 20)),
+                SValidator<size_t>("mc_params.n_bins",                &mc_params.n_bins,                                SValidator<size_t>::SVFRangeIn( 1, 100)),
+                SValidator<size_t>("profile.swa_laden_pages_before_SWA_0",
+                                                                &swa_laden_pages_before_SWA_0,                        SValidator<size_t>::SVFRangeIn( 1, 100)),
+                SValidator<size_t>("mc_param.smooth_side",        &mc_params.smooth_side,                                SValidator<size_t>::SVFRangeIn( 0, 5)),
+        }),
+        config_keys_b ({
+                SValidator<bool>("ctl_param.DBAmendment1",        &ctl_params0.DBAmendment1),
+                SValidator<bool>("ctl_param.DBAmendment2",        &ctl_params0.DBAmendment2),
+                SValidator<bool>("ctl_param.AZAmendment1",        &ctl_params0.AZAmendment1),
+                SValidator<bool>("ctl_param.AZAmendment2",        &ctl_params0.AZAmendment2),
+                SValidator<bool>("profile.score_unscored_as_wake",
+                                                                  &score_unscored_as_wake),
+                SValidator<bool>("StrictSubjectIdChecks",        &strict_subject_id_checks),
+        }),
+        config_keys_s ({
+                SValidator<string>("LastUsedVersion",                &last_used_version),
+        })
 {
-	char *tmp = canonicalize_file_name(session_dir_.c_str());
-	if ( !tmp ) // does not exist
-		throw invalid_argument (string ("Failed to canonicalize dir: ") + session_dir_);
+        char *tmp = canonicalize_file_name(session_dir_.c_str());
+        if ( !tmp ) // does not exist
+                throw invalid_argument (string ("Failed to canonicalize dir: ") + session_dir_);
 
-	if ( session_dir_ != tmp ) {
-		printf( "CExpDesign::CExpDesign(): canonicalized session_dir \"%s\" to \"%s\"\n", session_dir_.c_str(), tmp);
-		_session_dir.assign( tmp);
-	} else
-		_session_dir = session_dir_;
-	free( tmp);
+        if ( session_dir_ != tmp ) {
+                printf( "CExpDesign::CExpDesign(): canonicalized session_dir \"%s\" to \"%s\"\n", session_dir_.c_str(), tmp);
+                _session_dir.assign( tmp);
+        } else
+                _session_dir = session_dir_;
+        free( tmp);
 
-	if ( _session_dir.size() > 1 && _session_dir[_session_dir.size()-1] == '/' )
-		_session_dir.erase( _session_dir.size()-1, 1);
+        if ( _session_dir.size() > 1 && _session_dir[_session_dir.size()-1] == '/' )
+                _session_dir.erase( _session_dir.size()-1, 1);
 
-	if ( fs::exists_and_is_writable( session_dir()) == false )
-		throw invalid_argument (string("Experiment directory ") + _session_dir + " does not exist or is not writable");
+        if ( fs::exists_and_is_writable( session_dir()) == false )
+                throw invalid_argument (string("Experiment directory ") + _session_dir + " does not exist or is not writable");
 
-	if ( chdir( session_dir()) == -1 )
-		throw invalid_argument (string("Failed to cd to ") + _session_dir);
+        if ( chdir( session_dir()) == -1 )
+                throw invalid_argument (string("Failed to cd to ") + _session_dir);
 
-	load_settings();
+        load_settings();
 
-	// that's pretty important: scope is not itself exposed to the user
-	mc_params.scope = fft_params.pagesize;
+        // that's pretty important: scope is not itself exposed to the user
+        mc_params.scope = fft_params.pagesize;
 
 #ifdef _OPENMP
-	omp_set_num_threads( (num_threads == 0) ? global::num_procs : num_threads);
-	printf( "SMP enabled with %d threads\n", omp_get_max_threads());
+        omp_set_num_threads( (num_threads == 0) ? global::num_procs : num_threads);
+        printf( "SMP enabled with %d threads\n", omp_get_max_threads());
 #endif
-	if ( last_used_version != VERSION ) {
-		printf( "Purging old files as we are upgrading from version %s to %s\n", last_used_version.c_str(), VERSION);
-	}
-	// last_used_version = VERSION;
-	/// leave it so SExpDesignUI::populate will see it and pop the changelog
+        if ( last_used_version != VERSION ) {
+                printf( "Purging old files as we are upgrading from version %s to %s\n", last_used_version.c_str(), VERSION);
+        }
+        // last_used_version = VERSION;
+        /// leave it so SExpDesignUI::populate will see it and pop the changelog
 
-	scan_tree( progress_fun);
+        scan_tree( progress_fun);
 }
 
 
@@ -140,26 +140,26 @@ void
 agh::CExpDesign::
 log_message( const char* fmt, ...)
 {
-	va_list ap;
-	va_start (ap, fmt);
-
-	char *buf0;
-	int np = vasprintf( &buf0, fmt, ap);
-	char *buf = buf0;
-	if ( np > 0 ) {
-		TLogEntryStyle style =
-			(strncmp( buf, "$$", 2) == 0)
-			? ((buf += 2), TLogEntryStyle::bold)
-			: (strncmp( buf, "//", 2) == 0)
-			? ((buf += 2), TLogEntryStyle::italic)
-			: TLogEntryStyle::plain;
-		fprintf( stdout, "%s\n", buf0);
-		_error_log.emplace_back( buf, style);
-	}
-	if ( np != -1 )
-		free( (void*)buf0);
-
-	va_end (ap);
+        va_list ap;
+        va_start (ap, fmt);
+
+        char *buf0;
+        int np = vasprintf( &buf0, fmt, ap);
+        char *buf = buf0;
+        if ( np > 0 ) {
+                TLogEntryStyle style =
+                        (strncmp( buf, "$$", 2) == 0)
+                        ? ((buf += 2), TLogEntryStyle::bold)
+                        : (strncmp( buf, "//", 2) == 0)
+                        ? ((buf += 2), TLogEntryStyle::italic)
+                        : TLogEntryStyle::plain;
+                fprintf( stdout, "%s\n", buf0);
+                _error_log.emplace_back( buf, style);
+        }
+        if ( np != -1 )
+                free( (void*)buf0);
+
+        va_end (ap);
 }
 
 
@@ -167,10 +167,10 @@ string
 agh::CExpDesign::
 error_log_serialize() const
 {
-	string ret;
-	for ( const auto& E : _error_log )
-		ret += E.first + '\n';
-	return move(ret);
+        string ret;
+        for ( const auto& E : _error_log )
+                ret += E.first + '\n';
+        return move(ret);
 }
 
 
@@ -179,26 +179,26 @@ void
 agh::CExpDesign::
 for_all_subjects( const TSubjectOpFun& F, const TSubjectReportFun& report, const TSubjectFilterFun& filter)
 {
-	vector<tuple<CJGroup*,
-		     CSubject*>> v;
-	for ( auto& G : groups )
-		for ( auto& J : G.second )
-			if ( filter(J) )
-				v.emplace_back( make_tuple(&G.second, &J));
-	size_t global_i = 0;
+        vector<tuple<CJGroup*,
+                     CSubject*>> v;
+        for ( auto& G : groups )
+                for ( auto& J : G.second )
+                        if ( filter(J) )
+                                v.emplace_back( make_tuple(&G.second, &J));
+        size_t global_i = 0;
 #ifdef _OPENMP
 #pragma omp parallel for schedule(guided)
 #endif
-	for ( size_t i = 0; i < v.size(); ++i ) {
+        for ( size_t i = 0; i < v.size(); ++i ) {
 #ifdef _OPENMP
 #pragma omp critical
 #endif
-		{
-			report( *get<0>(v[i]), *get<1>(v[i]),
-				++global_i, v.size());
-		}
-		F( *get<1>(v[i]));
-	}
+                {
+                        report( *get<0>(v[i]), *get<1>(v[i]),
+                                ++global_i, v.size());
+                }
+                F( *get<1>(v[i]));
+        }
 }
 
 
@@ -206,30 +206,30 @@ void
 agh::CExpDesign::
 for_all_episodes( const TEpisodeOpFun& F, const TEpisodeReportFun& report, const TEpisodeFilterFun& filter)
 {
-	vector<tuple<CJGroup*,
-		     CSubject*,
-		     const string*,
-		     SEpisode*>> v;
-	for ( auto& G : groups )
-		for ( auto& J : G.second )
-			for ( auto& M : J.measurements )
-				for ( auto& E : M.second.episodes )
-					if ( filter(E) )
-						v.emplace_back( make_tuple(&G.second, &J, &M.first, &E));
-	size_t global_i = 0;
+        vector<tuple<CJGroup*,
+                     CSubject*,
+                     const string*,
+                     SEpisode*>> v;
+        for ( auto& G : groups )
+                for ( auto& J : G.second )
+                        for ( auto& M : J.measurements )
+                                for ( auto& E : M.second.episodes )
+                                        if ( filter(E) )
+                                                v.emplace_back( make_tuple(&G.second, &J, &M.first, &E));
+        size_t global_i = 0;
 #ifdef _OPENMP
 #pragma omp parallel for schedule(guided)
 #endif
-	for ( size_t i = 0; i < v.size(); ++i ) {
+        for ( size_t i = 0; i < v.size(); ++i ) {
 #ifdef _OPENMP
 #pragma omp critical
 #endif
-		{
-			report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]),
-				++global_i, v.size());
-		}
-		F( *get<3>(v[i]));
-	}
+                {
+                        report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]),
+                                ++global_i, v.size());
+                }
+                F( *get<3>(v[i]));
+        }
 }
 
 
@@ -237,74 +237,74 @@ void
 agh::CExpDesign::
 for_all_recordings( const TRecordingOpFun& F, const TRecordingReportFun& report, const TRecordingFilterFun& filter)
 {
-	vector<tuple<CJGroup*,
-		     CSubject*,
-		     const string*,
-		     SEpisode*,
-		     CRecording*>> v;
-	for ( auto& G : groups )
-		for ( auto& J : G.second )
-			for ( auto& D : J.measurements )
-				for ( auto& E : D.second.episodes )
-					for ( auto &R : E.recordings )
-						if ( filter(R.second) )
-							v.emplace_back(
-								make_tuple (&G.second, &J, &D.first,
-									    &E,
-									    &R.second));
-	size_t global_i = 0;
+        vector<tuple<CJGroup*,
+                     CSubject*,
+                     const string*,
+                     SEpisode*,
+                     CRecording*>> v;
+        for ( auto& G : groups )
+                for ( auto& J : G.second )
+                        for ( auto& D : J.measurements )
+                                for ( auto& E : D.second.episodes )
+                                        for ( auto &R : E.recordings )
+                                                if ( filter(R.second) )
+                                                        v.emplace_back(
+                                                                make_tuple (&G.second, &J, &D.first,
+                                                                            &E,
+                                                                            &R.second));
+        size_t global_i = 0;
 #ifdef _OPENMP
 // read that man, bro
 #pragma omp parallel for schedule(guided)
 #endif
-	for ( size_t i = 0; i < v.size(); ++i ) {
+        for ( size_t i = 0; i < v.size(); ++i ) {
 #ifdef _OPENMP
 #pragma omp critical
 #endif
-		{
-			report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]), *get<4>(v[i]),
-				++global_i, v.size());
-		}
-		F( *get<4>(v[i]));
-	}
+                {
+                        report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]), *get<4>(v[i]),
+                                ++global_i, v.size());
+                }
+                F( *get<4>(v[i]));
+        }
 }
 
 void
 agh::CExpDesign::
 for_all_modruns( const TModelRunOpFun& F, const TModelRunReportFun& report, const TModelRunFilterFun& filter)
 {
-	vector<tuple<CJGroup*,
-		     CSubject*,
-		     const string*,
-		     const SProfileParamSet*,
-		     const string*,
-		     ach::CModelRun*>> v;
-	for ( auto& G : groups )
-		for ( auto& J : G.second )
-			for ( auto& D : J.measurements )
-				for ( auto& T : D.second.modrun_sets )
-					for ( auto& H : T.second )
-						if ( filter(H.second) )
-							v.emplace_back(
-								make_tuple (
-									&G.second, &J, &D.first,
-									&T.first,
-									&H.first,
-									&H.second));
-	size_t global_i = 0;
+        vector<tuple<CJGroup*,
+                     CSubject*,
+                     const string*,
+                     const SProfileParamSet*,
+                     const string*,
+                     ach::CModelRun*>> v;
+        for ( auto& G : groups )
+                for ( auto& J : G.second )
+                        for ( auto& D : J.measurements )
+                                for ( auto& T : D.second.modrun_sets )
+                                        for ( auto& H : T.second )
+                                                if ( filter(H.second) )
+                                                        v.emplace_back(
+                                                                make_tuple (
+                                                                        &G.second, &J, &D.first,
+                                                                        &T.first,
+                                                                        &H.first,
+                                                                        &H.second));
+        size_t global_i = 0;
 #ifdef _OPENMP
 #pragma omp parallel for schedule(guided)
 #endif
-	for ( size_t i = 0; i < v.size(); ++i ) {
+        for ( size_t i = 0; i < v.size(); ++i ) {
 #ifdef _OPENMP
 #pragma omp critical
 #endif
-		{
-			report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]), *get<4>(v[i]), *get<5>(v[i]),
-				++global_i, v.size());
-		}
-		F( *get<5>(v[i]));
-	}
+                {
+                        report( *get<0>(v[i]), *get<1>(v[i]), *get<2>(v[i]), *get<3>(v[i]), *get<4>(v[i]), *get<5>(v[i]),
+                                ++global_i, v.size());
+                }
+                F( *get<5>(v[i]));
+        }
 }
 
 
@@ -313,21 +313,21 @@ list<string>
 agh::CExpDesign::
 enumerate_groups() const
 {
-	list<string> recp;
-	for ( auto &G : groups )
-		recp.push_back( G.first);
-	return move(recp);
+        list<string> recp;
+        for ( auto &G : groups )
+                recp.push_back( G.first);
+        return move(recp);
 }
 
 list<string>
 agh::CExpDesign::
 enumerate_subjects() const
 {
-	list<string> recp;
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			recp.push_back( J.id);
-	return move(recp);
+        list<string> recp;
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        recp.push_back( J.id);
+        return move(recp);
 }
 
 
@@ -335,69 +335,69 @@ list<string>
 agh::CExpDesign::
 enumerate_sessions() const
 {
-	list<string> recp;
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				recp.push_back( D.first);
-	recp.sort();
-	recp.unique();
-	return move(recp);
+        list<string> recp;
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                recp.push_back( D.first);
+        recp.sort();
+        recp.unique();
+        return move(recp);
 }
 
 list<string>
 agh::CExpDesign::
 enumerate_episodes() const
 {
-	list<string> recp;
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					recp.push_back( E.name());
-	recp.sort();
-	recp.unique();
-	return move(recp);
+        list<string> recp;
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        recp.push_back( E.name());
+        recp.sort();
+        recp.unique();
+        return move(recp);
 }
 
 list<sigfile::SChannel>
 agh::CExpDesign::
 enumerate_eeg_channels() const
 {
-	list<sigfile::SChannel> recp;
+        list<sigfile::SChannel> recp;
 /// sigfile::SChannel will rightly not count oddly named channels
 /// which, still, were additionally qualified as EEG in the EDF
 /// header, so we'd better walk it again and look at signal type
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					for ( auto &F : E.sources )
-						for ( size_t h = 0; h < F().n_channels(); ++h )
-							if ( F().signal_type(h) == sigfile::SChannel::TType::eeg )
-								recp.push_back( F().channel_by_id(h));
-	recp.sort();
-	recp.unique();
-	return move(recp);
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        for ( auto &F : E.sources )
+                                                for ( size_t h = 0; h < F().n_channels(); ++h )
+                                                        if ( F().signal_type(h) == sigfile::SChannel::TType::eeg )
+                                                                recp.push_back( F().channel_by_id(h));
+        recp.sort();
+        recp.unique();
+        return move(recp);
 }
 
 list<sigfile::SChannel>
 agh::CExpDesign::
 enumerate_all_channels() const
 {
-	list<sigfile::SChannel> recp;
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					for ( auto &F : E.sources ) {
-						auto Ins = F().channel_list();
-						recp.insert( recp.end(),
-							     Ins.begin(), Ins.end());
-					}
-	recp.sort();
-	recp.unique();
-	return move(recp);
+        list<sigfile::SChannel> recp;
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        for ( auto &F : E.sources ) {
+                                                auto Ins = F().channel_list();
+                                                recp.insert( recp.end(),
+                                                             Ins.begin(), Ins.end());
+                                        }
+        recp.sort();
+        recp.unique();
+        return move(recp);
 }
 
 
@@ -405,20 +405,20 @@ vector<size_t>
 agh::CExpDesign::
 used_samplerates( sigfile::SChannel::TType type) const
 {
-	vector<size_t> recp;
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					for ( auto &F : E.sources )
-						for ( size_t h = 0; h < F().n_channels(); ++h )
-							if ( type == sigfile::SChannel::TType::other or
-							     type == F().signal_type(h) ) {
-								recp.push_back( F().samplerate(h));
-							}
-	sort(recp.begin(), recp.end());
-	unique(recp.begin(), recp.end());
-	return move(recp);
+        vector<size_t> recp;
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        for ( auto &F : E.sources )
+                                                for ( size_t h = 0; h < F().n_channels(); ++h )
+                                                        if ( type == sigfile::SChannel::TType::other or
+                                                             type == F().signal_type(h) ) {
+                                                                recp.push_back( F().samplerate(h));
+                                                        }
+        sort(recp.begin(), recp.end());
+        unique(recp.begin(), recp.end());
+        return move(recp);
 }
 
 
@@ -434,43 +434,43 @@ used_samplerates( sigfile::SChannel::TType type) const
 int
 agh::CExpDesign::
 setup_modrun( const string& j, const string& d, const string& h,
-	      const SProfileParamSet& profile_params0,
-	      agh::ach::CModelRun** Rpp)
+              const SProfileParamSet& profile_params0,
+              agh::ach::CModelRun** Rpp)
 {
-	try {
-		CSubject& J = subject_by_x(j);
-
-		if ( J.measurements[d].size() == 1 && ctl_params0.DBAmendment2 )
-			return CProfile::TFlags::eamendments_ineffective;
-
-		if ( J.measurements[d].size() == 1 && tstep[ach::TTunable::rs] > 0. )
-			return CProfile::TFlags::ers_nonsensical;
-
-		J.measurements[d].modrun_sets[profile_params0].insert(
-			pair<string, ach::CModelRun> (
-				h,
-				ach::CModelRun (
-					J, d, h,
-					profile_params0,
-					ctl_params0,
-					tunables0))
-			);
-		if ( Rpp )
-			*Rpp = &J.measurements[d]
-				. modrun_sets[profile_params0][h];
-
-	} catch (invalid_argument ex) { // thrown by CProfile ctor
-		fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
-		return -1;
-	} catch (out_of_range ex) {
-		fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
-		return -1;
-	} catch (int ex) { // thrown by CModelRun ctor
-		log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s", j.c_str(), d.c_str(), h.c_str(), CProfile::explain_status(ex).c_str());
-		return ex;
-	}
-
-	return 0;
+        try {
+                CSubject& J = subject_by_x(j);
+
+                if ( J.measurements[d].size() == 1 && ctl_params0.DBAmendment2 )
+                        return CProfile::TFlags::eamendments_ineffective;
+
+                if ( J.measurements[d].size() == 1 && tstep[ach::TTunable::rs] > 0. )
+                        return CProfile::TFlags::ers_nonsensical;
+
+                J.measurements[d].modrun_sets[profile_params0].insert(
+                        pair<string, ach::CModelRun> (
+                                h,
+                                ach::CModelRun (
+                                        J, d, h,
+                                        profile_params0,
+                                        ctl_params0,
+                                        tunables0))
+                        );
+                if ( Rpp )
+                        *Rpp = &J.measurements[d]
+                                . modrun_sets[profile_params0][h];
+
+        } catch (invalid_argument ex) { // thrown by CProfile ctor
+                fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
+                return -1;
+        } catch (out_of_range ex) {
+                fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
+                return -1;
+        } catch (int ex) { // thrown by CModelRun ctor
+                log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s", j.c_str(), d.c_str(), h.c_str(), CProfile::explain_status(ex).c_str());
+                return ex;
+        }
+
+        return 0;
 }
 
 
@@ -478,29 +478,29 @@ void
 agh::CExpDesign::
 prune_untried_modruns()
 {
-	for ( auto& G : groups )
-		for ( auto& J : G.second )
-			for ( auto& D : J.measurements )
-			retry_modruns:
-				for ( auto RSt = D.second.modrun_sets.begin(); RSt != D.second.modrun_sets.end(); ++RSt )
-					for ( auto Ri = RSt->second.begin(); Ri != RSt->second.end(); ++Ri ) {
-						if ( !(Ri->second.status & ach::CModelRun::modrun_tried) ) {
-							RSt->second.erase( Ri);
-							if ( RSt->second.empty() )
-								D.second.modrun_sets.erase(RSt);
-							goto retry_modruns;
-						}
-					}
+        for ( auto& G : groups )
+                for ( auto& J : G.second )
+                        for ( auto& D : J.measurements )
+                        retry_modruns:
+                                for ( auto RSt = D.second.modrun_sets.begin(); RSt != D.second.modrun_sets.end(); ++RSt )
+                                        for ( auto Ri = RSt->second.begin(); Ri != RSt->second.end(); ++Ri ) {
+                                                if ( !(Ri->second.status & ach::CModelRun::modrun_tried) ) {
+                                                        RSt->second.erase( Ri);
+                                                        if ( RSt->second.empty() )
+                                                                D.second.modrun_sets.erase(RSt);
+                                                        goto retry_modruns;
+                                                }
+                                        }
 }
 
 void
 agh::CExpDesign::
 remove_all_modruns()
 {
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				D.second.modrun_sets.clear();
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                D.second.modrun_sets.clear();
 }
 
 
@@ -508,48 +508,48 @@ void
 agh::CExpDesign::
 export_all_modruns( const string& fname) const
 {
-	FILE *f = fopen( fname.c_str(), "w");
-	if ( !f )
-		return;
-
-	size_t t = (size_t)ach::TTunable::rs;
-	fprintf( f, "#");
-	for ( ; t < ach::TTunable::_all_tunables; ++t )
-		fprintf( f, "%s%s", (t == 0) ? "" : "\t", ach::tunable_name(t).c_str());
-	fprintf( f, "\n");
-
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &RS : D.second.modrun_sets )
-					for ( auto &R : RS.second )
-						if ( R.second.status & ach::CModelRun::modrun_tried ) {
-							auto& M = R.second;
-							string extra;
-							switch ( M.P().metric ) {
-							case metrics::TType::psd:
-								extra = agh::str::sasprintf( "%g-%g Hz", M.P().P.psd.freq_from, M.P().P.psd.freq_upto);
-								break;
-							case metrics::TType::swu:
-								extra = agh::str::sasprintf( "%g Hz", M.P().P.swu.f0);
-								break;
-							case metrics::TType::mc:
-								extra = agh::str::sasprintf( "%g Hz", M.P().P.mc.f0);
-								break;
-							default:
-								throw runtime_error ("What metric?");
-							}
-							fprintf( f, "# ----- Subject: %s;  Session: %s;  Channel: %s;  Metric: %s (%s)\n",
-								 M.subject(), M.session(), M.channel(),
-								 M.P().metric_name(), extra.c_str());
-							t = ach::TTunable::rs;
-							do {
-								fprintf( f, "%g%s", M.tx[t] * ach::stock[t].display_scale_factor,
-									 (t < M.tx.size()-1) ? "\t" : "\n");
-							} while ( t++ < M.tx.size()-1 );
-						}
-
-	fclose( f);
+        FILE *f = fopen( fname.c_str(), "w");
+        if ( !f )
+                return;
+
+        size_t t = (size_t)ach::TTunable::rs;
+        fprintf( f, "#");
+        for ( ; t < ach::TTunable::_all_tunables; ++t )
+                fprintf( f, "%s%s", (t == 0) ? "" : "\t", ach::tunable_name(t).c_str());
+        fprintf( f, "\n");
+
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &RS : D.second.modrun_sets )
+                                        for ( auto &R : RS.second )
+                                                if ( R.second.status & ach::CModelRun::modrun_tried ) {
+                                                        auto& M = R.second;
+                                                        string extra;
+                                                        switch ( M.P().metric ) {
+                                                        case metrics::TType::psd:
+                                                                extra = agh::str::sasprintf( "%g-%g Hz", M.P().P.psd.freq_from, M.P().P.psd.freq_upto);
+                                                                break;
+                                                        case metrics::TType::swu:
+                                                                extra = agh::str::sasprintf( "%g Hz", M.P().P.swu.f0);
+                                                                break;
+                                                        case metrics::TType::mc:
+                                                                extra = agh::str::sasprintf( "%g Hz", M.P().P.mc.f0);
+                                                                break;
+                                                        default:
+                                                                throw runtime_error ("What metric?");
+                                                        }
+                                                        fprintf( f, "# ----- Subject: %s;  Session: %s;  Channel: %s;  Metric: %s (%s)\n",
+                                                                 M.subject(), M.session(), M.channel(),
+                                                                 M.P().metric_name(), extra.c_str());
+                                                        t = ach::TTunable::rs;
+                                                        do {
+                                                                fprintf( f, "%g%s", M.tx[t] * ach::stock[t].display_scale_factor,
+                                                                         (t < M.tx.size()-1) ? "\t" : "\n");
+                                                        } while ( t++ < M.tx.size()-1 );
+                                                }
+
+        fclose( f);
 }
 
 
@@ -561,12 +561,12 @@ void
 agh::CExpDesign::
 sync()
 {
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					for ( auto &F : E.sources )
-						F().save_ancillary_files();
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        for ( auto &F : E.sources )
+                                                F().save_ancillary_files();
 }
 
 
@@ -575,16 +575,16 @@ int
 agh::CExpDesign::
 purge_cached_profiles()
 {
-	return system(
-		agh::str::sasprintf(
-			"find '%s' \\( -name '.*.psd' -or -name '.*.mc' -or -name '.*.swu' \\) -delete",
-			session_dir())
-		.c_str());
+        return system(
+                agh::str::sasprintf(
+                        "find '%s' \\( -name '.*.psd' -or -name '.*.mc' -or -name '.*.swu' \\) -delete",
+                        session_dir())
+                .c_str());
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/expdesign.hh b/upstream/src/aghermann/expdesign/expdesign.hh
index cf06a36..d49a7f0 100644
--- a/upstream/src/aghermann/expdesign/expdesign.hh
+++ b/upstream/src/aghermann/expdesign/expdesign.hh
@@ -42,12 +42,12 @@ using namespace std;
 class CJGroup
       : public list<CSubject> {
 
-	void operator=( const CJGroup&) = delete;
+        void operator=( const CJGroup&) = delete;
     public:
-	map<string,  // session
-		   map<string,  // episode
-		       pair<float, float>>> // decimal hour
-		avg_episode_times;
+        map<string,  // session
+                   map<string,  // episode
+                       pair<float, float>>> // decimal hour
+                avg_episode_times;
 };
 
 
@@ -56,212 +56,212 @@ class CJGroup
 
 class CExpDesign {
 
-	DELETE_DEFAULT_METHODS (CExpDesign);
+        DELETE_DEFAULT_METHODS (CExpDesign);
 
     public:
       // constructor
-	typedef function<void(const string&, size_t, size_t)> TMsmtCollectProgressIndicatorFun;
-	CExpDesign (const string& sessiondir,
-		    TMsmtCollectProgressIndicatorFun progress_fun = progress_fun_stdout);
+        typedef function<void(const string&, size_t, size_t)> TMsmtCollectProgressIndicatorFun;
+        CExpDesign (const string& sessiondir,
+                    TMsmtCollectProgressIndicatorFun progress_fun = progress_fun_stdout);
        ~CExpDesign ()
-		{
-			save_settings();
-		}
+                {
+                        save_settings();
+                }
 
-	int status() const
-		{ return _status; }
+        int status() const
+                { return _status; }
 
-	const char*
-	session_dir() const
-		{ return _session_dir.c_str(); }
+        const char*
+        session_dir() const
+                { return _session_dir.c_str(); }
 
-	string
-	name() const // dirname
-		{ return _session_dir.substr( _session_dir.rfind( '/')); }
+        string
+        name() const // dirname
+                { return _session_dir.substr( _session_dir.rfind( '/')); }
 
       // error log
-	enum class TLogEntryStyle { plain, bold, italic };
-	const list<pair<string, TLogEntryStyle>>&
-	error_log() const
-		{ return _error_log; }
-	void reset_error_log()
-		{ _error_log.clear(); }
-	const char* last_error() const
-		{ return _error_log.back().first.c_str(); }
-	string error_log_serialize() const;
-	size_t error_log_n_messages() const
-		{ return _error_log.size(); }
-	void log_message( const char* fmt, ...)  __attribute__ (( format (printf, 2, 3) ));
+        enum class TLogEntryStyle { plain, bold, italic };
+        const list<pair<string, TLogEntryStyle>>&
+        error_log() const
+                { return _error_log; }
+        void reset_error_log()
+                { _error_log.clear(); }
+        const char* last_error() const
+                { return _error_log.back().first.c_str(); }
+        string error_log_serialize() const;
+        size_t error_log_n_messages() const
+                { return _error_log.size(); }
+        void log_message( const char* fmt, ...)  __attribute__ (( format (printf, 2, 3) ));
 
       // contains
-	typedef map<string, CJGroup> TJGroups;
-	TJGroups
-		groups;
-	template <typename T>
-	bool have_group( const T&) const;
+        typedef map<string, CJGroup> TJGroups;
+        TJGroups
+                groups;
+        template <typename T>
+        bool have_group( const T&) const;
 
-	template <class T>
-	CSubject& subject_by_x( const T&);
+        template <class T>
+        CSubject& subject_by_x( const T&);
 
-	template <class T>
-	const CSubject& subject_by_x( const T&,
-				      TJGroups::const_iterator *Giter_p = nullptr) const;
-	template <class T>
-	const char* group_of( const T&);
+        template <class T>
+        const CSubject& subject_by_x( const T&,
+                                      TJGroups::const_iterator *Giter_p = nullptr) const;
+        template <class T>
+        const char* group_of( const T&);
 
       // add subject to group; if he exists in another group, remove him therefrom first;
       // if he is already there, update his record
-	int add_subject( const char *name, CSubject::TGender gender, int age,
-			 const char *group,
-			 const char *comment = "");
-
-	template <class T>
-	string subject_dir( const T& j) const
-		{
-			map<string, CJGroup>::const_iterator G;
-			const CSubject& J = subject_by_x(j, &G);
-			return _session_dir + '/' + G->first + '/' + J.SSubjectId::id;
-		}
+        int add_subject( const char *name, CSubject::TGender gender, int age,
+                         const char *group,
+                         const char *comment = "");
+
+        template <class T>
+        string subject_dir( const T& j) const
+                {
+                        map<string, CJGroup>::const_iterator G;
+                        const CSubject& J = subject_by_x(j, &G);
+                        return _session_dir + '/' + G->first + '/' + J.SSubjectId::id;
+                }
 
       // scan tree: build all structures
-	static TMsmtCollectProgressIndicatorFun progress_fun_stdout;
-	void scan_tree( TMsmtCollectProgressIndicatorFun progress_fun = progress_fun_stdout);
+        static TMsmtCollectProgressIndicatorFun progress_fun_stdout;
+        void scan_tree( TMsmtCollectProgressIndicatorFun progress_fun = progress_fun_stdout);
     private:
-	void compute_profiles();
+        void compute_profiles();
 
     public:
       // edf sources
-	int register_intree_source( sigfile::CTypedSource&&,
-				    const char **reason_if_failed_p = nullptr);
-	static bool is_supported_source( sigfile::CTypedSource&);
+        int register_intree_source( sigfile::CTypedSource&&,
+                                    const char **reason_if_failed_p = nullptr);
+        static bool is_supported_source( sigfile::CTypedSource&);
 
       // model runs
-	int setup_modrun( const string& j, const string& d, const string& h,
-			  const SProfileParamSet&,
-			  ach::CModelRun**);
-	void remove_all_modruns();
-	void prune_untried_modruns();
-	void export_all_modruns( const string& fname) const;
+        int setup_modrun( const string& j, const string& d, const string& h,
+                          const SProfileParamSet&,
+                          ach::CModelRun**);
+        void remove_all_modruns();
+        void prune_untried_modruns();
+        void export_all_modruns( const string& fname) const;
 
-	void sync();
+        void sync();
 
       // global info on expdesign
-	list<string> enumerate_groups() const;
-	list<string> enumerate_subjects() const;
-	list<string> enumerate_sessions() const;
-	list<string> enumerate_episodes() const;
-	list<sigfile::SChannel> enumerate_all_channels() const;
-	list<sigfile::SChannel> enumerate_eeg_channels() const;
-	vector<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::TType::other) const;
+        list<string> enumerate_groups() const;
+        list<string> enumerate_subjects() const;
+        list<string> enumerate_sessions() const;
+        list<string> enumerate_episodes() const;
+        list<sigfile::SChannel> enumerate_all_channels() const;
+        list<sigfile::SChannel> enumerate_eeg_channels() const;
+        vector<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::TType::other) const;
 
       // omp-enabled lists:foreach
-	typedef function<void(CSubject&)>
-		TSubjectOpFun;
-	typedef function<void(const CJGroup&,
-			      const CSubject&,
-			      size_t, size_t)>
-		TSubjectReportFun;
-	typedef function<bool(CSubject&)>
-		TSubjectFilterFun;
-	void
-	for_all_subjects( const TSubjectOpFun&, const TSubjectReportFun&, const TSubjectFilterFun&);
-
-	typedef function<void(SEpisode&)>
-		TEpisodeOpFun;
-	typedef function<void(const CJGroup&,
-			      const CSubject&,
-			      const string&,
-			      const SEpisode&,
-			      size_t, size_t)>
-		TEpisodeReportFun;
-	typedef function<bool(SEpisode&)>
-		TEpisodeFilterFun;
-	void
-	for_all_episodes( const TEpisodeOpFun&, const TEpisodeReportFun&, const TEpisodeFilterFun&);
-
-	typedef function<void(CRecording&)>
-		TRecordingOpFun;
-	typedef function<void(const CJGroup&,
-			      const CSubject&,
-			      const string&,
-			      const SEpisode&,
-			      const CRecording&,
-			      size_t, size_t)>
-		TRecordingReportFun;
-	typedef function<bool(CRecording&)>
-		TRecordingFilterFun;
-	void
-	for_all_recordings( const TRecordingOpFun&, const TRecordingReportFun&, const TRecordingFilterFun&);
-
-	typedef function<void(ach::CModelRun&)>
-		TModelRunOpFun;
-	typedef function<void(const CJGroup&,
-			      const CSubject&,
-			      const string&,
-			      const SProfileParamSet&,
-			      const string&,
-			      const ach::CModelRun&,
-			      size_t, size_t)>
-		TModelRunReportFun;
-	typedef function<bool(ach::CModelRun&)>
-		TModelRunFilterFun;
-	void
-	for_all_modruns( const TModelRunOpFun&, const TModelRunReportFun&, const TModelRunFilterFun&);
+        typedef function<void(CSubject&)>
+                TSubjectOpFun;
+        typedef function<void(const CJGroup&,
+                              const CSubject&,
+                              size_t, size_t)>
+                TSubjectReportFun;
+        typedef function<bool(CSubject&)>
+                TSubjectFilterFun;
+        void
+        for_all_subjects( const TSubjectOpFun&, const TSubjectReportFun&, const TSubjectFilterFun&);
+
+        typedef function<void(SEpisode&)>
+                TEpisodeOpFun;
+        typedef function<void(const CJGroup&,
+                              const CSubject&,
+                              const string&,
+                              const SEpisode&,
+                              size_t, size_t)>
+                TEpisodeReportFun;
+        typedef function<bool(SEpisode&)>
+                TEpisodeFilterFun;
+        void
+        for_all_episodes( const TEpisodeOpFun&, const TEpisodeReportFun&, const TEpisodeFilterFun&);
+
+        typedef function<void(CRecording&)>
+                TRecordingOpFun;
+        typedef function<void(const CJGroup&,
+                              const CSubject&,
+                              const string&,
+                              const SEpisode&,
+                              const CRecording&,
+                              size_t, size_t)>
+                TRecordingReportFun;
+        typedef function<bool(CRecording&)>
+                TRecordingFilterFun;
+        void
+        for_all_recordings( const TRecordingOpFun&, const TRecordingReportFun&, const TRecordingFilterFun&);
+
+        typedef function<void(ach::CModelRun&)>
+                TModelRunOpFun;
+        typedef function<void(const CJGroup&,
+                              const CSubject&,
+                              const string&,
+                              const SProfileParamSet&,
+                              const string&,
+                              const ach::CModelRun&,
+                              size_t, size_t)>
+                TModelRunReportFun;
+        typedef function<bool(ach::CModelRun&)>
+                TModelRunFilterFun;
+        void
+        for_all_modruns( const TModelRunOpFun&, const TModelRunReportFun&, const TModelRunFilterFun&);
 
       // inventory
-	size_t	num_threads;
-	metrics::psd::SPPack
-		fft_params;
-	metrics::swu::SPPack
-		swu_params;
-	metrics::mc::SPPack
-		mc_params;
-	sigproc::TWinType // such a fussy
-		af_dampen_window_type;
-	double	af_dampen_factor;
-
-	static double
-		freq_bands[metrics::TBand::TBand_total][2];
-	static const char
-		*const FreqBandNames[metrics::TBand::TBand_total];
-
-	ach::STunableSet<ach::TTRole::d>	tstep;
-	ach::STunableSet<ach::TTRole::l>	tlo;
-	ach::STunableSet<ach::TTRole::u>	thi;
-	ach::STunableSetWithState		tunables0;
-
-	ach::SControlParamSet
-		ctl_params0;
-	double	req_percent_scored;
-	size_t	swa_laden_pages_before_SWA_0;
-	bool	score_unscored_as_wake,
-		strict_subject_id_checks;
-
-	int load_settings();
-	int save_settings();
-
-	string	last_used_version;
-	int purge_cached_profiles();
+        size_t        num_threads;
+        metrics::psd::SPPack
+                fft_params;
+        metrics::swu::SPPack
+                swu_params;
+        metrics::mc::SPPack
+                mc_params;
+        sigproc::TWinType // such a fussy
+                af_dampen_window_type;
+        double        af_dampen_factor;
+
+        static double
+                freq_bands[metrics::TBand::TBand_total][2];
+        static const char
+                *const FreqBandNames[metrics::TBand::TBand_total];
+
+        ach::STunableSet<ach::TTRole::d>        tstep;
+        ach::STunableSet<ach::TTRole::l>        tlo;
+        ach::STunableSet<ach::TTRole::u>        thi;
+        ach::STunableSetWithState                tunables0;
+
+        ach::SControlParamSet
+                ctl_params0;
+        double        req_percent_scored;
+        size_t        swa_laden_pages_before_SWA_0;
+        bool        score_unscored_as_wake,
+                strict_subject_id_checks;
+
+        int load_settings();
+        int save_settings();
+
+        string        last_used_version;
+        int purge_cached_profiles();
 
     private:
-	enum TStateFlags {
-		ok = 0,
-		init_fail = 1,
-		load_fail = 2, // irrelevant
-	};
-
-	int	_status;
-	string	_session_dir;
-	list<pair<string, TLogEntryStyle>>
-		_error_log;
-
-	sid_t	_id_pool;
+        enum TStateFlags {
+                ok = 0,
+                init_fail = 1,
+                load_fail = 2, // irrelevant
+        };
+
+        int        _status;
+        string        _session_dir;
+        list<pair<string, TLogEntryStyle>>
+                _error_log;
+
+        sid_t        _id_pool;
       // load/save
-	forward_list<confval::SValidator<double>>	config_keys_g;
-	forward_list<confval::SValidator<int>>		config_keys_d;
-	forward_list<confval::SValidator<size_t>>	config_keys_z;
-	forward_list<confval::SValidator<bool>>		config_keys_b;
-	forward_list<confval::SValidator<string>>	config_keys_s;
+        forward_list<confval::SValidator<double>>        config_keys_g;
+        forward_list<confval::SValidator<int>>                config_keys_d;
+        forward_list<confval::SValidator<size_t>>        config_keys_z;
+        forward_list<confval::SValidator<bool>>                config_keys_b;
+        forward_list<confval::SValidator<string>>        config_keys_s;
 };
 
 
@@ -269,58 +269,58 @@ class CExpDesign {
 template <typename T>
 bool CExpDesign::have_group( const T& g) const
 {
-	return groups.count(string(g)) > 0;
+        return groups.count(string(g)) > 0;
 }
 
 template <class T>
 CSubject& CExpDesign::subject_by_x( const T& jid)
 {
-	for ( auto &G : groups ) {
-		auto J = find( G.second.begin(), G.second.end(),
-			       jid);
-		if ( J != G.second.end() )
-			return *J;
-	}
-	throw invalid_argument("no such subject");
+        for ( auto &G : groups ) {
+                auto J = find( G.second.begin(), G.second.end(),
+                               jid);
+                if ( J != G.second.end() )
+                        return *J;
+        }
+        throw invalid_argument("no such subject");
 }
 
 template <class T>
 const CSubject&
 CExpDesign::subject_by_x( const T& jid,
-			  CExpDesign::TJGroups::const_iterator *Giter_p) const
+                          CExpDesign::TJGroups::const_iterator *Giter_p) const
 {
-	for ( auto G = groups.cbegin(); G != groups.cend(); ++G ) {
-		auto J = find( G->second.cbegin(), G->second.cend(),
-			       jid);
-		if ( J != G->second.cend() ) {
-			if ( Giter_p )
-				*Giter_p = G;
-			return *J;
-		}
-	}
-	throw invalid_argument("no such subject");
+        for ( auto G = groups.cbegin(); G != groups.cend(); ++G ) {
+                auto J = find( G->second.cbegin(), G->second.cend(),
+                               jid);
+                if ( J != G->second.cend() ) {
+                        if ( Giter_p )
+                                *Giter_p = G;
+                        return *J;
+                }
+        }
+        throw invalid_argument("no such subject");
 }
 
 template <class T>
 const char* CExpDesign::group_of( const T& jid)
 {
-	for ( auto I = groups.begin(); I != groups.end(); ++I ) {
-		auto J = find( I->second.begin(), I->second.end(),
-			       jid);
-		if ( J != I->second.end() )
-			return I->first.c_str();
-	}
-	throw invalid_argument("no such subject");
+        for ( auto I = groups.begin(); I != groups.end(); ++I ) {
+                auto J = find( I->second.begin(), I->second.end(),
+                               jid);
+                if ( J != I->second.end() )
+                        return I->first.c_str();
+        }
+        throw invalid_argument("no such subject");
 }
 
 // template <class T>
 // bool have_subject( T jid) const
-// 	{
-// 		for ( auto& I : groups )
-// 			if ( find( I.second.begin(), I.second.end(), jid) != I.second.end() )
-// 				return true;
-// 		return false;
-// 	}
+//         {
+//                 for ( auto& I : groups )
+//                         if ( find( I.second.begin(), I.second.end(), jid) != I.second.end() )
+//                                 return true;
+//                 return false;
+//         }
 
 
 
@@ -331,7 +331,7 @@ const char* CExpDesign::group_of( const T& jid)
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/forward-decls.hh b/upstream/src/aghermann/expdesign/forward-decls.hh
index 88af537..74cf788 100644
--- a/upstream/src/aghermann/expdesign/forward-decls.hh
+++ b/upstream/src/aghermann/expdesign/forward-decls.hh
@@ -31,7 +31,7 @@ class CProfile;
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/loadsave.cc b/upstream/src/aghermann/expdesign/loadsave.cc
index 00227a4..3c942ab 100644
--- a/upstream/src/aghermann/expdesign/loadsave.cc
+++ b/upstream/src/aghermann/expdesign/loadsave.cc
@@ -24,79 +24,79 @@ int
 CExpDesign::
 load_settings()
 {
-	libconfig::Config conf;
-
-	// Load the XML file into the property tree. If reading fails
-	// (cannot open file, parse error), an exception is thrown.
-	try {
-		conf.readFile( EXPD_FILENAME);
-
-		using namespace confval;
-		get( config_keys_d, conf);
-		get( config_keys_z, conf);
-		get( config_keys_g, conf);
-		get( config_keys_b, conf);
-		get( config_keys_s, conf);
-
-		for ( size_t t = 0; t < ach::TTunable::_basic_tunables; ++t ) {
-			auto& A = conf.lookup(string("tunable.") + ach::tunable_name(t));
-			tunables0[t] = A[0];
-			tlo      [t] = A[1];
-			thi      [t] = A[2];
-			tstep    [t] = A[3];
-		}
-	} catch (...) {
-		fprintf( stderr, "CExpDesign::load_settings(): Something is wrong with %s\n", EXPD_FILENAME);
-
-		_status = _status | load_fail;
-
-		ctl_params0.reset();
-		tunables0.set_defaults();
-		fft_params.reset();
-		mc_params.reset();
-
-		return -1;
-	}
-
-	try {
-		for ( size_t i = metrics::TBand::delta; i < metrics::TBand::TBand_total; ++i ) {
-			auto& A = conf.lookup(string("Band.")+FreqBandNames[i]);
-			float	f0 = A[0],
-				f1 = A[1];
-			if ( f0 < f1 ) {
-				freq_bands[i][0] = f0;
-				freq_bands[i][1] = f1;
-			} else
-				fprintf( stderr, "agh::SExpDesign::load_settings(): Invalid Band range\n");
-		}
-	} catch (...) {
-		fprintf( stderr, "agh::SExpDesign::load_settings(): Something is wrong with section Band\n");
-	}
-
-	try { ctl_params0.check(); }
-	catch (...) {
-		ctl_params0.reset();
-		fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid ctl params\n");
-	}
-
-	if ( tunables0.check() ) {
-		tunables0.set_defaults();
-		fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid tunables\n");
-	}
-
-	try { fft_params.check(); }
-	catch (invalid_argument ex) {
-		fft_params.reset();
-		fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid fft params (%s)\n", ex.what());
-	}
-
-	try { mc_params.check(); }
-	catch (invalid_argument ex) {
-		mc_params.reset();
-		fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid mc params (%s)\n", ex.what());
-	}
-
-	return 0;
+        libconfig::Config conf;
+
+        // Load the XML file into the property tree. If reading fails
+        // (cannot open file, parse error), an exception is thrown.
+        try {
+                conf.readFile( EXPD_FILENAME);
+
+                using namespace confval;
+                get( config_keys_d, conf);
+                get( config_keys_z, conf);
+                get( config_keys_g, conf);
+                get( config_keys_b, conf);
+                get( config_keys_s, conf);
+
+                for ( size_t t = 0; t < ach::TTunable::_basic_tunables; ++t ) {
+                        auto& A = conf.lookup(string("tunable.") + ach::tunable_name(t));
+                        tunables0[t] = A[0];
+                        tlo      [t] = A[1];
+                        thi      [t] = A[2];
+                        tstep    [t] = A[3];
+                }
+        } catch (...) {
+                fprintf( stderr, "CExpDesign::load_settings(): Something is wrong with %s\n", EXPD_FILENAME);
+
+                _status = _status | load_fail;
+
+                ctl_params0.reset();
+                tunables0.set_defaults();
+                fft_params.reset();
+                mc_params.reset();
+
+                return -1;
+        }
+
+        try {
+                for ( size_t i = metrics::TBand::delta; i < metrics::TBand::TBand_total; ++i ) {
+                        auto& A = conf.lookup(string("Band.")+FreqBandNames[i]);
+                        float        f0 = A[0],
+                                f1 = A[1];
+                        if ( f0 < f1 ) {
+                                freq_bands[i][0] = f0;
+                                freq_bands[i][1] = f1;
+                        } else
+                                fprintf( stderr, "agh::SExpDesign::load_settings(): Invalid Band range\n");
+                }
+        } catch (...) {
+                fprintf( stderr, "agh::SExpDesign::load_settings(): Something is wrong with section Band\n");
+        }
+
+        try { ctl_params0.check(); }
+        catch (...) {
+                ctl_params0.reset();
+                fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid ctl params\n");
+        }
+
+        if ( tunables0.check() ) {
+                tunables0.set_defaults();
+                fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid tunables\n");
+        }
+
+        try { fft_params.check(); }
+        catch (invalid_argument ex) {
+                fft_params.reset();
+                fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid fft params (%s)\n", ex.what());
+        }
+
+        try { mc_params.check(); }
+        catch (invalid_argument ex) {
+                mc_params.reset();
+                fprintf( stderr, "agh::CExpDesign::load_settings(): Invalid mc params (%s)\n", ex.what());
+        }
+
+        return 0;
 }
 
 
@@ -107,32 +107,32 @@ int
 CExpDesign::
 save_settings()
 {
-	libconfig::Config conf;
+        libconfig::Config conf;
 
-	confval::put( config_keys_d, conf);
-	confval::put( config_keys_g, conf);
-	confval::put( config_keys_b, conf);
-	confval::put( config_keys_s, conf);
-	confval::put( config_keys_z, conf);
+        confval::put( config_keys_d, conf);
+        confval::put( config_keys_g, conf);
+        confval::put( config_keys_b, conf);
+        confval::put( config_keys_s, conf);
+        confval::put( config_keys_z, conf);
 
-	// only save _agh_basic_tunables_
-	for ( size_t t = 0; t < ach::TTunable::_basic_tunables; ++t )
-		confval::put( conf, string("tunable.") + ach::tunable_name(t),
-			      forward_list<double> {tunables0[t], tlo[t], thi[t], tstep[t]});
+        // only save _agh_basic_tunables_
+        for ( size_t t = 0; t < ach::TTunable::_basic_tunables; ++t )
+                confval::put( conf, string("tunable.") + ach::tunable_name(t),
+                              forward_list<double> {tunables0[t], tlo[t], thi[t], tstep[t]});
 
-	for ( unsigned i = metrics::TBand::delta; i < metrics::TBand::TBand_total; ++i )
-		confval::put( conf, string("Band.") + FreqBandNames[i],
-			      forward_list<double> {freq_bands[i][0], freq_bands[i][1]});
+        for ( unsigned i = metrics::TBand::delta; i < metrics::TBand::TBand_total; ++i )
+                confval::put( conf, string("Band.") + FreqBandNames[i],
+                              forward_list<double> {freq_bands[i][0], freq_bands[i][1]});
 
-	conf.writeFile( EXPD_FILENAME);
+        conf.writeFile( EXPD_FILENAME);
 
-	return 0;
+        return 0;
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/profile.hh b/upstream/src/aghermann/expdesign/profile.hh
index 228c5f4..c64c59e 100644
--- a/upstream/src/aghermann/expdesign/profile.hh
+++ b/upstream/src/aghermann/expdesign/profile.hh
@@ -26,109 +26,109 @@ class CProfile
   : private SProfileParamSet {
 
     public:
-	CProfile (CRecording&,
-		  const SProfileParamSet&);
-	CProfile (CSubject&, const string& d, const sigfile::SChannel& h,
-		  const SProfileParamSet&);
-	void create_timeline( const SProfileParamSet& params)
-		{
-			*(SProfileParamSet*)this = params;
-			create_timeline();
-		}
-	void create_timeline();
-	bool need_compute( const SProfileParamSet&);
-
-	const SProfileParamSet& P() const
-					{ return *this; }
-	size_t sim_start() const	{ return _sim_start; }
-	size_t sim_end() const		{ return _sim_end; }
-	size_t baseline_end() const	{ return _baseline_end; }
-	size_t pages_with_swa() const	{ return _pages_with_SWA; }
-	size_t pages_non_wake() const	{ return _pages_non_wake; }
-	size_t pages_in_bed() const	{ return _pages_in_bed; }
-	double SWA_L() const		{ return _SWA_L; }
-	double SWA_0() const		{ return _SWA_0; }
-	double SWA_100() const		{ return _SWA_100; }
-	double metric_avg() const	{ return _metric_avg; }
-
-	const vector<sigfile::SPageSimulated>&
-	timeline() const		{ return _timeline; }
-
-	typedef pair<size_t, size_t> TBounds;
-	const vector<TBounds>&
-	mm_bounds() const		{ return _mm_bounds; }
-
-	const vector<CRecording*>&
-	mm_list() 			{ return _mm_list; }
-
-	const sigfile::SPageSimulated&
-	operator[]( size_t p) const
-		{
-			return _timeline[p];
-		}
-
-	time_t nth_episode_start_time( size_t n) const;
-	time_t nth_episode_end_time( size_t n) const;
-	size_t nth_episode_start_page( size_t n) const;
-	size_t nth_episode_end_page( size_t n) const;
-
-	size_t pagesize() const
-		{
-			return _pagesize;
-		}
-
-	const char* subject() const;
-	const char* session() const;
-	const char* channel() const;
-
-	enum TFlags {
-		ok			= 0,
-		enoscore		= 1,
-		efarapart		= 2,
-		esigtype		= 4,
-		etoomanymsmt		= 8,
-		enoswa			= 16,
-		eamendments_ineffective	= 32,
-		ers_nonsensical		= 64,
-		enegoffset		= 128,
-		euneq_pagesize		= 256
-	};
-
-	static string explain_status( int);
+        CProfile (CRecording&,
+                  const SProfileParamSet&);
+        CProfile (CSubject&, const string& d, const sigfile::SChannel& h,
+                  const SProfileParamSet&);
+        void create_timeline( const SProfileParamSet& params)
+                {
+                        *(SProfileParamSet*)this = params;
+                        create_timeline();
+                }
+        void create_timeline();
+        bool need_compute( const SProfileParamSet&);
+
+        const SProfileParamSet& P() const
+                                        { return *this; }
+        size_t sim_start() const        { return _sim_start; }
+        size_t sim_end() const                { return _sim_end; }
+        size_t baseline_end() const        { return _baseline_end; }
+        size_t pages_with_swa() const        { return _pages_with_SWA; }
+        size_t pages_non_wake() const        { return _pages_non_wake; }
+        size_t pages_in_bed() const        { return _pages_in_bed; }
+        double SWA_L() const                { return _SWA_L; }
+        double SWA_0() const                { return _SWA_0; }
+        double SWA_100() const                { return _SWA_100; }
+        double metric_avg() const        { return _metric_avg; }
+
+        const vector<sigfile::SPageSimulated>&
+        timeline() const                { return _timeline; }
+
+        typedef pair<size_t, size_t> TBounds;
+        const vector<TBounds>&
+        mm_bounds() const                { return _mm_bounds; }
+
+        const vector<CRecording*>&
+        mm_list()                         { return _mm_list; }
+
+        const sigfile::SPageSimulated&
+        operator[]( size_t p) const
+                {
+                        return _timeline[p];
+                }
+
+        time_t nth_episode_start_time( size_t n) const;
+        time_t nth_episode_end_time( size_t n) const;
+        size_t nth_episode_start_page( size_t n) const;
+        size_t nth_episode_end_page( size_t n) const;
+
+        size_t pagesize() const
+                {
+                        return _pagesize;
+                }
+
+        const char* subject() const;
+        const char* session() const;
+        const char* channel() const;
+
+        enum TFlags {
+                ok                        = 0,
+                enoscore                = 1,
+                efarapart                = 2,
+                esigtype                = 4,
+                etoomanymsmt                = 8,
+                enoswa                        = 16,
+                eamendments_ineffective        = 32,
+                ers_nonsensical                = 64,
+                enegoffset                = 128,
+                euneq_pagesize                = 256
+        };
+
+        static string explain_status( int);
 
     protected:
-	int	_status;
-
-	CProfile (const CProfile&) = delete;
-	CProfile ()
-		{
-			throw runtime_error ("nono");
-		}
-	CProfile (CProfile&& rv);
-
-	size_t	_sim_start,
-		_sim_end,
-		_baseline_end,
-		_pages_with_SWA,
-		_pages_non_wake,
-		_pages_in_bed;
-	double	_SWA_L,
-		_SWA_0,	_SWA_100,
-		_metric_avg;
-
-	time_t	_0at;
-	vector<sigfile::SPageSimulated>
-		_timeline;
-	vector<TBounds>  // in pages
-		_mm_bounds;
-
-	vector<CRecording*>
-		_mm_list;
+        int        _status;
+
+        CProfile (const CProfile&) = delete;
+        CProfile ()
+                {
+                        throw runtime_error ("nono");
+                }
+        CProfile (CProfile&& rv);
+
+        size_t        _sim_start,
+                _sim_end,
+                _baseline_end,
+                _pages_with_SWA,
+                _pages_non_wake,
+                _pages_in_bed;
+        double        _SWA_L,
+                _SWA_0,        _SWA_100,
+                _metric_avg;
+
+        time_t        _0at;
+        vector<sigfile::SPageSimulated>
+                _timeline;
+        vector<TBounds>  // in pages
+                _mm_bounds;
+
+        vector<CRecording*>
+                _mm_list;
     private:
-	size_t	_pagesize;  // since power is binned each time it is
-			    // collected in layout_measurements() and
-			    // then detached, we keep it here
-			    // privately
+        size_t        _pagesize;  // since power is binned each time it is
+                            // collected in layout_measurements() and
+                            // then detached, we keep it here
+                            // privately
 };
 
 
@@ -142,25 +142,25 @@ inline const char* CProfile::channel() const { return _mm_list.front()->channel(
 inline time_t
 CProfile::nth_episode_start_time( size_t n) const
 {
-	return _0at + _mm_bounds[n].first * _pagesize;
+        return _0at + _mm_bounds[n].first * _pagesize;
 }
 
 inline time_t
 CProfile::nth_episode_end_time( size_t n) const
 {
-	return _0at + _mm_bounds[n].second * _pagesize;
+        return _0at + _mm_bounds[n].second * _pagesize;
 }
 
 inline size_t
 CProfile::nth_episode_start_page( size_t n) const
 {
-	return _mm_bounds[n].first;
+        return _mm_bounds[n].first;
 }
 
 inline size_t
 CProfile::nth_episode_end_page( size_t n) const
 {
-	return _mm_bounds[n].second;
+        return _mm_bounds[n].second;
 }
 
 
@@ -172,7 +172,7 @@ CProfile::nth_episode_end_page( size_t n) const
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/recording.cc b/upstream/src/aghermann/expdesign/recording.cc
index 13021db..f6a8e40 100644
--- a/upstream/src/aghermann/expdesign/recording.cc
+++ b/upstream/src/aghermann/expdesign/recording.cc
@@ -22,23 +22,23 @@ using namespace std;
 
 agh::CRecording::
 CRecording (sigfile::CTypedSource& F, int sig_no,
-	    const metrics::psd::SPPack& fft_params,
-	    const metrics::swu::SPPack& swu_params,
-	    const metrics::mc::SPPack& mc_params)
+            const metrics::psd::SPPack& fft_params,
+            const metrics::swu::SPPack& swu_params,
+            const metrics::mc::SPPack& mc_params)
       : psd_profile (F, sig_no, fft_params),
         swu_profile (F, sig_no, swu_params),
-	mc_profile  (F, sig_no, mc_params),
-	uc_params (nullptr),
-	_status (0), // not computed
-	_source (F), _sig_no (sig_no)
+        mc_profile  (F, sig_no, mc_params),
+        uc_params (nullptr),
+        _status (0), // not computed
+        _source (F), _sig_no (sig_no)
 {}
 
 
 agh::CRecording::
 ~CRecording ()
 {
-	if ( uc_params )
-		delete uc_params;
+        if ( uc_params )
+                delete uc_params;
 }
 
 
@@ -50,39 +50,39 @@ string
 agh::SProfileParamSet::
 display_name() const
 {
-	using agh::str::sasprintf;
-	switch ( metric ) {
-	case metrics::TType::psd: return sasprintf( "%s (%g-%g Hz)", metric_name(), P.psd.freq_from, P.psd.freq_upto);
-	case metrics::TType::swu: return sasprintf( "%s (%g Hz)",    metric_name(), P.swu.f0);
-	case metrics::TType::mc : return sasprintf( "%s (%g Hz)",    metric_name(), P.mc.f0);
-	default: return sasprintf( "(invalid metric: %d)", metric);
-	}
+        using agh::str::sasprintf;
+        switch ( metric ) {
+        case metrics::TType::psd: return sasprintf( "%s (%g-%g Hz)", metric_name(), P.psd.freq_from, P.psd.freq_upto);
+        case metrics::TType::swu: return sasprintf( "%s (%g Hz)",    metric_name(), P.swu.f0);
+        case metrics::TType::mc : return sasprintf( "%s (%g Hz)",    metric_name(), P.mc.f0);
+        default: return sasprintf( "(invalid metric: %d)", metric);
+        }
 }
 
 string
 agh::CProfile::
 explain_status( int code)
 {
-	list<const char*> ss;
-	if ( code & TFlags::enoscore )
-		ss.push_back( "insufficiently scored");
-	if ( code & TFlags::efarapart )
-		ss.push_back( "episodes too far apart");
-	if ( code & TFlags::esigtype )
-		ss.push_back( "signal is not an EEG");
-	if ( code & TFlags::etoomanymsmt )
-		ss.push_back( "too many episodes");
-	if ( code & TFlags::enoswa )
-		ss.push_back( "no SWA");
-	if ( code & TFlags::eamendments_ineffective)
-		ss.push_back( "inappropriate amendments");
-	if ( code & TFlags::ers_nonsensical )
-		ss.push_back( "too few episoded for rs");
-	if ( code & TFlags::enegoffset )
-		ss.push_back( "negative offset");
-	if ( code & TFlags::euneq_pagesize )
-		ss.push_back( "wrong page size");
-	return agh::str::join( ss, "; ");
+        list<const char*> ss;
+        if ( code & TFlags::enoscore )
+                ss.push_back( "insufficiently scored");
+        if ( code & TFlags::efarapart )
+                ss.push_back( "episodes too far apart");
+        if ( code & TFlags::esigtype )
+                ss.push_back( "signal is not an EEG");
+        if ( code & TFlags::etoomanymsmt )
+                ss.push_back( "too many episodes");
+        if ( code & TFlags::enoswa )
+                ss.push_back( "no SWA");
+        if ( code & TFlags::eamendments_ineffective)
+                ss.push_back( "inappropriate amendments");
+        if ( code & TFlags::ers_nonsensical )
+                ss.push_back( "too few episoded for rs");
+        if ( code & TFlags::enegoffset )
+                ss.push_back( "negative offset");
+        if ( code & TFlags::euneq_pagesize )
+                ss.push_back( "wrong page size");
+        return agh::str::join( ss, "; ");
 }
 
 
@@ -92,71 +92,71 @@ explain_status( int code)
 
 agh::CProfile::
 CProfile (CSubject& J, const string& d, const sigfile::SChannel& h,
-	  const SProfileParamSet& params)
+          const SProfileParamSet& params)
       : SProfileParamSet (params),
-	_status (0),
-	_sim_start ((size_t)-1), _sim_end ((size_t)-1)
+        _status (0),
+        _sim_start ((size_t)-1), _sim_end ((size_t)-1)
 {
-	if ( not J.have_session(d) or J.measurements.at(d).size() == 0 )
-		throw invalid_argument (J.id + " has no recordings in session " + d);
-
-	auto& EE = J.measurements.at(d).episodes;
-	for ( auto &E : EE )
-		_mm_list.push_back( &E.recordings.at(h));
-
-	for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi ) {
-		const auto& M = **Mi;
-		const auto& F = M.F();
-
-		if ( Mi == _mm_list.begin() ) {
-			_0at = F.start_time();
-			_pagesize = M.psd_profile.Pp.pagesize;
-			_pages_in_bed = 0;
-		} else
-			if ( _pagesize != M.pagesize() ) {
-				_status |= TFlags::euneq_pagesize;
-				return;  // this is really serious, so return now
-			}
-
-		int	pa = (size_t)difftime( F.start_time(), _0at) / _pagesize,
-//			pz = (size_t)difftime( F.end_time(), _0at) / _pagesize;
-			pz = pa + M.hypnogram().pages();
-	      // anchor zero page, get pagesize from edf^W CBinnedPower^W either goes
-		time_t dima = F.start_time();
-		printf( "CProfile::CProfile(): adding %s of [%s, %s, %s] %zu pages (%zu full, %zu in hypnogram) recorded %s",
-			metrics::name(params.metric), F.subject().id.c_str(), F.session(), F.episode(),
-			M.total_pages(), M.full_pages(), M.hypnogram().pages(), ctime( &dima));
-
-		if ( pz - pa != (int)M.full_pages() ) {
-			fprintf( stderr, "CProfile::CProfile(): correcting end page to match full page count in EDF: %d->%zu\n",
-				 pz, pa + M.full_pages());
-			pz = pa + M.full_pages();
-		}
-		_pages_in_bed += (pz-pa);
-
-		if ( pa < 0 ) {
-			_status |= TFlags::enegoffset;
-			return;
-		}
-		// this condition is checked against already in SEpisodeSequence::add_one()
-		// if ( _mm_bounds.size() > 0  &&  pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
-		// 	_status |= (int)TSimPrepError::efarapart;
-		// 	return;
-		// }
-		_mm_bounds.emplace_back( TBounds (pa, pz));
-
-		_timeline.resize( pz, sigfile::SPageSimulated {0., 0., 1.});  // fill with WAKE
-	}
-
-	create_timeline();
-
-	if ( _sim_start != (size_t)-1 )
-		printf( "CProfile::CProfile(): sim start-end: %zu-%zu; avg SWA = %.4g (over %zu pp, or %.3g%% of all time in bed); "
-			" SWA_L = %g;  SWA[%zu] = %g\n",
-			_sim_start, _sim_end, _SWA_100, _pages_with_SWA, (double)_pages_with_SWA / _pages_in_bed * 100,
-			_SWA_L, _sim_start, _SWA_0);
-	else
-		printf( "CProfile::CProfile(): status %xd, %s\n", _status, CProfile::explain_status( _status).c_str());
+        if ( not J.have_session(d) or J.measurements.at(d).size() == 0 )
+                throw invalid_argument (J.id + " has no recordings in session " + d);
+
+        auto& EE = J.measurements.at(d).episodes;
+        for ( auto &E : EE )
+                _mm_list.push_back( &E.recordings.at(h));
+
+        for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi ) {
+                const auto& M = **Mi;
+                const auto& F = M.F();
+
+                if ( Mi == _mm_list.begin() ) {
+                        _0at = F.start_time();
+                        _pagesize = M.psd_profile.Pp.pagesize;
+                        _pages_in_bed = 0;
+                } else
+                        if ( _pagesize != M.pagesize() ) {
+                                _status |= TFlags::euneq_pagesize;
+                                return;  // this is really serious, so return now
+                        }
+
+                int        pa = (size_t)difftime( F.start_time(), _0at) / _pagesize,
+//                        pz = (size_t)difftime( F.end_time(), _0at) / _pagesize;
+                        pz = pa + M.hypnogram().pages();
+              // anchor zero page, get pagesize from edf^W CBinnedPower^W either goes
+                time_t dima = F.start_time();
+                printf( "CProfile::CProfile(): adding %s of [%s, %s, %s] %zu pages (%zu full, %zu in hypnogram) recorded %s",
+                        metrics::name(params.metric), F.subject().id.c_str(), F.session(), F.episode(),
+                        M.total_pages(), M.full_pages(), M.hypnogram().pages(), ctime( &dima));
+
+                if ( pz - pa != (int)M.full_pages() ) {
+                        fprintf( stderr, "CProfile::CProfile(): correcting end page to match full page count in EDF: %d->%zu\n",
+                                 pz, pa + M.full_pages());
+                        pz = pa + M.full_pages();
+                }
+                _pages_in_bed += (pz-pa);
+
+                if ( pa < 0 ) {
+                        _status |= TFlags::enegoffset;
+                        return;
+                }
+                // this condition is checked against already in SEpisodeSequence::add_one()
+                // if ( _mm_bounds.size() > 0  &&  pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
+                //         _status |= (int)TSimPrepError::efarapart;
+                //         return;
+                // }
+                _mm_bounds.emplace_back( TBounds (pa, pz));
+
+                _timeline.resize( pz, sigfile::SPageSimulated {0., 0., 1.});  // fill with WAKE
+        }
+
+        create_timeline();
+
+        if ( _sim_start != (size_t)-1 )
+                printf( "CProfile::CProfile(): sim start-end: %zu-%zu; avg SWA = %.4g (over %zu pp, or %.3g%% of all time in bed); "
+                        " SWA_L = %g;  SWA[%zu] = %g\n",
+                        _sim_start, _sim_end, _SWA_100, _pages_with_SWA, (double)_pages_with_SWA / _pages_in_bed * 100,
+                        _SWA_L, _sim_start, _SWA_0);
+        else
+                printf( "CProfile::CProfile(): status %xd, %s\n", _status, CProfile::explain_status( _status).c_str());
 }
 
 
@@ -164,53 +164,53 @@ CProfile (CSubject& J, const string& d, const sigfile::SChannel& h,
 
 agh::CProfile::
 CProfile (CRecording& M,
-	  const SProfileParamSet& params)
+          const SProfileParamSet& params)
       : SProfileParamSet (params),
-	_status (0),
-	_sim_start ((size_t)-1), _sim_end ((size_t)-1)
+        _status (0),
+        _sim_start ((size_t)-1), _sim_end ((size_t)-1)
 {
-	_mm_list.push_back( &M);
-
-	_0at = M.F().start_time();
-	_pagesize = M.psd_profile.Pp.pagesize;
-	_pages_in_bed = 0;
-
-	int	pa = (size_t)difftime( M.F().start_time(), _0at) / _pagesize,
-		pz = (size_t)difftime( M.F().end_time(), _0at) / _pagesize;
-	time_t	dima = M.F().start_time();
-	printf( "CProfile::CProfile(): adding single recording %s of [%s, %s, %s] %zu pages (%zu full, %zu in hypnogram) recorded %s",
-		metrics::name(params.metric), M.F().subject().id.c_str(), M.F().session(), M.F().episode(),
-		M.total_pages(), M.full_pages(), M.hypnogram().pages(), ctime( &dima));
-
-	if ( pz - pa != (int)M.full_pages() ) {
-		fprintf( stderr, "CProfile::CProfile(): correcting end page to match full page count in EDF: %d->%zu\n",
-			 pz, pa + M.full_pages());
-		pz = pa + M.full_pages();
-	}
-	_pages_in_bed += (pz-pa);
-
-	if ( pa < 0 ) {
-		_status |= TFlags::enegoffset;
-		return;
-	}
-	// this condition is checked against already in SEpisodeSequence::add_one()
-	// if ( _mm_bounds.size() > 0  &&  pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
-	// 	_status |= (int)TSimPrepError::efarapart;
-	// 	return;
-	// }
-	_mm_bounds.emplace_back( TBounds (pa, pz));
-
-	_timeline.resize( pz, sigfile::SPageSimulated {0., 0., 1.});  // fill with WAKE
-
-	create_timeline();
-
-	if ( _sim_start != (size_t)-1 )
-		printf( "CProfile::CProfile(): sim start-end: %zu-%zu; avg SWA = %.4g (over %zu pp, or %.3g%% of all time in bed); "
-			" SWA_L = %g;  SWA[%zu] = %g\n",
-			_sim_start, _sim_end, _SWA_100, _pages_with_SWA, (double)_pages_with_SWA / _pages_in_bed * 100,
-			_SWA_L, _sim_start, _SWA_0);
-	else
-		printf( "CProfile::CProfile(): status %xd, %s\n", _status, CProfile::explain_status( _status).c_str());
+        _mm_list.push_back( &M);
+
+        _0at = M.F().start_time();
+        _pagesize = M.psd_profile.Pp.pagesize;
+        _pages_in_bed = 0;
+
+        int        pa = (size_t)difftime( M.F().start_time(), _0at) / _pagesize,
+                pz = (size_t)difftime( M.F().end_time(), _0at) / _pagesize;
+        time_t        dima = M.F().start_time();
+        printf( "CProfile::CProfile(): adding single recording %s of [%s, %s, %s] %zu pages (%zu full, %zu in hypnogram) recorded %s",
+                metrics::name(params.metric), M.F().subject().id.c_str(), M.F().session(), M.F().episode(),
+                M.total_pages(), M.full_pages(), M.hypnogram().pages(), ctime( &dima));
+
+        if ( pz - pa != (int)M.full_pages() ) {
+                fprintf( stderr, "CProfile::CProfile(): correcting end page to match full page count in EDF: %d->%zu\n",
+                         pz, pa + M.full_pages());
+                pz = pa + M.full_pages();
+        }
+        _pages_in_bed += (pz-pa);
+
+        if ( pa < 0 ) {
+                _status |= TFlags::enegoffset;
+                return;
+        }
+        // this condition is checked against already in SEpisodeSequence::add_one()
+        // if ( _mm_bounds.size() > 0  &&  pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
+        //         _status |= (int)TSimPrepError::efarapart;
+        //         return;
+        // }
+        _mm_bounds.emplace_back( TBounds (pa, pz));
+
+        _timeline.resize( pz, sigfile::SPageSimulated {0., 0., 1.});  // fill with WAKE
+
+        create_timeline();
+
+        if ( _sim_start != (size_t)-1 )
+                printf( "CProfile::CProfile(): sim start-end: %zu-%zu; avg SWA = %.4g (over %zu pp, or %.3g%% of all time in bed); "
+                        " SWA_L = %g;  SWA[%zu] = %g\n",
+                        _sim_start, _sim_end, _SWA_100, _pages_with_SWA, (double)_pages_with_SWA / _pages_in_bed * 100,
+                        _SWA_L, _sim_start, _SWA_0);
+        else
+                printf( "CProfile::CProfile(): status %xd, %s\n", _status, CProfile::explain_status( _status).c_str());
 }
 
 
@@ -219,17 +219,17 @@ CProfile (CRecording& M,
 agh::CProfile::
 CProfile (CProfile&& rv)
       : SProfileParamSet (rv),
-	_sim_start (rv._sim_start), _sim_end (rv._sim_end),
-	_baseline_end (rv._baseline_end),
-	_pages_with_SWA (rv._pages_with_SWA),
-	_pages_in_bed (rv._pages_in_bed),
-	_SWA_L (rv._SWA_L), _SWA_0 (rv._SWA_0), _SWA_100 (rv._SWA_100),
-	_0at (rv._0at),
-	_pagesize (rv._pagesize)
+        _sim_start (rv._sim_start), _sim_end (rv._sim_end),
+        _baseline_end (rv._baseline_end),
+        _pages_with_SWA (rv._pages_with_SWA),
+        _pages_in_bed (rv._pages_in_bed),
+        _SWA_L (rv._SWA_L), _SWA_0 (rv._SWA_0), _SWA_100 (rv._SWA_100),
+        _0at (rv._0at),
+        _pagesize (rv._pagesize)
 {
-	swap( _timeline,  rv._timeline);
-	swap( _mm_bounds, rv._mm_bounds);
-	swap( _mm_list,   rv._mm_list);
+        swap( _timeline,  rv._timeline);
+        swap( _mm_bounds, rv._mm_bounds);
+        swap( _mm_list,   rv._mm_list);
 }
 
 
@@ -238,10 +238,10 @@ 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;
+        for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi )
+                if ( (*Mi)->need_compute( P) )
+                        return true;
+        return false;
 }
 
 
@@ -249,97 +249,97 @@ void
 agh::CProfile::
 create_timeline()
 {
-	_metric_avg = 0.;
-	for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi ) {
-		auto& M = **Mi;
-		const auto& F = M.F();
-		const auto& Y = M.hypnogram();
-
-		if ( Y.percent_scored() < req_percent_scored )
-			_status |= TFlags::enoscore;
-
-	      // collect M's power and scores
-		valarray<TFloat>
-			lumped_bins = M.course( *(SProfileParamSet*)this);
-
-		size_t	pa = (size_t)difftime( F.start_time(), _0at) / _pagesize,
-			pz = (size_t)difftime( F.end_time(), _0at) / _pagesize;
-		for ( size_t p = pa; p < pz; ++p ) {
-			_timeline[p] = sigfile::SPageSimulated {Y[p-pa]};
-		      // fill unscored/MVT per user setting
-			if ( !_timeline[p].is_scored() ) {
-				if ( score_unscored_as_wake )
-					_timeline[p].mark( sigfile::SPage::TScore::wake);
-				else
-					if ( p > 0 )
-						_timeline[p] = _timeline[p-1];
-			}
-		      // put SWA, compute avg PSD
-			_metric_avg +=
-				(_timeline[p].metric = lumped_bins[p-pa]);
-		}
-
-	      // determine SWA_0
-		if ( Mi == _mm_list.begin() ) {
-			_baseline_end = pz;
-
-			// require some length of swa-containing pages to happen before sim_start
-			for ( size_t p = 0; p < pz; ++p ) {
-				for ( size_t pp = p; pp < pz; ++pp ) {
-					if ( _timeline[pp].NREM < 1./3 ) {
-						p = pp;
-						goto outer_continue;
-					}
-					if ( (pp-p) >= swa_laden_pages_before_SWA_0 ) {
-						_sim_start = pp;
-						goto outer_break;
-					}
-				}
-			outer_continue:
-				;
-			}
-		outer_break:
-
-			if ( _sim_start == (size_t)-1 )
-				_status |= TFlags::enoswa;
-			else
-				_SWA_0 = _timeline[_sim_start].metric;
-		}
-
-		_sim_end = pz-1;
-	}
-	_metric_avg /= _pages_in_bed;
+        _metric_avg = 0.;
+        for ( auto Mi = _mm_list.begin(); Mi != _mm_list.end(); ++Mi ) {
+                auto& M = **Mi;
+                const auto& F = M.F();
+                const auto& Y = M.hypnogram();
+
+                if ( Y.percent_scored() < req_percent_scored )
+                        _status |= TFlags::enoscore;
+
+              // collect M's power and scores
+                valarray<TFloat>
+                        lumped_bins = M.course( *(SProfileParamSet*)this);
+
+                size_t        pa = (size_t)difftime( F.start_time(), _0at) / _pagesize,
+                        pz = (size_t)difftime( F.end_time(), _0at) / _pagesize;
+                for ( size_t p = pa; p < pz; ++p ) {
+                        _timeline[p] = sigfile::SPageSimulated {Y[p-pa]};
+                      // fill unscored/MVT per user setting
+                        if ( !_timeline[p].is_scored() ) {
+                                if ( score_unscored_as_wake )
+                                        _timeline[p].mark( sigfile::SPage::TScore::wake);
+                                else
+                                        if ( p > 0 )
+                                                _timeline[p] = _timeline[p-1];
+                        }
+                      // put SWA, compute avg PSD
+                        _metric_avg +=
+                                (_timeline[p].metric = lumped_bins[p-pa]);
+                }
+
+              // determine SWA_0
+                if ( Mi == _mm_list.begin() ) {
+                        _baseline_end = pz;
+
+                        // require some length of swa-containing pages to happen before sim_start
+                        for ( size_t p = 0; p < pz; ++p ) {
+                                for ( size_t pp = p; pp < pz; ++pp ) {
+                                        if ( _timeline[pp].NREM < 1./3 ) {
+                                                p = pp;
+                                                goto outer_continue;
+                                        }
+                                        if ( (pp-p) >= swa_laden_pages_before_SWA_0 ) {
+                                                _sim_start = pp;
+                                                goto outer_break;
+                                        }
+                                }
+                        outer_continue:
+                                ;
+                        }
+                outer_break:
+
+                        if ( _sim_start == (size_t)-1 )
+                                _status |= TFlags::enoswa;
+                        else
+                                _SWA_0 = _timeline[_sim_start].metric;
+                }
+
+                _sim_end = pz-1;
+        }
+        _metric_avg /= _pages_in_bed;
 
       // determine SWA metrics
-	_pages_with_SWA = _pages_non_wake = 0;
-	_SWA_L = _SWA_100 = 0.;
-
-	if ( _sim_start != (size_t)-1 ) {
-		size_t REM_pages_cnt = 0;
-		for ( size_t p = _sim_start; p < _sim_end; ++p ) {
-			auto& P = _timeline[p];
-			if ( P.REM > .5 ) {
-				_SWA_L += P.metric;
-				++REM_pages_cnt;
-			}
-			if ( P.NREM > 1./3 ) {
-				_SWA_100 += P.metric;
-				++_pages_with_SWA;
-			}
-			if ( P.Wake == 0. )
-				++_pages_non_wake;
-		}
-		if ( REM_pages_cnt )
-			_SWA_L /= (REM_pages_cnt / .95);
-		if ( _pages_with_SWA )
-			_SWA_100 /= _pages_with_SWA;
-	}
+        _pages_with_SWA = _pages_non_wake = 0;
+        _SWA_L = _SWA_100 = 0.;
+
+        if ( _sim_start != (size_t)-1 ) {
+                size_t REM_pages_cnt = 0;
+                for ( size_t p = _sim_start; p < _sim_end; ++p ) {
+                        auto& P = _timeline[p];
+                        if ( P.REM > .5 ) {
+                                _SWA_L += P.metric;
+                                ++REM_pages_cnt;
+                        }
+                        if ( P.NREM > 1./3 ) {
+                                _SWA_100 += P.metric;
+                                ++_pages_with_SWA;
+                        }
+                        if ( P.Wake == 0. )
+                                ++_pages_non_wake;
+                }
+                if ( REM_pages_cnt )
+                        _SWA_L /= (REM_pages_cnt / .95);
+                if ( _pages_with_SWA )
+                        _SWA_100 /= _pages_with_SWA;
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/recording.hh b/upstream/src/aghermann/expdesign/recording.hh
index 70780b9..3b8a41a 100644
--- a/upstream/src/aghermann/expdesign/recording.hh
+++ b/upstream/src/aghermann/expdesign/recording.hh
@@ -26,78 +26,78 @@ using namespace std;
 
 
 struct SProfileParamSet {
-	metrics::TType
-		metric;
-	const char*
-	metric_name() const
-		{
-			return metrics::name(metric);
-		}
-
-	struct PSD {
-		double	freq_from,
-			freq_upto;
-	};
-	struct MC {
-		double	f0;
-	};
-	struct SWU {
-		double	f0;
-	};
-
-	union {
-		PSD psd;
-		MC  mc;
-		SWU swu;
-	} P;
-
-	double	req_percent_scored;
-	size_t	swa_laden_pages_before_SWA_0;
-	bool	score_unscored_as_wake;
-
-	SProfileParamSet (const SProfileParamSet::PSD& psd_,
-			  double req_percent_scored_ = 90.,
-			  size_t swa_laden_pages_before_SWA_0_ = 3,
-			  bool	score_unscored_as_wake_ = true)
-	      : metric (metrics::TType::psd),
-		req_percent_scored (req_percent_scored_),
-		swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
-		score_unscored_as_wake (score_unscored_as_wake_)
-		{
-			P.psd = psd_;
-		}
-	SProfileParamSet (const SProfileParamSet::SWU& swu_,
-			  double req_percent_scored_ = 90.,
-			  size_t swa_laden_pages_before_SWA_0_ = 3,
-			  bool	score_unscored_as_wake_ = true)
-	      : metric (metrics::TType::swu),
-		req_percent_scored (req_percent_scored_),
-		swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
-		score_unscored_as_wake (score_unscored_as_wake_)
-		{
-			P.swu = swu_;
-		}
-	SProfileParamSet (const SProfileParamSet::MC& mc_,
-			  double req_percent_scored_ = 90.,
-			  size_t swa_laden_pages_before_SWA_0_ = 3,
-			  bool	score_unscored_as_wake_ = true)
-	      : metric (metrics::TType::mc),
-		req_percent_scored (req_percent_scored_),
-		swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
-		score_unscored_as_wake (score_unscored_as_wake_)
-		{
-			P.mc = mc_;
-		}
-
-	string display_name() const;
-
-	// silly stl requirements
-	SProfileParamSet ()
-		{} // if initialised as part of a class with us as base, exception already thrown by those
-	bool operator<( const SProfileParamSet&) const
-		{
-			return false;
-		}
+        metrics::TType
+                metric;
+        const char*
+        metric_name() const
+                {
+                        return metrics::name(metric);
+                }
+
+        struct PSD {
+                double        freq_from,
+                        freq_upto;
+        };
+        struct MC {
+                double        f0;
+        };
+        struct SWU {
+                double        f0;
+        };
+
+        union {
+                PSD psd;
+                MC  mc;
+                SWU swu;
+        } P;
+
+        double        req_percent_scored;
+        size_t        swa_laden_pages_before_SWA_0;
+        bool        score_unscored_as_wake;
+
+        SProfileParamSet (const SProfileParamSet::PSD& psd_,
+                          double req_percent_scored_ = 90.,
+                          size_t swa_laden_pages_before_SWA_0_ = 3,
+                          bool        score_unscored_as_wake_ = true)
+              : metric (metrics::TType::psd),
+                req_percent_scored (req_percent_scored_),
+                swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
+                score_unscored_as_wake (score_unscored_as_wake_)
+                {
+                        P.psd = psd_;
+                }
+        SProfileParamSet (const SProfileParamSet::SWU& swu_,
+                          double req_percent_scored_ = 90.,
+                          size_t swa_laden_pages_before_SWA_0_ = 3,
+                          bool        score_unscored_as_wake_ = true)
+              : metric (metrics::TType::swu),
+                req_percent_scored (req_percent_scored_),
+                swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
+                score_unscored_as_wake (score_unscored_as_wake_)
+                {
+                        P.swu = swu_;
+                }
+        SProfileParamSet (const SProfileParamSet::MC& mc_,
+                          double req_percent_scored_ = 90.,
+                          size_t swa_laden_pages_before_SWA_0_ = 3,
+                          bool        score_unscored_as_wake_ = true)
+              : metric (metrics::TType::mc),
+                req_percent_scored (req_percent_scored_),
+                swa_laden_pages_before_SWA_0 (swa_laden_pages_before_SWA_0_),
+                score_unscored_as_wake (score_unscored_as_wake_)
+                {
+                        P.mc = mc_;
+                }
+
+        string display_name() const;
+
+        // silly stl requirements
+        SProfileParamSet ()
+                {} // if initialised as part of a class with us as base, exception already thrown by those
+        bool operator<( const SProfileParamSet&) const
+                {
+                        return false;
+                }
 };
 
 template<metrics::TType t>
@@ -108,169 +108,169 @@ template<>
 inline SProfileParamSet
 make_profile_paramset<metrics::TType::psd>(double freq_from, ...)
 {
-	va_list ap;
-	va_start (ap, freq_from);
-	double freq_upto = va_arg (ap, double);
-	va_end (ap);
-	return SProfileParamSet (SProfileParamSet::PSD {freq_from, freq_upto});
+        va_list ap;
+        va_start (ap, freq_from);
+        double freq_upto = va_arg (ap, double);
+        va_end (ap);
+        return SProfileParamSet (SProfileParamSet::PSD {freq_from, freq_upto});
 }
 
 template<>
 inline SProfileParamSet
 make_profile_paramset<metrics::TType::swu>(double f0, ...)
 {
-	return SProfileParamSet (SProfileParamSet::SWU {f0});
+        return SProfileParamSet (SProfileParamSet::SWU {f0});
 }
 
 template<>
 inline SProfileParamSet
 make_profile_paramset<metrics::TType::mc>(double f0, ...)
 {
-	return SProfileParamSet (SProfileParamSet::MC {f0});
+        return SProfileParamSet (SProfileParamSet::MC {f0});
 }
 
 
 
 class CRecording {
 
-	CRecording () = delete;
-	void operator=( const CRecording&) = delete;
+        CRecording () = delete;
+        void operator=( const CRecording&) = delete;
 
     public:
-	CRecording (const CRecording& rv) // needed for map
-	      : psd_profile (rv.psd_profile),
-		swu_profile (rv.swu_profile),
-		mc_profile  (rv.mc_profile),
-		uc_params (nullptr),
-		_status (rv._status),
-		_source (rv._source),
-		_sig_no (rv._sig_no)
-		{}
-	CRecording (sigfile::CTypedSource& F, int sig_no,
-		    const metrics::psd::SPPack&,
-		    const metrics::swu::SPPack&,
-		    const metrics::mc::SPPack&);
+        CRecording (const CRecording& rv) // needed for map
+              : psd_profile (rv.psd_profile),
+                swu_profile (rv.swu_profile),
+                mc_profile  (rv.mc_profile),
+                uc_params (nullptr),
+                _status (rv._status),
+                _source (rv._source),
+                _sig_no (rv._sig_no)
+                {}
+        CRecording (sigfile::CTypedSource& F, int sig_no,
+                    const metrics::psd::SPPack&,
+                    const metrics::swu::SPPack&,
+                    const metrics::mc::SPPack&);
        ~CRecording ();
 
-	const char* subject() const      {  return _source().subject().name.c_str(); }
-	const char* session() const      {  return _source().session(); }
-	const char* episode() const      {  return _source().episode(); }
-	const char* channel() const      {  return _source().channel_by_id(_sig_no).name(); }
-
-	sigfile::SChannel::TType signal_type() const
-		{
-			return _source().signal_type(_sig_no);
-		}
-
-	const sigfile::CSource& F() const
-		{
-			return _source();
-		}
-	sigfile::CSource& F()  // although we shouldn't want to access CEDFFile writably from CRecording,
-		{      // this shortcut saves us the trouble of AghCC->subject_by_x(,,,).measurements...
-			return _source();  // on behalf of agh::ui::SChannelPresentation
-		}
-	const sigfile::CHypnogram&
-	hypnogram() const
-		{
-			return *(sigfile::CHypnogram*)&_source;
-		}
-
-	int h() const
-		{
-			return _sig_no;
-		}
-
-	bool operator<( const CRecording &o) const
-		{
-			return _source().end_time() < o._source().start_time();
-		}
-
-	time_t start() const
-		{
-			return _source().start_time();
-		}
-	time_t end() const
-		{
-			return _source().end_time();
-		}
-
-	// this one damn identical in all bases
-	size_t pagesize() const
-		{
-			return ((metrics::psd::CProfile*)this) -> Pp.pagesize;
-		}
-
-	// actual page counts based on actual edf samples
-	size_t total_pages() const
-		{
-			return _source().recording_time() / pagesize();
-		}
-	size_t full_pages() const
-		{
-			return round(_source().recording_time() / pagesize());
-		}
-	size_t total_samples() const
-		{
-			return _source().recording_time() * _source().samplerate(_sig_no);
-		}
-
-	valarray<TFloat>
-	course( const SProfileParamSet::PSD&);
-
-	valarray<TFloat>
-	course( const SProfileParamSet::SWU&);
-
-	valarray<TFloat>
-	course( const SProfileParamSet::MC&);
-
-	valarray<TFloat>
-	course( const SProfileParamSet& P)
-		{
-			switch ( P.metric ) {
-			case metrics::TType::psd:
-				return course( P.P.psd);
-			case metrics::TType::swu:
-				return course( P.P.swu);
-			case metrics::TType::mc:
-				return course( P.P.mc);
-			default:
-				throw runtime_error ("What metric?");
-			}
-		}
-
-	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;
-
-	bool have_uc_determined() const
-		{
-			return uc_params;
-		}
-	agh::beersma::SUltradianCycle
-		*uc_params;
+        const char* subject() const      {  return _source().subject().name.c_str(); }
+        const char* session() const      {  return _source().session(); }
+        const char* episode() const      {  return _source().episode(); }
+        const char* channel() const      {  return _source().channel_by_id(_sig_no).name(); }
+
+        sigfile::SChannel::TType signal_type() const
+                {
+                        return _source().signal_type(_sig_no);
+                }
+
+        const sigfile::CSource& F() const
+                {
+                        return _source();
+                }
+        sigfile::CSource& F()  // although we shouldn't want to access CEDFFile writably from CRecording,
+                {      // this shortcut saves us the trouble of AghCC->subject_by_x(,,,).measurements...
+                        return _source();  // on behalf of agh::ui::SChannelPresentation
+                }
+        const sigfile::CHypnogram&
+        hypnogram() const
+                {
+                        return *(sigfile::CHypnogram*)&_source;
+                }
+
+        int h() const
+                {
+                        return _sig_no;
+                }
+
+        bool operator<( const CRecording &o) const
+                {
+                        return _source().end_time() < o._source().start_time();
+                }
+
+        time_t start() const
+                {
+                        return _source().start_time();
+                }
+        time_t end() const
+                {
+                        return _source().end_time();
+                }
+
+        // this one damn identical in all bases
+        size_t pagesize() const
+                {
+                        return ((metrics::psd::CProfile*)this) -> Pp.pagesize;
+                }
+
+        // actual page counts based on actual edf samples
+        size_t total_pages() const
+                {
+                        return _source().recording_time() / pagesize();
+                }
+        size_t full_pages() const
+                {
+                        return round(_source().recording_time() / pagesize());
+                }
+        size_t total_samples() const
+                {
+                        return _source().recording_time() * _source().samplerate(_sig_no);
+                }
+
+        valarray<TFloat>
+        course( const SProfileParamSet::PSD&);
+
+        valarray<TFloat>
+        course( const SProfileParamSet::SWU&);
+
+        valarray<TFloat>
+        course( const SProfileParamSet::MC&);
+
+        valarray<TFloat>
+        course( const SProfileParamSet& P)
+                {
+                        switch ( P.metric ) {
+                        case metrics::TType::psd:
+                                return course( P.P.psd);
+                        case metrics::TType::swu:
+                                return course( P.P.swu);
+                        case metrics::TType::mc:
+                                return course( P.P.mc);
+                        default:
+                                throw runtime_error ("What metric?");
+                        }
+                }
+
+        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;
+
+        bool have_uc_determined() const
+                {
+                        return uc_params;
+                }
+        agh::beersma::SUltradianCycle
+                *uc_params;
 
     protected:
-	int	_status;
+        int        _status;
 
-	sigfile::CTypedSource&
-		_source;
-	int	_sig_no;
+        sigfile::CTypedSource&
+                _source;
+        int        _sig_no;
 };
 
 
@@ -282,24 +282,24 @@ inline valarray<TFloat>
 CRecording::
 course( const SProfileParamSet::PSD& p)
 {
-	return (psd_profile.compute(),
-		psd_profile.course( p.freq_from, p.freq_upto));
+        return (psd_profile.compute(),
+                psd_profile.course( p.freq_from, p.freq_upto));
 }
 
 inline valarray<TFloat>
 CRecording::
 course( const SProfileParamSet::SWU& p)
 {
-	return (swu_profile.compute(),
-		swu_profile.course( p.f0));
+        return (swu_profile.compute(),
+                swu_profile.course( p.f0));
 }
 
 inline valarray<TFloat>
 CRecording::
 course( const SProfileParamSet::MC& p)
 {
-	return (mc_profile.compute(),
-		mc_profile.course( p.f0));
+        return (mc_profile.compute(),
+                mc_profile.course( p.f0));
 }
 
 
@@ -309,7 +309,7 @@ course( const SProfileParamSet::MC& p)
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/subject.cc b/upstream/src/aghermann/expdesign/subject.cc
index c142bdb..eea9bdc 100644
--- a/upstream/src/aghermann/expdesign/subject.cc
+++ b/upstream/src/aghermann/expdesign/subject.cc
@@ -25,12 +25,12 @@ float
 CSubject::
 age( const string& d) const // age when recordings in this session were made
 {
-	if ( alg::member(d, measurements) &&
-	     measurements.at(d).episodes.size() > 0 )
-		return age_rel(
-			measurements.at(d).episodes.front().start_time());
-	else
-		return -1.;
+        if ( alg::member(d, measurements) &&
+             measurements.at(d).episodes.size() > 0 )
+                return age_rel(
+                        measurements.at(d).episodes.front().start_time());
+        else
+                return -1.;
 }
 
 
@@ -39,19 +39,19 @@ float
 CSubject::
 age() const
 {
-	time_t now = time(NULL);
-	if ( unlikely (now == -1) ) {
-		perror( "What's wrong with localtime? ");
-		return 21.;
-	}
-	return age_rel(now);
+        time_t now = time(NULL);
+        if ( unlikely (now == -1) ) {
+                perror( "What's wrong with localtime? ");
+                return 21.;
+        }
+        return age_rel(now);
 }
 
 float
 CSubject::
 age_rel( time_t rel) const
 {
-	return (difftime(rel, dob))/365.25/24/60/60;
+        return (difftime(rel, dob))/365.25/24/60/60;
 }
 
 
@@ -61,19 +61,19 @@ age_rel( time_t rel) const
 
 SEpisode::
 SEpisode (sigfile::CTypedSource&& F_,
-	  const metrics::psd::SPPack& fft_params,
-	  const metrics::swu::SPPack& swu_params,
-	  const metrics::mc::SPPack& mc_params)
+          const metrics::psd::SPPack& fft_params,
+          const metrics::swu::SPPack& swu_params,
+          const metrics::mc::SPPack& mc_params)
 {
       // move it in place
-	sources.emplace_back( move(F_));
-	auto& F = sources.back();
-	auto HH = F().channel_list();
-	printf( "SEpisode::SEpisode( \"%s\"): %s\n",
-		F().filename(), sigfile::join_channel_names(HH, ", ").c_str());
-	int h = 0;
-	for ( auto& H : HH )
-		recordings.insert( {H, {F, h++, fft_params, swu_params, mc_params}});
+        sources.emplace_back( move(F_));
+        auto& F = sources.back();
+        auto HH = F().channel_list();
+        printf( "SEpisode::SEpisode( \"%s\"): %s\n",
+                F().filename(), sigfile::join_channel_names(HH, ", ").c_str());
+        int h = 0;
+        for ( auto& H : HH )
+                recordings.insert( {H, {F, h++, fft_params, swu_params, mc_params}});
 }
 
 
@@ -81,20 +81,20 @@ list<SEpisode::SAnnotation>
 SEpisode::
 get_annotations() const
 {
-	list<agh::SEpisode::SAnnotation>
-		ret;
-	for ( auto &F : sources ) {
-		auto HH = F().channel_list();
-		for ( size_t h = 0; h < HH.size(); ++h ) {
-			auto &AA = F().annotations(h);
-			for ( auto &A : AA )
-				ret.emplace_back( F(), h, A);
-		}
-		for ( auto& A : F().annotations() )
-			ret.emplace_back( F(), -1, A);
-	}
-	ret.sort();
-	return ret;
+        list<agh::SEpisode::SAnnotation>
+                ret;
+        for ( auto &F : sources ) {
+                auto HH = F().channel_list();
+                for ( size_t h = 0; h < HH.size(); ++h ) {
+                        auto &AA = F().annotations(h);
+                        for ( auto &A : AA )
+                                ret.emplace_back( F(), h, A);
+                }
+                for ( auto& A : F().annotations() )
+                        ret.emplace_back( F(), -1, A);
+        }
+        ret.sort();
+        return ret;
 }
 
 
@@ -103,25 +103,25 @@ const SEpisode&
 SEpisodeSequence::
 operator[]( const string& e) const
 {
-	auto E = find( episodes.begin(), episodes.end(), e);
-	if ( E != episodes.end() )
-		return *E;
-	else
-		throw invalid_argument( string("no such episode: ") + e);
+        auto E = find( episodes.begin(), episodes.end(), e);
+        if ( E != episodes.end() )
+                return *E;
+        else
+                throw invalid_argument( string("no such episode: ") + e);
 }
 
 SEpisode&
 SEpisodeSequence::
 operator[]( const string& e)
 {
-	auto E = find( episodes.begin(), episodes.end(), e);
-	if ( E != episodes.end() )
-		return *E;
-	else // or don't throw, go and make one?
-		throw invalid_argument( string("no such episode: ") + e);
-	// no, let it be created in
-	// CExpDesign::add_measurement, when
-	// episode start/end times are known
+        auto E = find( episodes.begin(), episodes.end(), e);
+        if ( E != episodes.end() )
+                return *E;
+        else // or don't throw, go and make one?
+                throw invalid_argument( string("no such episode: ") + e);
+        // no, let it be created in
+        // CExpDesign::add_measurement, when
+        // episode start/end times are known
 }
 
 
@@ -129,7 +129,7 @@ operator[]( const string& e)
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/subject.hh b/upstream/src/aghermann/expdesign/subject.hh
index 40e360f..6996e28 100644
--- a/upstream/src/aghermann/expdesign/subject.hh
+++ b/upstream/src/aghermann/expdesign/subject.hh
@@ -39,108 +39,108 @@ using namespace std;
 
 struct SEpisode {
 
-	SEpisode (sigfile::CTypedSource&&,
-		  const metrics::psd::SPPack&,
-		  const metrics::swu::SPPack&,
-		  const metrics::mc::SPPack&);
-
-	time_t start_time() const	{ return sources.front()().start_time(); }
-	time_t end_time() const		{ return sources.front()().end_time();	 }
-	time_t start_time()		{ return sources.front()().start_time(); }
-	time_t end_time()		{ return sources.front()().end_time();	 }
-	time_t	// relative to start_time
-		start_rel,
-		end_rel;
-
-	typedef map<sigfile::SChannel, CRecording> TRecordingSet;
-	TRecordingSet
-		recordings; // one per channel, naturally
-
-	const char*
-	name() const
-		{ return sources.front()().episode(); }
-	bool
-	operator==( const string& e) const
-		{ return e == name(); }
-	bool
-	operator<( const SEpisode& rv) const
-		{
-			return sources.front()().end_time()
-				< rv.sources.front()().start_time();
-		}
-
-	struct SAnnotation
-	  : public sigfile::SAnnotation {
-		SAnnotation (const sigfile::CSource& _si, int _hi,
-			     const sigfile::SAnnotation& _a)
-		      : sigfile::SAnnotation (_a),
-			_source (_si), _h (_hi)
-			{}
-		SAnnotation( const SAnnotation&) = default;
-
-		const sigfile::CSource& _source;
-		int _h;
-
-		bool
-		operator<( const SAnnotation& rv) const
-			{ return span < rv.span; }
-
-		const char*
-		channel() const
-			{ return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).name(); }
-		agh::alg::SSpan<float>
-		page_span( size_t pagesize) const
-			{ return span / (float)pagesize; }
-	};
-	list<SAnnotation>
-	get_annotations() const;
+        SEpisode (sigfile::CTypedSource&&,
+                  const metrics::psd::SPPack&,
+                  const metrics::swu::SPPack&,
+                  const metrics::mc::SPPack&);
+
+        time_t start_time() const        { return sources.front()().start_time(); }
+        time_t end_time() const                { return sources.front()().end_time();         }
+        time_t start_time()                { return sources.front()().start_time(); }
+        time_t end_time()                { return sources.front()().end_time();         }
+        time_t        // relative to start_time
+                start_rel,
+                end_rel;
+
+        typedef map<sigfile::SChannel, CRecording> TRecordingSet;
+        TRecordingSet
+                recordings; // one per channel, naturally
+
+        const char*
+        name() const
+                { return sources.front()().episode(); }
+        bool
+        operator==( const string& e) const
+                { return e == name(); }
+        bool
+        operator<( const SEpisode& rv) const
+                {
+                        return sources.front()().end_time()
+                                < rv.sources.front()().start_time();
+                }
+
+        struct SAnnotation
+          : public sigfile::SAnnotation {
+                SAnnotation (const sigfile::CSource& _si, int _hi,
+                             const sigfile::SAnnotation& _a)
+                      : sigfile::SAnnotation (_a),
+                        _source (_si), _h (_hi)
+                        {}
+                SAnnotation( const SAnnotation&) = default;
+
+                const sigfile::CSource& _source;
+                int _h;
+
+                bool
+                operator<( const SAnnotation& rv) const
+                        { return span < rv.span; }
+
+                const char*
+                channel() const
+                        { return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).name(); }
+                agh::alg::SSpan<float>
+                page_span( size_t pagesize) const
+                        { return span / (float)pagesize; }
+        };
+        list<SAnnotation>
+        get_annotations() const;
 
     // private:
-    // 	friend class agh::CSubject;
-    // 	friend class agh::ui::SScoringFacility;
+    //         friend class agh::CSubject;
+    //         friend class agh::ui::SScoringFacility;
       // allow multiple sources (possibly supplying different channels)
-	list<sigfile::CTypedSource>
-		sources;
+        list<sigfile::CTypedSource>
+                sources;
 };
 
 
 struct SEpisodeSequence {
-	friend class agh::CExpDesign;
-	friend class agh::CProfile;
+        friend class agh::CExpDesign;
+        friend class agh::CProfile;
     public:
-	list<SEpisode> episodes;
-	size_t
-	size() const
-		{ return episodes.size(); }
-
-	list<SEpisode>::const_iterator
-	episode_iter_by_name( const string& e) const
-		{ return find( episodes.begin(), episodes.end(), e); }
-	bool
-	have_episode( const string& e) const
-		{ return episode_iter_by_name(e) != episodes.cend(); }
-
-	const SEpisode&
-	operator[]( const string& e) const;
-	SEpisode&
-	operator[]( const string& e);
+        list<SEpisode> episodes;
+        size_t
+        size() const
+                { return episodes.size(); }
+
+        list<SEpisode>::const_iterator
+        episode_iter_by_name( const string& e) const
+                { return find( episodes.begin(), episodes.end(), e); }
+        bool
+        have_episode( const string& e) const
+                { return episode_iter_by_name(e) != episodes.cend(); }
+
+        const SEpisode&
+        operator[]( const string& e) const;
+        SEpisode&
+        operator[]( const string& e);
 
       // either construct a new episode from F, or update an
       // existing one (add F to its sources)
-	int
-	add_one( sigfile::CTypedSource&&,
-		 const metrics::psd::SPPack&,
-		 const metrics::swu::SPPack&,
-		 const metrics::mc::SPPack&,
-		 float max_hours_apart = 7*24.);
+        int
+        add_one( sigfile::CTypedSource&&,
+                 const metrics::psd::SPPack&,
+                 const metrics::swu::SPPack&,
+                 const metrics::mc::SPPack&,
+                 float max_hours_apart = 7*24.);
 
       // simulations rather belong here
-	typedef map<SProfileParamSet,
-		    map<string, // channel
-			ach::CModelRun>>
-		TModrunSetMap;
-	TModrunSetMap
-		modrun_sets;  // a bunch (from, to) per each fftable channel
+        typedef map<SProfileParamSet,
+                    map<string, // channel
+                        ach::CModelRun>>
+                TModrunSetMap;
+        TModrunSetMap
+                modrun_sets;  // a bunch (from, to) per each fftable channel
 };
 
 
@@ -152,63 +152,63 @@ typedef size_t sid_t;
 
 class CSubject : public SSubjectId {
 
-	void operator=( const CSubject&) = delete;
-	CSubject () = delete;
+        void operator=( const CSubject&) = delete;
+        CSubject () = delete;
 
     public:
-	CSubject (const CSubject& rv)
-	      : agh::SSubjectId (rv),
-		_status (rv._status),
-		_id (rv._id),
-		_dir (rv._dir)
-		{}
-
-	CSubject (const string& dir, sid_t id)
-	      : agh::SSubjectId (dir.substr( dir.rfind('/')+1)),
-		_status (0),
-		_id (id),
-		_dir (dir)
-		{}
+        CSubject (const CSubject& rv)
+              : agh::SSubjectId (rv),
+                _status (rv._status),
+                _id (rv._id),
+                _dir (rv._dir)
+                {}
+
+        CSubject (const string& dir, sid_t id)
+              : agh::SSubjectId (dir.substr( dir.rfind('/')+1)),
+                _status (0),
+                _id (id),
+                _dir (dir)
+                {}
 
       // identification
-	const char*
-	dir() const
-		{ return _dir.c_str(); }
-
-	int try_update_subject_details( const agh::SSubjectId& j)
-		{ return SSubjectId::update_from( j); }
-
-	float age( const string& d) const; // age when recordings in this session were made
-	float age() const; // now
-	float age_rel( time_t) const;
-
-	bool operator==( const CSubject &o) const
-		{ return id == o.id; }
-	bool operator==( const string& n) const
-		{ return SSubjectId::id == n; }
-	bool operator==( sid_t id) const
-		{ return _id == id; }
-
-	// all episode sequences, all channels forming a session
-	// using CMSessionSet = map<string, // session name
-	// 			 SEpisodeSequence>;
-	typedef map<string, // session name
-		    SEpisodeSequence>
-		CMSessionSet;
-	CMSessionSet
-		measurements;
-
-	bool
-	have_session( const string& d) const
-		{
-			return measurements.find(d) != measurements.end();
-		}
+        const char*
+        dir() const
+                { return _dir.c_str(); }
+
+        int try_update_subject_details( const agh::SSubjectId& j)
+                { return SSubjectId::update_from( j); }
+
+        float age( const string& d) const; // age when recordings in this session were made
+        float age() const; // now
+        float age_rel( time_t) const;
+
+        bool operator==( const CSubject &o) const
+                { return id == o.id; }
+        bool operator==( const string& n) const
+                { return SSubjectId::id == n; }
+        bool operator==( sid_t id) const
+                { return _id == id; }
+
+        // all episode sequences, all channels forming a session
+        // using CMSessionSet = map<string, // session name
+        //                          SEpisodeSequence>;
+        typedef map<string, // session name
+                    SEpisodeSequence>
+                CMSessionSet;
+        CMSessionSet
+                measurements;
+
+        bool
+        have_session( const string& d) const
+                {
+                        return measurements.find(d) != measurements.end();
+                }
 
     private:
-	int	_status;
-	sid_t	_id; // eventually to allow distinctly identifiable namesakes in different groups
+        int        _status;
+        sid_t        _id; // eventually to allow distinctly identifiable namesakes in different groups
 
-	string	_dir;
+        string        _dir;
 };
 
 } // namespace agh
@@ -217,7 +217,7 @@ class CSubject : public SSubjectId {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/expdesign/tree-scanner.cc b/upstream/src/aghermann/expdesign/tree-scanner.cc
index 70eee13..058d0f8 100644
--- a/upstream/src/aghermann/expdesign/tree-scanner.cc
+++ b/upstream/src/aghermann/expdesign/tree-scanner.cc
@@ -25,15 +25,15 @@ using namespace std;
 
 namespace {
 struct progress_fun_stdout_fo {
-	void operator() ( const string& current, size_t n, size_t i) const
-		{
-			printf( "(%zu of %zu) %s\n", i, n, current.c_str());
-		}
+        void operator() ( const string& current, size_t n, size_t i) const
+                {
+                        printf( "(%zu of %zu) %s\n", i, n, current.c_str());
+                }
 };
 } // namespace
 
 agh::CExpDesign::TMsmtCollectProgressIndicatorFun
-	agh::CExpDesign::progress_fun_stdout = progress_fun_stdout_fo();
+        agh::CExpDesign::progress_fun_stdout = progress_fun_stdout_fo();
 
 
 // these old farts have been here from 2010 or earlier
@@ -44,79 +44,79 @@ agh::CExpDesign::TMsmtCollectProgressIndicatorFun
 int
 agh::SEpisodeSequence::
 add_one( sigfile::CTypedSource&& Fmc,
-	 const metrics::psd::SPPack& fft_params,
-	 const metrics::swu::SPPack& swu_params,
-	 const metrics::mc::SPPack& mc_params,
-	 float max_hours_apart)
+         const metrics::psd::SPPack& fft_params,
+         const metrics::swu::SPPack& swu_params,
+         const metrics::mc::SPPack& mc_params,
+         float max_hours_apart)
 {
-	auto Ei = find( episodes.begin(), episodes.end(),
-			Fmc().episode());
-
-	if ( Ei == episodes.end() ) {
-	      // ensure the newly added episode is well-placed
-		for ( auto &E : episodes )
-		      // does not overlap with existing ones
-			if ( agh::alg::overlap(
-				     E.start_time(), E.end_time(),
-				     Fmc().start_time(), Fmc().end_time()) )
-				return AGH_EPSEQADD_OVERLAP;
-
-		// or is not too far off
-		if ( episodes.size() > 0 &&
-		     episodes.begin()->sources.size() > 0 &&
-		     fabs( difftime( (*episodes.begin()->sources.begin())().start_time(), Fmc().start_time())) / 3600 > max_hours_apart )
-			return AGH_EPSEQADD_TOOFAR;
-
-		episodes.emplace_back( move(Fmc), fft_params, swu_params, mc_params);
-		episodes.sort();
-
-	} else { // same as SEpisode() but done on an existing one
-	      // check that the edf source being added has exactly the same timestamp and duration
-		printf( "SEpisodeSequence::add_one( \"%s\") try in-place\n",
-			Fmc().filename());
-		if ( fabs( difftime( Ei->start_time(), Fmc().start_time())) > 1 )
-			return AGH_EPSEQADD_TOOFAR;
-		Ei->sources.emplace_back( move(Fmc));
-		auto& F = Ei->sources.back();
-		auto HH = F().channel_list();
-		int h = 0;
-		for ( auto &H : HH )
-			Ei->recordings.insert( {H, {F, h++, fft_params, swu_params, mc_params}});
-		// no new episode added: don't sort
-	}
+        auto Ei = find( episodes.begin(), episodes.end(),
+                        Fmc().episode());
+
+        if ( Ei == episodes.end() ) {
+              // ensure the newly added episode is well-placed
+                for ( auto &E : episodes )
+                      // does not overlap with existing ones
+                        if ( agh::alg::overlap(
+                                     E.start_time(), E.end_time(),
+                                     Fmc().start_time(), Fmc().end_time()) )
+                                return AGH_EPSEQADD_OVERLAP;
+
+                // or is not too far off
+                if ( episodes.size() > 0 &&
+                     episodes.begin()->sources.size() > 0 &&
+                     fabs( difftime( (*episodes.begin()->sources.begin())().start_time(), Fmc().start_time())) / 3600 > max_hours_apart )
+                        return AGH_EPSEQADD_TOOFAR;
+
+                episodes.emplace_back( move(Fmc), fft_params, swu_params, mc_params);
+                episodes.sort();
+
+        } else { // same as SEpisode() but done on an existing one
+              // check that the edf source being added has exactly the same timestamp and duration
+                printf( "SEpisodeSequence::add_one( \"%s\") try in-place\n",
+                        Fmc().filename());
+                if ( fabs( difftime( Ei->start_time(), Fmc().start_time())) > 1 )
+                        return AGH_EPSEQADD_TOOFAR;
+                Ei->sources.emplace_back( move(Fmc));
+                auto& F = Ei->sources.back();
+                auto HH = F().channel_list();
+                int h = 0;
+                for ( auto &H : HH )
+                        Ei->recordings.insert( {H, {F, h++, fft_params, swu_params, mc_params}});
+                // no new episode added: don't sort
+        }
 
       // compute start_rel and end_rel
-	// do it for all episodes over again (necessary if the newly added episode becomes the new first)
-	SEpisode &e0 = episodes.front();
-	struct tm t0;
-	time_t start_time_tmp = e0.start_time();
-	memcpy( &t0, localtime( &start_time_tmp), sizeof(struct tm));
-	t0.tm_year = 101;
-	t0.tm_mon = 10;
-	t0.tm_mday = 1 + (t0.tm_hour < 12);
-	t0.tm_isdst = 0; // must clear this, else a wall clock hour of
-			 // 23:00 in summer will become 22:00 in
-			 // October, which makes no sense in circadian
-			 // context
-	e0.start_rel = mktime( &t0);
-	// printf( "E0 %s: ", e0.name());
-	// puts( asctime( localtime(&e0.start_time())));
-	// puts( asctime( localtime(&e0.start_rel)));
-	double shift = difftime( e0.start_rel, e0.start_time());
-	e0.end_rel   = e0.end_time() + shift;
-
-	for_each( next( episodes.begin()), episodes.end(),
-		  [&shift] ( SEpisode& E )
-		  {
-			  E.start_rel	= E.start_time() + shift;
-			  E.end_rel	= E.end_time()   + shift;
-			  // printf("E %s: ", E.name());
-			  // puts( asctime( localtime(&E.start_time())));
-			  // puts( asctime( localtime(&E.start_rel)));
-			  // printf( "--\n");
-		  });
-
-	return episodes.size();
+        // do it for all episodes over again (necessary if the newly added episode becomes the new first)
+        SEpisode &e0 = episodes.front();
+        struct tm t0;
+        time_t start_time_tmp = e0.start_time();
+        memcpy( &t0, localtime( &start_time_tmp), sizeof(struct tm));
+        t0.tm_year = 101;
+        t0.tm_mon = 10;
+        t0.tm_mday = 1 + (t0.tm_hour < 12);
+        t0.tm_isdst = 0; // must clear this, else a wall clock hour of
+                         // 23:00 in summer will become 22:00 in
+                         // October, which makes no sense in circadian
+                         // context
+        e0.start_rel = mktime( &t0);
+        // printf( "E0 %s: ", e0.name());
+        // puts( asctime( localtime(&e0.start_time())));
+        // puts( asctime( localtime(&e0.start_rel)));
+        double shift = difftime( e0.start_rel, e0.start_time());
+        e0.end_rel   = e0.end_time() + shift;
+
+        for_each( next( episodes.begin()), episodes.end(),
+                  [&shift] ( SEpisode& E )
+                  {
+                          E.start_rel        = E.start_time() + shift;
+                          E.end_rel        = E.end_time()   + shift;
+                          // printf("E %s: ", E.name());
+                          // puts( asctime( localtime(&E.start_time())));
+                          // puts( asctime( localtime(&E.start_rel)));
+                          // printf( "--\n");
+                  });
+
+        return episodes.size();
 }
 
 
@@ -128,121 +128,121 @@ add_one( sigfile::CTypedSource&& Fmc,
 int
 agh::CExpDesign::
 register_intree_source( sigfile::CTypedSource&& F,
-			const char **reason_if_failed_p)
+                        const char **reason_if_failed_p)
 {
-	try {
-	      // parse fname (as appearing in the right place in the
-	      // tree) as ./group/subject/session/episode.edf
-	      // in order to validate this source wrt its placement in the tree
-		string toparse (F().filename());
-		if ( strncmp( F().filename(), _session_dir.c_str(), _session_dir.size()) == 0 )
-			toparse.erase( 0, _session_dir.size());
-		list<string> broken_path = agh::fs::path_elements( toparse);
-		assert ( broken_path.size() == 5 );
-		list<string>::iterator pe = broken_path.begin();
-		string& g_name = (pe = next(pe), *pe),
-			j_name = (pe = next(pe), *pe),
-			d_name = (pe = next(pe), *pe);
-		string	e_name =
-			fs::make_fname_base(
-				*next(pe),
-				sigfile::supported_sigfile_extensions,
-				agh::fs::TMakeFnameOption::normal);
-		// take care of the case of episode-2.edf
-		{
-			auto subf = agh::str::tokens_trimmed(e_name, "-");
-			if ( subf.size() == 2 ) {
-				try {
-					stoi(subf.back());
-					e_name = subf.front();
-				} catch (...) {
-					;
-				}
-			}
-		}
-
-		// refuse to register sources of wrong subjects
-		if ( j_name != F().subject().id ) {
-			log_message( "$$%s:", F().filename());
-			log_message( "file belongs to subject %s (\"%s\"), is misplaced here under subject \"%s\"",
-				     F().subject().id.c_str(), F().subject().name.c_str(), j_name.c_str());
-			return -1;
-		}
-		try {
-			auto existing_group = group_of( F().subject().id.c_str());
-			if ( g_name != existing_group ) {
-				log_message( "$$%s:", F().filename());
-				log_message( "subject %s (\"%s\") belongs to a different group (\"%s\")",
-					     F().subject().id.c_str(), F().subject().name.c_str(), existing_group);
-				return -1;
-			}
-		} catch (invalid_argument) {
-			;
-		}
-
-		// but correct session/episode fields
-		if ( d_name != F().session() ) {
-			log_message( "$$%s:", F().filename());
-			log_message( "correcting embedded session \"%s\" to match placement in the tree (\"%s\")",
-				     F().session(), d_name.c_str());
-			F().set_session( d_name.c_str());
-		}
-		if ( e_name != F().episode() ) {
-			log_message( "correcting embedded episode \"%s\" to match file name",
-				     F().episode());
-			F().set_episode( e_name.c_str());
-		}
-
-		CSubject *J;
-		CJGroup& G = groups[g_name];
-		CJGroup::iterator Ji;
-		if ( (Ji = find( G.begin(), G.end(), j_name)) == G.end() ) {
-			G.emplace_back( _session_dir + '/' + g_name + '/' + j_name, _id_pool++);
-			J = &G.back();
-		} else
-			J = &*Ji;
-
-	      // check/update CSubject::SSubjectId fields against those in the file being added
-		// printf( "Update subject details: [%s, %s, %c, %s] <- [%s, %s, %c, %s]\n",
-		// 	J->id.c_str(), J->name.c_str(), J->gender_sign(), ctime(&J->dob),
-		// 	F().subject().id.c_str(), F().subject().name.c_str(), F().subject().gender_sign(), ctime(&F().subject().dob));
-		if ( J->try_update_subject_details( F().subject()) ) {
-			if ( strict_subject_id_checks ) {
-				fprintf( stderr, "%s: subject details mismatch", F().filename());
-				return -1;
-			} else
-				fprintf( stderr, "%s: keeping previously recorded subject details", F().filename());
-		}
-
-	      // insert/update episode observing start/end times
-		printf( "\nCExpDesign::register_intree_source( file: \"%s\", J: %s (\"%s\"), E: \"%s\", D: \"%s\")\n",
-			F().filename(), F().subject().id.c_str(), F().subject().name.c_str(), F().episode(), F().session());
-		switch ( J->measurements[F().session()].add_one(
-				 move(F), fft_params, swu_params, mc_params) ) {  // this will do it
-		case AGH_EPSEQADD_OVERLAP:
-			log_message( "%s: not added as it overlaps with existing episodes",
-				     F().filename());
-			return -1;
-		case AGH_EPSEQADD_TOOFAR:
-			log_message( "%s: not added as it is too far removed from the rest",
-				     F().filename());
-			return -1;
-		default:
-			return 0;
-		}
-
-	} catch (invalid_argument ex) {
-		log_message( "%s", ex.what());
-		if ( reason_if_failed_p )
-			*reason_if_failed_p = ex.what();
-		return -1;
-	} catch (int status) {
-		log_message( "Bad edf header or data");
-		if ( reason_if_failed_p )
-			*reason_if_failed_p = "Bad edf header or data";
-		return -1;
-	}
-	return 0;
+        try {
+              // parse fname (as appearing in the right place in the
+              // tree) as ./group/subject/session/episode.edf
+              // in order to validate this source wrt its placement in the tree
+                string toparse (F().filename());
+                if ( strncmp( F().filename(), _session_dir.c_str(), _session_dir.size()) == 0 )
+                        toparse.erase( 0, _session_dir.size());
+                list<string> broken_path = agh::fs::path_elements( toparse);
+                assert ( broken_path.size() == 5 );
+                list<string>::iterator pe = broken_path.begin();
+                string& g_name = (pe = next(pe), *pe),
+                        j_name = (pe = next(pe), *pe),
+                        d_name = (pe = next(pe), *pe);
+                string        e_name =
+                        fs::make_fname_base(
+                                *next(pe),
+                                sigfile::supported_sigfile_extensions,
+                                agh::fs::TMakeFnameOption::normal);
+                // take care of the case of episode-2.edf
+                {
+                        auto subf = agh::str::tokens_trimmed(e_name, "-");
+                        if ( subf.size() == 2 ) {
+                                try {
+                                        stoi(subf.back());
+                                        e_name = subf.front();
+                                } catch (...) {
+                                        ;
+                                }
+                        }
+                }
+
+                // refuse to register sources of wrong subjects
+                if ( j_name != F().subject().id ) {
+                        log_message( "$$%s:", F().filename());
+                        log_message( "file belongs to subject %s (\"%s\"), is misplaced here under subject \"%s\"",
+                                     F().subject().id.c_str(), F().subject().name.c_str(), j_name.c_str());
+                        return -1;
+                }
+                try {
+                        auto existing_group = group_of( F().subject().id.c_str());
+                        if ( g_name != existing_group ) {
+                                log_message( "$$%s:", F().filename());
+                                log_message( "subject %s (\"%s\") belongs to a different group (\"%s\")",
+                                             F().subject().id.c_str(), F().subject().name.c_str(), existing_group);
+                                return -1;
+                        }
+                } catch (invalid_argument) {
+                        ;
+                }
+
+                // but correct session/episode fields
+                if ( d_name != F().session() ) {
+                        log_message( "$$%s:", F().filename());
+                        log_message( "correcting embedded session \"%s\" to match placement in the tree (\"%s\")",
+                                     F().session(), d_name.c_str());
+                        F().set_session( d_name.c_str());
+                }
+                if ( e_name != F().episode() ) {
+                        log_message( "correcting embedded episode \"%s\" to match file name",
+                                     F().episode());
+                        F().set_episode( e_name.c_str());
+                }
+
+                CSubject *J;
+                CJGroup& G = groups[g_name];
+                CJGroup::iterator Ji;
+                if ( (Ji = find( G.begin(), G.end(), j_name)) == G.end() ) {
+                        G.emplace_back( _session_dir + '/' + g_name + '/' + j_name, _id_pool++);
+                        J = &G.back();
+                } else
+                        J = &*Ji;
+
+              // check/update CSubject::SSubjectId fields against those in the file being added
+                // printf( "Update subject details: [%s, %s, %c, %s] <- [%s, %s, %c, %s]\n",
+                //         J->id.c_str(), J->name.c_str(), J->gender_sign(), ctime(&J->dob),
+                //         F().subject().id.c_str(), F().subject().name.c_str(), F().subject().gender_sign(), ctime(&F().subject().dob));
+                if ( J->try_update_subject_details( F().subject()) ) {
+                        if ( strict_subject_id_checks ) {
+                                fprintf( stderr, "%s: subject details mismatch", F().filename());
+                                return -1;
+                        } else
+                                fprintf( stderr, "%s: keeping previously recorded subject details", F().filename());
+                }
+
+              // insert/update episode observing start/end times
+                printf( "\nCExpDesign::register_intree_source( file: \"%s\", J: %s (\"%s\"), E: \"%s\", D: \"%s\")\n",
+                        F().filename(), F().subject().id.c_str(), F().subject().name.c_str(), F().episode(), F().session());
+                switch ( J->measurements[F().session()].add_one(
+                                 move(F), fft_params, swu_params, mc_params) ) {  // this will do it
+                case AGH_EPSEQADD_OVERLAP:
+                        log_message( "%s: not added as it overlaps with existing episodes",
+                                     F().filename());
+                        return -1;
+                case AGH_EPSEQADD_TOOFAR:
+                        log_message( "%s: not added as it is too far removed from the rest",
+                                     F().filename());
+                        return -1;
+                default:
+                        return 0;
+                }
+
+        } catch (invalid_argument ex) {
+                log_message( "%s", ex.what());
+                if ( reason_if_failed_p )
+                        *reason_if_failed_p = ex.what();
+                return -1;
+        } catch (int status) {
+                log_message( "Bad edf header or data");
+                if ( reason_if_failed_p )
+                        *reason_if_failed_p = "Bad edf header or data";
+                return -1;
+        }
+        return 0;
 }
 
 
@@ -253,62 +253,62 @@ bool
 agh::CExpDesign::
 is_supported_source( sigfile::CTypedSource& F)
 {
-	using namespace sigfile;
-	union {
-		CEDFFile::TSubtype e;
-		CTSVFile::TSubtype t;
-	} u;
-	return (F.type() == CTypedSource::TType::edf and
-		(u.e = F.obj<CEDFFile>().subtype(),
-		 (u.e == CEDFFile::TSubtype::edf ||
-		  u.e == CEDFFile::TSubtype::edfplus_c)))
-		or
-		(F.type() == CTypedSource::TType::ascii and
-		 (u.t = F.obj<CTSVFile>().subtype(),
-		  (u.t == CTSVFile::TSubtype::csv ||
-		   u.t == CTSVFile::TSubtype::tsv)));
+        using namespace sigfile;
+        union {
+                CEDFFile::TSubtype e;
+                CTSVFile::TSubtype t;
+        } u;
+        return (F.type() == CTypedSource::TType::edf and
+                (u.e = F.obj<CEDFFile>().subtype(),
+                 (u.e == CEDFFile::TSubtype::edf ||
+                  u.e == CEDFFile::TSubtype::edfplus_c)))
+                or
+                (F.type() == CTypedSource::TType::ascii and
+                 (u.t = F.obj<CTSVFile>().subtype(),
+                  (u.t == CTSVFile::TSubtype::csv ||
+                   u.t == CTSVFile::TSubtype::tsv)));
 }
 
 namespace {
 
 size_t
-	current_sigfile_source;
+        current_sigfile_source;
 agh::CExpDesign
-	*only_expdesign;
+        *only_expdesign;
 
 agh::CExpDesign::TMsmtCollectProgressIndicatorFun
-	only_progress_fun;
+        only_progress_fun;
 
 int
 supported_sigfile_processor( const char *fname, const struct stat*, int flag, struct FTW *ftw)
 {
-	if ( flag == FTW_F && ftw->level == 4 ) {
-		int fnlen = strlen(fname); // - ftw->base;
-		if ( fnlen < 5 )
-			return 0;
-		if ( sigfile::is_fname_ext_supported( fname) ) {
-			++current_sigfile_source;
-			only_progress_fun( fname, agh::fs::total_supported_sigfiles, current_sigfile_source);
-			try {
-				using namespace sigfile;
-				CTypedSource F {fname, (size_t)roundf(only_expdesign->fft_params.pagesize)};
-				string st = F().explain_status();
-				if ( not st.empty() ) {
-					only_expdesign->log_message( "$$%s:", fname);
-					only_expdesign->log_message( "%s", st.c_str());
-				}
-				// we only support edf and edfplus/edf_c
-				if ( agh::CExpDesign::is_supported_source(F) )
-					only_expdesign -> register_intree_source( move(F));
-				else
-					only_expdesign -> log_message( "File %s: unsupported format", fname);
-
-			} catch ( invalid_argument ex) {
-				only_expdesign->log_message( "%s", ex.what());
-			}
-		}
-	}
-	return 0;
+        if ( flag == FTW_F && ftw->level == 4 ) {
+                int fnlen = strlen(fname); // - ftw->base;
+                if ( fnlen < 5 )
+                        return 0;
+                if ( sigfile::is_fname_ext_supported( fname) ) {
+                        ++current_sigfile_source;
+                        only_progress_fun( fname, agh::fs::total_supported_sigfiles, current_sigfile_source);
+                        try {
+                                using namespace sigfile;
+                                CTypedSource F {fname, (size_t)roundf(only_expdesign->fft_params.pagesize)};
+                                string st = F().explain_status();
+                                if ( not st.empty() ) {
+                                        only_expdesign->log_message( "$$%s:", fname);
+                                        only_expdesign->log_message( "%s", st.c_str());
+                                }
+                                // we only support edf and edfplus/edf_c
+                                if ( agh::CExpDesign::is_supported_source(F) )
+                                        only_expdesign -> register_intree_source( move(F));
+                                else
+                                        only_expdesign -> log_message( "File %s: unsupported format", fname);
+
+                        } catch ( invalid_argument ex) {
+                                only_expdesign->log_message( "%s", ex.what());
+                        }
+                }
+        }
+        return 0;
 }
 
 
@@ -318,19 +318,19 @@ typedef pair<time_t, size_t> TTimePair;
 pair<float, float> // as fractions of day
 avg_tm( vector<TTimePair>& tms)
 {
-	float avg_start = 0., avg_end = 0.;
-	for ( auto &T : tms ) {
-		struct tm
-			t0 = *localtime( &T.first);
-		if ( t0.tm_hour > 12 )
-			t0.tm_hour -= 24;  // go negative if we must
-		t0.tm_hour += 24;   // pull back into positive
-		float this_j_start = (t0.tm_hour/24. + t0.tm_min/24./60. + t0.tm_sec/24./60./60.);
-		avg_start += this_j_start;
-		avg_end   += (this_j_start + T.second/3600./24.);
-	}
-
-	return pair<float, float> (avg_start / tms.size(), avg_end / tms.size());
+        float avg_start = 0., avg_end = 0.;
+        for ( auto &T : tms ) {
+                struct tm
+                        t0 = *localtime( &T.first);
+                if ( t0.tm_hour > 12 )
+                        t0.tm_hour -= 24;  // go negative if we must
+                t0.tm_hour += 24;   // pull back into positive
+                float this_j_start = (t0.tm_hour/24. + t0.tm_min/24./60. + t0.tm_sec/24./60./60.);
+                avg_start += this_j_start;
+                avg_end   += (this_j_start + T.second/3600./24.);
+        }
+
+        return pair<float, float> (avg_start / tms.size(), avg_end / tms.size());
 }
 
 } // namespace
@@ -339,57 +339,57 @@ void
 agh::CExpDesign::
 scan_tree( TMsmtCollectProgressIndicatorFun user_progress_fun)
 {
-	groups.clear();
+        groups.clear();
 
       // glob it!
-	agh::fs::total_supported_sigfiles = 0;
-	nftw( "./", agh::fs::supported_sigfile_counter, 20, 0);
-	printf( "CExpDesign::scan_tree(\"%s\"): %zu edf file(s) found\n",
-		session_dir(), agh::fs::total_supported_sigfiles);
-	if ( agh::fs::total_supported_sigfiles == 0 )
-		return;
-
-	current_sigfile_source = 0;
-	only_progress_fun = user_progress_fun;
-	only_expdesign = this;
-	nftw( "./", supported_sigfile_processor, 10, 0);
-	printf( "CExpDesign::scan_tree(): recordings collected\n");
-
-	compute_profiles(); // in an SMP fashion
-	printf( "CExpDesign::scan_tree(): all computed\n");
+        agh::fs::total_supported_sigfiles = 0;
+        nftw( "./", agh::fs::supported_sigfile_counter, 20, 0);
+        printf( "CExpDesign::scan_tree(\"%s\"): %zu edf file(s) found\n",
+                session_dir(), agh::fs::total_supported_sigfiles);
+        if ( agh::fs::total_supported_sigfiles == 0 )
+                return;
+
+        current_sigfile_source = 0;
+        only_progress_fun = user_progress_fun;
+        only_expdesign = this;
+        nftw( "./", supported_sigfile_processor, 10, 0);
+        printf( "CExpDesign::scan_tree(): recordings collected\n");
+
+        compute_profiles(); // in an SMP fashion
+        printf( "CExpDesign::scan_tree(): all computed\n");
 
       // find any subjects with incomplete episode sets
-	list<string> complete_episode_set = enumerate_episodes();
-	size_t	n_episodes = complete_episode_set.size();
-
-	for ( auto &G : groups )
-		for ( auto &J : G.second )
-		startover:
-			for ( auto &D : J.measurements )
-				if ( D.second.episodes.size() < n_episodes &&
-				     complete_episode_set.front() != D.second.episodes.begin()->name() ) { // the baseline is missing
-					log_message( "No Baseline episode in %s's %s: skip this session",
-						     J.id.c_str(), D.first.c_str());
-					J.measurements.erase(D.first);
-					goto startover;
-				}
-
-	list<string> complete_session_set = enumerate_sessions();
+        list<string> complete_episode_set = enumerate_episodes();
+        size_t        n_episodes = complete_episode_set.size();
+
+        for ( auto &G : groups )
+                for ( auto &J : G.second )
+                startover:
+                        for ( auto &D : J.measurements )
+                                if ( D.second.episodes.size() < n_episodes &&
+                                     complete_episode_set.front() != D.second.episodes.begin()->name() ) { // the baseline is missing
+                                        log_message( "No Baseline episode in %s's %s: skip this session",
+                                                     J.id.c_str(), D.first.c_str());
+                                        J.measurements.erase(D.first);
+                                        goto startover;
+                                }
+
+        list<string> complete_session_set = enumerate_sessions();
 
       // calculate average episode times
-	for ( auto &G : groups ) {
-		map <string, map<string, vector <TTimePair>>> tms;
-		for ( auto &J : G.second )
-			for ( auto &D : J.measurements )
-				for ( auto &E : D.second.episodes )
-					tms[D.first][E.name()].emplace_back(
-						E.sources.front()().start_time(),
-						E.sources.front()().recording_time());
-		for ( auto &D : complete_session_set )
-			for ( auto &E : complete_episode_set )
-				G.second.avg_episode_times[D][E] =
-					avg_tm( tms[D][E]);
-	}
+        for ( auto &G : groups ) {
+                map <string, map<string, vector <TTimePair>>> tms;
+                for ( auto &J : G.second )
+                        for ( auto &D : J.measurements )
+                                for ( auto &E : D.second.episodes )
+                                        tms[D.first][E.name()].emplace_back(
+                                                E.sources.front()().start_time(),
+                                                E.sources.front()().recording_time());
+                for ( auto &D : complete_session_set )
+                        for ( auto &E : complete_episode_set )
+                                G.second.avg_episode_times[D][E] =
+                                        avg_tm( tms[D][E]);
+        }
 }
 
 
@@ -397,32 +397,32 @@ void
 agh::CExpDesign::
 compute_profiles()
 {
-	TRecordingOpFun F =
-		[&]( CRecording& R)
-		{
-			R.psd_profile.compute();
-			R.swu_profile.compute();
-			R.mc_profile.compute();
-		};
-	TRecordingReportFun G =
-		[&]( const CJGroup&, const CSubject&, const string&, const SEpisode&, const CRecording& R,
-		     size_t i, size_t total)
-		{
-			only_progress_fun(
-				string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h()).name(),
-				total, i);
-		};
-	TRecordingFilterFun filter =
-		[&]( CRecording& R)
-		{
-			return R.signal_type() == sigfile::SChannel::TType::eeg;
-		};
-	for_all_recordings( F, G, filter);
+        TRecordingOpFun F =
+                [&]( CRecording& R)
+                {
+                        R.psd_profile.compute();
+                        R.swu_profile.compute();
+                        R.mc_profile.compute();
+                };
+        TRecordingReportFun G =
+                [&]( const CJGroup&, const CSubject&, const string&, const SEpisode&, const CRecording& R,
+                     size_t i, size_t total)
+                {
+                        only_progress_fun(
+                                string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h()).name(),
+                                total, i);
+                };
+        TRecordingFilterFun filter =
+                [&]( CRecording& R)
+                {
+                        return R.signal_type() == sigfile::SChannel::TType::eeg;
+                };
+        for_all_recordings( F, G, filter);
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/globals.cc b/upstream/src/aghermann/globals.cc
index fed13a9..3da9cfe 100644
--- a/upstream/src/aghermann/globals.cc
+++ b/upstream/src/aghermann/globals.cc
@@ -36,23 +36,23 @@ agh::global::
 init()
 {
       // 1. init rng
-	{
-		const gsl_rng_type *T;
-		gsl_rng_env_setup();
-		T = gsl_rng_default;
-		if ( gsl_rng_default_seed == 0 ) {
-			struct timeval tp = { 0L, 0L };
-			gettimeofday( &tp, NULL);
-			gsl_rng_default_seed = tp.tv_usec;
-		}
-		rng = gsl_rng_alloc( T);
-	}
+        {
+                const gsl_rng_type *T;
+                gsl_rng_env_setup();
+                T = gsl_rng_default;
+                if ( gsl_rng_default_seed == 0 ) {
+                        struct timeval tp = { 0L, 0L };
+                        gettimeofday( &tp, NULL);
+                        gsl_rng_default_seed = tp.tv_usec;
+                }
+                rng = gsl_rng_alloc( T);
+        }
 
 #ifdef _OPENMP
       // 2. omp
-	{
-		agh::global::num_procs = omp_get_max_threads();
-	}
+        {
+                agh::global::num_procs = omp_get_max_threads();
+        }
 #endif
 }
 
@@ -61,13 +61,13 @@ void
 agh::global::
 fini()
 {
-	gsl_rng_free( rng);
-	rng = nullptr;
+        gsl_rng_free( rng);
+        rng = nullptr;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/globals.hh b/upstream/src/aghermann/globals.hh
index a367e07..da937bd 100644
--- a/upstream/src/aghermann/globals.hh
+++ b/upstream/src/aghermann/globals.hh
@@ -37,7 +37,7 @@ void fini();
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ica/ica.hh b/upstream/src/aghermann/ica/ica.hh
index ae22a35..6d4eb35 100644
--- a/upstream/src/aghermann/ica/ica.hh
+++ b/upstream/src/aghermann/ica/ica.hh
@@ -37,51 +37,51 @@ template <class T>
 inline vector<valarray<T>>
 to_vecva( const itpp::Mat<T>& rv)
 {
-	vector<valarray<T>> ret;
-	for ( int r = 0; r < rv.rows(); ++r ) {
-		itpp::Vec<T> v = rv.get_row(r);
-		ret.emplace_back( rv.cols());
-		memcpy( &ret.back()[0], &v(0), sizeof(T) * rv.cols());
-	}
-	return move(ret);
+        vector<valarray<T>> ret;
+        for ( int r = 0; r < rv.rows(); ++r ) {
+                itpp::Vec<T> v = rv.get_row(r);
+                ret.emplace_back( rv.cols());
+                memcpy( &ret.back()[0], &v(0), sizeof(T) * rv.cols());
+        }
+        return move(ret);
 }
 
 template <class Tl, class Tr>
 inline valarray<Tl>
 to_va( const itpp::Mat<Tr>& rv, int row)
 {
-	valarray<Tl> ret;
-	itpp::Vec<Tr> v = rv.get_row(row);
-	ret.resize( v.size());
-	if ( sizeof(Tl) == sizeof(Tr) )
-		memcpy( &ret[0], &v(0), sizeof(Tr) * rv.cols());
-	else
-		for ( int c = 0; c < rv.cols(); ++c )
-			ret[c] = rv(row, c);
-	return move(ret);
+        valarray<Tl> ret;
+        itpp::Vec<Tr> v = rv.get_row(row);
+        ret.resize( v.size());
+        if ( sizeof(Tl) == sizeof(Tr) )
+                memcpy( &ret[0], &v(0), sizeof(Tr) * rv.cols());
+        else
+                for ( int c = 0; c < rv.cols(); ++c )
+                        ret[c] = rv(row, c);
+        return move(ret);
 }
 
 template <class Titpp, class T>
 inline void
 make_mat_from_vecva( itpp::Mat<Titpp>& lv, const vector<valarray<T>>& rv)
 {
-	if ( rv.empty() )
-		lv.set_size( 0, 0, false);
-	else {
-		lv.set_size( rv.size(), rv.front().size());
-		for ( size_t r = 0; r < rv.size(); ++r ) {
-			auto& row = rv[r];
-			itpp::Vec<Titpp> tmp;
-			if ( sizeof(Titpp) == sizeof(T) )
-				tmp = itpp::Vec<Titpp> (&row[0], row.size());
-			else {
-				tmp.set_size( row.size());
-				for ( size_t c = 0; c < row.size(); ++c )
-					tmp[c] = row[c];
-			}
-			lv.set_row( r, tmp);
-		}
-	}
+        if ( rv.empty() )
+                lv.set_size( 0, 0, false);
+        else {
+                lv.set_size( rv.size(), rv.front().size());
+                for ( size_t r = 0; r < rv.size(); ++r ) {
+                        auto& row = rv[r];
+                        itpp::Vec<Titpp> tmp;
+                        if ( sizeof(Titpp) == sizeof(T) )
+                                tmp = itpp::Vec<Titpp> (&row[0], row.size());
+                        else {
+                                tmp.set_size( row.size());
+                                for ( size_t c = 0; c < row.size(); ++c )
+                                        tmp[c] = row[c];
+                        }
+                        lv.set_row( r, tmp);
+                }
+        }
 }
 
 } // namespace itpp
@@ -93,41 +93,41 @@ namespace ica {
 class CFastICA {
     public:
       // ctor
-	template <class T>
-	CFastICA (const vector<valarray<T> >& source)
-		{
-			itpp::Mat<double>
-				_source_mat;
-			itpp::make_mat_from_vecva<double, T>( _source_mat, source);
-			_obj = new itpp::Fast_ICA (_source_mat);
-		}
-	CFastICA (const vector<function<valarray<TFloat>()>>& source, size_t cols)
-	// avoid creating a third temporary, specially for use with agh::CEDFFile::get_signal
-		{
-			itpp::Mat<double>
-				_source_mat (source.size(), cols);
-			for ( int r = 0; r < (int)source.size(); ++r ) {
-				auto tmp = source[r]();
-				tmp -= tmp.sum() / tmp.size();
-				for ( int c = 0; c < (int)cols; ++c )
-					_source_mat( r, c) = tmp[c];
-			}
-			_obj = new itpp::Fast_ICA (_source_mat);
-		}
+        template <class T>
+        CFastICA (const vector<valarray<T> >& source)
+                {
+                        itpp::Mat<double>
+                                _source_mat;
+                        itpp::make_mat_from_vecva<double, T>( _source_mat, source);
+                        _obj = new itpp::Fast_ICA (_source_mat);
+                }
+        CFastICA (const vector<function<valarray<TFloat>()>>& source, size_t cols)
+        // avoid creating a third temporary, specially for use with agh::CEDFFile::get_signal
+                {
+                        itpp::Mat<double>
+                                _source_mat (source.size(), cols);
+                        for ( int r = 0; r < (int)source.size(); ++r ) {
+                                auto tmp = source[r]();
+                                tmp -= tmp.sum() / tmp.size();
+                                for ( int c = 0; c < (int)cols; ++c )
+                                        _source_mat( r, c) = tmp[c];
+                        }
+                        _obj = new itpp::Fast_ICA (_source_mat);
+                }
        ~CFastICA ()
-		{
-			delete _obj;
-		}
+                {
+                        delete _obj;
+                }
 
       // do all ops via this proxy
-	itpp::Fast_ICA&
-	obj()
-		{
-			return *_obj;
-		};
+        itpp::Fast_ICA&
+        obj()
+                {
+                        return *_obj;
+                };
     private:
-	itpp::Fast_ICA*
-		_obj;
+        itpp::Fast_ICA*
+                _obj;
 };
 
 
@@ -137,7 +137,7 @@ class CFastICA {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/main.cc b/upstream/src/aghermann/main.cc
index 19a5095..b533709 100644
--- a/upstream/src/aghermann/main.cc
+++ b/upstream/src/aghermann/main.cc
@@ -29,7 +29,7 @@ using namespace agh;
 void print_version();
 
 namespace {
-UniqueResponse message_received_cb( UniqueApp*, UniqueCommand,	UniqueMessageData*, const guint, gpointer);
+UniqueResponse message_received_cb( UniqueApp*, UniqueCommand,        UniqueMessageData*, const guint, gpointer);
 void print_usage( const char*);
 }
 
@@ -37,115 +37,115 @@ void print_usage( const char*);
 int
 main( int argc, char **argv)
 {
-	print_version();
-
-	bool headless = false;
-	int	c;
-	while ( (c = getopt( argc, argv, "hn")) != -1 )
-		switch ( c ) {
-		case 'n': // headless
-			headless = true;
-			break;
-		case 'h':
-			print_usage( argv[0]);
-			return 0;
-		}
-
-	if ( headless ) {
-		char*& explicit_session = argv[optind];
-		if ( (!explicit_session || strlen(explicit_session) == 0) ) {
-			fprintf( stderr, "Headless mode requires explicit session dir\n");
-			print_usage( argv[0]);
-			return -1;
-		}
-
-		global::init();
-		CExpDesign ED (explicit_session); // essentially a very thoughtful no-op
-		global::fini();
-
-	} else {
-		gtk_init( &argc, &argv);
-
-		// don't let user get us started twice
-		ui::global::unique_app =
-			unique_app_new_with_commands(
-				"com.johnhommer.Aghermann",
-				NULL, "fafa", 1, NULL);
-		if ( unique_app_is_running( ui::global::unique_app) ) {
-			printf( "There is unique app, switching to it now\n");
-			unique_app_send_message( ui::global::unique_app, UNIQUE_ACTIVATE, NULL);
-		} else {
-			g_signal_connect(
-				ui::global::unique_app, "message-received",
-				(GCallback)message_received_cb,
-				NULL);
-
-			agh::global::init();
-
-			if ( ui::prepare_for_expdesign() ) {
-				ui::pop_ok_message(
-					NULL,
-					"UI failed to initialize",
-					"Your install is broken.");
-				return 2;
-			}
-
-			ui::SSessionChooser chooser (argv[optind]);
-			// implicit read sessionrc, run
-
-			gtk_main();
-
-			agh::global::fini();
-		}
-		// g_object_unref (app); // abandon ship anyway
-	}
-
-	return 0;
+        print_version();
+
+        bool headless = false;
+        int        c;
+        while ( (c = getopt( argc, argv, "hn")) != -1 )
+                switch ( c ) {
+                case 'n': // headless
+                        headless = true;
+                        break;
+                case 'h':
+                        print_usage( argv[0]);
+                        return 0;
+                }
+
+        if ( headless ) {
+                char*& explicit_session = argv[optind];
+                if ( (!explicit_session || strlen(explicit_session) == 0) ) {
+                        fprintf( stderr, "Headless mode requires explicit session dir\n");
+                        print_usage( argv[0]);
+                        return -1;
+                }
+
+                global::init();
+                CExpDesign ED (explicit_session); // essentially a very thoughtful no-op
+                global::fini();
+
+        } else {
+                gtk_init( &argc, &argv);
+
+                // don't let user get us started twice
+                ui::global::unique_app =
+                        unique_app_new_with_commands(
+                                "com.johnhommer.Aghermann",
+                                NULL, "fafa", 1, NULL);
+                if ( unique_app_is_running( ui::global::unique_app) ) {
+                        printf( "There is unique app, switching to it now\n");
+                        unique_app_send_message( ui::global::unique_app, UNIQUE_ACTIVATE, NULL);
+                } else {
+                        g_signal_connect(
+                                ui::global::unique_app, "message-received",
+                                (GCallback)message_received_cb,
+                                NULL);
+
+                        agh::global::init();
+
+                        if ( ui::prepare_for_expdesign() ) {
+                                ui::pop_ok_message(
+                                        NULL,
+                                        "UI failed to initialize",
+                                        "Your install is broken.");
+                                return 2;
+                        }
+
+                        ui::SSessionChooser chooser (argv[optind]);
+                        // implicit read sessionrc, run
+
+                        gtk_main();
+
+                        agh::global::fini();
+                }
+                // g_object_unref (app); // abandon ship anyway
+        }
+
+        return 0;
 }
 
 namespace {
 UniqueResponse
 message_received_cb(
-	UniqueApp*,
-	const UniqueCommand      command,
-	UniqueMessageData       *message,
-	const guint              time_,
-	gpointer)
+        UniqueApp*,
+        const UniqueCommand      command,
+        UniqueMessageData       *message,
+        const guint              time_,
+        gpointer)
 {
-	if ( ui::global::main_window == NULL )
-		return UNIQUE_RESPONSE_OK;
-
-	UniqueResponse res;
-
-	switch ( command ) {
-	case UNIQUE_ACTIVATE:
-		// move the main window to the screen that sent us the command
-		gtk_window_set_screen(
-			ui::global::main_window,
-			unique_message_data_get_screen( message));
-		gtk_window_present_with_time(
-			ui::global::main_window,
-			time_);
-		res = UNIQUE_RESPONSE_OK;
-	    break;
-	default:
-		res = UNIQUE_RESPONSE_OK;
-	    break;
-	}
-
-	return res;
+        if ( ui::global::main_window == NULL )
+                return UNIQUE_RESPONSE_OK;
+
+        UniqueResponse res;
+
+        switch ( command ) {
+        case UNIQUE_ACTIVATE:
+                // move the main window to the screen that sent us the command
+                gtk_window_set_screen(
+                        ui::global::main_window,
+                        unique_message_data_get_screen( message));
+                gtk_window_present_with_time(
+                        ui::global::main_window,
+                        time_);
+                res = UNIQUE_RESPONSE_OK;
+            break;
+        default:
+                res = UNIQUE_RESPONSE_OK;
+            break;
+        }
+
+        return res;
 }
 
 void
 print_usage( const char* argv0)
 {
-	printf( "Usage: %s [-n] [exp_root_dir]\n", argv0);
+        printf( "Usage: %s [-n] [exp_root_dir]\n", argv0);
 }
 } // namespace
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/achermann-siman.cc b/upstream/src/aghermann/model/achermann-siman.cc
index 258ad1a..aed73c8 100644
--- a/upstream/src/aghermann/model/achermann-siman.cc
+++ b/upstream/src/aghermann/model/achermann-siman.cc
@@ -24,9 +24,9 @@ using namespace std;
 namespace {
 
 struct SAchermannSimanPPack {
-	agh::ach::CModelRun *R;
-	// STunableSet is probably not a POD after all
-	double t[agh::ach::TTunable::_all_tunables];
+        agh::ach::CModelRun *R;
+        // STunableSet is probably not a POD after all
+        double t[agh::ach::TTunable::_all_tunables];
 };
 
 
@@ -35,60 +35,60 @@ struct SAchermannSimanPPack {
 void
 _siman_step( const gsl_rng *r, void *xp, double step_size)
 {
-	using namespace agh::ach;
+        using namespace agh::ach;
 
-	auto& P = *(SAchermannSimanPPack*)xp;
-	STunableSet<TTRole::v>
-		X0 (P.R->tx.n_egc),
-		X  (P.R->tx.n_egc);
-	memcpy( X0.P, P.t, sizeof(double) * X.size());
-	memcpy( X .P, P.t, sizeof(double) * X.size());
+        auto& P = *(SAchermannSimanPPack*)xp;
+        STunableSet<TTRole::v>
+                X0 (P.R->tx.n_egc),
+                X  (P.R->tx.n_egc);
+        memcpy( X0.P, P.t, sizeof(double) * X.size());
+        memcpy( X .P, P.t, sizeof(double) * X.size());
 
       // randomly pick a tunable
 retry:
-	size_t t = gsl_rng_uniform_int( r, X.size());
-	if ( P.R->ctl_params.DBAmendment2 && t == TTunable::SU )
-		goto retry;
-
-	bool go_positive = (bool)gsl_rng_uniform_int( r, 2);
-
-	double	nudge = P.R->tstep[t],
-		d;
-	size_t nudges = 0;
-	do {
-	      // nudge it a little,
-	      // prevent from going out-of-bounds
-		if ( go_positive )
-			if ( likely (X[t] + nudge < P.R->thi[t]) )
-				X[t] += nudge;
-			else
-				goto retry;
-		else
-			if ( likely (X[t] - nudge > P.R->tlo[t]) )
-				X[t] -= nudge;
-			else
-				goto retry;
-
-	      // special checks
-		if ( (t == TTunable::S0 && X[TTunable::S0] + nudge >= X[TTunable::SU]) ||
-		     (t == TTunable::SU && X[TTunable::S0] >= X[TTunable::SU] - nudge) )
-			goto retry;
-
-		d = distance( X, X0, P.R->tstep.P);
-
-		if ( d > step_size && nudges == 0 ) {  // nudged too far from the outset
-			nudge /= 2;
-			X[t] = X0[t];
-			continue;
-		}
-
-		++nudges;
-
-	} while ( d < step_size );
-
-	// are there ever multiple copies of t in existence?
-	// can we just always use R->tx?
-	memcpy( P.t, X.P, sizeof(double) * X.size());
+        size_t t = gsl_rng_uniform_int( r, X.size());
+        if ( P.R->ctl_params.DBAmendment2 && t == TTunable::SU )
+                goto retry;
+
+        bool go_positive = (bool)gsl_rng_uniform_int( r, 2);
+
+        double        nudge = P.R->tstep[t],
+                d;
+        size_t nudges = 0;
+        do {
+              // nudge it a little,
+              // prevent from going out-of-bounds
+                if ( go_positive )
+                        if ( likely (X[t] + nudge < P.R->thi[t]) )
+                                X[t] += nudge;
+                        else
+                                goto retry;
+                else
+                        if ( likely (X[t] - nudge > P.R->tlo[t]) )
+                                X[t] -= nudge;
+                        else
+                                goto retry;
+
+              // special checks
+                if ( (t == TTunable::S0 && X[TTunable::S0] + nudge >= X[TTunable::SU]) ||
+                     (t == TTunable::SU && X[TTunable::S0] >= X[TTunable::SU] - nudge) )
+                        goto retry;
+
+                d = distance( X, X0, P.R->tstep.P);
+
+                if ( d > step_size && nudges == 0 ) {  // nudged too far from the outset
+                        nudge /= 2;
+                        X[t] = X0[t];
+                        continue;
+                }
+
+                ++nudges;
+
+        } while ( d < step_size );
+
+        // are there ever multiple copies of t in existence?
+        // can we just always use R->tx?
+        memcpy( P.t, X.P, sizeof(double) * X.size());
 }
 
 
@@ -97,35 +97,35 @@ retry:
 double
 _cost_function( void *xp)
 {
-	auto& P = *(SAchermannSimanPPack*)xp;
-	memcpy( P.R->tx.P, P.t, sizeof(double) * P.R->tx.size());
-	return P.R->snapshot();
+        auto& P = *(SAchermannSimanPPack*)xp;
+        memcpy( P.R->tx.P, P.t, sizeof(double) * P.R->tx.size());
+        return P.R->snapshot();
 }
 
 double
 _siman_metric( void *xp, void *yp)
 {
-	auto& P1 = *(SAchermannSimanPPack*)xp;
-	auto& P2 = *(SAchermannSimanPPack*)yp;
-	agh::ach::STunableSet<agh::ach::TTRole::v>
-		X1 (P1.R->tx.n_egc),
-		X2 (P2.R->tx.n_egc);
-	memcpy( X1.P, P1.t, sizeof(double) * X1.size());
-	memcpy( X2.P, P2.t, sizeof(double) * X2.size());
-
-	printf( "metric %g\n", agh::ach::distance( X1, X2, P1.R->tstep.P));
-	return agh::ach::distance( X1, X2, P1.R->tstep.P);
+        auto& P1 = *(SAchermannSimanPPack*)xp;
+        auto& P2 = *(SAchermannSimanPPack*)yp;
+        agh::ach::STunableSet<agh::ach::TTRole::v>
+                X1 (P1.R->tx.n_egc),
+                X2 (P2.R->tx.n_egc);
+        memcpy( X1.P, P1.t, sizeof(double) * X1.size());
+        memcpy( X2.P, P2.t, sizeof(double) * X2.size());
+
+        printf( "metric %g\n", agh::ach::distance( X1, X2, P1.R->tstep.P));
+        return agh::ach::distance( X1, X2, P1.R->tstep.P);
 }
 
 // void
 // _siman_print( void *xp)
 // {
-// 	auto& P = *(SAchermannSimanPPack*)xp;
-// 	for ( size_t t = 0; t < P.R->tx.size(); ++t )
-// 		printf( "%s = %g %s  ",
-// 			agh::ach::tunable_name(t).c_str(), P.t[t],
-// 			agh::ach::tunable_unit(t).c_str());
-// 	printf( "\n");
+//         auto& P = *(SAchermannSimanPPack*)xp;
+//         for ( size_t t = 0; t < P.R->tx.size(); ++t )
+//                 printf( "%s = %g %s  ",
+//                         agh::ach::tunable_name(t).c_str(), P.t[t],
+//                         agh::ach::tunable_unit(t).c_str());
+//         printf( "\n");
 // }
 
 } // namespace
@@ -136,29 +136,29 @@ int
 agh::ach::CModelRun::
 watch_simplex_move( void (*printer)(void*))
 {
-	SAchermannSimanPPack x0;
-	x0.R = this;
-	memcpy( x0.t, tx.P, sizeof(double) * tx.size());
-	gsl_siman_solve( agh::global::rng,
-			 (void*)&x0,	// void * x0_p,
-			 _cost_function,	// gsl_siman_Efunc_t,
-			 _siman_step,	// gsl_siman_step_t
-			 _siman_metric,	// gsl_siman_metric_t,
-			 printer,		// gsl_siman_print_t print_position,
-//			 _siman_print,
-			 NULL, NULL, NULL,	// gsl_siman_copy_t copyfunc, gsl_siman_copy_construct_t copy_constructor, gsl_siman_destroy_t destructor,
-			 sizeof(SAchermannSimanPPack),	// size_t element_size,
-			 ctl_params.siman_params);		// gsl_siman_params_t params
-
-	if ( ctl_params.DBAmendment2 ) {
-		const float ppm = 60. / pagesize();
-		double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * tx[TTunable::rs]);
-		tx[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt)
-			/ (_SWA_100/100);
-	}
-
-	status |= modrun_tried;
-	return 0;
+        SAchermannSimanPPack x0;
+        x0.R = this;
+        memcpy( x0.t, tx.P, sizeof(double) * tx.size());
+        gsl_siman_solve( agh::global::rng,
+                         (void*)&x0,        // void * x0_p,
+                         _cost_function,        // gsl_siman_Efunc_t,
+                         _siman_step,        // gsl_siman_step_t
+                         _siman_metric,        // gsl_siman_metric_t,
+                         printer,                // gsl_siman_print_t print_position,
+//                         _siman_print,
+                         NULL, NULL, NULL,        // gsl_siman_copy_t copyfunc, gsl_siman_copy_construct_t copy_constructor, gsl_siman_destroy_t destructor,
+                         sizeof(SAchermannSimanPPack),        // size_t element_size,
+                         ctl_params.siman_params);                // gsl_siman_params_t params
+
+        if ( ctl_params.DBAmendment2 ) {
+                const float ppm = 60. / pagesize();
+                double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * tx[TTunable::rs]);
+                tx[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt)
+                        / (_SWA_100/100);
+        }
+
+        status |= modrun_tried;
+        return 0;
 }
 
 
@@ -166,7 +166,7 @@ watch_simplex_move( void (*printer)(void*))
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/achermann-tunable.cc b/upstream/src/aghermann/model/achermann-tunable.cc
index 4b319e2..065b32f 100644
--- a/upstream/src/aghermann/model/achermann-tunable.cc
+++ b/upstream/src/aghermann/model/achermann-tunable.cc
@@ -18,88 +18,88 @@
 using namespace std;
 
 const agh::ach::STunableDescription
-	agh::ach::stock[TTunable::_basic_tunables] = {
-	{
-		.918e-3,	.100e-3,	2.000e-3,	.001e-3,
-		1e3, 0.001,
-		true,	-1,
-		"rs",		"%5.3f",	"1/min",
-		"<i>rs</i>",
-		"S Rise rate",
-		"S Rise rate",
-	},
-	{
-		.283,		.01,		4.,		.002,
-		1, .001,
-		true,	-1,
-		"rc",	 	"%5.3f",	"1/min",
-		"<i>rc</i>",
-		"SWA rise rate",
-		"SWA rise rate",
-	},
-	{
-		.24,		.04,		4.,		.001,
-		1, .01,
-		true,	-1,
-		"fc_R",		"%4.2f",	"1/min",
-		"<i>fc</i><sub>R</sub>",
-		"SWA decay rate in REM",
-		"SWA decay rate in REM",
-	},
-	{
-		.6,		.04,		4.,		.001,
-		1, .01,
-		true,	-1,
-		"fc_W",		"%4.2f",	"1/min",
-		"<i>fc</i><sub>W</sub>",
-		"SWA decay rate in Wake",
-		"SWA decay rate in Wake",
-	},
-	{
-		300,		9,		1005,		1,
-		1, 1,
-		true,	0,
-		"S_0",		"%5.1f",	"%",
-		"<i>S</i><sub>0</sub>",
-		"Starting value of S",
-		"Starting value of S",
-	},
-	{
-		500,		18,		2010,		1,
-		1, 1,
-		true,	0,
-		"S_U",	 	"%5.1f",	"%",
-		"<i>S</i><sub>U</sub>",
-		"S upper asymptote",
-		"S upper asymptote",
-	},
-	{
-		3,		.4,		22,		1,
-		1, .1,
-		false,	1,
-		"t_a",		"%3.1f",	"min",
-		"<i>rem</i><sub>pre</sub>",
-		"REM anticipation time",
-		"REM anticipation time",
-	},
-	{
-		3,		.4,		22,		1,
-		1, .1,
-		false,	1,
-		"t_p",		"%3.1f",	"min",
-		"<i>rem</i><sub>post</sub>",
-		"REM extension time",
-		"REM extension time",
-	},
-	{
-		.835e-2,	.010e-2,	4.000e-2,	.004e-2,
-		1e2, .001,
-		true,	-1,
-		"gc",		"%5.3f",	"1/min",
-		"<i>gc</i>",
-		"Gain constant",
-		"SWA self-dissipation efficiency"
-	},
+        agh::ach::stock[TTunable::_basic_tunables] = {
+        {
+                .918e-3,        .100e-3,        2.000e-3,        .001e-3,
+                1e3, 0.001,
+                true,        -1,
+                "rs",                "%5.3f",        "1/min",
+                "<i>rs</i>",
+                "S Rise rate",
+                "S Rise rate",
+        },
+        {
+                .283,                .01,                4.,                .002,
+                1, .001,
+                true,        -1,
+                "rc",                 "%5.3f",        "1/min",
+                "<i>rc</i>",
+                "SWA rise rate",
+                "SWA rise rate",
+        },
+        {
+                .24,                .04,                4.,                .001,
+                1, .01,
+                true,        -1,
+                "fc_R",                "%4.2f",        "1/min",
+                "<i>fc</i><sub>R</sub>",
+                "SWA decay rate in REM",
+                "SWA decay rate in REM",
+        },
+        {
+                .6,                .04,                4.,                .001,
+                1, .01,
+                true,        -1,
+                "fc_W",                "%4.2f",        "1/min",
+                "<i>fc</i><sub>W</sub>",
+                "SWA decay rate in Wake",
+                "SWA decay rate in Wake",
+        },
+        {
+                300,                9,                1005,                1,
+                1, 1,
+                true,        0,
+                "S_0",                "%5.1f",        "%",
+                "<i>S</i><sub>0</sub>",
+                "Starting value of S",
+                "Starting value of S",
+        },
+        {
+                500,                18,                2010,                1,
+                1, 1,
+                true,        0,
+                "S_U",                 "%5.1f",        "%",
+                "<i>S</i><sub>U</sub>",
+                "S upper asymptote",
+                "S upper asymptote",
+        },
+        {
+                3,                .4,                22,                1,
+                1, .1,
+                false,        1,
+                "t_a",                "%3.1f",        "min",
+                "<i>rem</i><sub>pre</sub>",
+                "REM anticipation time",
+                "REM anticipation time",
+        },
+        {
+                3,                .4,                22,                1,
+                1, .1,
+                false,        1,
+                "t_p",                "%3.1f",        "min",
+                "<i>rem</i><sub>post</sub>",
+                "REM extension time",
+                "REM extension time",
+        },
+        {
+                .835e-2,        .010e-2,        4.000e-2,        .004e-2,
+                1e2, .001,
+                true,        -1,
+                "gc",                "%5.3f",        "1/min",
+                "<i>gc</i>",
+                "Gain constant",
+                "SWA self-dissipation efficiency"
+        },
 };
 
 
@@ -113,13 +113,13 @@ string
 agh::ach::
 tunable_name( size_t t)
 {
-	if ( t < TTunable::_basic_tunables )
-		return stock[t].name;
-	else if ( t < TTunable::_all_tunables )
-		return string("gc")
-			+ to_string((long long unsigned)t - TTunable::gc + 1);
-	else
-		return "BAD_TUNABLE";
+        if ( t < TTunable::_basic_tunables )
+                return stock[t].name;
+        else if ( t < TTunable::_all_tunables )
+                return string("gc")
+                        + to_string((long long unsigned)t - TTunable::gc + 1);
+        else
+                return "BAD_TUNABLE";
 }
 
 
@@ -127,14 +127,14 @@ string
 agh::ach::
 tunable_pango_name( size_t t)
 {
-	if ( t < TTunable::_basic_tunables )
-		return stock[t].pango_name;
-	else if ( t < TTunable::_all_tunables )
-		return string("<i>gc</i><sub>")
-			+ to_string((long long unsigned)t - TTunable::gc + 1)
-			+ "</sub>";
-	else
-		return "BAD_TUNABLE";
+        if ( t < TTunable::_basic_tunables )
+                return stock[t].pango_name;
+        else if ( t < TTunable::_all_tunables )
+                return string("<i>gc</i><sub>")
+                        + to_string((long long unsigned)t - TTunable::gc + 1)
+                        + "</sub>";
+        else
+                return "BAD_TUNABLE";
 }
 
 
@@ -142,12 +142,12 @@ string
 agh::ach::
 tunable_unit( size_t t)
 {
-	if ( t < TTunable::_basic_tunables )
-		return stock[t].unit;
-	else if ( t < TTunable::_all_tunables )
-		return stock[(size_t)TTunable::gc].unit;
-	else
-		return "BAD_TUNABLE";
+        if ( t < TTunable::_basic_tunables )
+                return stock[t].unit;
+        else if ( t < TTunable::_all_tunables )
+                return stock[(size_t)TTunable::gc].unit;
+        else
+                return "BAD_TUNABLE";
 }
 
 
@@ -157,10 +157,10 @@ tunable_unit( size_t t)
 // agh::ach::STunableSetWithState::
 // validate_range() const
 // {
-// 	for ( size_t t = 0; t < size(); ++t )
-//  		if ( lo[t] >= hi[t] || step[t] >= (hi[t] - lo[t])/2 )
-// 			return -1;
-// 	return 0;
+//         for ( size_t t = 0; t < size(); ++t )
+//                  if ( lo[t] >= hi[t] || step[t] >= (hi[t] - lo[t])/2 )
+//                         return -1;
+//         return 0;
 // }
 
 
@@ -174,11 +174,11 @@ void
 STunableSet<TTRole::v>::
 set_defaults()
 {
-	size_t t = 0;
-	for ( ; t < ach::TTunable::_basic_tunables; ++t )
-		P[t] = stock[t].def_val;
-	for ( ; t < size(); ++t )
-		P[t] = stock[ach::TTunable::gc].def_val;
+        size_t t = 0;
+        for ( ; t < ach::TTunable::_basic_tunables; ++t )
+                P[t] = stock[t].def_val;
+        for ( ; t < size(); ++t )
+                P[t] = stock[ach::TTunable::gc].def_val;
 }
 
 template <>
@@ -186,11 +186,11 @@ void
 STunableSet<TTRole::l>::
 set_defaults()
 {
-	size_t t = 0;
-	for ( ; t < ach::TTunable::_basic_tunables; ++t )
-		P[t] = stock[t].def_min;
-	for ( ; t < size(); ++t )
-		P[t] = stock[ach::TTunable::gc].def_min;
+        size_t t = 0;
+        for ( ; t < ach::TTunable::_basic_tunables; ++t )
+                P[t] = stock[t].def_min;
+        for ( ; t < size(); ++t )
+                P[t] = stock[ach::TTunable::gc].def_min;
 }
 
 template <>
@@ -198,11 +198,11 @@ void
 STunableSet<TTRole::u>::
 set_defaults()
 {
-	size_t t = 0;
-	for ( ; t < ach::TTunable::_basic_tunables; ++t )
-		P[t] = stock[t].def_max;
-	for ( ; t < size(); ++t )
-		P[t] = stock[ach::TTunable::gc].def_max;
+        size_t t = 0;
+        for ( ; t < ach::TTunable::_basic_tunables; ++t )
+                P[t] = stock[t].def_max;
+        for ( ; t < size(); ++t )
+                P[t] = stock[ach::TTunable::gc].def_max;
 }
 
 template <>
@@ -210,11 +210,11 @@ void
 STunableSet<TTRole::d>::
 set_defaults()
 {
-	size_t t = 0;
-	for ( ; t < ach::TTunable::_basic_tunables; ++t )
-		P[t] = stock[t].def_step;
-	for ( ; t < size(); ++t )
-		P[t] = stock[ach::TTunable::gc].def_step;
+        size_t t = 0;
+        for ( ; t < ach::TTunable::_basic_tunables; ++t )
+                P[t] = stock[t].def_step;
+        for ( ; t < size(); ++t )
+                P[t] = stock[ach::TTunable::gc].def_step;
 }
 
 
@@ -224,14 +224,14 @@ __attribute__ ((pure))
 STunableSet<TTRole::v>::
 check() const
 {
-	size_t t = 0;
-	for ( ; t < ach::TTunable::_basic_tunables; ++t )
-		if ( P[t] <= stock[t].def_min || P[t] >= stock[t].def_max )
-			return 1;
-	for ( ; t < size(); ++t )
-		if ( P[t] <= stock[ach::TTunable::gc].def_min || P[t] >= stock[ach::TTunable::gc].def_max )
-			return 1;
-	return 0;
+        size_t t = 0;
+        for ( ; t < ach::TTunable::_basic_tunables; ++t )
+                if ( P[t] <= stock[t].def_min || P[t] >= stock[t].def_max )
+                        return 1;
+        for ( ; t < size(); ++t )
+                if ( P[t] <= stock[ach::TTunable::gc].def_min || P[t] >= stock[ach::TTunable::gc].def_max )
+                        return 1;
+        return 0;
 }
 
 } // namespace ach
@@ -242,15 +242,15 @@ void
 agh::ach::STunableSetWithState::
 randomise()
 {
-	for ( size_t t = 0; t < size(); ++t )
-		if ( d[t] > 0. )
-			P[t] = l[t] + gsl_rng_uniform( agh::global::rng) * range( (TTunable)t);
+        for ( size_t t = 0; t < size(); ++t )
+                if ( d[t] > 0. )
+                        P[t] = l[t] + gsl_rng_uniform( agh::global::rng) * range( (TTunable)t);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/achermann-tunable.hh b/upstream/src/aghermann/model/achermann-tunable.hh
index 59f1244..ead39b1 100644
--- a/upstream/src/aghermann/model/achermann-tunable.hh
+++ b/upstream/src/aghermann/model/achermann-tunable.hh
@@ -32,42 +32,42 @@ using namespace std;
 
 
 enum TTunable {
-	rs,	rc,
-	fcR,	fcW,
-	S0,	SU,
-	ta,	tp,
-	gc,
-	_basic_tunables,
-	gc1 = gc,
-	gc2,
-	gc3,
-	gc4,
-	_all_tunables
+        rs,        rc,
+        fcR,        fcW,
+        S0,        SU,
+        ta,        tp,
+        gc,
+        _basic_tunables,
+        gc1 = gc,
+        gc2,
+        gc3,
+        gc4,
+        _all_tunables
 };
 
 
 
 enum class TTRole {
-	v, d, l, u
+        v, d, l, u
 };
 
 
 struct STunableDescription {
-	double	def_val, def_min, def_max, def_step;
-	float	display_scale_factor,
-		adj_step;
-	bool	is_required;
-	int	time_adj;
-	const char
-		*name,
-		*fmt,
-		*unit,
-		*pango_name,
-		*human_name,
-		*description;
+        double        def_val, def_min, def_max, def_step;
+        float        display_scale_factor,
+                adj_step;
+        bool        is_required;
+        int        time_adj;
+        const char
+                *name,
+                *fmt,
+                *unit,
+                *pango_name,
+                *human_name,
+                *description;
 };
 extern const STunableDescription
-	stock[TTunable::_basic_tunables];
+        stock[TTunable::_basic_tunables];
 
 string tunable_name( size_t);
 string tunable_pango_name( size_t);
@@ -78,56 +78,56 @@ string tunable_unit( size_t);
 template <TTRole Of = TTRole::v>
 struct STunableSet {
     public:
-	double	P[TTunable::_all_tunables];
-	size_t	n_egc;
-
-	STunableSet (const STunableSet&) = default;
-	STunableSet (size_t n_egc_ = 0)
-	      : n_egc (n_egc_)
-		{
-			set_defaults();
-		}
-
-	STunableSet& operator=( const STunableSet&) = default;
-
-	size_t size() const
-		{
-			return TTunable::_basic_tunables + n_egc;
-		}
-
-	double& operator[]( size_t t)
-		{
-			return P[t];
-		}
-	const double& operator[]( size_t t) const
-		{
-			return P[t];
-		}
-
-	int check() const;
-
-	void set_defaults();
-
-	void adjust_for_ppm( double ppm)
-		{
-			for ( size_t t = 0; t < size(); ++t )
-				P[t] *= pow( ppm, stock[min(t, (size_t)TTunable::gc)].time_adj);
-		}
-
-	void unadjust_for_ppm( double ppm)
-		{
-			for ( size_t t = 0; t < size(); t++ )
-				P[t] /= pow( ppm, stock[min(t, (size_t)TTunable::gc)].time_adj);
-		}
-
-	valarray<double>
-	normalize( const double fac[]) const
-		{
-			valarray<double> Px (size());
-			for ( size_t t = 0; t < size(); ++t )
-				Px[t] = P[t] / fac[t];
-			return Px;
-		}
+        double        P[TTunable::_all_tunables];
+        size_t        n_egc;
+
+        STunableSet (const STunableSet&) = default;
+        STunableSet (size_t n_egc_ = 0)
+              : n_egc (n_egc_)
+                {
+                        set_defaults();
+                }
+
+        STunableSet& operator=( const STunableSet&) = default;
+
+        size_t size() const
+                {
+                        return TTunable::_basic_tunables + n_egc;
+                }
+
+        double& operator[]( size_t t)
+                {
+                        return P[t];
+                }
+        const double& operator[]( size_t t) const
+                {
+                        return P[t];
+                }
+
+        int check() const;
+
+        void set_defaults();
+
+        void adjust_for_ppm( double ppm)
+                {
+                        for ( size_t t = 0; t < size(); ++t )
+                                P[t] *= pow( ppm, stock[min(t, (size_t)TTunable::gc)].time_adj);
+                }
+
+        void unadjust_for_ppm( double ppm)
+                {
+                        for ( size_t t = 0; t < size(); t++ )
+                                P[t] /= pow( ppm, stock[min(t, (size_t)TTunable::gc)].time_adj);
+                }
+
+        valarray<double>
+        normalize( const double fac[]) const
+                {
+                        valarray<double> Px (size());
+                        for ( size_t t = 0; t < size(); ++t )
+                                Px[t] = P[t] / fac[t];
+                        return Px;
+                }
 };
 
 
@@ -136,10 +136,10 @@ struct STunableSet {
 
 inline double
 distance( const STunableSet<TTRole::v>& lv,
-	  const STunableSet<TTRole::v>& rv,
-	  const double f[])
+          const STunableSet<TTRole::v>& rv,
+          const double f[])
 {
-	return sqrt( pow( lv.normalize(f) - rv.normalize(f), 2.).sum());
+        return sqrt( pow( lv.normalize(f) - rv.normalize(f), 2.).sum());
 }
 
 
@@ -148,33 +148,33 @@ struct STunableSetWithState
   : public STunableSet<TTRole::v> {
 
     public:
-	const STunableSet<TTRole::d>& d;
-	const STunableSet<TTRole::l>& l;
-	const STunableSet<TTRole::u>& u;
-
-	array<int, TTunable::_all_tunables>
- 		state;
-
-	STunableSetWithState (const STunableSet<TTRole::v>& v_,
-			      const STunableSet<TTRole::d>& d_,
-			      const STunableSet<TTRole::l>& l_,
-			      const STunableSet<TTRole::u>& u_)
-	      : STunableSet (v_), d (d_), l (l_), u (u_)
-		{}
-	STunableSetWithState (const STunableSet<TTRole::d>& d_,
-			      const STunableSet<TTRole::l>& l_,
-			      const STunableSet<TTRole::u>& u_)
-	      : STunableSet (d_.n_egc), d (d_), l (l_), u (u_)
-		{}
-	STunableSetWithState (const STunableSetWithState&) = default;
-
-	double range( TTunable t) const
-		{
-			return u[(size_t)t] - l[(size_t)t];
-		}
-
-	void center();
-	void randomise();
+        const STunableSet<TTRole::d>& d;
+        const STunableSet<TTRole::l>& l;
+        const STunableSet<TTRole::u>& u;
+
+        array<int, TTunable::_all_tunables>
+                 state;
+
+        STunableSetWithState (const STunableSet<TTRole::v>& v_,
+                              const STunableSet<TTRole::d>& d_,
+                              const STunableSet<TTRole::l>& l_,
+                              const STunableSet<TTRole::u>& u_)
+              : STunableSet (v_), d (d_), l (l_), u (u_)
+                {}
+        STunableSetWithState (const STunableSet<TTRole::d>& d_,
+                              const STunableSet<TTRole::l>& l_,
+                              const STunableSet<TTRole::u>& u_)
+              : STunableSet (d_.n_egc), d (d_), l (l_), u (u_)
+                {}
+        STunableSetWithState (const STunableSetWithState&) = default;
+
+        double range( TTunable t) const
+                {
+                        return u[(size_t)t] - l[(size_t)t];
+                }
+
+        void center();
+        void randomise();
 };
 
 
@@ -188,7 +188,7 @@ struct STunableSetWithState
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/achermann.cc b/upstream/src/aghermann/model/achermann.cc
index 622c95f..c829430 100644
--- a/upstream/src/aghermann/model/achermann.cc
+++ b/upstream/src/aghermann/model/achermann.cc
@@ -22,33 +22,33 @@ void
 agh::ach::SControlParamSet::
 check() const
 {
-	if ( siman_params.n_tries < 1 ||
-	     siman_params.iters_fixed_T < 1 ||
-	     siman_params.step_size <= 0. ||
-	     siman_params.k <= 0. ||
-	     siman_params.t_initial <= 0. ||
-	     siman_params.t_min <= 0. ||
-	     siman_params.t_min >= siman_params.t_initial ||
-	     siman_params.mu_t <= 0 )
-		throw invalid_argument("Bad SControlParamSet");
+        if ( siman_params.n_tries < 1 ||
+             siman_params.iters_fixed_T < 1 ||
+             siman_params.step_size <= 0. ||
+             siman_params.k <= 0. ||
+             siman_params.t_initial <= 0. ||
+             siman_params.t_min <= 0. ||
+             siman_params.t_min >= siman_params.t_initial ||
+             siman_params.mu_t <= 0 )
+                throw invalid_argument("Bad SControlParamSet");
 }
 
 void
 agh::ach::SControlParamSet::
 reset()
 {
-	siman_params.n_tries		=   20;
-	siman_params.iters_fixed_T	=   10;
-	siman_params.step_size		=    3.;
-	siman_params.k			=    1.0;
-	siman_params.t_initial  	=  200.;
-	siman_params.mu_t		=    1.003;
-	siman_params.t_min		=    1.;
-
-	DBAmendment1		= true;
-	DBAmendment2		= false;
-	AZAmendment1		= false;
-	AZAmendment2		= false;
+        siman_params.n_tries                =   20;
+        siman_params.iters_fixed_T        =   10;
+        siman_params.step_size                =    3.;
+        siman_params.k                        =    1.0;
+        siman_params.t_initial          =  200.;
+        siman_params.mu_t                =    1.003;
+        siman_params.t_min                =    1.;
+
+        DBAmendment1                = true;
+        DBAmendment2                = false;
+        AZAmendment1                = false;
+        AZAmendment2                = false;
 }
 
 
@@ -58,11 +58,11 @@ __attribute__ ((pure))
 agh::ach::SControlParamSet::
 operator==( const SControlParamSet &rv) const
 {
-	return	memcmp( &siman_params, &rv.siman_params, sizeof(siman_params)) == 0 &&
-		DBAmendment1 == rv.DBAmendment1 &&
-		DBAmendment2 == rv.DBAmendment2 &&
-		AZAmendment1 == rv.AZAmendment1 &&
-		AZAmendment2 == rv.AZAmendment2;
+        return        memcmp( &siman_params, &rv.siman_params, sizeof(siman_params)) == 0 &&
+                DBAmendment1 == rv.DBAmendment1 &&
+                DBAmendment2 == rv.DBAmendment2 &&
+                AZAmendment1 == rv.AZAmendment1 &&
+                AZAmendment2 == rv.AZAmendment2;
 }
 
 
@@ -72,38 +72,38 @@ operator==( const SControlParamSet &rv) const
 
 agh::ach::CModelRun::
 CModelRun (CSubject& subject, const string& session, const sigfile::SChannel& channel,
-	   const agh::SProfileParamSet& _scourse_params,
-	   const SControlParamSet& _ctl_params,
-	   const STunableSetWithState& t0)
+           const agh::SProfileParamSet& _scourse_params,
+           const SControlParamSet& _ctl_params,
+           const STunableSetWithState& t0)
       : CProfile (subject, session, channel,
-		  _scourse_params),
-	status (0),
-	ctl_params (_ctl_params),
-	tstep (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
-	tlo   (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
-	thi   (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
-	t0    (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
-	tx (t0, tstep, tlo, thi),
-	cf (NAN)
+                  _scourse_params),
+        status (0),
+        ctl_params (_ctl_params),
+        tstep (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
+        tlo   (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
+        thi   (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
+        t0    (ctl_params.AZAmendment1 ? _mm_list.size()-1 : 0),
+        tx (t0, tstep, tlo, thi),
+        cf (NAN)
 {
-	if ( CProfile::_status )
-		throw CProfile::_status;
-	_prepare_scores2();
+        if ( CProfile::_status )
+                throw CProfile::_status;
+        _prepare_scores2();
 }
 
 agh::ach::CModelRun::
 CModelRun (CModelRun&& rv)
       : CProfile (move(rv)),
-	status (rv.status),
-	ctl_params (rv.ctl_params),
-	tstep (rv.tstep),
-	tlo (rv.tlo),
-	thi (rv.thi),
-	t0  (rv.t0),
-	tx (tstep, tlo, thi),
-	cf (NAN)
+        status (rv.status),
+        ctl_params (rv.ctl_params),
+        tstep (rv.tstep),
+        tlo (rv.tlo),
+        thi (rv.thi),
+        t0  (rv.t0),
+        tx (tstep, tlo, thi),
+        cf (NAN)
 {
-	_prepare_scores2();
+        _prepare_scores2();
 }
 
 
@@ -118,31 +118,31 @@ void
 agh::ach::CModelRun::
 _prepare_scores2()
 {
-	size_t p, pp;
-
-	_scores2.assign( _timeline.begin(), _timeline.end());
-
-	if ( ctl_params.ScoreUnscoredAsWake ) {
-		for ( p = _sim_start; p < _timeline.size(); ++p )
-			if ( _scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0 ) { // this is Unscored
-//				printf( " (patching Unscored as Wake at %d)\n", p);
-				_scores2[p].Wake = 1.;
-			}
-	} else {  // ... as prev page
-		for ( p = (_sim_start > 0) ?_sim_start :1; p < _timeline.size(); ++p )
-			if ( _scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0 ) {
-//				printf( " (patching Unscored as prev at %d)\n", p);
-				pp = p-1;
-				do
-					_scores2[p] = _scores2[pp];
-				while ( ++p < _timeline.size() &&
-					_scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0. );
-			}
-	}
-
-	if ( ctl_params.AZAmendment2 )
-		for ( p = 0; p < _timeline.size(); ++p )
-			_timeline[p].NREM = ceil(_timeline[p].NREM);
+        size_t p, pp;
+
+        _scores2.assign( _timeline.begin(), _timeline.end());
+
+        if ( ctl_params.ScoreUnscoredAsWake ) {
+                for ( p = _sim_start; p < _timeline.size(); ++p )
+                        if ( _scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0 ) { // this is Unscored
+//                                printf( " (patching Unscored as Wake at %d)\n", p);
+                                _scores2[p].Wake = 1.;
+                        }
+        } else {  // ... as prev page
+                for ( p = (_sim_start > 0) ?_sim_start :1; p < _timeline.size(); ++p )
+                        if ( _scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0 ) {
+//                                printf( " (patching Unscored as prev at %d)\n", p);
+                                pp = p-1;
+                                do
+                                        _scores2[p] = _scores2[pp];
+                                while ( ++p < _timeline.size() &&
+                                        _scores2[p].NREM + _scores2[p].REM + _scores2[p].Wake == 0. );
+                        }
+        }
+
+        if ( ctl_params.AZAmendment2 )
+                for ( p = 0; p < _timeline.size(); ++p )
+                        _timeline[p].NREM = ceil(_timeline[p].NREM);
 }
 
 
@@ -154,35 +154,35 @@ void
 agh::ach::CModelRun::
 _restore_scores_and_extend_rem( size_t da, size_t dz)
 {
-	size_t	a  =                    da,
-		z  = _timeline.size() - dz,
-		p, pi, di;
-
-	for ( p = 0; p < _timeline.size(); ++p )
-		_timeline[p].REM = _scores2[p].REM;
-
-	for ( p = a; p < z; ++p )
-		if ( _scores2[p].REM > 0.33 ) {  // only deal with some substantial REM
-			for ( pi = p; _timeline[pi].REM > .33 && pi < z; ++pi ) {
-
-				// pull front
-				di = da;
-				do  {
-					if ( _scores2[pi].REM > _scores2[pi - di].REM )
-						_timeline[pi - di].REM = _scores2[pi].REM;
-				} while ( di-- );
-
-				// push end
-				di = dz;
-				do {
-					if ( _scores2[pi].REM > _scores2[pi + di].REM )
-						_timeline[pi + di].REM = _scores2[pi].REM;
-				} while ( di-- );
-
-			}  // perhaps, in addition to spreading the boundary value to regions before and after existing REM,
-			   // we should also bump the existing values inside it?
-			p = pi;
-		}
+        size_t        a  =                    da,
+                z  = _timeline.size() - dz,
+                p, pi, di;
+
+        for ( p = 0; p < _timeline.size(); ++p )
+                _timeline[p].REM = _scores2[p].REM;
+
+        for ( p = a; p < z; ++p )
+                if ( _scores2[p].REM > 0.33 ) {  // only deal with some substantial REM
+                        for ( pi = p; _timeline[pi].REM > .33 && pi < z; ++pi ) {
+
+                                // pull front
+                                di = da;
+                                do  {
+                                        if ( _scores2[pi].REM > _scores2[pi - di].REM )
+                                                _timeline[pi - di].REM = _scores2[pi].REM;
+                                } while ( di-- );
+
+                                // push end
+                                di = dz;
+                                do {
+                                        if ( _scores2[pi].REM > _scores2[pi + di].REM )
+                                                _timeline[pi + di].REM = _scores2[pi].REM;
+                                } while ( di-- );
+
+                        }  // perhaps, in addition to spreading the boundary value to regions before and after existing REM,
+                           // we should also bump the existing values inside it?
+                        p = pi;
+                }
 }
 
 
@@ -195,102 +195,102 @@ __attribute__ ((hot))
 agh::ach::CModelRun::
 snapshot()
 {
-//	printf( "AZAmendment = %d; cur_tset.size = %zu\n", AZAmendment, cur_tset.size());
-	const float ppm = 60. / pagesize();
-	auto _tset = tx;
-	_tset.adjust_for_ppm( ppm);
+//        printf( "AZAmendment = %d; cur_tset.size = %zu\n", AZAmendment, cur_tset.size());
+        const float ppm = 60. / pagesize();
+        auto _tset = tx;
+        _tset.adjust_for_ppm( ppm);
 
-	_restore_scores_and_extend_rem( (int)round( _tset[TTunable::ta]), (int)round( _tset[TTunable::tp]));
+        _restore_scores_and_extend_rem( (int)round( _tset[TTunable::ta]), (int)round( _tset[TTunable::tp]));
 
       // substitute S_0 and S_U, expressed in %, with abs values
-	_tset[TTunable::S0] *= _SWA_100/100;
-	_tset[TTunable::SU] *= _SWA_100/100;
+        _tset[TTunable::S0] *= _SWA_100/100;
+        _tset[TTunable::SU] *= _SWA_100/100;
 
-	if ( ctl_params.DBAmendment2 )
-		_timeline[_baseline_end].S = _SWA_100 * 3; // will be overwritten at completion of the first iteration
+        if ( ctl_params.DBAmendment2 )
+                _timeline[_baseline_end].S = _SWA_100 * 3; // will be overwritten at completion of the first iteration
 
       // prime S and swa_sim
-	_timeline[_sim_start].metric_sim = _SWA_0;
-	_timeline[_sim_start].S = _tset[TTunable::S0];
+        _timeline[_sim_start].metric_sim = _SWA_0;
+        _timeline[_sim_start].S = _tset[TTunable::S0];
 
-	double _fit = 0.;
+        double _fit = 0.;
 
 #define CF_CYCLE_COMMON_DB1 \
-	int	WT = (_timeline[p].Wake > 0.33);			\
-	TFloat	pS = _timeline[p].S / _tset[TTunable::SU];		\
-	TFloat	pSWA =							\
-		_tset[TTunable::rc] * _timeline[p].metric_sim * pS		\
-		* (1. - _timeline[p].metric_sim / _timeline[p].S)		\
-		* (1. - _timeline[p].Wake);				\
-	_timeline[p+1].metric_sim =					\
-		_timeline[p].metric_sim					\
-		+ pSWA							\
-		- _tset[TTunable::fcR] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].REM \
-		- _tset[TTunable::fcW] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].Wake; \
-									\
-	_timeline[p+1].S =						\
-		_timeline[p].S + ( WT					\
-				   ? 0					\
-				   : (-_which_gc(p) * _timeline[p].metric_sim) ) \
-		+ (_tset[TTunable::SU] - _timeline[p].S) * _tset[TTunable::rs]; \
-									\
-	if ( _timeline[p].has_swa() )					\
-		_fit += gsl_pow_2( _timeline[p].metric - _timeline[p].metric_sim); \
-	if ( _timeline[p].S < 0 ) \
-		_fit += 1e9;
+        int        WT = (_timeline[p].Wake > 0.33);                        \
+        TFloat        pS = _timeline[p].S / _tset[TTunable::SU];                \
+        TFloat        pSWA =                                                        \
+                _tset[TTunable::rc] * _timeline[p].metric_sim * pS                \
+                * (1. - _timeline[p].metric_sim / _timeline[p].S)                \
+                * (1. - _timeline[p].Wake);                                \
+        _timeline[p+1].metric_sim =                                        \
+                _timeline[p].metric_sim                                        \
+                + pSWA                                                        \
+                - _tset[TTunable::fcR] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].REM \
+                - _tset[TTunable::fcW] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].Wake; \
+                                                                        \
+        _timeline[p+1].S =                                                \
+                _timeline[p].S + ( WT                                        \
+                                   ? 0                                        \
+                                   : (-_which_gc(p) * _timeline[p].metric_sim) ) \
+                + (_tset[TTunable::SU] - _timeline[p].S) * _tset[TTunable::rs]; \
+                                                                        \
+        if ( _timeline[p].has_swa() )                                        \
+                _fit += gsl_pow_2( _timeline[p].metric - _timeline[p].metric_sim); \
+        if ( _timeline[p].S < 0 ) \
+                _fit += 1e9;
 
 #define CF_CYCLE_COMMON_NODB1 \
-	int	WT = (_timeline[p].Wake > 0.33);			\
-	double	pS = _timeline[p].S / _tset[TTunable::SU];		\
-	double	pSWA =							\
-		_tset[TTunable::rc] * _timeline[p].metric_sim * pS * (1. - _timeline[p].metric_sim / _timeline[p].S); \
-	_timeline[p+1].metric_sim =					\
-		_timeline[p].metric_sim					\
-		+ pSWA							\
-		- _tset[TTunable::fcR] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].REM \
-		- _tset[TTunable::fcW] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].Wake; \
-									\
-	_timeline[p+1].S =						\
-		_timeline[p].S + ( WT					\
-				   ? 0					\
-				   : (-_which_gc(p) * _timeline[p].metric_sim) ) \
-		+ (_tset[TTunable::SU] - _timeline[p].S) * _tset[TTunable::rs]; \
-									\
-	if ( _timeline[p].has_swa() )					\
-		_fit += gsl_pow_2( _timeline[p].metric - _timeline[p].metric_sim); \
-	if ( _timeline[p].S < 0 ) \
-		_fit += 1e9;
+        int        WT = (_timeline[p].Wake > 0.33);                        \
+        double        pS = _timeline[p].S / _tset[TTunable::SU];                \
+        double        pSWA =                                                        \
+                _tset[TTunable::rc] * _timeline[p].metric_sim * pS * (1. - _timeline[p].metric_sim / _timeline[p].S); \
+        _timeline[p+1].metric_sim =                                        \
+                _timeline[p].metric_sim                                        \
+                + pSWA                                                        \
+                - _tset[TTunable::fcR] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].REM \
+                - _tset[TTunable::fcW] * (_timeline[p].metric_sim - _SWA_L) * _timeline[p].Wake; \
+                                                                        \
+        _timeline[p+1].S =                                                \
+                _timeline[p].S + ( WT                                        \
+                                   ? 0                                        \
+                                   : (-_which_gc(p) * _timeline[p].metric_sim) ) \
+                + (_tset[TTunable::SU] - _timeline[p].S) * _tset[TTunable::rs]; \
+                                                                        \
+        if ( _timeline[p].has_swa() )                                        \
+                _fit += gsl_pow_2( _timeline[p].metric - _timeline[p].metric_sim); \
+        if ( _timeline[p].S < 0 ) \
+                _fit += 1e9;
 // define end
 
-	if ( ctl_params.DBAmendment2 )
-		if ( ctl_params.DBAmendment1 )
-			for ( size_t p = _sim_start; p < _sim_end; ++p ) {
-				double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * _tset[TTunable::rs]);
-				_tset[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt);
-
-				CF_CYCLE_COMMON_DB1;
-			}
-		else
-			for ( size_t p = _sim_start; p < _sim_end; ++p ) {
-				double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * _tset[TTunable::rs]);
-				_tset[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt);
-
-				CF_CYCLE_COMMON_NODB1;
-			}
-	else
-		if ( ctl_params.DBAmendment1 )
-			for ( size_t p = _sim_start; p < _sim_end; ++p ) {
-				CF_CYCLE_COMMON_DB1;
-			}
-		else
-			for ( size_t p = _sim_start; p < _sim_end; ++p ) {
-				CF_CYCLE_COMMON_NODB1;
-			}
+        if ( ctl_params.DBAmendment2 )
+                if ( ctl_params.DBAmendment1 )
+                        for ( size_t p = _sim_start; p < _sim_end; ++p ) {
+                                double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * _tset[TTunable::rs]);
+                                _tset[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt);
+
+                                CF_CYCLE_COMMON_DB1;
+                        }
+                else
+                        for ( size_t p = _sim_start; p < _sim_end; ++p ) {
+                                double edt = exp( -(24*60*ppm + _sim_start - _baseline_end) * _tset[TTunable::rs]);
+                                _tset[TTunable::SU] = (_timeline[_sim_start].S - _timeline[_baseline_end].S * edt) / (1. - edt);
+
+                                CF_CYCLE_COMMON_NODB1;
+                        }
+        else
+                if ( ctl_params.DBAmendment1 )
+                        for ( size_t p = _sim_start; p < _sim_end; ++p ) {
+                                CF_CYCLE_COMMON_DB1;
+                        }
+                else
+                        for ( size_t p = _sim_start; p < _sim_end; ++p ) {
+                                CF_CYCLE_COMMON_NODB1;
+                        }
 
 #undef CF_CYCLE_COMMON_DB1
 #undef CF_CYCLE_COMMON_NODB1
 
-	return cf = sqrt( _fit/_pages_with_SWA);
+        return cf = sqrt( _fit/_pages_with_SWA);
 }
 
 
@@ -298,7 +298,7 @@ snapshot()
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/achermann.hh b/upstream/src/aghermann/model/achermann.hh
index 52cb4dd..cc45f8a 100644
--- a/upstream/src/aghermann/model/achermann.hh
+++ b/upstream/src/aghermann/model/achermann.hh
@@ -38,32 +38,32 @@ using namespace std;
 
 
 struct SControlParamSet {
-	bool	DBAmendment1,
-		DBAmendment2,
-		AZAmendment1,
-		AZAmendment2,
-		ScoreUnscoredAsWake;
-
-	gsl_siman_params_t
-		siman_params;
-		    // int n_tries
-		    // 	The number of points to try for each step.
-		    // int iters_fixed_T
-		    // 	The number of iterations at each temperature.
-		    // double step_size
-		    // 	The maximum step size in the random walk.
-		    // double k, t_initial, mu_t, t_min
-
-	SControlParamSet()
-		{
-			reset();
-		}
-
-	SControlParamSet& operator=( const SControlParamSet&) = default;
-	bool operator==( const SControlParamSet &rv) const;
-
-	void check() const; // throws
-	void reset();
+        bool        DBAmendment1,
+                DBAmendment2,
+                AZAmendment1,
+                AZAmendment2,
+                ScoreUnscoredAsWake;
+
+        gsl_siman_params_t
+                siman_params;
+                    // int n_tries
+                    //         The number of points to try for each step.
+                    // int iters_fixed_T
+                    //         The number of iterations at each temperature.
+                    // double step_size
+                    //         The maximum step size in the random walk.
+                    // double k, t_initial, mu_t, t_min
+
+        SControlParamSet()
+                {
+                        reset();
+                }
+
+        SControlParamSet& operator=( const SControlParamSet&) = default;
+        bool operator==( const SControlParamSet &rv) const;
+
+        void check() const; // throws
+        void reset();
 };
 
 
@@ -77,48 +77,48 @@ class CModelRun
 // makes no practical sense
 #pragma GCC diagnostic ignored "-Wextra"
 #pragma GCC diagnostic push
-	CModelRun (const CModelRun&)
-	      : tx (t0, tstep, tlo, thi)
-		{
-			throw runtime_error ("nono");
-		}
-	CModelRun () // oblige map
-	      : tx (t0, tstep, tlo, thi)
-		{
-			throw runtime_error ("nono");
-		}
+        CModelRun (const CModelRun&)
+              : tx (t0, tstep, tlo, thi)
+                {
+                        throw runtime_error ("nono");
+                }
+        CModelRun () // oblige map
+              : tx (t0, tstep, tlo, thi)
+                {
+                        throw runtime_error ("nono");
+                }
 #pragma GCC diagnostic pop
 
-	CModelRun (CModelRun&&);
-	CModelRun (CSubject&, const string& session, const sigfile::SChannel&,
-		   const agh::SProfileParamSet&,
-		   const SControlParamSet&, const STunableSetWithState&);
-
-	enum TModrunFlags { modrun_tried = 1 };
-	int	status;
-	SControlParamSet
-		ctl_params;
-	STunableSet<TTRole::d>	tstep;
-	STunableSet<TTRole::l>	tlo;
-	STunableSet<TTRole::u>	thi;
-	STunableSet<TTRole::v>	t0;
-	STunableSetWithState	tx;
-
-	int watch_simplex_move( void (*)(void*));
-	double snapshot();
-	double cf;
-
-  //	double _siman_metric( const void *xp, const void *yp) const;
-  //	void _siman_step( const gsl_rng *r, void *xp,
-  //			  double step_size);
+        CModelRun (CModelRun&&);
+        CModelRun (CSubject&, const string& session, const sigfile::SChannel&,
+                   const agh::SProfileParamSet&,
+                   const SControlParamSet&, const STunableSetWithState&);
+
+        enum TModrunFlags { modrun_tried = 1 };
+        int        status;
+        SControlParamSet
+                ctl_params;
+        STunableSet<TTRole::d>        tstep;
+        STunableSet<TTRole::l>        tlo;
+        STunableSet<TTRole::u>        thi;
+        STunableSet<TTRole::v>        t0;
+        STunableSetWithState        tx;
+
+        int watch_simplex_move( void (*)(void*));
+        double snapshot();
+        double cf;
+
+  //        double _siman_metric( const void *xp, const void *yp) const;
+  //        void _siman_step( const gsl_rng *r, void *xp,
+  //                          double step_size);
     private:
-	vector<sigfile::SPage>
-		_scores2;  // we need shadow to hold scores as modified per Score{MVT,Unscored}As... and by t_{a,p},
-			   // and also to avoid recreating it before each stride
-	void _restore_scores_and_extend_rem( size_t, size_t);
-	void _prepare_scores2();
+        vector<sigfile::SPage>
+                _scores2;  // we need shadow to hold scores as modified per Score{MVT,Unscored}As... and by t_{a,p},
+                           // and also to avoid recreating it before each stride
+        void _restore_scores_and_extend_rem( size_t, size_t);
+        void _prepare_scores2();
 
-	const double &_which_gc( size_t p) const; // selects episode egc by page, or returns &gc if !AZAmendment
+        const double &_which_gc( size_t p) const; // selects episode egc by page, or returns &gc if !AZAmendment
 };
 
 
@@ -128,11 +128,11 @@ inline const double&
 CModelRun::
 _which_gc( size_t p) const // selects episode egc by page, or returns &gc if !AZAmendment
 {
-	if ( ctl_params.AZAmendment1 )
-		for ( size_t m = _mm_bounds.size()-1; m >= 1; --m )
-			if ( p >= _mm_bounds[m].first )
-				return tx[TTunable::gc + m];
-	return tx[TTunable::gc];
+        if ( ctl_params.AZAmendment1 )
+                for ( size_t m = _mm_bounds.size()-1; m >= 1; --m )
+                        if ( p >= _mm_bounds[m].first )
+                                return tx[TTunable::gc + m];
+        return tx[TTunable::gc];
 }
 
 
@@ -144,7 +144,7 @@ _which_gc( size_t p) const // selects episode egc by page, or returns &gc if !AZ
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/beersma.hh b/upstream/src/aghermann/model/beersma.hh
index 2349406..afd5ede 100644
--- a/upstream/src/aghermann/model/beersma.hh
+++ b/upstream/src/aghermann/model/beersma.hh
@@ -32,140 +32,140 @@ namespace beersma {
 
 
 struct SClassicFitWeightedData {
-	size_t	n;
-	double	*y,
-		*sigma;
-	int	pagesize;
-	double	SWA_0, SWA_L;
+        size_t        n;
+        double        *y,
+                *sigma;
+        int        pagesize;
+        double        SWA_0, SWA_L;
 };
 
 
 
 
 struct SClassicFit {
-	double	r;
+        double        r;
 };
 
 struct SClassicFitCtl {
-	SProfileParamSet
-		P;
-	double	sigma;
-	size_t	iterations;
+        SProfileParamSet
+                P;
+        double        sigma;
+        size_t        iterations;
 };
 
 class FClassicFit {
-	FClassicFit() = delete;
-	FClassicFit( const FClassicFit&) = delete;
+        FClassicFit() = delete;
+        FClassicFit( const FClassicFit&) = delete;
     public:
-	double	A, r, b;
-	FClassicFit (double A_, double r_, double b_)
-	      : A (A_), r (r_), b (b_)
-		{}
-	double operator()( double t) const
-		{
-			return A * exp(-r*t) + b;
-		}
+        double        A, r, b;
+        FClassicFit (double A_, double r_, double b_)
+              : A (A_), r (r_), b (b_)
+                {}
+        double operator()( double t) const
+                {
+                        return A * exp(-r*t) + b;
+                }
 };
 
 
 SClassicFit
 classic_fit( agh::CRecording&,
-	     const SClassicFitCtl&);
+             const SClassicFitCtl&);
 
 
 
 
 
 struct SUltradianCycle {
-	double	r, T, d, b;
-	SUltradianCycle& operator=( const SUltradianCycle&) = default;
-	static constexpr double
-		ir = 0.0001,  iT =   1., id =  .1, ib = .1, // the last one is a normalized value of metric
-		ur = 0.010,   uT = 130., ud =  60., ub = .01,
-		lr = 0.001,   lT =  60., ld = -60., lb = .1;
-	double	cf;
+        double        r, T, d, b;
+        SUltradianCycle& operator=( const SUltradianCycle&) = default;
+        static constexpr double
+                ir = 0.0001,  iT =   1., id =  .1, ib = .1, // the last one is a normalized value of metric
+                ur = 0.010,   uT = 130., ud =  60., ub = .01,
+                lr = 0.001,   lT =  60., ld = -60., lb = .1;
+        double        cf;
 };
 
 inline double
 distance( const SUltradianCycle& lv,
-	  const SUltradianCycle& rv)
+          const SUltradianCycle& rv)
 {
-	return sqrt(
-		gsl_pow_2( (lv.r - rv.r)/SUltradianCycle::ir) +
-		gsl_pow_2( (lv.T - rv.T)/SUltradianCycle::iT) +
-		gsl_pow_2( (lv.d - rv.d)/SUltradianCycle::id) +
-		gsl_pow_2( (lv.b - rv.d)/SUltradianCycle::ib));
+        return sqrt(
+                gsl_pow_2( (lv.r - rv.r)/SUltradianCycle::ir) +
+                gsl_pow_2( (lv.T - rv.T)/SUltradianCycle::iT) +
+                gsl_pow_2( (lv.d - rv.d)/SUltradianCycle::id) +
+                gsl_pow_2( (lv.b - rv.d)/SUltradianCycle::ib));
 }
 
 struct SUltradianCycleDetails {
-	time_t	start, end;
-	double	max, avg;
+        time_t        start, end;
+        double        max, avg;
 };
 
 
 struct SUltradianCycleCtl {
-	agh::SProfileParamSet
-		profile_params;
-
-	double	sigma;
-	gsl_siman_params_t
-		siman_params;
-		    // int n_tries
-		    // 	The number of points to try for each step.
-		    // int iters_fixed_T
-		    // 	The number of iterations at each temperature.
-		    // double step_size
-		    // 	The maximum step size in the random walk.
-		    // double k, t_initial, mu_t, t_min
+        agh::SProfileParamSet
+                profile_params;
+
+        double        sigma;
+        gsl_siman_params_t
+                siman_params;
+                    // int n_tries
+                    //         The number of points to try for each step.
+                    // int iters_fixed_T
+                    //         The number of iterations at each temperature.
+                    // double step_size
+                    //         The maximum step size in the random walk.
+                    // double k, t_initial, mu_t, t_min
 };
 
 
 class FUltradianCycle
   : public SUltradianCycle {
-	FUltradianCycle () = delete;
+        FUltradianCycle () = delete;
 
     public:
-	FUltradianCycle (const FUltradianCycle&) = default;
-	FUltradianCycle (const SUltradianCycle& rv)
-	      : SUltradianCycle (rv)
-		{}
-
-	double operator()( double t) const
-		{
-			return f(t);
-		}
-
-	// function
-	double f( double t) const
-		{
-			// if ( (unlikely (r > ur || r < lr ||
-			// 		T > uT || T < lT ||
-			// 		d > ud || d < ld ||
-			// 		b > ub || b < lb) ) )
-			//      return 1e9;
-			/// better let the caller do it just once
-			double A = -(exp(-r*t) * (cos((t+d)/T * 2 * M_PI) - 1)) - b;
-			return (A > 0.) ? A : 0.;
-		}
+        FUltradianCycle (const FUltradianCycle&) = default;
+        FUltradianCycle (const SUltradianCycle& rv)
+              : SUltradianCycle (rv)
+                {}
+
+        double operator()( double t) const
+                {
+                        return f(t);
+                }
+
+        // function
+        double f( double t) const
+                {
+                        // if ( (unlikely (r > ur || r < lr ||
+                        //                 T > uT || T < lT ||
+                        //                 d > ud || d < ld ||
+                        //                 b > ub || b < lb) ) )
+                        //      return 1e9;
+                        /// better let the caller do it just once
+                        double A = -(exp(-r*t) * (cos((t+d)/T * 2 * M_PI) - 1)) - b;
+                        return (A > 0.) ? A : 0.;
+                }
 };
 
 // struct SUltradianCycleWeightedData {
-// 	size_t	n;
-// 	double	*y,
-// 		*sigma;
-// 	int	pagesize;
+//         size_t        n;
+//         double        *y,
+//                 *sigma;
+//         int        pagesize;
 // };
 
 
 SUltradianCycle
 ultradian_cycles( agh::CRecording&,
-		  const SUltradianCycleCtl&,
-		  list<SUltradianCycleDetails>* extra = nullptr);
+                  const SUltradianCycleCtl&,
+                  list<SUltradianCycleDetails>* extra = nullptr);
 
 list<SUltradianCycleDetails>
 analyse_deeper( const SUltradianCycle&,
-		agh::CRecording&,
-		const SUltradianCycleCtl&);
+                agh::CRecording&,
+                const SUltradianCycleCtl&);
 
 } // namespace beersma
 } // namespace agh
@@ -174,7 +174,7 @@ analyse_deeper( const SUltradianCycle&,
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/borbely.cc b/upstream/src/aghermann/model/borbely.cc
index 2265259..480c00c 100644
--- a/upstream/src/aghermann/model/borbely.cc
+++ b/upstream/src/aghermann/model/borbely.cc
@@ -31,69 +31,69 @@ namespace {
 
 int
 expb_f( const gsl_vector* x, void* data,
-	gsl_vector* f)
+        gsl_vector* f)
 {
-	auto& D = *(agh::beersma::SClassicFitWeightedData*)data;
+        auto& D = *(agh::beersma::SClassicFitWeightedData*)data;
 
-	agh::beersma::FClassicFit
-		F (D.SWA_0,
-		   gsl_vector_get( x, 0),
-		   D.SWA_L);
-	for ( size_t i = 0; i < D.n; ++i ) {
-		/* Model Yi = A * exp(-lambda * i) + b */
-		double t = (i * D.pagesize) / 60.;
+        agh::beersma::FClassicFit
+                F (D.SWA_0,
+                   gsl_vector_get( x, 0),
+                   D.SWA_L);
+        for ( size_t i = 0; i < D.n; ++i ) {
+                /* Model Yi = A * exp(-lambda * i) + b */
+                double t = (i * D.pagesize) / 60.;
 
-//	if ( i % 30 == 0 ) printf( "Y[%zu] = %g\n", i, Yi);
-		gsl_vector_set( f, i, (F(t) - D.y[i]) / D.sigma[i]);
-	}
+//        if ( i % 30 == 0 ) printf( "Y[%zu] = %g\n", i, Yi);
+                gsl_vector_set( f, i, (F(t) - D.y[i]) / D.sigma[i]);
+        }
 
-	return GSL_SUCCESS;
+        return GSL_SUCCESS;
 }
 
 int
 expb_df( const gsl_vector* x, void* data,
-	 gsl_matrix* J)
+         gsl_matrix* J)
 {
-	auto& D = *(agh::beersma::SClassicFitWeightedData*)data;
-
-	double	r = gsl_vector_get( x, 0);
-
-	for ( size_t i = 0; i < D.n; ++i ) {
-		/* Jacobian matrix J(i,j) = dfi / dxj, */
-		/* where fi = (Yi - yi)/sigma[i],      */
-		/*       Yi = A * exp(-lambda * i) + b  */
-		/* and the xj are the parameters (A,lambda,b) */
-		// except that we have A = 1 here...
-		double	t = (i * D.pagesize) / 60.,
-			s = D.sigma[i],
-			e = exp(-r * t);
-//		gsl_matrix_set( J, i, 0, e/s);
-		gsl_matrix_set( J, i, 0, -t * D.SWA_0 * e/s);
-//		gsl_matrix_set( J, i, 1, 1/s);
-	}
-	return GSL_SUCCESS;
+        auto& D = *(agh::beersma::SClassicFitWeightedData*)data;
+
+        double        r = gsl_vector_get( x, 0);
+
+        for ( size_t i = 0; i < D.n; ++i ) {
+                /* Jacobian matrix J(i,j) = dfi / dxj, */
+                /* where fi = (Yi - yi)/sigma[i],      */
+                /*       Yi = A * exp(-lambda * i) + b  */
+                /* and the xj are the parameters (A,lambda,b) */
+                // except that we have A = 1 here...
+                double        t = (i * D.pagesize) / 60.,
+                        s = D.sigma[i],
+                        e = exp(-r * t);
+//                gsl_matrix_set( J, i, 0, e/s);
+                gsl_matrix_set( J, i, 0, -t * D.SWA_0 * e/s);
+//                gsl_matrix_set( J, i, 1, 1/s);
+        }
+        return GSL_SUCCESS;
 }
 
 int
 expb_fdf( const gsl_vector* x, void *data,
-	  gsl_vector* f, gsl_matrix* J)
+          gsl_vector* f, gsl_matrix* J)
 {
-	expb_f( x, data, f);
-	expb_df( x, data, J);
+        expb_f( x, data, f);
+        expb_df( x, data, J);
 
-	return GSL_SUCCESS;
+        return GSL_SUCCESS;
 }
 
 
 void
 print_state( size_t iter, gsl_multifit_fdfsolver* s)
 {
-	printf ("iter: %3zu x = % 15.8f "
-		"|f(x)| = %g\n",
-		iter,
-		gsl_vector_get (s->x, 0),
-//		gsl_vector_get (s->x, 1),
-		gsl_blas_dnrm2 (s->f));
+        printf ("iter: %3zu x = % 15.8f "
+                "|f(x)| = %g\n",
+                iter,
+                gsl_vector_get (s->x, 0),
+//                gsl_vector_get (s->x, 1),
+                gsl_blas_dnrm2 (s->f));
 }
 
 } // namespace
@@ -101,105 +101,105 @@ print_state( size_t iter, gsl_multifit_fdfsolver* s)
 agh::beersma::SClassicFit
 agh::beersma::
 classic_fit( agh::CRecording& M,
-	     const agh::beersma::SClassicFitCtl& P)
+             const agh::beersma::SClassicFitCtl& P)
 {
       // set up
-	auto	course = agh::alg::to_vad( M.course( P.P));
-	auto	pp = course.size(),
-		pagesize = M.pagesize();
+        auto        course = agh::alg::to_vad( M.course( P.P));
+        auto        pp = course.size(),
+                pagesize = M.pagesize();
 
 
       // determine A (SWA_0) and b (SWA_L)
-	double	SWA_0, SWA_L;
-	{
-		// this one doesn't throw
-		agh::CProfile tmp (M, P.P);
-		SWA_0 = tmp.SWA_0();
-		SWA_L = tmp.SWA_L();
-	}
-
-	valarray<double>
-		sigma (P.sigma, pp);
-	// {
-	// // use artifacts for weights
-	// 	auto	af = M.CBinnedPower::artifacts_in_samples(); // for common methods reaching to _using_F, one would fancy some disambiguating shortcut, no?
-	// 	for ( size_t i = 0; i < pp; ++i )
-	// 		sigma[i] = 1. - (agh::SSpan<size_t> (i, i+1) * pagesize * samplerate)
-	// 			. dirty( af);
-	// }
-
-	SClassicFitWeightedData wd = {
-		pp,
-		&course[0],
-		&sigma[0],
-		(int)pagesize,
-		// and also:
-		SWA_0, SWA_L,
-	};
+        double        SWA_0, SWA_L;
+        {
+                // this one doesn't throw
+                agh::CProfile tmp (M, P.P);
+                SWA_0 = tmp.SWA_0();
+                SWA_L = tmp.SWA_L();
+        }
+
+        valarray<double>
+                sigma (P.sigma, pp);
+        // {
+        // // use artifacts for weights
+        //         auto        af = M.CBinnedPower::artifacts_in_samples(); // for common methods reaching to _using_F, one would fancy some disambiguating shortcut, no?
+        //         for ( size_t i = 0; i < pp; ++i )
+        //                 sigma[i] = 1. - (agh::SSpan<size_t> (i, i+1) * pagesize * samplerate)
+        //                         . dirty( af);
+        // }
+
+        SClassicFitWeightedData wd = {
+                pp,
+                &course[0],
+                &sigma[0],
+                (int)pagesize,
+                // and also:
+                SWA_0, SWA_L,
+        };
 
       // set up (contd)
-	gsl_matrix *covar = gsl_matrix_alloc( 1, 1);
-	double x_init[1] = { 0.0046 }; // min^-1, physiologically plausible
-	gsl_vector_view X = gsl_vector_view_array( x_init, 1);
-
-	gsl_multifit_function_fdf F;
-	F.f = &expb_f;
-	F.df = &expb_df;
-	F.fdf = &expb_fdf;
-	F.n = pp;
-	F.p = 1;
-	F.params = &wd;
-
-	gsl_multifit_fdfsolver
-		*S = gsl_multifit_fdfsolver_alloc(
-			gsl_multifit_fdfsolver_lmsder,
-			pp, 1);
-	gsl_multifit_fdfsolver_set( S, &F, &X.vector);
+        gsl_matrix *covar = gsl_matrix_alloc( 1, 1);
+        double x_init[1] = { 0.0046 }; // min^-1, physiologically plausible
+        gsl_vector_view X = gsl_vector_view_array( x_init, 1);
+
+        gsl_multifit_function_fdf F;
+        F.f = &expb_f;
+        F.df = &expb_df;
+        F.fdf = &expb_fdf;
+        F.n = pp;
+        F.p = 1;
+        F.params = &wd;
+
+        gsl_multifit_fdfsolver
+                *S = gsl_multifit_fdfsolver_alloc(
+                        gsl_multifit_fdfsolver_lmsder,
+                        pp, 1);
+        gsl_multifit_fdfsolver_set( S, &F, &X.vector);
 
       // find it
-	int status;
-	unsigned int iter = 0;
-	do {
-		++iter;
-		status = gsl_multifit_fdfsolver_iterate( S);
+        int status;
+        unsigned int iter = 0;
+        do {
+                ++iter;
+                status = gsl_multifit_fdfsolver_iterate( S);
 
-		print_state( iter, S);
-		if ( status ) {
-			printf ("status = %s\n", gsl_strerror( status));
-			break;
-		}
+                print_state( iter, S);
+                if ( status ) {
+                        printf ("status = %s\n", gsl_strerror( status));
+                        break;
+                }
 
-		status = gsl_multifit_test_delta( S->dx, S->x,
-						  1e-4, 1e-4);
-	} while ( iter < P.iterations );
+                status = gsl_multifit_test_delta( S->dx, S->x,
+                                                  1e-4, 1e-4);
+        } while ( iter < P.iterations );
 
-	gsl_multifit_covar( S->J, 0.0, covar);
+        gsl_multifit_covar( S->J, 0.0, covar);
 
 #define FIT(i) gsl_vector_get( S->x, i)
 #define ERR(i) sqrt(gsl_matrix_get( covar, i, i))
-	{
-		double chi = gsl_blas_dnrm2(S->f);
-		double dof = pp - 1;
-		double c = GSL_MAX_DBL(1, chi / sqrt(dof));
+        {
+                double chi = gsl_blas_dnrm2(S->f);
+                double dof = pp - 1;
+                double c = GSL_MAX_DBL(1, chi / sqrt(dof));
 
-		printf("chisq/dof = %g\n",  gsl_pow_2(chi) / dof);
+                printf("chisq/dof = %g\n",  gsl_pow_2(chi) / dof);
 
-		printf ("r = %.5f +/- %.5f\n\n", FIT(0), c*ERR(0));
-	}
+                printf ("r = %.5f +/- %.5f\n\n", FIT(0), c*ERR(0));
+        }
 
-	double	rate = gsl_vector_get( S->x, 0);
+        double        rate = gsl_vector_get( S->x, 0);
 
-	gsl_multifit_fdfsolver_free( S);
-	gsl_matrix_free( covar);
+        gsl_multifit_fdfsolver_free( S);
+        gsl_matrix_free( covar);
 
-	return {rate};
+        return {rate};
 
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/forward-decls.hh b/upstream/src/aghermann/model/forward-decls.hh
index e3051cc..3597cbc 100644
--- a/upstream/src/aghermann/model/forward-decls.hh
+++ b/upstream/src/aghermann/model/forward-decls.hh
@@ -15,25 +15,25 @@
 
 namespace agh {
 
-	namespace ach {
+        namespace ach {
 
-		struct SControlParamSet;
-		class CModelRun;
+                struct SControlParamSet;
+                class CModelRun;
 
-		enum class TTRole;
-		template <TTRole Of> struct STunableSet;
-		struct STunableSetWithState;
-	}
+                enum class TTRole;
+                template <TTRole Of> struct STunableSet;
+                struct STunableSetWithState;
+        }
 
 
-	namespace beersma {
+        namespace beersma {
 
-		struct SClassicFit;
-		struct SClassicFitCtl;
+                struct SClassicFit;
+                struct SClassicFitCtl;
 
-		struct SUltradianCycle;
-		struct SUltradianCycleCtl;
-	}
+                struct SUltradianCycle;
+                struct SUltradianCycleCtl;
+        }
 
 } // namespace agh
 
@@ -42,7 +42,7 @@ namespace agh {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/model/ultradian-cycle.cc b/upstream/src/aghermann/model/ultradian-cycle.cc
index 6b58979..53e0ecb 100644
--- a/upstream/src/aghermann/model/ultradian-cycle.cc
+++ b/upstream/src/aghermann/model/ultradian-cycle.cc
@@ -26,27 +26,27 @@ using namespace std;
 namespace agh {
 namespace beersma {
 constexpr double
-	SUltradianCycle::ir, SUltradianCycle::iT, SUltradianCycle::id, SUltradianCycle::ib, // the last one is a normalized value of metric
-	SUltradianCycle::ur, SUltradianCycle::uT, SUltradianCycle::ud, SUltradianCycle::ub,
-	SUltradianCycle::lr, SUltradianCycle::lT, SUltradianCycle::ld, SUltradianCycle::lb;
+        SUltradianCycle::ir, SUltradianCycle::iT, SUltradianCycle::id, SUltradianCycle::ib, // the last one is a normalized value of metric
+        SUltradianCycle::ur, SUltradianCycle::uT, SUltradianCycle::ud, SUltradianCycle::ub,
+        SUltradianCycle::lr, SUltradianCycle::lT, SUltradianCycle::ld, SUltradianCycle::lb;
 }
 }
 
 namespace {
 
 struct SUltradianCyclePPack {
-	double X[4];
-	valarray<TFloat>* coursep;
-	size_t pagesize;
-	const agh::beersma::SUltradianCycleCtl* P;
-
-	// SUltradianCyclePPack () = delete;
-	// SUltradianCyclePPack (const SUltradianCyclePPack&) = default;
-	// SUltradianCyclePPack (const agh::beersma::SUltradianCycle& X_,
-	// 		      agh::CRecording* M_,
-	// 		      const agh::beersma::SUltradianCycleCtl* P_)
-	//       : X {X_.r, X_.T, X_.d, X_.b}, M (M_), P (P_)
-	// 	{}
+        double X[4];
+        valarray<TFloat>* coursep;
+        size_t pagesize;
+        const agh::beersma::SUltradianCycleCtl* P;
+
+        // SUltradianCyclePPack () = delete;
+        // SUltradianCyclePPack (const SUltradianCyclePPack&) = default;
+        // SUltradianCyclePPack (const agh::beersma::SUltradianCycle& X_,
+        //                       agh::CRecording* M_,
+        //                       const agh::beersma::SUltradianCycleCtl* P_)
+        //       : X {X_.r, X_.T, X_.d, X_.b}, M (M_), P (P_)
+        //         {}
 };
 
 
@@ -54,78 +54,78 @@ struct SUltradianCyclePPack {
 double
 uc_cost_function( void *xp)
 {
-	auto& P = *(SUltradianCyclePPack*)(xp);
-
-	agh::beersma::FUltradianCycle F ({P.X[0], P.X[1], P.X[2], P.X[3], NAN});
-	// if ( (unlikely (F.r > F.ur || F.r < F.lr ||
-	// 		F.T > F.uT || F.T < F.lT ||
-	// 		F.d > F.ud || F.d < F.ld ||
-	// 		F.b > F.ub || F.b < F.lb) ) )
-	// 	return 1e9;
-	double	cf = 0.;
-	for ( size_t p = 0; p < P.coursep->size(); ++p ) {
-		cf += gsl_pow_2( F(p*P.pagesize/60.) - (*P.coursep)[p]);
-	}
-//	printf( "CF = %g\n\n", sqrt(cf));
-	return sqrt(cf);
+        auto& P = *(SUltradianCyclePPack*)(xp);
+
+        agh::beersma::FUltradianCycle F ({P.X[0], P.X[1], P.X[2], P.X[3], NAN});
+        // if ( (unlikely (F.r > F.ur || F.r < F.lr ||
+        //                 F.T > F.uT || F.T < F.lT ||
+        //                 F.d > F.ud || F.d < F.ld ||
+        //                 F.b > F.ub || F.b < F.lb) ) )
+        //         return 1e9;
+        double        cf = 0.;
+        for ( size_t p = 0; p < P.coursep->size(); ++p ) {
+                cf += gsl_pow_2( F(p*P.pagesize/60.) - (*P.coursep)[p]);
+        }
+//        printf( "CF = %g\n\n", sqrt(cf));
+        return sqrt(cf);
 }
 
 void
 uc_siman_step( const gsl_rng *r, void *xp, double step_size)
 {
-	auto&	P = *(SUltradianCyclePPack*)(xp);
-	agh::beersma::SUltradianCycle
-		Xm = {P.X[0], P.X[1], P.X[2], P.X[3], NAN},
-		X0 = Xm;
+        auto&        P = *(SUltradianCyclePPack*)(xp);
+        agh::beersma::SUltradianCycle
+                Xm = {P.X[0], P.X[1], P.X[2], P.X[3], NAN},
+                X0 = Xm;
 
 retry:
-	double *pip;
-	const double *ipip, *upip, *lpip;
-	switch ( gsl_rng_uniform_int( r, 4) ) {
-	case 0:  pip = &Xm.r; ipip = &Xm.ir; lpip = &Xm.lr; upip = &Xm.ur; break;
-	case 1:  pip = &Xm.T; ipip = &Xm.iT; lpip = &Xm.lT; upip = &Xm.uT; break;
-	case 2:  pip = &Xm.d; ipip = &Xm.id; lpip = &Xm.ld; upip = &Xm.ud; break;
-	case 3:
-	default: pip = &Xm.b; ipip = &Xm.ib; lpip = &Xm.lb; upip = &Xm.ub; break;
-	}
-
-	bool go_positive = (bool)gsl_rng_uniform_int( r, 2);
-
-	double	d,
-		nudge = *ipip;
-	size_t nudges = 0;
-	do {
-		// nudge it a little,
-		// prevent from going out-of-bounds
-		if ( go_positive )
-			if ( likely (*pip + nudge < *upip) )
-				*pip += nudge;
-			else
-				goto retry;
-		else
-			if ( likely (*pip - nudge > *lpip) )
-				*pip -= nudge;
-			else
-				goto retry;
-
-		d = agh::beersma::distance( X0, Xm);
-		// printf( "  r = %g, T = %g, d = %g, b = %g; distance = %g\n",
-		// 	Xm.r, Xm.T, Xm.d, Xm.b, d);
-
-		if ( d > step_size && nudges == 0 ) {  // nudged too far from the outset
-			nudge /= 2;
-			Xm = X0;
-			continue;
-		}
-
-		++nudges;
-
-	} while ( d < step_size );
-
-	P.X[0] = Xm.r;
-	P.X[1] = Xm.T;
-	P.X[2] = Xm.d;
-	P.X[3] = Xm.b;
+        double *pip;
+        const double *ipip, *upip, *lpip;
+        switch ( gsl_rng_uniform_int( r, 4) ) {
+        case 0:  pip = &Xm.r; ipip = &Xm.ir; lpip = &Xm.lr; upip = &Xm.ur; break;
+        case 1:  pip = &Xm.T; ipip = &Xm.iT; lpip = &Xm.lT; upip = &Xm.uT; break;
+        case 2:  pip = &Xm.d; ipip = &Xm.id; lpip = &Xm.ld; upip = &Xm.ud; break;
+        case 3:
+        default: pip = &Xm.b; ipip = &Xm.ib; lpip = &Xm.lb; upip = &Xm.ub; break;
+        }
+
+        bool go_positive = (bool)gsl_rng_uniform_int( r, 2);
+
+        double        d,
+                nudge = *ipip;
+        size_t nudges = 0;
+        do {
+                // nudge it a little,
+                // prevent from going out-of-bounds
+                if ( go_positive )
+                        if ( likely (*pip + nudge < *upip) )
+                                *pip += nudge;
+                        else
+                                goto retry;
+                else
+                        if ( likely (*pip - nudge > *lpip) )
+                                *pip -= nudge;
+                        else
+                                goto retry;
+
+                d = agh::beersma::distance( X0, Xm);
+                // printf( "  r = %g, T = %g, d = %g, b = %g; distance = %g\n",
+                //         Xm.r, Xm.T, Xm.d, Xm.b, d);
+
+                if ( d > step_size && nudges == 0 ) {  // nudged too far from the outset
+                        nudge /= 2;
+                        Xm = X0;
+                        continue;
+                }
+
+                ++nudges;
+
+        } while ( d < step_size );
+
+        P.X[0] = Xm.r;
+        P.X[1] = Xm.T;
+        P.X[2] = Xm.d;
+        P.X[3] = Xm.b;
 }
 
 
@@ -133,20 +133,20 @@ retry:
 double
 uc_siman_metric( void *xp, void *yp)
 {
-	auto& P1 = *(SUltradianCyclePPack*)xp;
-	auto& P2 = *(SUltradianCyclePPack*)yp;
-	agh::beersma::SUltradianCycle
-		X1 = {P1.X[0], P1.X[1], P1.X[2], P1.X[3], NAN},
-		X2 = {P2.X[0], P2.X[1], P2.X[2], P2.X[3], NAN};
-	return agh::beersma::distance( X1, X2);
+        auto& P1 = *(SUltradianCyclePPack*)xp;
+        auto& P2 = *(SUltradianCyclePPack*)yp;
+        agh::beersma::SUltradianCycle
+                X1 = {P1.X[0], P1.X[1], P1.X[2], P1.X[3], NAN},
+                X2 = {P2.X[0], P2.X[1], P2.X[2], P2.X[3], NAN};
+        return agh::beersma::distance( X1, X2);
 }
 
 // void
 // uc_siman_print( void *xp)
 // {
-// 	auto& P = *(SUltradianCyclePPack*)(xp);
-// 	printf( "F r = %g, T = %g, d = %g, b = %g\n",
-// 		P.X[0], P.X[1], P.X[2], P.X[3]);
+//         auto& P = *(SUltradianCyclePPack*)(xp);
+//         printf( "F r = %g, T = %g, d = %g, b = %g\n",
+//                 P.X[0], P.X[1], P.X[2], P.X[3]);
 // }
 
 } // namespace
@@ -157,47 +157,47 @@ uc_siman_metric( void *xp, void *yp)
 agh::beersma::SUltradianCycle
 agh::beersma::
 ultradian_cycles( agh::CRecording& M,
-		  const agh::beersma::SUltradianCycleCtl& C,
-		  list<agh::beersma::SUltradianCycleDetails> *extra)
+                  const agh::beersma::SUltradianCycleCtl& C,
+                  list<agh::beersma::SUltradianCycleDetails> *extra)
 {
-	// normalize please
-	auto course = M.course( C.profile_params);
-	sigproc::smooth( course, 5u);
-	//auto avg = course.sum()/course.size();
-	course /= course.max() / 2; // because ultradian cycle function has a range of 2
-
-	SUltradianCyclePPack
-		P {{0.0046, 60., 0.2, 0.01},
-		   &course,
-		   M.pagesize(),
-		   &C};
-	gsl_siman_solve( agh::global::rng,
-			 (void*)&P,		//
-			 uc_cost_function,	// gsl_siman_Efunc_t,
-			 uc_siman_step,		// gsl_siman_step_t
-			 uc_siman_metric,	// gsl_siman_metric_t,
-			 NULL, //uc_siman_print,	// gsl_siman_print_t print_position,
-			 NULL, NULL, NULL,	// gsl_siman_copy_t copyfunc, gsl_siman_copy_construct_t copy_constructor, gsl_siman_destroy_t destructor,
-			 sizeof(SUltradianCyclePPack),	// size_t element_size,
-			 C.siman_params);		// gsl_siman_params_t
-
-	agh::beersma::SUltradianCycle
-		X = {P.X[0], P.X[1], P.X[2], P.X[3], NAN};
-
-	{
-		FUltradianCycle F (X);
-		X.cf = 0.;
-		for ( size_t p = 0; p < course.size(); ++p ) {
-			X.cf += gsl_pow_2( F(p*M.pagesize()/60.) - course[p]);
-		}
-		X.cf = sqrt(X.cf);
-	}
-
-
-	if ( extra )
-		*extra = analyse_deeper( X, M, C);
-
-	return X;
+        // normalize please
+        auto course = M.course( C.profile_params);
+        sigproc::smooth( course, 5u);
+        //auto avg = course.sum()/course.size();
+        course /= course.max() / 2; // because ultradian cycle function has a range of 2
+
+        SUltradianCyclePPack
+                P {{0.0046, 60., 0.2, 0.01},
+                   &course,
+                   M.pagesize(),
+                   &C};
+        gsl_siman_solve( agh::global::rng,
+                         (void*)&P,                //
+                         uc_cost_function,        // gsl_siman_Efunc_t,
+                         uc_siman_step,                // gsl_siman_step_t
+                         uc_siman_metric,        // gsl_siman_metric_t,
+                         NULL, //uc_siman_print,        // gsl_siman_print_t print_position,
+                         NULL, NULL, NULL,        // gsl_siman_copy_t copyfunc, gsl_siman_copy_construct_t copy_constructor, gsl_siman_destroy_t destructor,
+                         sizeof(SUltradianCyclePPack),        // size_t element_size,
+                         C.siman_params);                // gsl_siman_params_t
+
+        agh::beersma::SUltradianCycle
+                X = {P.X[0], P.X[1], P.X[2], P.X[3], NAN};
+
+        {
+                FUltradianCycle F (X);
+                X.cf = 0.;
+                for ( size_t p = 0; p < course.size(); ++p ) {
+                        X.cf += gsl_pow_2( F(p*M.pagesize()/60.) - course[p]);
+                }
+                X.cf = sqrt(X.cf);
+        }
+
+
+        if ( extra )
+                *extra = analyse_deeper( X, M, C);
+
+        return X;
 }
 
 
@@ -206,20 +206,20 @@ ultradian_cycles( agh::CRecording& M,
 list<agh::beersma::SUltradianCycleDetails>
 agh::beersma::
 analyse_deeper( const SUltradianCycle&,
-		agh::CRecording&,
-		const agh::beersma::SUltradianCycleCtl&)
+                agh::CRecording&,
+                const agh::beersma::SUltradianCycleCtl&)
 {
-	list<agh::beersma::SUltradianCycleDetails>
-		ret;
-	
+        list<agh::beersma::SUltradianCycleDetails>
+                ret;
+        
 
-	return move(ret);
+        return move(ret);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/patterns/patterns.cc b/upstream/src/aghermann/patterns/patterns.cc
index 7703bab..f0e6146 100644
--- a/upstream/src/aghermann/patterns/patterns.cc
+++ b/upstream/src/aghermann/patterns/patterns.cc
@@ -30,7 +30,7 @@ namespace {
 int
 scandir_filter( const struct dirent *e)
 {
-	return strcmp( e->d_name, ".") && strcmp( e->d_name, "..");
+        return strcmp( e->d_name, ".") && strcmp( e->d_name, "..");
 }
 }
 
@@ -42,84 +42,84 @@ template <>
 SPattern<TFloat>
 load_pattern( const char* fname) throw(invalid_argument)
 {
-	SPattern<TFloat>
-		P;
-
-	FILE *fd = fopen( fname, "r");
-	if ( fd ) {
-		size_t	full_sample;
-		double t1, t2, t3, t4;
-		if ( fscanf( fd,
-			     "%lg  %u %lg %lg  %lg %lg %u"
-			     " %lg %lg %lg %lg"
-			     " %zu %zu %zu %zu\n"
-			     "--DATA--\n",
-			     &P.Pp.env_scope,
-			     &P.Pp.bwf_order, &P.Pp.bwf_ffrom, &P.Pp.bwf_fupto,
-			     &P.Pp.dzcdf_step, &P.Pp.dzcdf_sigma, &P.Pp.dzcdf_smooth,
-			     &t1, &t2, &t3, &t4,
-			     &P.samplerate, &P.context_before, &P.context_after,
-			     &full_sample) == 15 ) {
-
-			get<0>(P.criteria) = t1;
-			get<1>(P.criteria) = t2;
-			get<2>(P.criteria) = t3;
-			get<3>(P.criteria) = t4;
-
-			if ( P.samplerate == 0 || P.samplerate > 4096 ||
-			     full_sample == 0 || full_sample > P.samplerate * 10 ||
-			     P.context_before > P.samplerate * 2 ||
-			     P.context_after > P.samplerate * 2 ||
-			     not P.Pp.sane() ) {
-				string msg = agh::str::sasprintf(
-					"load_pattern(\"%s\"): bogus data in header; removing file",
-					fname);
-				fprintf( stderr, "%s\n", msg.c_str());
-				P.thing.resize( 0);
-				fclose( fd);
-				unlink( fname);
-				throw invalid_argument (msg);
-			}
-
-			P.thing.resize( full_sample);
-			for ( size_t i = 0; i < full_sample; ++i ) {
-				double d;
-				if ( fscanf( fd, "%la", &d) != 1 ) {
-					string msg = agh::str::sasprintf(
-						"load_pattern(\"%s\"): short read at sample %zu; removing file",
-						fname, i);
-					fprintf( stderr, "%s\n", msg.c_str());
-					P.thing.resize( 0);
-					fclose( fd);
-					unlink( fname);
-					throw invalid_argument (msg);
-				} else
-					P.thing[i] = d;
-			}
-
-		} else {
-			P.thing.resize( 0);
-			string msg = agh::str::sasprintf( "load_pattern(\"%s\"): bad header, so removing file", fname);
-			fprintf( stderr, "%s\n", msg.c_str());
-			P.thing.resize( 0);
-			fclose( fd);
-			unlink( fname);
-			throw invalid_argument (msg);
-		}
-
-		fclose( fd);
-
-	} else {
-		string msg = agh::str::sasprintf( "Failed to open pattern %s", fname);
-		fprintf( stderr, "%s\n", msg.c_str());
-		throw invalid_argument (msg);
-	}
-
-	printf( "loaded pattern in %s\n", fname);
-	P.saved = true;
-	P.name = agh::str::tokens( fname, "/").back();
-	P.path = fname;
-	return P;
+        SPattern<TFloat>
+                P;
+
+        FILE *fd = fopen( fname, "r");
+        if ( fd ) {
+                size_t        full_sample;
+                double t1, t2, t3, t4;
+                if ( fscanf( fd,
+                             "%lg  %u %lg %lg  %lg %lg %u"
+                             " %lg %lg %lg %lg"
+                             " %zu %zu %zu %zu\n"
+                             "--DATA--\n",
+                             &P.Pp.env_scope,
+                             &P.Pp.bwf_order, &P.Pp.bwf_ffrom, &P.Pp.bwf_fupto,
+                             &P.Pp.dzcdf_step, &P.Pp.dzcdf_sigma, &P.Pp.dzcdf_smooth,
+                             &t1, &t2, &t3, &t4,
+                             &P.samplerate, &P.context_before, &P.context_after,
+                             &full_sample) == 15 ) {
+
+                        get<0>(P.criteria) = t1;
+                        get<1>(P.criteria) = t2;
+                        get<2>(P.criteria) = t3;
+                        get<3>(P.criteria) = t4;
+
+                        if ( P.samplerate == 0 || P.samplerate > 4096 ||
+                             full_sample == 0 || full_sample > P.samplerate * 10 ||
+                             P.context_before > P.samplerate * 2 ||
+                             P.context_after > P.samplerate * 2 ||
+                             not P.Pp.sane() ) {
+                                string msg = agh::str::sasprintf(
+                                        "load_pattern(\"%s\"): bogus data in header; removing file",
+                                        fname);
+                                fprintf( stderr, "%s\n", msg.c_str());
+                                P.thing.resize( 0);
+                                fclose( fd);
+                                unlink( fname);
+                                throw invalid_argument (msg);
+                        }
+
+                        P.thing.resize( full_sample);
+                        for ( size_t i = 0; i < full_sample; ++i ) {
+                                double d;
+                                if ( fscanf( fd, "%la", &d) != 1 ) {
+                                        string msg = agh::str::sasprintf(
+                                                "load_pattern(\"%s\"): short read at sample %zu; removing file",
+                                                fname, i);
+                                        fprintf( stderr, "%s\n", msg.c_str());
+                                        P.thing.resize( 0);
+                                        fclose( fd);
+                                        unlink( fname);
+                                        throw invalid_argument (msg);
+                                } else
+                                        P.thing[i] = d;
+                        }
+
+                } else {
+                        P.thing.resize( 0);
+                        string msg = agh::str::sasprintf( "load_pattern(\"%s\"): bad header, so removing file", fname);
+                        fprintf( stderr, "%s\n", msg.c_str());
+                        P.thing.resize( 0);
+                        fclose( fd);
+                        unlink( fname);
+                        throw invalid_argument (msg);
+                }
+
+                fclose( fd);
+
+        } else {
+                string msg = agh::str::sasprintf( "Failed to open pattern %s", fname);
+                fprintf( stderr, "%s\n", msg.c_str());
+                throw invalid_argument (msg);
+        }
+
+        printf( "loaded pattern in %s\n", fname);
+        P.saved = true;
+        P.name = agh::str::tokens( fname, "/").back();
+        P.path = fname;
+        return P;
 }
 
 
@@ -127,45 +127,45 @@ template <>
 int
 save_pattern( SPattern<TFloat>& P, const char* fname)
 {
-	if ( agh::fs::mkdir_with_parents( agh::fs::dirname(fname)) ) {
-		fprintf( stderr, "save_pattern(\"%s\"): mkdir %s failed\n", fname, agh::fs::dirname(fname).c_str());
-		return -1;
-	}
-	printf( "saving pattern in %s\n", fname);
-
-	FILE *fd = fopen( fname, "w");
-	try {
-		if ( !fd )
-			throw -2;
-
-		if ( fprintf( fd,
-			      "%g  %u %g %g  %g %g %u  %g %g %g %g\n"
-			      "%zu  %zu %zu %zu\n"
-			      "--DATA--\n",
-			      P.Pp.env_scope,
-			      P.Pp.bwf_order, P.Pp.bwf_ffrom, P.Pp.bwf_fupto,
-			      P.Pp.dzcdf_step, P.Pp.dzcdf_sigma, P.Pp.dzcdf_smooth,
-			      get<0>(P.criteria), get<1>(P.criteria), get<2>(P.criteria), get<3>(P.criteria),
-			      P.samplerate, P.context_before, P.context_after,
-			      P.thing.size()) < 1 ) {
-			fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname);
-			throw -3;
-		}
-
-		for ( size_t i = 0; i < P.thing.size(); ++i )
-			if ( fprintf( fd, "%a\n", (double)P.thing[i]) < 1 ) {
-				fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname);
-				throw -3;
-			}
-		fclose( fd);
-
-		return 0;
-
-	} catch (int ret) {
-		if ( fd )
-			fclose( fd);
-		return ret;
-	}
+        if ( agh::fs::mkdir_with_parents( agh::fs::dirname(fname)) ) {
+                fprintf( stderr, "save_pattern(\"%s\"): mkdir %s failed\n", fname, agh::fs::dirname(fname).c_str());
+                return -1;
+        }
+        printf( "saving pattern in %s\n", fname);
+
+        FILE *fd = fopen( fname, "w");
+        try {
+                if ( !fd )
+                        throw -2;
+
+                if ( fprintf( fd,
+                              "%g  %u %g %g  %g %g %u  %g %g %g %g\n"
+                              "%zu  %zu %zu %zu\n"
+                              "--DATA--\n",
+                              P.Pp.env_scope,
+                              P.Pp.bwf_order, P.Pp.bwf_ffrom, P.Pp.bwf_fupto,
+                              P.Pp.dzcdf_step, P.Pp.dzcdf_sigma, P.Pp.dzcdf_smooth,
+                              get<0>(P.criteria), get<1>(P.criteria), get<2>(P.criteria), get<3>(P.criteria),
+                              P.samplerate, P.context_before, P.context_after,
+                              P.thing.size()) < 1 ) {
+                        fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname);
+                        throw -3;
+                }
+
+                for ( size_t i = 0; i < P.thing.size(); ++i )
+                        if ( fprintf( fd, "%a\n", (double)P.thing[i]) < 1 ) {
+                                fprintf( stderr, "save_pattern(\"%s\"): write failed\n", fname);
+                                throw -3;
+                        }
+                fclose( fd);
+
+                return 0;
+
+        } catch (int ret) {
+                if ( fd )
+                        fclose( fd);
+                return ret;
+        }
 }
 
 
@@ -173,7 +173,7 @@ template <>
 int
 delete_pattern( const SPattern<TFloat>& P)
 {
-	return unlink( P.path.c_str());
+        return unlink( P.path.c_str());
 }
 
 
@@ -181,27 +181,27 @@ template <>
 list<pattern::SPattern<TFloat>>
 load_patterns_from_location<TFloat>( const string& loc, pattern::TOrigin origin)
 {
-	list<SPattern<TFloat>>
-		ret;
-
-	struct dirent **eps;
-	int	total = scandir( loc.c_str(), &eps, scandir_filter, alphasort);
-
-	if ( total != -1 ) {
-		for ( int i = 0; i < total; ++i ) {
-			try {
-				ret.push_back(
-					load_pattern<TFloat>( (loc + '/' + eps[i]->d_name).c_str()));
-				ret.back().origin = origin;
-			} catch (invalid_argument& ex) {
-				;
-			}
-			free( eps[i]);
-		}
-		free( (void*)eps);
-	}
-
-	return ret;
+        list<SPattern<TFloat>>
+                ret;
+
+        struct dirent **eps;
+        int        total = scandir( loc.c_str(), &eps, scandir_filter, alphasort);
+
+        if ( total != -1 ) {
+                for ( int i = 0; i < total; ++i ) {
+                        try {
+                                ret.push_back(
+                                        load_pattern<TFloat>( (loc + '/' + eps[i]->d_name).c_str()));
+                                ret.back().origin = origin;
+                        } catch (invalid_argument& ex) {
+                                ;
+                        }
+                        free( eps[i]);
+                }
+                free( (void*)eps);
+        }
+
+        return ret;
 }
 
 
@@ -209,7 +209,7 @@ load_patterns_from_location<TFloat>( const string& loc, pattern::TOrigin origin)
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/patterns/patterns.hh b/upstream/src/aghermann/patterns/patterns.hh
index 59e0e21..922b44f 100644
--- a/upstream/src/aghermann/patterns/patterns.hh
+++ b/upstream/src/aghermann/patterns/patterns.hh
@@ -32,49 +32,49 @@ template <typename T>
 class CMatch
   : public tuple<T, T, T, T> {
     public:
-	CMatch ()
-	      : tuple<T, T, T, T> (.1, .1, .1, .1) // empirically ok default
-		{}
-
-	bool good_enough( const CMatch<T>& rv) const
-		{
-			return get<0>(*this) < get<0>(rv) &&
-			       get<1>(*this) < get<1>(rv) &&
-			       get<2>(*this) < get<2>(rv) &&
-			       get<3>(*this) < get<3>(rv);
-		}
+        CMatch ()
+              : tuple<T, T, T, T> (.1, .1, .1, .1) // empirically ok default
+                {}
+
+        bool good_enough( const CMatch<T>& rv) const
+                {
+                        return get<0>(*this) < get<0>(rv) &&
+                               get<1>(*this) < get<1>(rv) &&
+                               get<2>(*this) < get<2>(rv) &&
+                               get<3>(*this) < get<3>(rv);
+                }
 };
 
 template <typename T>
 struct SPatternPPack {
-	double	env_scope;
-	double	bwf_ffrom,
-		bwf_fupto;
-	int	bwf_order;
-	double 	dzcdf_step,
-		dzcdf_sigma;
-	int	dzcdf_smooth;
-	bool operator==( const SPatternPPack<T>& rv) const // cannot be defaulted!
-		{
-			return	env_scope == rv.env_scope &&
-				bwf_ffrom == rv.bwf_ffrom &&
-				bwf_fupto == rv.bwf_fupto &&
-				bwf_order == rv.bwf_order &&
-				dzcdf_step == rv.dzcdf_step &&
-				dzcdf_sigma == rv.dzcdf_sigma &&
-				dzcdf_smooth == rv.dzcdf_smooth;
-		}
-	bool sane() const
-		{
-			return	env_scope > 0. && env_scope <= 1. &&
-				bwf_ffrom < bwf_fupto &&
-			        bwf_ffrom >= 0. && bwf_ffrom <= 50. &&
-				bwf_fupto >= 0. && bwf_fupto <= 50. &&
-				bwf_order > 0 && bwf_order <= 5 &&
-				dzcdf_step > 0. && dzcdf_step <= 1. &&
-				dzcdf_sigma > 0. && dzcdf_sigma <= 1. &&
-				dzcdf_smooth >= 0 && dzcdf_smooth <= 50;
-		}
+        double        env_scope;
+        double        bwf_ffrom,
+                bwf_fupto;
+        int        bwf_order;
+        double         dzcdf_step,
+                dzcdf_sigma;
+        int        dzcdf_smooth;
+        bool operator==( const SPatternPPack<T>& rv) const // cannot be defaulted!
+                {
+                        return        env_scope == rv.env_scope &&
+                                bwf_ffrom == rv.bwf_ffrom &&
+                                bwf_fupto == rv.bwf_fupto &&
+                                bwf_order == rv.bwf_order &&
+                                dzcdf_step == rv.dzcdf_step &&
+                                dzcdf_sigma == rv.dzcdf_sigma &&
+                                dzcdf_smooth == rv.dzcdf_smooth;
+                }
+        bool sane() const
+                {
+                        return        env_scope > 0. && env_scope <= 1. &&
+                                bwf_ffrom < bwf_fupto &&
+                                bwf_ffrom >= 0. && bwf_ffrom <= 50. &&
+                                bwf_fupto >= 0. && bwf_fupto <= 50. &&
+                                bwf_order > 0 && bwf_order <= 5 &&
+                                dzcdf_step > 0. && dzcdf_step <= 1. &&
+                                dzcdf_sigma > 0. && dzcdf_sigma <= 1. &&
+                                dzcdf_smooth >= 0 && dzcdf_smooth <= 50;
+                }
 }; // keep fields in order, or edit ctor by initializer_list
 
 
@@ -82,7 +82,7 @@ struct SPatternPPack {
 template <typename T>
 class CPatternTool
   : public SPatternPPack<T> {
-	DELETE_DEFAULT_METHODS (CPatternTool);
+        DELETE_DEFAULT_METHODS (CPatternTool);
 
     public:
       // the complete pattern signature is made of:
@@ -91,57 +91,57 @@ class CPatternTool
       // (c) target frequency (band-passed);
       // (d) instantaneous frequency at fine intervals;
 
-	CPatternTool (const sigproc::SSignalRef<T>& thing,
-		      size_t ctx_before_, size_t ctx_after_,
-		      const SPatternPPack<T>& Pp_)
-	      : SPatternPPack<T> (Pp_),
-		penv (thing),
-		ptarget_freq (thing),
-		pdzcdf (thing),
-		samplerate (thing.samplerate),
-		ctx_before (ctx_before_), ctx_after (ctx_after_)
-		{
-			if ( ctx_before + ctx_after >= 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,  // broken-down field
-		       const valarray<T>& env_l,
-		       const valarray<T>& target_freq,
-		       const valarray<T>& dzcdf,
-		       size_t inc);
-
-	vector<CMatch<T>>
-		diff;
-
-	size_t size_with_context() const
-		{
-			return ptarget_freq.signal.size();
-		}
-	size_t size_essential() const
-		{
-			return size_with_context()
-				- ctx_before - ctx_after;
-		}
+        CPatternTool (const sigproc::SSignalRef<T>& thing,
+                      size_t ctx_before_, size_t ctx_after_,
+                      const SPatternPPack<T>& Pp_)
+              : SPatternPPack<T> (Pp_),
+                penv (thing),
+                ptarget_freq (thing),
+                pdzcdf (thing),
+                samplerate (thing.samplerate),
+                ctx_before (ctx_before_), ctx_after (ctx_after_)
+                {
+                        if ( ctx_before + ctx_after >= 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,  // broken-down field
+                       const valarray<T>& env_l,
+                       const valarray<T>& target_freq,
+                       const valarray<T>& dzcdf,
+                       size_t inc);
+
+        vector<CMatch<T>>
+                diff;
+
+        size_t size_with_context() const
+                {
+                        return ptarget_freq.signal.size();
+                }
+        size_t size_essential() const
+                {
+                        return size_with_context()
+                                - ctx_before - ctx_after;
+                }
 
     private:
-	sigproc::SCachedEnvelope<T>
-		penv;
-	sigproc::SCachedBandPassCourse<T>
-		ptarget_freq;
-	sigproc::SCachedDzcdf<T>
-		pdzcdf;
-
-	size_t	samplerate;
-	size_t	ctx_before,
-		ctx_after;
-
-	T	crit_linear_unity;
-	double	crit_dzcdf_unity;
+        sigproc::SCachedEnvelope<T>
+                penv;
+        sigproc::SCachedBandPassCourse<T>
+                ptarget_freq;
+        sigproc::SCachedDzcdf<T>
+                pdzcdf;
+
+        size_t        samplerate;
+        size_t        ctx_before,
+                ctx_after;
+
+        T        crit_linear_unity;
+        double        crit_dzcdf_unity;
 };
 
 
@@ -149,49 +149,49 @@ class CPatternTool
 enum TOrigin { transient, subject, experiment, user, system };
 
 extern const char*
-	origin_markers[5];
+        origin_markers[5];
 
 
 template <typename T>
 struct SPattern {
-	string	name,
-		path;
-
-	TOrigin	origin;
-
-	bool	saved:1;
-
-	valarray<T>
-		thing;
-	size_t	samplerate;
-	size_t	context_before,
-		context_after;
-	static const size_t
-		context_pad = 100;
-	size_t pattern_size_essential() const
-		{
-			return thing.size() - context_before - context_after;
-		}
-
-	double pattern_length() const // in seconds
-		{
-			return (double)thing.size() / samplerate;
-		}
-
-	double pattern_length_essential() const
-		{
-			return (double)pattern_size_essential() / samplerate;
-		}
-
-	SPatternPPack<TFloat>
-		Pp;
-	CMatch<T>
-		criteria;
-
-	bool operator==( const SPattern<T>& rv) const
-		{
-			return origin == rv.origin && name == rv.name;
-		}
+        string        name,
+                path;
+
+        TOrigin        origin;
+
+        bool        saved:1;
+
+        valarray<T>
+                thing;
+        size_t        samplerate;
+        size_t        context_before,
+                context_after;
+        static const size_t
+                context_pad = 100;
+        size_t pattern_size_essential() const
+                {
+                        return thing.size() - context_before - context_after;
+                }
+
+        double pattern_length() const // in seconds
+                {
+                        return (double)thing.size() / samplerate;
+                }
+
+        double pattern_length_essential() const
+                {
+                        return (double)pattern_size_essential() / samplerate;
+                }
+
+        SPatternPPack<TFloat>
+                Pp;
+        CMatch<T>
+                criteria;
+
+        bool operator==( const SPattern<T>& rv) const
+                {
+                        return origin == rv.origin && name == rv.name;
+                }
 };
 
 
@@ -221,7 +221,7 @@ delete_pattern( const SPattern<T>&);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/patterns/patterns.ii b/upstream/src/aghermann/patterns/patterns.ii
index 50cec6b..b97a84e 100644
--- a/upstream/src/aghermann/patterns/patterns.ii
+++ b/upstream/src/aghermann/patterns/patterns.ii
@@ -19,61 +19,61 @@ template <typename T>
 int
 CPatternTool<T>::
 do_search( const valarray<T>& fenv_l,
-	   const valarray<T>& fenv_u,
-	   const valarray<T>& ftarget_freq,
-	   const valarray<T>& fdzcdf,
-	   size_t inc)
+           const valarray<T>& fenv_u,
+           const valarray<T>& ftarget_freq,
+           const valarray<T>& fdzcdf,
+           size_t inc)
 {
-	size_t fsize = ftarget_freq.size();
-	if ( inc == 0 || inc > fsize ) {
-		fprintf( stderr, "%s: bad search increment: %zu\n", __FUNCTION__, inc);
-		return -1;
-	}
-
-	// make it (each time) field-specific
-	crit_linear_unity =
-		fenv_u.sum() / fenv_u.size() -
-		fenv_l.sum() / fenv_l.size();
-	crit_dzcdf_unity =
-		fdzcdf.sum() / fdzcdf.size();
-
-	// printf( "field = %zu, thing = %zu(%zu), size_essential = %zu\n"
-	// 	"linear_unity %g; dzcdf_unity %g\n",
-	//  	fsize, ptarget_freq.signal.size(),
-	// 	penv.centre(SPatternPPack<T>::env_scope).size(), size_essential(),
-	// 	crit_linear_unity, crit_dzcdf_unity);
-
-	// here be all diffs
-	diff.resize( fsize);
-
-	size_t	essential_part = size_essential();
-	for ( ssize_t i = 0; i+inc < fsize - essential_part; i += inc ) {
-		auto	p0 = penv.centre( SPatternPPack<T>::env_scope),
-			p1 = penv.breadth( SPatternPPack<T>::env_scope),
-			p2 = ptarget_freq( SPatternPPack<T>::bwf_ffrom,
-					   SPatternPPack<T>::bwf_fupto,
-					   SPatternPPack<T>::bwf_order),
-			p3 = pdzcdf( SPatternPPack<T>::dzcdf_step,
-				     SPatternPPack<T>::dzcdf_sigma,
-				     SPatternPPack<T>::dzcdf_smooth);
-
-		T	d0 = 0., d1 = 0., d2 = 0., d3 = 0.;
-		for ( size_t j = 0; j < essential_part; ++j ) {
-			d0 += gsl_pow_2( p0[ctx_before + j] - (fenv_u[i+j] + fenv_l[i+j])/2);
-			d1 += gsl_pow_2( p1[ctx_before + j] - (fenv_u[i+j] - fenv_l[i+j]));
-			d2 += gsl_pow_2( p2[ctx_before + j] - ftarget_freq[i+j]);
-			d3 += gsl_pow_2( p3[ctx_before + j] - fdzcdf[i+j]);
-		}
-
-		get<0>(diff[i]) = sqrt(d0 / essential_part) / crit_linear_unity; // normalise
-		get<1>(diff[i]) = sqrt(d1 / essential_part) / crit_linear_unity;
-		get<2>(diff[i]) = sqrt(d2 / essential_part) / crit_linear_unity;
-		get<3>(diff[i]) = sqrt(d3 / essential_part) / crit_dzcdf_unity;
-
-		// if ( i % 25 == 0 ) printf( "at %zu d = [%g, %g, %g, %g]\ndiff = [%g, %g, %g, %g]\n", i, d0, d1, d2, d3, get<0>(diff[i]), get<1>(diff[i]), get<2>(diff[i]), get<3>(diff[i]));
-	}
-
-	return 0;
+        size_t fsize = ftarget_freq.size();
+        if ( inc == 0 || inc > fsize ) {
+                fprintf( stderr, "%s: bad search increment: %zu\n", __FUNCTION__, inc);
+                return -1;
+        }
+
+        // make it (each time) field-specific
+        crit_linear_unity =
+                fenv_u.sum() / fenv_u.size() -
+                fenv_l.sum() / fenv_l.size();
+        crit_dzcdf_unity =
+                fdzcdf.sum() / fdzcdf.size();
+
+        // printf( "field = %zu, thing = %zu(%zu), size_essential = %zu\n"
+        //         "linear_unity %g; dzcdf_unity %g\n",
+        //          fsize, ptarget_freq.signal.size(),
+        //         penv.centre(SPatternPPack<T>::env_scope).size(), size_essential(),
+        //         crit_linear_unity, crit_dzcdf_unity);
+
+        // here be all diffs
+        diff.resize( fsize);
+
+        size_t        essential_part = size_essential();
+        for ( ssize_t i = 0; i+inc < fsize - essential_part; i += inc ) {
+                auto        p0 = penv.centre( SPatternPPack<T>::env_scope),
+                        p1 = penv.breadth( SPatternPPack<T>::env_scope),
+                        p2 = ptarget_freq( SPatternPPack<T>::bwf_ffrom,
+                                           SPatternPPack<T>::bwf_fupto,
+                                           SPatternPPack<T>::bwf_order),
+                        p3 = pdzcdf( SPatternPPack<T>::dzcdf_step,
+                                     SPatternPPack<T>::dzcdf_sigma,
+                                     SPatternPPack<T>::dzcdf_smooth);
+
+                T        d0 = 0., d1 = 0., d2 = 0., d3 = 0.;
+                for ( size_t j = 0; j < essential_part; ++j ) {
+                        d0 += gsl_pow_2( p0[ctx_before + j] - (fenv_u[i+j] + fenv_l[i+j])/2);
+                        d1 += gsl_pow_2( p1[ctx_before + j] - (fenv_u[i+j] - fenv_l[i+j]));
+                        d2 += gsl_pow_2( p2[ctx_before + j] - ftarget_freq[i+j]);
+                        d3 += gsl_pow_2( p3[ctx_before + j] - fdzcdf[i+j]);
+                }
+
+                get<0>(diff[i]) = sqrt(d0 / essential_part) / crit_linear_unity; // normalise
+                get<1>(diff[i]) = sqrt(d1 / essential_part) / crit_linear_unity;
+                get<2>(diff[i]) = sqrt(d2 / essential_part) / crit_linear_unity;
+                get<3>(diff[i]) = sqrt(d3 / essential_part) / crit_dzcdf_unity;
+
+                // if ( i % 25 == 0 ) printf( "at %zu d = [%g, %g, %g, %g]\ndiff = [%g, %g, %g, %g]\n", i, d0, d1, d2, d3, get<0>(diff[i]), get<1>(diff[i]), get<2>(diff[i]), get<3>(diff[i]));
+        }
+
+        return 0;
 }
 
 
@@ -81,47 +81,47 @@ template <typename T>
 int
 CPatternTool<T>::
 do_search( const sigproc::SSignalRef<T>& signal,
-	   size_t inc)
+           size_t inc)
 {
-	if ( signal.samplerate != samplerate )
-		throw invalid_argument( "CPattern::find( SSignalRef&): not same samplerate");
+        if ( signal.samplerate != samplerate )
+                throw invalid_argument( "CPattern::find( SSignalRef&): not same samplerate");
 
-	return do_search( signal.signal,
-			  inc);
+        return do_search( signal.signal,
+                          inc);
 }
 
 template <typename T>
 int
 CPatternTool<T>::
 do_search( const valarray<T>& signal,
-	   size_t inc)
+           size_t inc)
 {
-	valarray<T> fenv_l, fenv_u;
-	sigproc::envelope(
-		{signal, samplerate}, SPatternPPack<T>::env_scope,
-		1./samplerate, &fenv_u, &fenv_l);
-
-	auto ftarget_freq =
-		exstrom::band_pass(
-			signal, samplerate,
-			SPatternPPack<T>::bwf_ffrom,
-			SPatternPPack<T>::bwf_fupto,
-			SPatternPPack<T>::bwf_order, true);
-	auto fdzcdf =
-		sigproc::dzcdf(
-			sigproc::SSignalRef<T> {signal, samplerate},
-			SPatternPPack<T>::dzcdf_step,
-			SPatternPPack<T>::dzcdf_sigma,
-			SPatternPPack<T>::dzcdf_smooth);
-
-	return do_search( fenv_l, fenv_u, ftarget_freq, fdzcdf,
-			  inc);
+        valarray<T> fenv_l, fenv_u;
+        sigproc::envelope(
+                {signal, samplerate}, SPatternPPack<T>::env_scope,
+                1./samplerate, &fenv_u, &fenv_l);
+
+        auto ftarget_freq =
+                exstrom::band_pass(
+                        signal, samplerate,
+                        SPatternPPack<T>::bwf_ffrom,
+                        SPatternPPack<T>::bwf_fupto,
+                        SPatternPPack<T>::bwf_order, true);
+        auto fdzcdf =
+                sigproc::dzcdf(
+                        sigproc::SSignalRef<T> {signal, samplerate},
+                        SPatternPPack<T>::dzcdf_step,
+                        SPatternPPack<T>::dzcdf_sigma,
+                        SPatternPPack<T>::dzcdf_smooth);
+
+        return do_search( fenv_l, fenv_u, ftarget_freq, fdzcdf,
+                          inc);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/print_version.cc b/upstream/src/aghermann/print_version.cc
index 5230e70..40ead33 100644
--- a/upstream/src/aghermann/print_version.cc
+++ b/upstream/src/aghermann/print_version.cc
@@ -15,12 +15,12 @@
 void
 print_version()
 {
-	printf( PACKAGE_STRING " built " __DATE__ " " __TIME__ " by " BUILT_BY "\n");
+        printf( PACKAGE_STRING " built " __DATE__ " " __TIME__ " by " BUILT_BY "\n");
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 70809e3..a6fc75f 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -29,43 +29,43 @@ int
 CScoreAssistant::
 score( agh::SEpisode& E)
 {
-	forward_list<agh::CRecording*> HH;
-	for ( auto &R : E.recordings )
-		if ( R.second.psd_profile.have_data() )
-			HH.push_front( &R.second);
+        forward_list<agh::CRecording*> HH;
+        for ( auto &R : E.recordings )
+                if ( R.second.psd_profile.have_data() )
+                        HH.push_front( &R.second);
 
-	forward_list<valarray<TFloat>>
-		courses_delta,
-		courses_theta;
-	for ( auto &H : HH ) {
-		courses_delta.emplace_front(
-			H->psd_profile.course(
-				agh::CExpDesign::freq_bands[metrics::TBand::delta][0],
-				agh::CExpDesign::freq_bands[metrics::TBand::delta][1]));
-		courses_theta.emplace_front(
-			H->psd_profile.course(
-				agh::CExpDesign::freq_bands[metrics::TBand::theta][0],
-				agh::CExpDesign::freq_bands[metrics::TBand::theta][1]));
-	}
+        forward_list<valarray<TFloat>>
+                courses_delta,
+                courses_theta;
+        for ( auto &H : HH ) {
+                courses_delta.emplace_front(
+                        H->psd_profile.course(
+                                agh::CExpDesign::freq_bands[metrics::TBand::delta][0],
+                                agh::CExpDesign::freq_bands[metrics::TBand::delta][1]));
+                courses_theta.emplace_front(
+                        H->psd_profile.course(
+                                agh::CExpDesign::freq_bands[metrics::TBand::theta][0],
+                                agh::CExpDesign::freq_bands[metrics::TBand::theta][1]));
+        }
 
-	auto& firstsource = E.sources.front();
-	for ( size_t p = 0; p < firstsource.pages(); ++p ) {
-		auto	Di = courses_delta.begin(),
-			Ti = courses_theta.begin();
-		int decision = 0;
-		for ( ; Di != courses_delta.end(); ++Di, ++Ti )
-			decision +=
-				( (*Di)[p] > (*Ti)[p] * nrem3_delta_theta_ratio );
-		if ( decision > 0 )
-			firstsource[p].mark( sigfile::SPage::TScore::nrem3);
-	}
-	return 0;
+        auto& firstsource = E.sources.front();
+        for ( size_t p = 0; p < firstsource.pages(); ++p ) {
+                auto        Di = courses_delta.begin(),
+                        Ti = courses_theta.begin();
+                int decision = 0;
+                for ( ; Di != courses_delta.end(); ++Di, ++Ti )
+                        decision +=
+                                ( (*Di)[p] > (*Ti)[p] * nrem3_delta_theta_ratio );
+                if ( decision > 0 )
+                        firstsource[p].mark( sigfile::SPage::TScore::nrem3);
+        }
+        return 0;
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/rk1968/rk1968.hh b/upstream/src/aghermann/rk1968/rk1968.hh
index a53986d..926faef 100644
--- a/upstream/src/aghermann/rk1968/rk1968.hh
+++ b/upstream/src/aghermann/rk1968/rk1968.hh
@@ -18,19 +18,19 @@ namespace agh {
 namespace rk1968 {
 
 struct SScoreAssistantPPack {
-	double	nrem3_delta_theta_ratio;
+        double        nrem3_delta_theta_ratio;
 
-	SScoreAssistantPPack (const SScoreAssistantPPack&) = default;
-	SScoreAssistantPPack ()
-	      : nrem3_delta_theta_ratio (1.5)
-		{}
+        SScoreAssistantPPack (const SScoreAssistantPPack&) = default;
+        SScoreAssistantPPack ()
+              : nrem3_delta_theta_ratio (1.5)
+                {}
 };
 
 class CScoreAssistant
   : public SScoreAssistantPPack {
 
     public:
-	int score( agh::SEpisode&);
+        int score( agh::SEpisode&);
 };
 
 
@@ -41,7 +41,7 @@ class CScoreAssistant
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/forward-decls.hh b/upstream/src/aghermann/ui/forward-decls.hh
index 03d7a97..7ab4151 100644
--- a/upstream/src/aghermann/ui/forward-decls.hh
+++ b/upstream/src/aghermann/ui/forward-decls.hh
@@ -28,7 +28,7 @@ class SModelrunFacility;
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/globals.cc b/upstream/src/aghermann/ui/globals.cc
index d23318d..14e64c4 100644
--- a/upstream/src/aghermann/ui/globals.cc
+++ b/upstream/src/aghermann/ui/globals.cc
@@ -15,24 +15,24 @@
 using namespace std;
 using namespace agh::ui;
 
-char	global::buf[AGH_BUF_SIZE];
+char        global::buf[AGH_BUF_SIZE];
 
 GdkDevice
-	*global::client_pointer;
+        *global::client_pointer;
 
 UniqueApp
-	*global::unique_app;
+        *global::unique_app;
 
 GtkWindow
-	*global::main_window;
+        *global::main_window;
 
-double	global::hdpmm,
-	global::vdpmm;
+double        global::hdpmm,
+        global::vdpmm;
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/globals.hh b/upstream/src/aghermann/ui/globals.hh
index ed263d2..3f47729 100644
--- a/upstream/src/aghermann/ui/globals.hh
+++ b/upstream/src/aghermann/ui/globals.hh
@@ -29,22 +29,22 @@ namespace global {
 
 // convenience assign-once vars
 extern UniqueApp
-	*unique_app;
+        *unique_app;
 
 extern GtkWindow
-	*main_window;
+        *main_window;
 
 extern GdkDevice
-	*client_pointer;
+        *client_pointer;
 
 extern double
-	hdpmm,
-	vdpmm;
+        hdpmm,
+        vdpmm;
 
 // quick tmp storage
 #define AGH_BUF_SIZE (1024*5)
 extern char
-	buf[AGH_BUF_SIZE];
+        buf[AGH_BUF_SIZE];
 
 }
 }
@@ -54,7 +54,7 @@ extern char
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mf/mf-construct.cc b/upstream/src/aghermann/ui/mf/mf-construct.cc
index 5d15781..caf6301 100644
--- a/upstream/src/aghermann/ui/mf/mf-construct.cc
+++ b/upstream/src/aghermann/ui/mf/mf-construct.cc
@@ -19,135 +19,135 @@ int
 SModelrunFacility::
 construct_widgets()
 {
-	if ( !(AGH_GBGETOBJ3 (builder, GtkWindow,	wModelrunFacility)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkDrawingArea,	daMFProfile)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkTextView,	lMFLog)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFLiveUpdate)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFHighlightWake)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFHighlightNREM)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFHighlightREM)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFLiveUpdate)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkScaleButton,	eMFSmooth)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkHBox,		cMFControls)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkLabel,	lMFCostFunction)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFClassicFit)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkLabel,	lMFClassicFit)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkButton,	bMFRun)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkButton,	bMFReset)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkToolButton,	bMFAccept)) )
-		return -1;
-
-	g_signal_connect( wModelrunFacility, "delete-event",
-			  (GCallback)wModelrunFacility_delete_event_cb,
-			  this);
-	g_signal_connect( eMFSmooth, "value-changed",
-			  (GCallback)eMFSmooth_value_changed_cb,
-			  this);
-
-	g_signal_connect( eMFHighlightNREM, "toggled",
-			  (GCallback)eMFHighlightNREM_toggled_cb,
-			  this);
-	g_signal_connect( eMFHighlightREM, "toggled",
-			  (GCallback)eMFHighlightREM_toggled_cb,
-			  this);
-	g_signal_connect( eMFHighlightWake, "toggled",
-			  (GCallback)eMFHighlightWake_toggled_cb,
-			  this);
-	g_signal_connect( eMFClassicFit, "toggled",
-			  (GCallback)eMFClassicFit_toggled_cb,
-			  this);
-
-	if ( !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFDB1)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFDB2)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFAZ1)) ||
-	     !(AGH_GBGETOBJ3 (builder, GtkCheckButton,	eMFAZ2)) )
-		return -1;
-
-	g_signal_connect( eMFDB1, "toggled",
-			  (GCallback)eMFDB1_toggled_cb,
-			  this);
-	g_signal_connect( eMFDB2, "toggled",
-			  (GCallback)eMFDB2_toggled_cb,
-			  this);
-	g_signal_connect( eMFAZ1, "toggled",
-			  (GCallback)eMFAZ1_toggled_cb,
-			  this);
-	g_signal_connect( eMFAZ2, "toggled",
-			  (GCallback)eMFAZ2_toggled_cb,
-			  this);
-
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrs" )] = agh::ach::TTunable::rs ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrc" )] = agh::ach::TTunable::rc ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcR")] = agh::ach::TTunable::fcR;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcW")] = agh::ach::TTunable::fcW;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVS0" )] = agh::ach::TTunable::S0 ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVSU" )] = agh::ach::TTunable::SU ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVta" )] = agh::ach::TTunable::ta ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVtp" )] = agh::ach::TTunable::tp ;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc1")] = agh::ach::TTunable::gc1;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc2")] = agh::ach::TTunable::gc2;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc3")] = agh::ach::TTunable::gc3;
-	eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc4")] = agh::ach::TTunable::gc4;
-	for ( auto &tuple : eMFVx )
-		if ( tuple.first == nullptr )
-			return -1;
-	if ( not csimulation.ctl_params.AZAmendment1 ) // disable gcx unless AZAmendment is in effect
-		for ( auto &tuple : eMFVx )
-			if ( tuple.second > agh::ach::TTunable::gc )
-				gtk_widget_set_sensitive( (GtkWidget*)tuple.first, FALSE);
-
-	for ( auto &tuple : eMFVx )
-		g_signal_connect( tuple.first, "value-changed",
-				  (GCallback)eMFVx_value_changed_cb,
-				  this);
-
-	g_object_set( (GObject*)lMFLog,
-		      "tabs", pango_tab_array_new_with_positions(
-			      6, TRUE,
-			      PANGO_TAB_LEFT, 50,
-			      PANGO_TAB_LEFT, 150,
-			      PANGO_TAB_LEFT, 240,
-			      PANGO_TAB_LEFT, 330,
-			      PANGO_TAB_LEFT, 420,
-			      PANGO_TAB_LEFT, 510),
-		      NULL);
-
-
-	auto font_desc = pango_font_description_from_string( "Mono 9");
-	gtk_widget_override_font( (GtkWidget*)lMFLog, font_desc);
-	pango_font_description_free( font_desc);
-
-	log_text_buffer = gtk_text_view_get_buffer( lMFLog);
-
-	g_signal_connect( daMFProfile, "configure-event",
-			  (GCallback)daMFProfile_configure_event_cb,
-			  this);
-	g_signal_connect( daMFProfile, "draw",
-			  (GCallback)daMFProfile_draw_cb,
-			  this);
-	g_signal_connect( daMFProfile, "button-press-event",
-			  (GCallback)daMFProfile_button_press_event_cb,
-			  this);
-	g_signal_connect( daMFProfile, "scroll-event",
-			  (GCallback)daMFProfile_scroll_event_cb,
-			  this);
-
-	g_signal_connect( bMFRun, "clicked",
-			  (GCallback)bMFRun_clicked_cb,
-			  this);
-	g_signal_connect( bMFReset, "clicked",
-			  (GCallback)bMFReset_clicked_cb,
-			  this);
-	g_signal_connect( bMFAccept, "clicked",
-			  (GCallback)bMFAccept_clicked_cb,
-			  this);
-
-	return 0;
+        if ( !(AGH_GBGETOBJ3 (builder, GtkWindow,        wModelrunFacility)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkDrawingArea,        daMFProfile)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkTextView,        lMFLog)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFLiveUpdate)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFHighlightWake)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFHighlightNREM)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFHighlightREM)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFLiveUpdate)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkScaleButton,        eMFSmooth)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkHBox,                cMFControls)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkLabel,        lMFCostFunction)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFClassicFit)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkLabel,        lMFClassicFit)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkButton,        bMFRun)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkButton,        bMFReset)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkToolButton,        bMFAccept)) )
+                return -1;
+
+        g_signal_connect( wModelrunFacility, "delete-event",
+                          (GCallback)wModelrunFacility_delete_event_cb,
+                          this);
+        g_signal_connect( eMFSmooth, "value-changed",
+                          (GCallback)eMFSmooth_value_changed_cb,
+                          this);
+
+        g_signal_connect( eMFHighlightNREM, "toggled",
+                          (GCallback)eMFHighlightNREM_toggled_cb,
+                          this);
+        g_signal_connect( eMFHighlightREM, "toggled",
+                          (GCallback)eMFHighlightREM_toggled_cb,
+                          this);
+        g_signal_connect( eMFHighlightWake, "toggled",
+                          (GCallback)eMFHighlightWake_toggled_cb,
+                          this);
+        g_signal_connect( eMFClassicFit, "toggled",
+                          (GCallback)eMFClassicFit_toggled_cb,
+                          this);
+
+        if ( !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFDB1)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFDB2)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFAZ1)) ||
+             !(AGH_GBGETOBJ3 (builder, GtkCheckButton,        eMFAZ2)) )
+                return -1;
+
+        g_signal_connect( eMFDB1, "toggled",
+                          (GCallback)eMFDB1_toggled_cb,
+                          this);
+        g_signal_connect( eMFDB2, "toggled",
+                          (GCallback)eMFDB2_toggled_cb,
+                          this);
+        g_signal_connect( eMFAZ1, "toggled",
+                          (GCallback)eMFAZ1_toggled_cb,
+                          this);
+        g_signal_connect( eMFAZ2, "toggled",
+                          (GCallback)eMFAZ2_toggled_cb,
+                          this);
+
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrs" )] = agh::ach::TTunable::rs ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVrc" )] = agh::ach::TTunable::rc ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcR")] = agh::ach::TTunable::fcR;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVfcW")] = agh::ach::TTunable::fcW;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVS0" )] = agh::ach::TTunable::S0 ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVSU" )] = agh::ach::TTunable::SU ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVta" )] = agh::ach::TTunable::ta ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVtp" )] = agh::ach::TTunable::tp ;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc1")] = agh::ach::TTunable::gc1;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc2")] = agh::ach::TTunable::gc2;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc3")] = agh::ach::TTunable::gc3;
+        eMFVx[(GtkSpinButton*)gtk_builder_get_object( builder, "eMFVgc4")] = agh::ach::TTunable::gc4;
+        for ( auto &tuple : eMFVx )
+                if ( tuple.first == nullptr )
+                        return -1;
+        if ( not csimulation.ctl_params.AZAmendment1 ) // disable gcx unless AZAmendment is in effect
+                for ( auto &tuple : eMFVx )
+                        if ( tuple.second > agh::ach::TTunable::gc )
+                                gtk_widget_set_sensitive( (GtkWidget*)tuple.first, FALSE);
+
+        for ( auto &tuple : eMFVx )
+                g_signal_connect( tuple.first, "value-changed",
+                                  (GCallback)eMFVx_value_changed_cb,
+                                  this);
+
+        g_object_set( (GObject*)lMFLog,
+                      "tabs", pango_tab_array_new_with_positions(
+                              6, TRUE,
+                              PANGO_TAB_LEFT, 50,
+                              PANGO_TAB_LEFT, 150,
+                              PANGO_TAB_LEFT, 240,
+                              PANGO_TAB_LEFT, 330,
+                              PANGO_TAB_LEFT, 420,
+                              PANGO_TAB_LEFT, 510),
+                      NULL);
+
+
+        auto font_desc = pango_font_description_from_string( "Mono 9");
+        gtk_widget_override_font( (GtkWidget*)lMFLog, font_desc);
+        pango_font_description_free( font_desc);
+
+        log_text_buffer = gtk_text_view_get_buffer( lMFLog);
+
+        g_signal_connect( daMFProfile, "configure-event",
+                          (GCallback)daMFProfile_configure_event_cb,
+                          this);
+        g_signal_connect( daMFProfile, "draw",
+                          (GCallback)daMFProfile_draw_cb,
+                          this);
+        g_signal_connect( daMFProfile, "button-press-event",
+                          (GCallback)daMFProfile_button_press_event_cb,
+                          this);
+        g_signal_connect( daMFProfile, "scroll-event",
+                          (GCallback)daMFProfile_scroll_event_cb,
+                          this);
+
+        g_signal_connect( bMFRun, "clicked",
+                          (GCallback)bMFRun_clicked_cb,
+                          this);
+        g_signal_connect( bMFReset, "clicked",
+                          (GCallback)bMFReset_clicked_cb,
+                          this);
+        g_signal_connect( bMFAccept, "clicked",
+                          (GCallback)bMFAccept_clicked_cb,
+                          this);
+
+        return 0;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mf/mf.cc b/upstream/src/aghermann/ui/mf/mf.cc
index f4d7184..f1cdd3b 100644
--- a/upstream/src/aghermann/ui/mf/mf.cc
+++ b/upstream/src/aghermann/ui/mf/mf.cc
@@ -25,7 +25,7 @@ using namespace agh::ui;
 
 namespace {
 unsigned short __score_hypn_depth[8] = {
-	0, 20, 23, 30, 33, 5, 10, 1
+        0, 20, 23, 30, 33, 5, 10, 1
 };
 }
 
@@ -34,90 +34,90 @@ SModelrunFacility::
 SModelrunFacility (agh::ach::CModelRun& csim, SExpDesignUI& parent)
       : csimulation (csim),
 // subject is known only by name, so look up his full object now
-	// not sure we need this though
-	display_factor (1.),
-	zoomed_episode (-1),
-	_tunables_header_printed (false),
-	highlight_nrem (true),
-	highlight_rem (false),
-	highlight_wake (false),
-	_p (parent)
+        // not sure we need this though
+        display_factor (1.),
+        zoomed_episode (-1),
+        _tunables_header_printed (false),
+        highlight_nrem (true),
+        highlight_rem (false),
+        highlight_wake (false),
+        _p (parent)
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mf.glade", NULL) ) {
-		g_object_unref( (GObject*)builder);
-		throw runtime_error( "SModelrunFacility::SModelrunFacility(): Failed to load GtkBuilder object");
-	}
-	if ( construct_widgets() )
-		throw runtime_error( "SModelrunFacility::SModelrunFacility(): Failed to construct own widgets");
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mf.glade", NULL) ) {
+                g_object_unref( (GObject*)builder);
+                throw runtime_error( "SModelrunFacility::SModelrunFacility(): Failed to load GtkBuilder object");
+        }
+        if ( construct_widgets() )
+                throw runtime_error( "SModelrunFacility::SModelrunFacility(): Failed to construct own widgets");
 
-	_suppress_Vx_value_changed = true;
+        _suppress_Vx_value_changed = true;
 
       // do a single cycle to produce SWA_sim and Process S
-	cf = csim.snapshot();
+        cf = csim.snapshot();
 
       // determine SWA_max, for scaling purposes;
-	SWA_max = 0.;
-	for ( size_t p = 0; p < csim.timeline().size(); ++p )
-		if ( csim[p].metric > SWA_max )
-			SWA_max = csim[p].metric;
-
-	gtk_window_set_title(
-		wModelrunFacility,
-		snprintf_buf(
-			"Simulation: %s (%s) in %s (%s)",
-			csim.subject(), csim.session(), csim.channel(),
-			csim.P().display_name().c_str()));
-	gtk_window_set_default_size(
-		wModelrunFacility,
-		gdk_screen_get_width( gdk_screen_get_default()) * .80,
-		gdk_screen_get_height( gdk_screen_get_default()) * .55);
-
-	gtk_toggle_button_set_active( (GtkToggleButton*)eMFDB1, csim.ctl_params.DBAmendment1);
-	gtk_toggle_button_set_active( (GtkToggleButton*)eMFDB2, csim.ctl_params.DBAmendment2);
-	gtk_toggle_button_set_active( (GtkToggleButton*)eMFAZ1, csim.ctl_params.AZAmendment1);
-	gtk_toggle_button_set_active( (GtkToggleButton*)eMFAZ2, csim.ctl_params.AZAmendment2);
-	gtk_scale_button_set_value( eMFSmooth, swa_smoothover);
-	update_infobar();
-
-	snprintf_buf(
-		"### Simulation: %s (%s) in %s (%s)\n"
-		"# sim start at p. %zu, end at p. %zu, baseline end at p. %zu,\n"
-		"# %zu pp with SWA, %zu pp in bed;\n"
-		"# SWA_L = %g, SWA[0] = %g, 100%% SWA = %g\n",
-		csim.subject(),
-		_p.AghD(), _p.AghH(), csim.P().display_name().c_str(),
-		csim.sim_start(), csim.sim_end(), csim.baseline_end(),
-		csim.pages_with_swa(), csim.pages_in_bed(),
-		csim.SWA_L(), csim.SWA_0(), csim.SWA_100());
-	gtk_text_buffer_set_text( log_text_buffer, global::buf, -1);
-
-	for ( auto &tuple : eMFVx ) {
-		auto	jdst = gtk_spin_button_get_adjustment( tuple.first);
-		auto	t = min((size_t)tuple.second, (size_t)agh::ach::TTunable::_basic_tunables - 1);
-		gtk_adjustment_configure(
-			jdst,
-			csimulation.tx [t] * agh::ach::stock[t].display_scale_factor,
-			csimulation.tlo[t] * agh::ach::stock[t].display_scale_factor,
-			csimulation.thi[t] * agh::ach::stock[t].display_scale_factor,
-			agh::ach::stock[t].adj_step,
-			agh::ach::stock[t].adj_step * 10,
-			0.);
-	}
-
-	gtk_button_set_label(
-		(GtkButton*)eMFSmooth,
-		snprintf_buf( "Smooth: %zu", swa_smoothover));
-
-	gtk_widget_show_all( (GtkWidget*)wModelrunFacility);
+        SWA_max = 0.;
+        for ( size_t p = 0; p < csim.timeline().size(); ++p )
+                if ( csim[p].metric > SWA_max )
+                        SWA_max = csim[p].metric;
+
+        gtk_window_set_title(
+                wModelrunFacility,
+                snprintf_buf(
+                        "Simulation: %s (%s) in %s (%s)",
+                        csim.subject(), csim.session(), csim.channel(),
+                        csim.P().display_name().c_str()));
+        gtk_window_set_default_size(
+                wModelrunFacility,
+                gdk_screen_get_width( gdk_screen_get_default()) * .80,
+                gdk_screen_get_height( gdk_screen_get_default()) * .55);
+
+        gtk_toggle_button_set_active( (GtkToggleButton*)eMFDB1, csim.ctl_params.DBAmendment1);
+        gtk_toggle_button_set_active( (GtkToggleButton*)eMFDB2, csim.ctl_params.DBAmendment2);
+        gtk_toggle_button_set_active( (GtkToggleButton*)eMFAZ1, csim.ctl_params.AZAmendment1);
+        gtk_toggle_button_set_active( (GtkToggleButton*)eMFAZ2, csim.ctl_params.AZAmendment2);
+        gtk_scale_button_set_value( eMFSmooth, swa_smoothover);
+        update_infobar();
+
+        snprintf_buf(
+                "### Simulation: %s (%s) in %s (%s)\n"
+                "# sim start at p. %zu, end at p. %zu, baseline end at p. %zu,\n"
+                "# %zu pp with SWA, %zu pp in bed;\n"
+                "# SWA_L = %g, SWA[0] = %g, 100%% SWA = %g\n",
+                csim.subject(),
+                _p.AghD(), _p.AghH(), csim.P().display_name().c_str(),
+                csim.sim_start(), csim.sim_end(), csim.baseline_end(),
+                csim.pages_with_swa(), csim.pages_in_bed(),
+                csim.SWA_L(), csim.SWA_0(), csim.SWA_100());
+        gtk_text_buffer_set_text( log_text_buffer, global::buf, -1);
+
+        for ( auto &tuple : eMFVx ) {
+                auto        jdst = gtk_spin_button_get_adjustment( tuple.first);
+                auto        t = min((size_t)tuple.second, (size_t)agh::ach::TTunable::_basic_tunables - 1);
+                gtk_adjustment_configure(
+                        jdst,
+                        csimulation.tx [t] * agh::ach::stock[t].display_scale_factor,
+                        csimulation.tlo[t] * agh::ach::stock[t].display_scale_factor,
+                        csimulation.thi[t] * agh::ach::stock[t].display_scale_factor,
+                        agh::ach::stock[t].adj_step,
+                        agh::ach::stock[t].adj_step * 10,
+                        0.);
+        }
+
+        gtk_button_set_label(
+                (GtkButton*)eMFSmooth,
+                snprintf_buf( "Smooth: %zu", swa_smoothover));
+
+        gtk_widget_show_all( (GtkWidget*)wModelrunFacility);
 }
 
 
 SModelrunFacility::
 ~SModelrunFacility()
 {
-	gtk_widget_destroy( (GtkWidget*)wModelrunFacility);
-	g_object_unref( (GObject*)builder);
+        gtk_widget_destroy( (GtkWidget*)wModelrunFacility);
+        g_object_unref( (GObject*)builder);
 }
 
 
@@ -125,12 +125,12 @@ void
 SModelrunFacility::
 siman_param_printer( void* /* xp */)
 {
-//	memcpy( __t_set.tunables, xp, __t_set.n_tunables * sizeof(double));
-	// access this directly, no?
-	gtk_widget_queue_draw( (GtkWidget*)daMFProfile);
-	update_infobar();
-	while ( gtk_events_pending() )
-		gtk_main_iteration();
+//        memcpy( __t_set.tunables, xp, __t_set.n_tunables * sizeof(double));
+        // access this directly, no?
+        gtk_widget_queue_draw( (GtkWidget*)daMFProfile);
+        update_infobar();
+        while ( gtk_events_pending() )
+                gtk_main_iteration();
 }
 
 
@@ -143,72 +143,72 @@ SModelrunFacility::
 draw_timeline( cairo_t *cr)
 {
       // empirical SWA
-	size_t	cur_ep;
-
-	if ( zoomed_episode != -1 ) {
-		size_t	ep_start = csimulation.nth_episode_start_page( zoomed_episode),
-			ep_end   = csimulation.nth_episode_end_page  ( zoomed_episode);
-		draw_episode( cr,
-			      zoomed_episode,
-			      ep_start, ep_end,
-			      ep_start, ep_end);
-		draw_ticks( cr, ep_start, ep_end);
-	} else {
-	      // draw day and night
-		{
-			time_t	timeline_start = csimulation.mm_list().front()->start(),
-				timeline_end   = csimulation.mm_list().back()->end();
-
-			cairo_pattern_t *cp = cairo_pattern_create_linear( 0., 0., da_wd, 0);
-			struct tm clock_time;
-			memcpy( &clock_time, localtime( &timeline_start), sizeof(clock_time));
-			clock_time.tm_hour = 4;
-			clock_time.tm_min = clock_time.tm_sec = 0;
-			time_t	dawn = mktime( &clock_time),
-				t;
-			bool up = false;
-
-			for ( t = dawn; t < timeline_end; t += 3600 * 12, up = !up )
-				if ( t > timeline_start )
-					_p.CwB[up ? SExpDesignUI::TColour::mw_day : SExpDesignUI::TColour::mw_night].
-						pattern_add_color_stop_rgba( cp, (difftime( t, timeline_start)/(timeline_end-timeline_start)));
-			cairo_set_source( cr, cp);
-			cairo_rectangle( cr, 0., 0., da_wd, da_ht);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-			cairo_pattern_destroy( cp);
-		}
-	      // draw episodes
-		for ( cur_ep = 0; cur_ep < csimulation.mm_list().size(); ++cur_ep )
-			draw_episode( cr,
-				      cur_ep,
-				      csimulation.nth_episode_start_page( cur_ep),
-				      csimulation.nth_episode_end_page  ( cur_ep),
-				      0, csimulation.timeline().size());
-	      // Process S in one go for the entire timeline
-		cairo_set_line_width( cr, 2.);
-		_p.CwB[SExpDesignUI::TColour::mf_process_s].set_source_rgba( cr);
-		cairo_move_to( cr, tl_pad + 0,
-			       da_ht - lgd_margin-hypn_depth
-			       - csimulation[csimulation.sim_start()].S * da_ht / SWA_max * display_factor);
-		for ( size_t i = csimulation.sim_start()+1; i < csimulation.timeline().size(); ++i )
-			cairo_line_to( cr,
-				       tl_pad + (float)i / csimulation.timeline().size() * da_wd_actual(),
-				       da_ht - lgd_margin-hypn_depth
-				       - csimulation[i].S * da_ht / SWA_max * display_factor);
-		cairo_stroke( cr);
-
-		draw_ticks( cr, 0, csimulation.timeline().size());
-	}
+        size_t        cur_ep;
+
+        if ( zoomed_episode != -1 ) {
+                size_t        ep_start = csimulation.nth_episode_start_page( zoomed_episode),
+                        ep_end   = csimulation.nth_episode_end_page  ( zoomed_episode);
+                draw_episode( cr,
+                              zoomed_episode,
+                              ep_start, ep_end,
+                              ep_start, ep_end);
+                draw_ticks( cr, ep_start, ep_end);
+        } else {
+              // draw day and night
+                {
+                        time_t        timeline_start = csimulation.mm_list().front()->start(),
+                                timeline_end   = csimulation.mm_list().back()->end();
+
+                        cairo_pattern_t *cp = cairo_pattern_create_linear( 0., 0., da_wd, 0);
+                        struct tm clock_time;
+                        memcpy( &clock_time, localtime( &timeline_start), sizeof(clock_time));
+                        clock_time.tm_hour = 4;
+                        clock_time.tm_min = clock_time.tm_sec = 0;
+                        time_t        dawn = mktime( &clock_time),
+                                t;
+                        bool up = false;
+
+                        for ( t = dawn; t < timeline_end; t += 3600 * 12, up = !up )
+                                if ( t > timeline_start )
+                                        _p.CwB[up ? SExpDesignUI::TColour::mw_day : SExpDesignUI::TColour::mw_night].
+                                                pattern_add_color_stop_rgba( cp, (difftime( t, timeline_start)/(timeline_end-timeline_start)));
+                        cairo_set_source( cr, cp);
+                        cairo_rectangle( cr, 0., 0., da_wd, da_ht);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+                        cairo_pattern_destroy( cp);
+                }
+              // draw episodes
+                for ( cur_ep = 0; cur_ep < csimulation.mm_list().size(); ++cur_ep )
+                        draw_episode( cr,
+                                      cur_ep,
+                                      csimulation.nth_episode_start_page( cur_ep),
+                                      csimulation.nth_episode_end_page  ( cur_ep),
+                                      0, csimulation.timeline().size());
+              // Process S in one go for the entire timeline
+                cairo_set_line_width( cr, 2.);
+                _p.CwB[SExpDesignUI::TColour::mf_process_s].set_source_rgba( cr);
+                cairo_move_to( cr, tl_pad + 0,
+                               da_ht - lgd_margin-hypn_depth
+                               - csimulation[csimulation.sim_start()].S * da_ht / SWA_max * display_factor);
+                for ( size_t i = csimulation.sim_start()+1; i < csimulation.timeline().size(); ++i )
+                        cairo_line_to( cr,
+                                       tl_pad + (float)i / csimulation.timeline().size() * da_wd_actual(),
+                                       da_ht - lgd_margin-hypn_depth
+                                       - csimulation[i].S * da_ht / SWA_max * display_factor);
+                cairo_stroke( cr);
+
+                draw_ticks( cr, 0, csimulation.timeline().size());
+        }
 
 
       // zeroline
-	cairo_set_line_width( cr, .3);
-	cairo_set_source_rgb( cr, 0, 0, 0);
-	cairo_move_to( cr, 0., da_ht-lgd_margin-hypn_depth + 5);
-	cairo_rel_line_to( cr, da_wd, 0.);
+        cairo_set_line_width( cr, .3);
+        cairo_set_source_rgb( cr, 0, 0, 0);
+        cairo_move_to( cr, 0., da_ht-lgd_margin-hypn_depth + 5);
+        cairo_rel_line_to( cr, da_wd, 0.);
 
-	cairo_stroke( cr);
+        cairo_stroke( cr);
 }
 
 
@@ -224,158 +224,158 @@ size_t SModelrunFacility::swa_smoothover = 2;
 void
 SModelrunFacility::
 draw_episode( cairo_t *cr,
-	      const size_t ep,
-	      const size_t ep_start, const size_t ep_end,
-	      const size_t tl_start, const size_t tl_end)
+              const size_t ep,
+              const size_t ep_start, const size_t ep_end,
+              const size_t tl_start, const size_t tl_end)
 {
-	if ( zoomed_episode != -1 ) {
-		_p.CwB[SExpDesignUI::TColour::mf_paper].set_source_rgb( cr);
-		cairo_rectangle( cr, 0., 0., da_wd, da_ht);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-	}
+        if ( zoomed_episode != -1 ) {
+                _p.CwB[SExpDesignUI::TColour::mf_paper].set_source_rgb( cr);
+                cairo_rectangle( cr, 0., 0., da_wd, da_ht);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+        }
 
-	cairo_set_line_width( cr, 1.5);
-	_p.CwB[SExpDesignUI::TColour::mf_swa].set_source_rgba( cr);
+        cairo_set_line_width( cr, 1.5);
+        _p.CwB[SExpDesignUI::TColour::mf_swa].set_source_rgba( cr);
 
-	size_t	tl_len = tl_end - tl_start,
-		ep_len = ep_end - ep_start,
-	      // consider not displaying SWA-less wake pages at front
-		wakepages = (ep == 0 || zoomed_episode == -1) ? csimulation.sim_start() : 0;
+        size_t        tl_len = tl_end - tl_start,
+                ep_len = ep_end - ep_start,
+              // consider not displaying SWA-less wake pages at front
+                wakepages = (ep == 0 || zoomed_episode == -1) ? csimulation.sim_start() : 0;
 
       // empirical SWA
-	{
-		valarray<TFloat> swa (ep_len);
-		for ( size_t i = 0; i < ep_len; ++i )
-			swa[i] = csimulation[ep_start + i].metric;
-	      // smooth the SWA course
-		sigproc::smooth( swa, swa_smoothover);
-
-		cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
-			       da_ht - lgd_margin-hypn_depth
-			       - swa[wakepages] / SWA_max * (float)da_ht * display_factor);
-		for ( size_t i = wakepages+1; i < ep_len-1; ++i )
-			cairo_line_to( cr,
-				       tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
-				       da_ht - lgd_margin-hypn_depth
-				       - swa[i] * (float)da_ht / SWA_max * display_factor);
-		cairo_stroke( cr);
-	}
-
-	cairo_set_source_rgba( cr, 0., 0., 0., .6);
-	cairo_set_font_size( cr, (zoomed_episode == -1 ) ? 11 : 17);
-	cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-	cairo_move_to( cr, tl_pad + (float)(ep_start - tl_start)/tl_len * da_wd_actual(), 16);
-	cairo_show_text( cr, csimulation.mm_list()[ep]->F().episode());
-	cairo_stroke( cr);
+        {
+                valarray<TFloat> swa (ep_len);
+                for ( size_t i = 0; i < ep_len; ++i )
+                        swa[i] = csimulation[ep_start + i].metric;
+              // smooth the SWA course
+                sigproc::smooth( swa, swa_smoothover);
+
+                cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
+                               da_ht - lgd_margin-hypn_depth
+                               - swa[wakepages] / SWA_max * (float)da_ht * display_factor);
+                for ( size_t i = wakepages+1; i < ep_len-1; ++i )
+                        cairo_line_to( cr,
+                                       tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
+                                       da_ht - lgd_margin-hypn_depth
+                                       - swa[i] * (float)da_ht / SWA_max * display_factor);
+                cairo_stroke( cr);
+        }
+
+        cairo_set_source_rgba( cr, 0., 0., 0., .6);
+        cairo_set_font_size( cr, (zoomed_episode == -1 ) ? 11 : 17);
+        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+        cairo_move_to( cr, tl_pad + (float)(ep_start - tl_start)/tl_len * da_wd_actual(), 16);
+        cairo_show_text( cr, csimulation.mm_list()[ep]->F().episode());
+        cairo_stroke( cr);
 
       // simulated SWA
-	cairo_set_line_width( cr, 2.5);
-	_p.CwB[SExpDesignUI::TColour::mf_swa_sim].set_source_rgba( cr);
-	cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
-		       da_ht - lgd_margin-hypn_depth
-		       - csimulation[ep_start + wakepages].metric_sim * da_ht / SWA_max * display_factor);
-	for ( size_t i = wakepages+1; i < ep_len; ++i )
-		cairo_line_to( cr,
-			       tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
-			       da_ht - lgd_margin-hypn_depth
-			       - csimulation[ep_start + i].metric_sim * da_ht / SWA_max * display_factor);
-	cairo_stroke( cr);
+        cairo_set_line_width( cr, 2.5);
+        _p.CwB[SExpDesignUI::TColour::mf_swa_sim].set_source_rgba( cr);
+        cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
+                       da_ht - lgd_margin-hypn_depth
+                       - csimulation[ep_start + wakepages].metric_sim * da_ht / SWA_max * display_factor);
+        for ( size_t i = wakepages+1; i < ep_len; ++i )
+                cairo_line_to( cr,
+                               tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
+                               da_ht - lgd_margin-hypn_depth
+                               - csimulation[ep_start + i].metric_sim * da_ht / SWA_max * display_factor);
+        cairo_stroke( cr);
 
       // Process S
-	// draw only for zoomed episode: else it is drawn for all in one go
-	if ( zoomed_episode != -1 ) {
-		cairo_set_line_width( cr, 3);
-		_p.CwB[SExpDesignUI::TColour::mf_process_s].set_source_rgba( cr);
-		cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
-			       da_ht - lgd_margin-hypn_depth
-			       - csimulation[ep_start + wakepages].S * da_ht / SWA_max * display_factor);
-		size_t possible_end = ep_len +
-			((zoomed_episode == (int)csimulation.mm_list().size() - 1) ? 0 : ((float)csimulation.timeline().size()/da_wd_actual() * tl_pad));
-		for ( size_t i = wakepages+1; i < possible_end; ++i )
-			cairo_line_to( cr,
-				       tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
-				       da_ht - lgd_margin-hypn_depth
-				       - csimulation[ep_start + i].S * da_ht / SWA_max * display_factor);
-		cairo_stroke( cr);
-	}
+        // draw only for zoomed episode: else it is drawn for all in one go
+        if ( zoomed_episode != -1 ) {
+                cairo_set_line_width( cr, 3);
+                _p.CwB[SExpDesignUI::TColour::mf_process_s].set_source_rgba( cr);
+                cairo_move_to( cr, tl_pad + (float)(ep_start + wakepages - tl_start) / tl_len * da_wd_actual(),
+                               da_ht - lgd_margin-hypn_depth
+                               - csimulation[ep_start + wakepages].S * da_ht / SWA_max * display_factor);
+                size_t possible_end = ep_len +
+                        ((zoomed_episode == (int)csimulation.mm_list().size() - 1) ? 0 : ((float)csimulation.timeline().size()/da_wd_actual() * tl_pad));
+                for ( size_t i = wakepages+1; i < possible_end; ++i )
+                        cairo_line_to( cr,
+                                       tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
+                                       da_ht - lgd_margin-hypn_depth
+                                       - csimulation[ep_start + i].S * da_ht / SWA_max * display_factor);
+                cairo_stroke( cr);
+        }
 
       // hypnogram
-	// draw a line at Wake (rem will be above)
-	cairo_set_source_rgba( cr, 0., 0., 0., .9);
-	cairo_set_line_width( cr, .2);
-	cairo_move_to( cr,    0., da_ht - hypn_depth + __score_hypn_depth[sigfile::SPage::TScore::wake]);
-	cairo_line_to( cr, da_wd, da_ht - hypn_depth + __score_hypn_depth[sigfile::SPage::TScore::wake]);
-	cairo_stroke( cr);
-
-	cairo_set_source_rgba( cr, 0., 0., 0., .4);
-	cairo_set_line_width( cr, 3.);
-	for ( size_t i = 0; i < ep_len; ++i ) {
-		auto sco = csimulation[i].score();
-		using namespace sigfile;
-		if ( sco != SPage::TScore::none ) {
-			int y = __score_hypn_depth[sco];
-			cairo_move_to( cr, tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
-				       da_ht - hypn_depth + y);
-			cairo_rel_line_to( cr, 1. / tl_len * da_wd_actual(), 0);
-			cairo_stroke( cr);
-
-			if ( (highlight_nrem && (sco == SPage::TScore::nrem1 || sco == SPage::TScore::nrem2 || sco == SPage::TScore::nrem3 || sco == SPage::TScore::nrem4))
-			     || (highlight_rem && sco == SPage::TScore::rem)
-			     || (highlight_wake && sco == SPage::TScore::wake) ) {
-				cairo_set_line_width( cr, 0.);
-				cairo_pattern_t *cp = cairo_pattern_create_linear( 0., 0., 0., da_ht);
-				_p.CwB[ SExpDesignUI::score2colour(sco) ].pattern_add_color_stop_rgba( cp, 0., 0.50);
-				_p.CwB[ SExpDesignUI::score2colour(sco) ].pattern_add_color_stop_rgba( cp, 1., 0.02);
-				cairo_set_source( cr, cp);
-				cairo_rectangle( cr,
-						 tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(), 0.,
-						 1. / tl_len * da_wd_actual(), da_ht);
-				cairo_fill( cr);
-				cairo_stroke( cr);
-				cairo_pattern_destroy( cp);
-			}
-			// revert
-			cairo_set_source_rgba( cr, 0., 0., 0., .4);
-			cairo_set_line_width( cr, 3.);
-		}
-	}
+        // draw a line at Wake (rem will be above)
+        cairo_set_source_rgba( cr, 0., 0., 0., .9);
+        cairo_set_line_width( cr, .2);
+        cairo_move_to( cr,    0., da_ht - hypn_depth + __score_hypn_depth[sigfile::SPage::TScore::wake]);
+        cairo_line_to( cr, da_wd, da_ht - hypn_depth + __score_hypn_depth[sigfile::SPage::TScore::wake]);
+        cairo_stroke( cr);
+
+        cairo_set_source_rgba( cr, 0., 0., 0., .4);
+        cairo_set_line_width( cr, 3.);
+        for ( size_t i = 0; i < ep_len; ++i ) {
+                auto sco = csimulation[i].score();
+                using namespace sigfile;
+                if ( sco != SPage::TScore::none ) {
+                        int y = __score_hypn_depth[sco];
+                        cairo_move_to( cr, tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(),
+                                       da_ht - hypn_depth + y);
+                        cairo_rel_line_to( cr, 1. / tl_len * da_wd_actual(), 0);
+                        cairo_stroke( cr);
+
+                        if ( (highlight_nrem && (sco == SPage::TScore::nrem1 || sco == SPage::TScore::nrem2 || sco == SPage::TScore::nrem3 || sco == SPage::TScore::nrem4))
+                             || (highlight_rem && sco == SPage::TScore::rem)
+                             || (highlight_wake && sco == SPage::TScore::wake) ) {
+                                cairo_set_line_width( cr, 0.);
+                                cairo_pattern_t *cp = cairo_pattern_create_linear( 0., 0., 0., da_ht);
+                                _p.CwB[ SExpDesignUI::score2colour(sco) ].pattern_add_color_stop_rgba( cp, 0., 0.50);
+                                _p.CwB[ SExpDesignUI::score2colour(sco) ].pattern_add_color_stop_rgba( cp, 1., 0.02);
+                                cairo_set_source( cr, cp);
+                                cairo_rectangle( cr,
+                                                 tl_pad + (float)(ep_start - tl_start + i) / tl_len * da_wd_actual(), 0.,
+                                                 1. / tl_len * da_wd_actual(), da_ht);
+                                cairo_fill( cr);
+                                cairo_stroke( cr);
+                                cairo_pattern_destroy( cp);
+                        }
+                        // revert
+                        cairo_set_source_rgba( cr, 0., 0., 0., .4);
+                        cairo_set_line_width( cr, 3.);
+                }
+        }
 }
 
 
 void
 SModelrunFacility::
 draw_ticks( cairo_t *cr,
-	    size_t start, const size_t end)
+            size_t start, const size_t end)
 {
       // ticks
-	guint	pph = 3600/csimulation.pagesize(),
-		pps = pph/2;
-	float	tick_spc_rough = (float)(end-start)/(da_wd/120.) / pph,
-		tick_spc;
-	float	sizes[] = { NAN, .25, .5, 1, 2, 3, 4, 6, 12 };
-	size_t i = 8;
-	while ( i > 0 && (tick_spc = sizes[i]) > tick_spc_rough )
-		--i;
-	tick_spc *= pph;
-
-	cairo_set_font_size( cr, 9);
-	cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-	start = start/pps * pps;  // align to 30 min
-	for ( i = start; i < end; i += (unsigned)tick_spc ) {
-		_p.CwB[SExpDesignUI::TColour::mf_ticks].set_source_rgba( cr);
-		cairo_set_line_width( cr, (i % (24*pph) == 0) ? 1 : .3);
-		cairo_move_to( cr, (float)(i-start)/(end-start) * da_wd_actual(), 0);
-		cairo_rel_line_to( cr, 0., da_ht);
-		cairo_stroke( cr);
-
-		_p.CwB[SExpDesignUI::TColour::mf_labels].set_source_rgba( cr);
-		cairo_move_to( cr,
-			       (float)(i-start)/(end-start) * da_wd_actual() + 2,
-			       da_ht - hypn_depth-lgd_margin + 14);
-		cairo_show_text( cr, snprintf_buf_ts_h( (double)i/pph));
-		cairo_stroke( cr);
-	}
+        guint        pph = 3600/csimulation.pagesize(),
+                pps = pph/2;
+        float        tick_spc_rough = (float)(end-start)/(da_wd/120.) / pph,
+                tick_spc;
+        float        sizes[] = { NAN, .25, .5, 1, 2, 3, 4, 6, 12 };
+        size_t i = 8;
+        while ( i > 0 && (tick_spc = sizes[i]) > tick_spc_rough )
+                --i;
+        tick_spc *= pph;
+
+        cairo_set_font_size( cr, 9);
+        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+        start = start/pps * pps;  // align to 30 min
+        for ( i = start; i < end; i += (unsigned)tick_spc ) {
+                _p.CwB[SExpDesignUI::TColour::mf_ticks].set_source_rgba( cr);
+                cairo_set_line_width( cr, (i % (24*pph) == 0) ? 1 : .3);
+                cairo_move_to( cr, (float)(i-start)/(end-start) * da_wd_actual(), 0);
+                cairo_rel_line_to( cr, 0., da_ht);
+                cairo_stroke( cr);
+
+                _p.CwB[SExpDesignUI::TColour::mf_labels].set_source_rgba( cr);
+                cairo_move_to( cr,
+                               (float)(i-start)/(end-start) * da_wd_actual() + 2,
+                               da_ht - hypn_depth-lgd_margin + 14);
+                cairo_show_text( cr, snprintf_buf_ts_h( (double)i/pph));
+                cairo_stroke( cr);
+        }
 }
 
 
@@ -389,26 +389,26 @@ void
 SModelrunFacility::
 update_infobar()
 {
-	_suppress_Vx_value_changed = true;
-	for ( auto &e : eMFVx )
-		if ( gtk_widget_get_sensitive( (GtkWidget*)e.first) ) {
-			auto t = min(e.second, agh::ach::TTunable::gc);
-			gtk_spin_button_set_value(
-				e.first,
-				csimulation.tx[e.second]
-				* agh::ach::stock[t].display_scale_factor);
-		}
-	_suppress_Vx_value_changed = false;
-	gtk_label_set_markup(
-		lMFCostFunction,
-		snprintf_buf( "CF = <b>%6g</b>\n", cf));
+        _suppress_Vx_value_changed = true;
+        for ( auto &e : eMFVx )
+                if ( gtk_widget_get_sensitive( (GtkWidget*)e.first) ) {
+                        auto t = min(e.second, agh::ach::TTunable::gc);
+                        gtk_spin_button_set_value(
+                                e.first,
+                                csimulation.tx[e.second]
+                                * agh::ach::stock[t].display_scale_factor);
+                }
+        _suppress_Vx_value_changed = false;
+        gtk_label_set_markup(
+                lMFCostFunction,
+                snprintf_buf( "CF = <b>%6g</b>\n", cf));
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mf/mf.hh b/upstream/src/aghermann/ui/mf/mf.hh
index 82707bc..058f7fd 100644
--- a/upstream/src/aghermann/ui/mf/mf.hh
+++ b/upstream/src/aghermann/ui/mf/mf.hh
@@ -26,97 +26,97 @@ namespace ui {
 
 struct SModelrunFacility {
 
-	DELETE_DEFAULT_METHODS (SModelrunFacility);
+        DELETE_DEFAULT_METHODS (SModelrunFacility);
 
-	SModelrunFacility (agh::ach::CModelRun&, SExpDesignUI&);
+        SModelrunFacility (agh::ach::CModelRun&, SExpDesignUI&);
        ~SModelrunFacility ();
 
-	agh::ach::CModelRun&
-		csimulation;
-
-	double	cf;
-	double snapshot()
-		{
-			return cf = csimulation.snapshot();
-		}
-
-	void draw_episode( cairo_t*, size_t ep,
-			   size_t ep_start, size_t ep_end,
-			   size_t tl_start, size_t tl_end);
-	void draw_ticks( cairo_t*, size_t start, size_t end);
-	void draw_timeline( cairo_t*);
-	void update_infobar();
-	void siman_param_printer( void*);
-
-	double	SWA_max;
-	float	display_factor;
-	int	zoomed_episode;
-	static size_t
-		swa_smoothover;  // one side
-
-	bool	_suppress_Vx_value_changed:1,
-		_tunables_header_printed:1,
-		highlight_nrem:1,
-		highlight_rem:1,
-		highlight_wake:1;
-
-	SGeometry
-		GeometryModRunFac;
+        agh::ach::CModelRun&
+                csimulation;
+
+        double        cf;
+        double snapshot()
+                {
+                        return cf = csimulation.snapshot();
+                }
+
+        void draw_episode( cairo_t*, size_t ep,
+                           size_t ep_start, size_t ep_end,
+                           size_t tl_start, size_t tl_end);
+        void draw_ticks( cairo_t*, size_t start, size_t end);
+        void draw_timeline( cairo_t*);
+        void update_infobar();
+        void siman_param_printer( void*);
+
+        double        SWA_max;
+        float        display_factor;
+        int        zoomed_episode;
+        static size_t
+                swa_smoothover;  // one side
+
+        bool        _suppress_Vx_value_changed:1,
+                _tunables_header_printed:1,
+                highlight_nrem:1,
+                highlight_rem:1,
+                highlight_wake:1;
+
+        SGeometry
+                GeometryModRunFac;
 
       // widgets
-	GtkBuilder
-		*builder;
-	int construct_widgets();
-
-	GtkWindow
-		*wModelrunFacility;
-
-	GtkDrawingArea
-		*daMFProfile;
-	GtkTextView
-		*lMFLog;
-	GtkLabel
-		*lMFCostFunction;
-	GtkCheckButton
-		*eMFClassicFit;
-	GtkLabel
-		*lMFClassicFit;
-	GtkScaleButton
-		*eMFSmooth;
-	GtkCheckButton
-		*eMFLiveUpdate,
-		*eMFHighlightWake,
-		*eMFHighlightNREM,
-		*eMFHighlightREM;
-	map<GtkSpinButton*, agh::ach::TTunable>
-		eMFVx;
-	GtkCheckButton
-		*eMFDB1,
-		*eMFDB2,
-		*eMFAZ1,
-		*eMFAZ2;
-	GtkHBox
-		*cMFControls;
-	GtkButton
-		*bMFRun,
-		*bMFReset;
-	GtkToolButton
-		*bMFAccept;
-
-	GtkTextBuffer
-		*log_text_buffer;
-
-	int	da_wd, da_ht;
-	static const int tl_pad = 20;
-	static const int lgd_margin = 20;
-	static const int hypn_depth = 35;
-	int da_wd_actual() const
-		{
-			return da_wd - 2 * tl_pad;
-		}
-
-	SExpDesignUI&
-		_p;
+        GtkBuilder
+                *builder;
+        int construct_widgets();
+
+        GtkWindow
+                *wModelrunFacility;
+
+        GtkDrawingArea
+                *daMFProfile;
+        GtkTextView
+                *lMFLog;
+        GtkLabel
+                *lMFCostFunction;
+        GtkCheckButton
+                *eMFClassicFit;
+        GtkLabel
+                *lMFClassicFit;
+        GtkScaleButton
+                *eMFSmooth;
+        GtkCheckButton
+                *eMFLiveUpdate,
+                *eMFHighlightWake,
+                *eMFHighlightNREM,
+                *eMFHighlightREM;
+        map<GtkSpinButton*, agh::ach::TTunable>
+                eMFVx;
+        GtkCheckButton
+                *eMFDB1,
+                *eMFDB2,
+                *eMFAZ1,
+                *eMFAZ2;
+        GtkHBox
+                *cMFControls;
+        GtkButton
+                *bMFRun,
+                *bMFReset;
+        GtkToolButton
+                *bMFAccept;
+
+        GtkTextBuffer
+                *log_text_buffer;
+
+        int        da_wd, da_ht;
+        static const int tl_pad = 20;
+        static const int lgd_margin = 20;
+        static const int hypn_depth = 35;
+        int da_wd_actual() const
+                {
+                        return da_wd - 2 * tl_pad;
+                }
+
+        SExpDesignUI&
+                _p;
 };
 
 
@@ -127,7 +127,7 @@ struct SModelrunFacility {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mf/mf_cb.cc b/upstream/src/aghermann/ui/mf/mf_cb.cc
index fde36db..29f0888 100644
--- a/upstream/src/aghermann/ui/mf/mf_cb.cc
+++ b/upstream/src/aghermann/ui/mf/mf_cb.cc
@@ -23,31 +23,31 @@ extern "C" {
 
 gboolean
 daMFProfile_configure_event_cb(
-	GtkWidget*,
-	GdkEventConfigure *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventConfigure *event,
+        const gpointer userdata)
 {
-	if ( event->type == GDK_CONFIGURE ) {
-		auto& MF = *(SModelrunFacility*)userdata;
-		MF.da_ht = event->height;
-		MF.da_wd = event->width;
-	}
-	return FALSE;
+        if ( event->type == GDK_CONFIGURE ) {
+                auto& MF = *(SModelrunFacility*)userdata;
+                MF.da_ht = event->height;
+                MF.da_wd = event->width;
+        }
+        return FALSE;
 }
 
 
 gboolean
 daMFProfile_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-	MF.draw_timeline( cr);
+        auto& MF = *(SModelrunFacility*)userdata;
+        MF.draw_timeline( cr);
 
-	MF.update_infobar();
+        MF.update_infobar();
 
-	return TRUE;
+        return TRUE;
 }
 
 
@@ -55,60 +55,60 @@ daMFProfile_draw_cb(
 
 gboolean
 daMFProfile_button_press_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-
-	switch ( event->button ) {
-	case 1:
-		if ( event->state & GDK_MOD1_MASK ) {
-			GtkWidget *f_chooser
-				= gtk_file_chooser_dialog_new(
-					"Export Profile Snapshot",
-					NULL,
-					GTK_FILE_CHOOSER_ACTION_SAVE,
-					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-					GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-					NULL);
-			g_object_ref_sink( f_chooser);
-			GtkFileFilter *file_filter = gtk_file_filter_new();
-			g_object_ref_sink( file_filter);
-
-			gtk_file_filter_set_name( file_filter, "SVG images");
-			gtk_file_filter_add_pattern( file_filter, "*.svg");
-			gtk_file_chooser_add_filter( (GtkFileChooser*)f_chooser, file_filter);
-			if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
-				char *fname_ = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
-				snprintf_buf( "%s%s", fname_,
-					      g_str_has_suffix( fname_, ".svg") ? "" : ".svg");
-				g_free( fname_);
-				cairo_surface_t *cs = cairo_svg_surface_create( global::buf, MF.da_wd, MF.da_ht);
-				cairo_t *cr = cairo_create( cs);
-				MF.draw_timeline( cr);
-				cairo_destroy( cr);
-				cairo_surface_destroy( cs);
-			}
-			g_object_unref( file_filter);
-			g_object_unref( f_chooser);
-			gtk_widget_destroy( f_chooser);
-		} else {
-			if ( MF.zoomed_episode == -1 ) {
-				for ( int ep = MF.csimulation.mm_list().size()-1; ep > -1; --ep )
-					if ( event->x/MF.da_wd * MF.csimulation.timeline().size() >
-					     MF.csimulation.nth_episode_start_page( ep) ) {
-						MF.zoomed_episode = ep;
-						break;
-					}
-			} else
-				MF.zoomed_episode = -1;
-			gtk_widget_queue_draw( wid);
-		}
-		break;
-	}
-
-	return TRUE;
+        auto& MF = *(SModelrunFacility*)userdata;
+
+        switch ( event->button ) {
+        case 1:
+                if ( event->state & GDK_MOD1_MASK ) {
+                        GtkWidget *f_chooser
+                                = gtk_file_chooser_dialog_new(
+                                        "Export Profile Snapshot",
+                                        NULL,
+                                        GTK_FILE_CHOOSER_ACTION_SAVE,
+                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                        NULL);
+                        g_object_ref_sink( f_chooser);
+                        GtkFileFilter *file_filter = gtk_file_filter_new();
+                        g_object_ref_sink( file_filter);
+
+                        gtk_file_filter_set_name( file_filter, "SVG images");
+                        gtk_file_filter_add_pattern( file_filter, "*.svg");
+                        gtk_file_chooser_add_filter( (GtkFileChooser*)f_chooser, file_filter);
+                        if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
+                                char *fname_ = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
+                                snprintf_buf( "%s%s", fname_,
+                                              g_str_has_suffix( fname_, ".svg") ? "" : ".svg");
+                                g_free( fname_);
+                                cairo_surface_t *cs = cairo_svg_surface_create( global::buf, MF.da_wd, MF.da_ht);
+                                cairo_t *cr = cairo_create( cs);
+                                MF.draw_timeline( cr);
+                                cairo_destroy( cr);
+                                cairo_surface_destroy( cs);
+                        }
+                        g_object_unref( file_filter);
+                        g_object_unref( f_chooser);
+                        gtk_widget_destroy( f_chooser);
+                } else {
+                        if ( MF.zoomed_episode == -1 ) {
+                                for ( int ep = MF.csimulation.mm_list().size()-1; ep > -1; --ep )
+                                        if ( event->x/MF.da_wd * MF.csimulation.timeline().size() >
+                                             MF.csimulation.nth_episode_start_page( ep) ) {
+                                                MF.zoomed_episode = ep;
+                                                break;
+                                        }
+                        } else
+                                MF.zoomed_episode = -1;
+                        gtk_widget_queue_draw( wid);
+                }
+                break;
+        }
+
+        return TRUE;
 }
 
 
@@ -117,35 +117,35 @@ daMFProfile_button_press_event_cb(
 
 gboolean
 daMFProfile_scroll_event_cb(
-	GtkWidget *wid,
-	GdkEventScroll *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-
-	switch ( event->direction ) {
-	case GDK_SCROLL_DOWN:
-		MF.display_factor /= MF._p.scroll_factor;
-	    break;
-	case GDK_SCROLL_UP:
-		MF.display_factor *= MF._p.scroll_factor;
-	    break;
-	case GDK_SCROLL_LEFT:
-	    break;
-	case GDK_SCROLL_RIGHT:
-	    break;
-	case GDK_SCROLL_SMOOTH: // wow
-	    break;
-	}
-
-	// if ( event->state & GDK_CONTROL_MASK ) {
-	// 	;
-	// } else
-	// 	;
-
-	gtk_widget_queue_draw( wid);
-
-	return TRUE;
+        auto& MF = *(SModelrunFacility*)userdata;
+
+        switch ( event->direction ) {
+        case GDK_SCROLL_DOWN:
+                MF.display_factor /= MF._p.scroll_factor;
+            break;
+        case GDK_SCROLL_UP:
+                MF.display_factor *= MF._p.scroll_factor;
+            break;
+        case GDK_SCROLL_LEFT:
+            break;
+        case GDK_SCROLL_RIGHT:
+            break;
+        case GDK_SCROLL_SMOOTH: // wow
+            break;
+        }
+
+        // if ( event->state & GDK_CONTROL_MASK ) {
+        //         ;
+        // } else
+        //         ;
+
+        gtk_widget_queue_draw( wid);
+
+        return TRUE;
 }
 
 
@@ -156,66 +156,66 @@ namespace {
 SModelrunFacility *this_mf = nullptr;
 void this_mf_siman_param_printer(void *xp)
 {
-	this_mf -> siman_param_printer(xp);
+        this_mf -> siman_param_printer(xp);
 }
 }
 
 void
 bMFRun_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-
-	SBusyBlock bb (MF.wModelrunFacility);
-
-	void (*fun)(void*) = (this_mf == nullptr)
-		? (this_mf = &MF, this_mf_siman_param_printer)
-		: nullptr;
-	MF.csimulation.watch_simplex_move(
-		gtk_toggle_button_get_active( (GtkToggleButton*)MF.eMFLiveUpdate)
-		? fun : nullptr);
-	this_mf = nullptr;
-
-	MF.snapshot();
-	MF.update_infobar();
-
-	GtkTextIter iter;
-	if ( not MF._tunables_header_printed ) {
-		ostringstream ss;
-		ss << "#";
-		for ( size_t t = 0; t < MF.csimulation.tx.size(); ++t )
-			ss << agh::str::sasprintf(
-				"%s%s",
-				agh::ach::tunable_name(t).c_str(),
-				t < MF.csimulation.tx.size()-1 ? "\t" : "\n");
-		gtk_text_buffer_insert(
-			MF.log_text_buffer,
-			(gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
-			ss.str().c_str(), -1);
-		MF._tunables_header_printed = true;
-	}
-
-	for ( size_t t = 0; t < MF.csimulation.tx.size(); ++t ) {
-		auto tg = min( t, (size_t)agh::ach::TTunable::_basic_tunables-1);
-		snprintf_buf(
-			"%s%s",
-			agh::str::sasprintf(
-				agh::ach::stock[tg].fmt,
-				MF.csimulation.tx[t] * agh::ach::stock[tg].display_scale_factor).c_str(),
-			t < MF.csimulation.tx.size()-1 ? "\t" : "\n");
-		gtk_text_buffer_insert(
-			MF.log_text_buffer,
-  			(gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
-			global::buf, -1);
-	}
-	gtk_text_view_scroll_to_iter(
-		MF.lMFLog,
-		(gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
-		0.1, FALSE,
-		0., 1.);
-
-	gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        auto& MF = *(SModelrunFacility*)userdata;
+
+        SBusyBlock bb (MF.wModelrunFacility);
+
+        void (*fun)(void*) = (this_mf == nullptr)
+                ? (this_mf = &MF, this_mf_siman_param_printer)
+                : nullptr;
+        MF.csimulation.watch_simplex_move(
+                gtk_toggle_button_get_active( (GtkToggleButton*)MF.eMFLiveUpdate)
+                ? fun : nullptr);
+        this_mf = nullptr;
+
+        MF.snapshot();
+        MF.update_infobar();
+
+        GtkTextIter iter;
+        if ( not MF._tunables_header_printed ) {
+                ostringstream ss;
+                ss << "#";
+                for ( size_t t = 0; t < MF.csimulation.tx.size(); ++t )
+                        ss << agh::str::sasprintf(
+                                "%s%s",
+                                agh::ach::tunable_name(t).c_str(),
+                                t < MF.csimulation.tx.size()-1 ? "\t" : "\n");
+                gtk_text_buffer_insert(
+                        MF.log_text_buffer,
+                        (gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
+                        ss.str().c_str(), -1);
+                MF._tunables_header_printed = true;
+        }
+
+        for ( size_t t = 0; t < MF.csimulation.tx.size(); ++t ) {
+                auto tg = min( t, (size_t)agh::ach::TTunable::_basic_tunables-1);
+                snprintf_buf(
+                        "%s%s",
+                        agh::str::sasprintf(
+                                agh::ach::stock[tg].fmt,
+                                MF.csimulation.tx[t] * agh::ach::stock[tg].display_scale_factor).c_str(),
+                        t < MF.csimulation.tx.size()-1 ? "\t" : "\n");
+                gtk_text_buffer_insert(
+                        MF.log_text_buffer,
+                          (gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
+                        global::buf, -1);
+        }
+        gtk_text_view_scroll_to_iter(
+                MF.lMFLog,
+                (gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
+                0.1, FALSE,
+                0., 1.);
+
+        gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
 }
 
 
@@ -224,118 +224,118 @@ bMFRun_clicked_cb(
 
 void
 eMFSmooth_value_changed_cb(
-	GtkScaleButton *b,
-	const gdouble v,
-	const gpointer userdata)
+        GtkScaleButton *b,
+        const gdouble v,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-	MF.swa_smoothover = v;
-	gtk_button_set_label(
-		(GtkButton*)b,
-		snprintf_buf( "Smooth: %zu", MF.swa_smoothover));
-	if ( !MF._suppress_Vx_value_changed )
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        auto& MF = *(SModelrunFacility*)userdata;
+        MF.swa_smoothover = v;
+        gtk_button_set_label(
+                (GtkButton*)b,
+                snprintf_buf( "Smooth: %zu", MF.swa_smoothover));
+        if ( !MF._suppress_Vx_value_changed )
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
 }
 
 
 
 void
 eMFHighlightNREM_toggled_cb(
-	GtkCheckButton *e,
-	const gpointer u)
+        GtkCheckButton *e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	MF.highlight_nrem = gtk_toggle_button_get_active( (GtkToggleButton*)e);
-	if ( !MF._suppress_Vx_value_changed )
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        auto& MF = *(SModelrunFacility*)u;
+        MF.highlight_nrem = gtk_toggle_button_get_active( (GtkToggleButton*)e);
+        if ( !MF._suppress_Vx_value_changed )
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
 }
 
 void
 eMFHighlightREM_toggled_cb(
-	GtkCheckButton *e,
-	const gpointer u)
+        GtkCheckButton *e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	MF.highlight_rem = gtk_toggle_button_get_active( (GtkToggleButton*)e);
-	if ( !MF._suppress_Vx_value_changed )
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        auto& MF = *(SModelrunFacility*)u;
+        MF.highlight_rem = gtk_toggle_button_get_active( (GtkToggleButton*)e);
+        if ( !MF._suppress_Vx_value_changed )
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
 }
 
 void
 eMFHighlightWake_toggled_cb(
-	GtkCheckButton *e,
-	const gpointer u)
+        GtkCheckButton *e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	MF.highlight_wake = gtk_toggle_button_get_active( (GtkToggleButton*)e);
-	if ( !MF._suppress_Vx_value_changed )
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        auto& MF = *(SModelrunFacility*)u;
+        MF.highlight_wake = gtk_toggle_button_get_active( (GtkToggleButton*)e);
+        if ( !MF._suppress_Vx_value_changed )
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
 }
 
 
 void
 bMFReset_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
+        auto& MF = *(SModelrunFacility*)userdata;
 
-	MF.csimulation.tx.set_defaults();
-	MF.update_infobar();
+        MF.csimulation.tx.set_defaults();
+        MF.update_infobar();
 
-	gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-	gtk_text_buffer_set_text( MF.log_text_buffer, "", -1);
-	MF._tunables_header_printed = false;
+        gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        gtk_text_buffer_set_text( MF.log_text_buffer, "", -1);
+        MF._tunables_header_printed = false;
 }
 
 
 
 void
 eMFClassicFit_toggled_cb(
-	GtkCheckButton *b,
-	const gpointer userdata)
+        GtkCheckButton *b,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
-
-	if ( gtk_toggle_button_get_active( (GtkToggleButton*)b) == TRUE ) {
-		const auto mm = MF.csimulation.mm_list().size();
-		valarray<double>
-			rr (mm);
-
-		size_t i = 0;
-		for ( auto& M : MF.csimulation.mm_list() ) {
-			agh::beersma::SClassicFit borbely =
-				agh::beersma::classic_fit(
-					*M, { MF.csimulation.P(), .1, 40 });
-			rr[i] = borbely.r;
-
-			++i;
-		}
-		snprintf_buf(
-			"avg r = %4g",
-			rr.sum()/rr.size());
-	} else
-		snprintf_buf(
-			"N/A");
-
-	gtk_label_set_markup(
-		MF.lMFClassicFit,
-		global::buf);
+        auto& MF = *(SModelrunFacility*)userdata;
+
+        if ( gtk_toggle_button_get_active( (GtkToggleButton*)b) == TRUE ) {
+                const auto mm = MF.csimulation.mm_list().size();
+                valarray<double>
+                        rr (mm);
+
+                size_t i = 0;
+                for ( auto& M : MF.csimulation.mm_list() ) {
+                        agh::beersma::SClassicFit borbely =
+                                agh::beersma::classic_fit(
+                                        *M, { MF.csimulation.P(), .1, 40 });
+                        rr[i] = borbely.r;
+
+                        ++i;
+                }
+                snprintf_buf(
+                        "avg r = %4g",
+                        rr.sum()/rr.size());
+        } else
+                snprintf_buf(
+                        "N/A");
+
+        gtk_label_set_markup(
+                MF.lMFClassicFit,
+                global::buf);
 }
 
 
 
 void
 bMFAccept_clicked_cb(
-	GtkToolButton*,
-	const gpointer userdata)
+        GtkToolButton*,
+        const gpointer userdata)
 {
-	auto& MF = *(SModelrunFacility*)userdata;
+        auto& MF = *(SModelrunFacility*)userdata;
 
-	if ( MF.csimulation.status & agh::ach::CModelRun::modrun_tried )
-		MF._p.populate_2();
+        if ( MF.csimulation.status & agh::ach::CModelRun::modrun_tried )
+                MF._p.populate_2();
 
-	delete &MF;
+        delete &MF;
 }
 
 
@@ -343,94 +343,94 @@ bMFAccept_clicked_cb(
 
 void
 eMFVx_value_changed_cb(
-	GtkSpinButton* e,
-	const gpointer u)
+        GtkSpinButton* e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	if ( !MF._suppress_Vx_value_changed ) {
-		agh::ach::TTunable t = MF.eMFVx[e];
-		if ( (size_t)t < MF.csimulation.tx.size() ) {
-			MF.csimulation.tx[t] =
-				gtk_spin_button_get_value(e)
-				/ agh::ach::stock[min(t, agh::ach::TTunable::gc)].display_scale_factor;
-			MF.snapshot();
-			gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-		}
-	}
+        auto& MF = *(SModelrunFacility*)u;
+        if ( !MF._suppress_Vx_value_changed ) {
+                agh::ach::TTunable t = MF.eMFVx[e];
+                if ( (size_t)t < MF.csimulation.tx.size() ) {
+                        MF.csimulation.tx[t] =
+                                gtk_spin_button_get_value(e)
+                                / agh::ach::stock[min(t, agh::ach::TTunable::gc)].display_scale_factor;
+                        MF.snapshot();
+                        gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+                }
+        }
 }
 
 
 void
 eMFDB1_toggled_cb(
-	GtkCheckButton* e,
-	const gpointer u)
+        GtkCheckButton* e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	if ( !MF._suppress_Vx_value_changed ) {
-		MF.csimulation.ctl_params.DBAmendment1 =
-			gtk_toggle_button_get_active( (GtkToggleButton*)e);
-		MF.snapshot();
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-	}
+        auto& MF = *(SModelrunFacility*)u;
+        if ( !MF._suppress_Vx_value_changed ) {
+                MF.csimulation.ctl_params.DBAmendment1 =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)e);
+                MF.snapshot();
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        }
 }
 void
 eMFDB2_toggled_cb(
-	GtkCheckButton* e,
-	const gpointer u)
+        GtkCheckButton* e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	if ( !MF._suppress_Vx_value_changed ) {
-		MF.csimulation.ctl_params.DBAmendment2 =
-			gtk_toggle_button_get_active( (GtkToggleButton*)e);
-		MF.snapshot();
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-	}
+        auto& MF = *(SModelrunFacility*)u;
+        if ( !MF._suppress_Vx_value_changed ) {
+                MF.csimulation.ctl_params.DBAmendment2 =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)e);
+                MF.snapshot();
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        }
 }
 void
 eMFAZ1_toggled_cb(
-	GtkCheckButton* e,
-	const gpointer u)
+        GtkCheckButton* e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	if ( !MF._suppress_Vx_value_changed ) {
-		MF.csimulation.ctl_params.AZAmendment1 =
-			gtk_toggle_button_get_active( (GtkToggleButton*)e);
-		MF.snapshot();
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-	}
+        auto& MF = *(SModelrunFacility*)u;
+        if ( !MF._suppress_Vx_value_changed ) {
+                MF.csimulation.ctl_params.AZAmendment1 =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)e);
+                MF.snapshot();
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        }
 }
 void
 eMFAZ2_toggled_cb(
-	GtkCheckButton* e,
-	const gpointer u)
+        GtkCheckButton* e,
+        const gpointer u)
 {
-	auto& MF = *(SModelrunFacility*)u;
-	if ( !MF._suppress_Vx_value_changed ) {
-		MF.csimulation.ctl_params.AZAmendment2 =
-			gtk_toggle_button_get_active( (GtkToggleButton*)e);
-		MF.snapshot();
-		gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
-	}
+        auto& MF = *(SModelrunFacility*)u;
+        if ( !MF._suppress_Vx_value_changed ) {
+                MF.csimulation.ctl_params.AZAmendment2 =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)e);
+                MF.snapshot();
+                gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
+        }
 }
 
 
 
 gboolean
 wModelrunFacility_delete_event_cb(
-	GtkWidget*,
-	GdkEvent*,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEvent*,
+        const gpointer userdata)
 {
-	auto MFp = (SModelrunFacility*)userdata;
-	delete MFp;
-	return TRUE;
+        auto MFp = (SModelrunFacility*)userdata;
+        delete MFp;
+        return TRUE;
 }
 
 }  // extern "C"
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mf/mf_cb.hh b/upstream/src/aghermann/ui/mf/mf_cb.hh
index bba9353..7180917 100644
--- a/upstream/src/aghermann/ui/mf/mf_cb.hh
+++ b/upstream/src/aghermann/ui/mf/mf_cb.hh
@@ -50,7 +50,7 @@ gboolean wModelrunFacility_delete_event_cb( GtkWidget*, GdkEvent*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/misc.cc b/upstream/src/aghermann/ui/misc.cc
index f2f3c7d..b184a7f 100644
--- a/upstream/src/aghermann/ui/misc.cc
+++ b/upstream/src/aghermann/ui/misc.cc
@@ -20,77 +20,77 @@ const char*
 agh::ui::
 snprintf_buf_ts_d( const double d_)
 {
-	if ( d_ < 1. )
-		snprintf_buf_ts_h( d_ * 24);
-	else {
-		unsigned m_ = lroundf(d_*24*60*60) / 60,
-			m = (m_ % 60),
-			h = (m_ / 60) % 24,
-			d = (m_ / 60 / 24);
-		if ( h % 24 == 0 && m % 60 == 0 )
-			snprintf_buf( "%ud", d);
-		else if ( m % 60 == 0 )
-			snprintf_buf( "%ud%uh", d, h);
-		else
-			snprintf_buf( "%ud%uh%um", d, h, m);
-	}
-	return global::buf;
+        if ( d_ < 1. )
+                snprintf_buf_ts_h( d_ * 24);
+        else {
+                unsigned m_ = lroundf(d_*24*60*60) / 60,
+                        m = (m_ % 60),
+                        h = (m_ / 60) % 24,
+                        d = (m_ / 60 / 24);
+                if ( h % 24 == 0 && m % 60 == 0 )
+                        snprintf_buf( "%ud", d);
+                else if ( m % 60 == 0 )
+                        snprintf_buf( "%ud%uh", d, h);
+                else
+                        snprintf_buf( "%ud%uh%um", d, h, m);
+        }
+        return global::buf;
 }
 
 const char*
 agh::ui::
 snprintf_buf_ts_h( const double h_)
 {
-	if ( h_ < 1. )
-		snprintf_buf_ts_m( h_ * 60);
-	else if ( h_ >= 24. )
-		snprintf_buf_ts_d( h_ / 24);
-	else {
-		unsigned m_ = lroundf( h_*60*60) / 60,
-			m = (m_ % 60),
-			h = (m_ / 60);
-		if ( m % 60 == 0 )
-			snprintf_buf( "%uh", h);
-		else
-			snprintf_buf( "%uh%um", h, m);
-	}
-	return global::buf;
+        if ( h_ < 1. )
+                snprintf_buf_ts_m( h_ * 60);
+        else if ( h_ >= 24. )
+                snprintf_buf_ts_d( h_ / 24);
+        else {
+                unsigned m_ = lroundf( h_*60*60) / 60,
+                        m = (m_ % 60),
+                        h = (m_ / 60);
+                if ( m % 60 == 0 )
+                        snprintf_buf( "%uh", h);
+                else
+                        snprintf_buf( "%uh%um", h, m);
+        }
+        return global::buf;
 }
 
 const char*
 agh::ui::
 snprintf_buf_ts_m( const double m_)
 {
-	if ( m_ < 1. )
-		snprintf_buf_ts_s( m_ * 60);
-	else if ( m_ >= 60. )
-		snprintf_buf_ts_h( m_ / 60);
-	else {
-		unsigned s_ = lroundf( m_*60) / 60,
-			s = (s_ % 60),
-			m = (s_ / 60);
-		if ( s % 60 == 0 )
-			snprintf_buf( "%um", m);
-		else
-			snprintf_buf( "%um%us", m, s);
-	}
-	return global::buf;
+        if ( m_ < 1. )
+                snprintf_buf_ts_s( m_ * 60);
+        else if ( m_ >= 60. )
+                snprintf_buf_ts_h( m_ / 60);
+        else {
+                unsigned s_ = lroundf( m_*60) / 60,
+                        s = (s_ % 60),
+                        m = (s_ / 60);
+                if ( s % 60 == 0 )
+                        snprintf_buf( "%um", m);
+                else
+                        snprintf_buf( "%um%us", m, s);
+        }
+        return global::buf;
 }
 
 const char*
 agh::ui::
 snprintf_buf_ts_s( const double s_)
 {
-	if ( s_ >= 60. )
-		snprintf_buf_ts_m( s_/60);
-	else
-		snprintf_buf( "%.2gs", s_);
-	return global::buf;
+        if ( s_ >= 60. )
+                snprintf_buf_ts_m( s_/60);
+        else
+                snprintf_buf( "%.2gs", s_);
+        return global::buf;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/misc.hh b/upstream/src/aghermann/ui/misc.hh
index 221d24f..3b88a13 100644
--- a/upstream/src/aghermann/ui/misc.hh
+++ b/upstream/src/aghermann/ui/misc.hh
@@ -32,13 +32,13 @@ snprintf_buf( const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
 inline const char*
 snprintf_buf( const char* fmt, ...)
 {
-	va_list ap;
-	va_start (ap, fmt);
+        va_list ap;
+        va_start (ap, fmt);
 
-	vsnprintf( global::buf, AGH_BUF_SIZE-1, fmt, ap);
-	va_end (ap);
+        vsnprintf( global::buf, AGH_BUF_SIZE-1, fmt, ap);
+        va_end (ap);
 
-	return global::buf;
+        return global::buf;
 }
 
 
@@ -54,7 +54,7 @@ const char* snprintf_buf_ts_s( double s);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/admit-one.cc b/upstream/src/aghermann/ui/mw/admit-one.cc
index e24a00c..b3dee39 100644
--- a/upstream/src/aghermann/ui/mw/admit-one.cc
+++ b/upstream/src/aghermann/ui/mw/admit-one.cc
@@ -22,187 +22,187 @@ int
 SExpDesignUI::
 dnd_maybe_admit_one( const char* fname)
 {
-	try {
-		string info;
-		sigfile::CTypedSource F_ (fname, ED->fft_params.pagesize);
-		switch ( F_.type() ) {
-		case sigfile::CTypedSource::TType::edf:
-		{
-			sigfile::CEDFFile& F = F_.obj<sigfile::CEDFFile>();
-			if ( F.subtype() == sigfile::CEDFFile::TSubtype::edfplus_d ) {
-				pop_ok_message(
-					wMainWindow,
-					"EDF+D is unsupported",
-					"The file <b>%s</b> is in EDF+D format, which is not supported yet",
-					fname);
-				return 0;
-			}
-			if ( F.status() & sigfile::CEDFFile::TStatus::inoperable ) {
-				pop_ok_message(
-					wMainWindow,
-					"Bad EDF file",
-					"The file <b>%s</b> cannot be processed due to these issues:\n\n%s",
-					fname, F.explain_status().c_str());
-				return 0;
-			}
-		}
-		break;
-
-		case sigfile::CTypedSource::TType::ascii:
-		break;
-
-		default:
-			pop_ok_message(
-				wMainWindow,
-				"Unsupported format",
-				"The file <b>%s</b> is in unrecognised format. Sorry.", fname);
-			return 0;
-		}
-
-		auto& F = F_();
-
-		info = F.details( 0|sigfile::CSource::TDetails::with_channels);
-
-		{
-			char* mike;
-			mike = g_markup_escape_text(
-				agh::str::homedir2tilda( F.filename()).c_str(),
-				-1);
-			gtk_label_set_markup(
-				lEdfImportCaption,
-				snprintf_buf( "File: <i>%s</i>", mike));
-			free( (void*)mike);
-
-			mike = g_markup_escape_text(
-				F.subject().name.empty() ? "<no name>" : F.subject().name.c_str(),
-				-1);
-			gtk_label_set_markup(
-				lEdfImportSubject,
-				snprintf_buf(
-					"<b>%s</b> (%s)",
-					F.subject().id.c_str(),
-					mike));
-			free( (void*)mike);
-		}
-
-		gtk_text_buffer_set_text( tEDFFileDetailsReport, info.c_str(), -1);
-
-		GtkTreeIter iter;
-		// populate and attach models
-		GtkListStore
-			*m_groups = gtk_list_store_new( 1, G_TYPE_STRING),
-			*m_episodes = gtk_list_store_new( 1, G_TYPE_STRING),
-			*m_sessions = gtk_list_store_new( 1, G_TYPE_STRING);
-		// when adding a source for an already existing subject, disallow group selection
-		try {
-			gtk_entry_set_text(
-				eEdfImportGroupEntry,
-				ED->group_of( F.subject().id.c_str()));
-			gtk_widget_set_sensitive( (GtkWidget*)eEdfImportGroup, FALSE);
-		} catch (invalid_argument ex) {
-			for ( auto &i : AghGG ) {
-				gtk_list_store_append( m_groups, &iter);
-				gtk_list_store_set( m_groups, &iter, 0, i.c_str(), -1);
-			}
-			gtk_combo_box_set_model(
-				eEdfImportGroup,
-				(GtkTreeModel*)m_groups);
-			gtk_combo_box_set_entry_text_column( eEdfImportGroup, 0);
-			// gtk_entry_set_text(
-			// 	(GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportGroup),
-			// 	"");
-			gtk_widget_set_sensitive( (GtkWidget*)eEdfImportGroup, TRUE);
-		}
-
-		// enumerate known sessions and episodes
-		// suggest those from the file proper
-		for ( auto &i : AghEE ) {
-			gtk_list_store_append( m_episodes, &iter);
-			gtk_list_store_set( m_episodes, &iter, 0, i.c_str(), -1);
-		}
-		gtk_combo_box_set_model(
-			eEdfImportEpisode,
-			(GtkTreeModel*)m_episodes);
-		gtk_combo_box_set_entry_text_column(
-			eEdfImportEpisode, 0);
-		gtk_entry_set_text(
-			(GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportEpisode),
-			F.episode());
-
-		for ( auto &i : AghDD ) {
-			gtk_list_store_append( m_sessions, &iter);
-			gtk_list_store_set( m_sessions, &iter, 0, i.c_str(), -1);
-		}
-		gtk_combo_box_set_model(
-			eEdfImportSession,
-			(GtkTreeModel*)m_sessions);
-		gtk_combo_box_set_entry_text_column(
-			eEdfImportSession, 0);
-		gtk_entry_set_text(
-			(GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportSession),
-			F.session());
-
-		// display
-		g_signal_emit_by_name( eEdfImportGroupEntry, "changed");
-
-		gint response = gtk_dialog_run( (GtkDialog*)wEdfImport);
-		const gchar
-			*selected_group   = gtk_entry_get_text( eEdfImportGroupEntry),
-			*selected_session = gtk_entry_get_text( eEdfImportSessionEntry),
-			*selected_episode = gtk_entry_get_text( eEdfImportEpisodeEntry);
-		switch ( response ) {
-		case GTK_RESPONSE_OK: // Admit
-		{
-			string dest_path, dest, cmd;
-			using agh::str::sasprintf;
-			dest_path = sasprintf(
-				"%s/%s/%s/%s",
-				ED->session_dir(), selected_group,
-				F.subject().id.c_str(), selected_session);
-			dest = sasprintf(
-				"%s/%s.edf",
-				dest_path.c_str(), selected_episode);
-			if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachCopy) )
-				cmd = sasprintf( "mkdir -p '%s' && cp -n '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
-			else if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachMove) )
-				cmd = sasprintf( "mkdir -p '%s' && mv -n '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
-			else
-				cmd = sasprintf( "mkdir -p '%s' && ln -s '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
-			char* cmde = g_markup_escape_text( cmd.c_str(), -1);
-
-			int cmd_exit = system( cmd.c_str());
-			if ( cmd_exit )
-				pop_ok_message(
-					wMainWindow,
-					"Failed to create recording path in experiment tree",
-					"Command\n <span font=\"monospace\">%s</span>\nexited with code %d",
-					cmde, cmd_exit);
-			g_free( cmde);
-		}
-		break;
-		case GTK_RESPONSE_CANCEL: // Drop
-			break;
-		}
-
-		g_object_unref( m_groups);
-		g_object_unref( m_sessions);
-		g_object_unref( m_episodes);
-
-		return 0;
-
-	} catch ( exception& ex) {
-		pop_ok_message(
-			wMainWindow,
-			"Corrupted source file", "File <b>%s</b> could not be processed.",
-			fname);
-		return 0;
-	}
+        try {
+                string info;
+                sigfile::CTypedSource F_ (fname, ED->fft_params.pagesize);
+                switch ( F_.type() ) {
+                case sigfile::CTypedSource::TType::edf:
+                {
+                        sigfile::CEDFFile& F = F_.obj<sigfile::CEDFFile>();
+                        if ( F.subtype() == sigfile::CEDFFile::TSubtype::edfplus_d ) {
+                                pop_ok_message(
+                                        wMainWindow,
+                                        "EDF+D is unsupported",
+                                        "The file <b>%s</b> is in EDF+D format, which is not supported yet",
+                                        fname);
+                                return 0;
+                        }
+                        if ( F.status() & sigfile::CEDFFile::TStatus::inoperable ) {
+                                pop_ok_message(
+                                        wMainWindow,
+                                        "Bad EDF file",
+                                        "The file <b>%s</b> cannot be processed due to these issues:\n\n%s",
+                                        fname, F.explain_status().c_str());
+                                return 0;
+                        }
+                }
+                break;
+
+                case sigfile::CTypedSource::TType::ascii:
+                break;
+
+                default:
+                        pop_ok_message(
+                                wMainWindow,
+                                "Unsupported format",
+                                "The file <b>%s</b> is in unrecognised format. Sorry.", fname);
+                        return 0;
+                }
+
+                auto& F = F_();
+
+                info = F.details( 0|sigfile::CSource::TDetails::with_channels);
+
+                {
+                        char* mike;
+                        mike = g_markup_escape_text(
+                                agh::str::homedir2tilda( F.filename()).c_str(),
+                                -1);
+                        gtk_label_set_markup(
+                                lEdfImportCaption,
+                                snprintf_buf( "File: <i>%s</i>", mike));
+                        free( (void*)mike);
+
+                        mike = g_markup_escape_text(
+                                F.subject().name.empty() ? "<no name>" : F.subject().name.c_str(),
+                                -1);
+                        gtk_label_set_markup(
+                                lEdfImportSubject,
+                                snprintf_buf(
+                                        "<b>%s</b> (%s)",
+                                        F.subject().id.c_str(),
+                                        mike));
+                        free( (void*)mike);
+                }
+
+                gtk_text_buffer_set_text( tEDFFileDetailsReport, info.c_str(), -1);
+
+                GtkTreeIter iter;
+                // populate and attach models
+                GtkListStore
+                        *m_groups = gtk_list_store_new( 1, G_TYPE_STRING),
+                        *m_episodes = gtk_list_store_new( 1, G_TYPE_STRING),
+                        *m_sessions = gtk_list_store_new( 1, G_TYPE_STRING);
+                // when adding a source for an already existing subject, disallow group selection
+                try {
+                        gtk_entry_set_text(
+                                eEdfImportGroupEntry,
+                                ED->group_of( F.subject().id.c_str()));
+                        gtk_widget_set_sensitive( (GtkWidget*)eEdfImportGroup, FALSE);
+                } catch (invalid_argument ex) {
+                        for ( auto &i : AghGG ) {
+                                gtk_list_store_append( m_groups, &iter);
+                                gtk_list_store_set( m_groups, &iter, 0, i.c_str(), -1);
+                        }
+                        gtk_combo_box_set_model(
+                                eEdfImportGroup,
+                                (GtkTreeModel*)m_groups);
+                        gtk_combo_box_set_entry_text_column( eEdfImportGroup, 0);
+                        // gtk_entry_set_text(
+                        //         (GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportGroup),
+                        //         "");
+                        gtk_widget_set_sensitive( (GtkWidget*)eEdfImportGroup, TRUE);
+                }
+
+                // enumerate known sessions and episodes
+                // suggest those from the file proper
+                for ( auto &i : AghEE ) {
+                        gtk_list_store_append( m_episodes, &iter);
+                        gtk_list_store_set( m_episodes, &iter, 0, i.c_str(), -1);
+                }
+                gtk_combo_box_set_model(
+                        eEdfImportEpisode,
+                        (GtkTreeModel*)m_episodes);
+                gtk_combo_box_set_entry_text_column(
+                        eEdfImportEpisode, 0);
+                gtk_entry_set_text(
+                        (GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportEpisode),
+                        F.episode());
+
+                for ( auto &i : AghDD ) {
+                        gtk_list_store_append( m_sessions, &iter);
+                        gtk_list_store_set( m_sessions, &iter, 0, i.c_str(), -1);
+                }
+                gtk_combo_box_set_model(
+                        eEdfImportSession,
+                        (GtkTreeModel*)m_sessions);
+                gtk_combo_box_set_entry_text_column(
+                        eEdfImportSession, 0);
+                gtk_entry_set_text(
+                        (GtkEntry*)gtk_bin_get_child( (GtkBin*)eEdfImportSession),
+                        F.session());
+
+                // display
+                g_signal_emit_by_name( eEdfImportGroupEntry, "changed");
+
+                gint response = gtk_dialog_run( (GtkDialog*)wEdfImport);
+                const gchar
+                        *selected_group   = gtk_entry_get_text( eEdfImportGroupEntry),
+                        *selected_session = gtk_entry_get_text( eEdfImportSessionEntry),
+                        *selected_episode = gtk_entry_get_text( eEdfImportEpisodeEntry);
+                switch ( response ) {
+                case GTK_RESPONSE_OK: // Admit
+                {
+                        string dest_path, dest, cmd;
+                        using agh::str::sasprintf;
+                        dest_path = sasprintf(
+                                "%s/%s/%s/%s",
+                                ED->session_dir(), selected_group,
+                                F.subject().id.c_str(), selected_session);
+                        dest = sasprintf(
+                                "%s/%s.edf",
+                                dest_path.c_str(), selected_episode);
+                        if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachCopy) )
+                                cmd = sasprintf( "mkdir -p '%s' && cp -n '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
+                        else if ( gtk_toggle_button_get_active( (GtkToggleButton*)bEdfImportAttachMove) )
+                                cmd = sasprintf( "mkdir -p '%s' && mv -n '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
+                        else
+                                cmd = sasprintf( "mkdir -p '%s' && ln -s '%s' '%s'", dest_path.c_str(), fname, dest.c_str());
+                        char* cmde = g_markup_escape_text( cmd.c_str(), -1);
+
+                        int cmd_exit = system( cmd.c_str());
+                        if ( cmd_exit )
+                                pop_ok_message(
+                                        wMainWindow,
+                                        "Failed to create recording path in experiment tree",
+                                        "Command\n <span font=\"monospace\">%s</span>\nexited with code %d",
+                                        cmde, cmd_exit);
+                        g_free( cmde);
+                }
+                break;
+                case GTK_RESPONSE_CANCEL: // Drop
+                        break;
+                }
+
+                g_object_unref( m_groups);
+                g_object_unref( m_sessions);
+                g_object_unref( m_episodes);
+
+                return 0;
+
+        } catch ( exception& ex) {
+                pop_ok_message(
+                        wMainWindow,
+                        "Corrupted source file", "File <b>%s</b> could not be processed.",
+                        fname);
+                return 0;
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/admit-one_cb.cc b/upstream/src/aghermann/ui/mw/admit-one_cb.cc
index 9740ce5..6d27e6a 100644
--- a/upstream/src/aghermann/ui/mw/admit-one_cb.cc
+++ b/upstream/src/aghermann/ui/mw/admit-one_cb.cc
@@ -19,40 +19,40 @@ extern "C" {
 
 gboolean
 check_gtk_entry_nonempty_cb(
-	GtkEditable*,
-	const gpointer  userdata)
+        GtkEditable*,
+        const gpointer  userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, TRUE);
 
-	const gchar *e;
-	gchar *ee;
+        const gchar *e;
+        gchar *ee;
 
-	ee = NULL;
-	e = gtk_entry_get_text( ED.eEdfImportGroupEntry);
-	if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
-		gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
-	}
-	g_free( ee);
+        ee = NULL;
+        e = gtk_entry_get_text( ED.eEdfImportGroupEntry);
+        if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
+                gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
+        }
+        g_free( ee);
 
-	ee = NULL;
-	e = gtk_entry_get_text( ED.eEdfImportSessionEntry);
-	if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
-		gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
-	}
-	g_free( ee);
+        ee = NULL;
+        e = gtk_entry_get_text( ED.eEdfImportSessionEntry);
+        if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
+                gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
+        }
+        g_free( ee);
 
-	ee = NULL;
-	e = gtk_entry_get_text( ED.eEdfImportEpisodeEntry);
-	if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
-		gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
-	}
-	g_free( ee);
+        ee = NULL;
+        e = gtk_entry_get_text( ED.eEdfImportEpisodeEntry);
+        if ( !e || !*g_strchug( g_strchomp( ee = g_strdup( e))) ) {
+                gtk_widget_set_sensitive( (GtkWidget*)ED.bEdfImportAdmit, FALSE);
+        }
+        g_free( ee);
 
-	gtk_widget_queue_draw( (GtkWidget*)ED.bEdfImportAdmit);
+        gtk_widget_queue_draw( (GtkWidget*)ED.bEdfImportAdmit);
 
-	return false;
+        return false;
 }
 
 
@@ -60,75 +60,75 @@ check_gtk_entry_nonempty_cb(
 
 void
 cMeasurements_drag_data_received_cb(
-	const GtkWidget*,
-	GdkDragContext         *context,
-	const gint, //              x,
-	const gint, //              y,
-	const GtkSelectionData *selection_data,
-	const guint, //             info,
-	const guint             time,
-	const gpointer          userdata)
+        const GtkWidget*,
+        GdkDragContext         *context,
+        const gint, //              x,
+        const gint, //              y,
+        const GtkSelectionData *selection_data,
+        const guint, //             info,
+        const guint             time,
+        const gpointer          userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	gchar **uris = gtk_selection_data_get_uris( selection_data);
-	if ( uris != NULL ) {
-
-		guint i = 0;
-		while ( uris[i] ) {
-			if ( strncmp( uris[i], "file://", 7) == 0 ) {
-				char *fname = g_filename_from_uri( uris[i], NULL, NULL);
-				int retval = ED.dnd_maybe_admit_one( fname);
-				g_free( fname);
-				if ( retval )
-					break;
-			}
-			++i;
-		}
-
-		// fear no shortcuts
-		ED.do_rescan_tree( true);
-
-		g_strfreev( uris);
-	}
-
-	gtk_drag_finish (context, TRUE, FALSE, time);
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        gchar **uris = gtk_selection_data_get_uris( selection_data);
+        if ( uris != NULL ) {
+
+                guint i = 0;
+                while ( uris[i] ) {
+                        if ( strncmp( uris[i], "file://", 7) == 0 ) {
+                                char *fname = g_filename_from_uri( uris[i], NULL, NULL);
+                                int retval = ED.dnd_maybe_admit_one( fname);
+                                g_free( fname);
+                                if ( retval )
+                                        break;
+                        }
+                        ++i;
+                }
+
+                // fear no shortcuts
+                ED.do_rescan_tree( true);
+
+                g_strfreev( uris);
+        }
+
+        gtk_drag_finish (context, TRUE, FALSE, time);
 }
 
 
 gboolean
 __attribute__ ((const))
 cMeasurements_drag_drop_cb(
-	GtkWidget*,
-	GdkDragContext*,
-	gint, // x,
-	gint, // y,
-	guint, // time,
-	gpointer) // userdata)
+        GtkWidget*,
+        GdkDragContext*,
+        gint, // x,
+        gint, // y,
+        guint, // time,
+        gpointer) // userdata)
 {
-		//auto& ED = *(SExpDesignUI*)userdata;
-//	GdkAtom         target_type;
+                //auto& ED = *(SExpDesignUI*)userdata;
+//        GdkAtom         target_type;
 //
 //      if ( context->targets ) {
 //              // Choose the best target type
 //              target_type = GDK_POINTER_TO_ATOM
 //                      (g_list_nth_data( context->targets, 0));
-//		unsigned i = g_list_length(context->targets);
-//		while ( i-- )
-//			printf( "%zu: %s\n", i, gdk_atom_name( GDK_POINTER_TO_ATOM (g_list_nth_data( context->targets, i))));
+//                unsigned i = g_list_length(context->targets);
+//                while ( i-- )
+//                        printf( "%zu: %s\n", i, gdk_atom_name( GDK_POINTER_TO_ATOM (g_list_nth_data( context->targets, i))));
 //
-//		//Request the data from the source.
+//                //Request the data from the source.
 //              gtk_drag_get_data(
 //                      widget,         // will receive 'drag-data-received' signal
 //                      context,        // represents the current state of the DnD
 //                      target_type,    // the target type we want
 //                      time);          // time stamp
 //
-//	} else { // No target offered by source => error
+//        } else { // No target offered by source => error
 //              return FALSE;
-//	}
+//        }
 //
-		return  TRUE;
+                return  TRUE;
 }
 
 
@@ -137,7 +137,7 @@ cMeasurements_drag_drop_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/construct.cc b/upstream/src/aghermann/ui/mw/construct.cc
index a933f5f..f4b18a1 100644
--- a/upstream/src/aghermann/ui/mw/construct.cc
+++ b/upstream/src/aghermann/ui/mw/construct.cc
@@ -23,701 +23,701 @@ SExpDesignUIWidgets::
 SExpDesignUIWidgets ()
 {
       // load glade
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mw.glade", NULL) ||
-	     !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mw-dialogs.glade", NULL) )
-		throw runtime_error ("Failed to load main resources");
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mw.glade", NULL) ||
+             !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/mw-dialogs.glade", NULL) )
+                throw runtime_error ("Failed to load main resources");
 
-	gtk_builder_connect_signals( builder, NULL);
+        gtk_builder_connect_signals( builder, NULL);
 
       // ======== construct list and tree stores
-	// dynamic
-	mSessions =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-	mEEGChannels =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-	mAllChannels =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-	mGlobalAnnotations =
-		gtk_tree_store_new( 7,
-				    G_TYPE_STRING, // id
-				    G_TYPE_STRING, // at pages
-				    G_TYPE_STRING, // channel
-				    G_TYPE_STRING, // type
-				    G_TYPE_STRING, // label
-				    G_TYPE_BOOLEAN, G_TYPE_POINTER);
-	mGlobalADProfiles =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-	mSimulations =
-		gtk_tree_store_new( 16,
-				    G_TYPE_STRING,	// group, subject, channel, from-upto
-				    G_TYPE_STRING,
-				    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,	// tunables
-				    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-				    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-				    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-				    G_TYPE_BOOLEAN,
-				    G_TYPE_POINTER);
-	// static
-	if ( !AGH_GBGETOBJ (GtkListStore,	mScoringPageSize) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mFFTParamsPageSize) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mFFTParamsBinSize) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mFFTParamsWindowType) )
-		throw runtime_error ("Failed to construct widgets");
-	// (some of) these are directly attached to combo boxes in dauaghter widgets, so ref
-	g_object_ref( (GObject*)mScoringPageSize);
-	g_object_ref( (GObject*)mFFTParamsPageSize);
-	g_object_ref( (GObject*)mFFTParamsBinSize);
-	g_object_ref( (GObject*)mFFTParamsWindowType);
+        // dynamic
+        mSessions =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+        mEEGChannels =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+        mAllChannels =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+        mGlobalAnnotations =
+                gtk_tree_store_new( 7,
+                                    G_TYPE_STRING, // id
+                                    G_TYPE_STRING, // at pages
+                                    G_TYPE_STRING, // channel
+                                    G_TYPE_STRING, // type
+                                    G_TYPE_STRING, // label
+                                    G_TYPE_BOOLEAN, G_TYPE_POINTER);
+        mGlobalADProfiles =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+        mSimulations =
+                gtk_tree_store_new( 16,
+                                    G_TYPE_STRING,        // group, subject, channel, from-upto
+                                    G_TYPE_STRING,
+                                    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,        // tunables
+                                    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                                    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                                    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                                    G_TYPE_BOOLEAN,
+                                    G_TYPE_POINTER);
+        // static
+        if ( !AGH_GBGETOBJ (GtkListStore,        mScoringPageSize) ||
+             !AGH_GBGETOBJ (GtkListStore,        mFFTParamsPageSize) ||
+             !AGH_GBGETOBJ (GtkListStore,        mFFTParamsBinSize) ||
+             !AGH_GBGETOBJ (GtkListStore,        mFFTParamsWindowType) )
+                throw runtime_error ("Failed to construct widgets");
+        // (some of) these are directly attached to combo boxes in dauaghter widgets, so ref
+        g_object_ref( (GObject*)mScoringPageSize);
+        g_object_ref( (GObject*)mFFTParamsPageSize);
+        g_object_ref( (GObject*)mFFTParamsBinSize);
+        g_object_ref( (GObject*)mFFTParamsWindowType);
 
       // misc
-	auto font_desc = pango_font_description_from_string( "Mono 9");
+        auto font_desc = pango_font_description_from_string( "Mono 9");
 
-	GtkTreeViewColumn *col;
+        GtkTreeViewColumn *col;
 
       // =========== 1. Measurements
       // ------------- cMeasurements
-	if ( !AGH_GBGETOBJ (GtkWindow,		wMainWindow) ||
-	     !AGH_GBGETOBJ (GtkVBox,		cMeasurements) )
-		throw runtime_error ("Failed to construct widgets");
-
-	wMainWindow_delete_event_cb_handler_id =
-		G_CONNECT_2 (wMainWindow, delete, event);
-	G_CONNECT_2 (wMainWindow, configure, event);
-	G_CONNECT_3 (wMainWindow, key, press, event);
-
-	G_CONNECT_3 (cMeasurements, drag, data, received);
-	G_CONNECT_2 (cMeasurements, drag, drop);
-
-	gtk_drag_dest_set( (GtkWidget*)cMeasurements, GTK_DEST_DEFAULT_ALL,
-			   NULL, 0, GDK_ACTION_COPY);
-	gtk_drag_dest_add_uri_targets( (GtkWidget*)(cMeasurements));
-
-	if ( !AGH_GBGETOBJ (GtkMenuItem,	iiMainMenu) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpRefresh) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpPurgeComputed) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpAnnotations) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iExpSubjectSortName) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iExpSubjectSortAge) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iExpSubjectSortAdmissionDate) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iExpSubjectSortAvgPower) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iExpSubjectSortAscending) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iExpSubjectSortSegregate) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpBasicSADetectUltradianCycles) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iiExpGlobalOperations) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpGloballyDetectArtifacts) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpGloballySetFilters) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iiExpSubjectSort) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iMontageSetDefaults) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpClose) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iExpQuit) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iHelpAbout) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iHelpUsage) )
-		throw runtime_error ("Failed to construct widgets");
-
-	G_CONNECT_1 (iExpClose, activate);
-	// g_signal_connect( iExpClose, "activate",
-	// 		  (GCallback)iExpClose_activate_cb,
-	// 		  this);
-	G_CONNECT_1 (iExpRefresh, activate);
-	G_CONNECT_1 (iExpPurgeComputed, activate);
-	G_CONNECT_1 (iExpAnnotations, activate);
-	G_CONNECT_1 (iExpBasicSADetectUltradianCycles, activate);
-	G_CONNECT_1 (iExpGloballyDetectArtifacts, activate);
-	G_CONNECT_1 (iExpGloballySetFilters, activate);
-	// G_CONNECT_1 (iMontageSetDefaults, activate);
-	G_CONNECT_1 (iExpQuit, activate);
-	G_CONNECT_1 (iHelpAbout, activate);
-	G_CONNECT_1 (iHelpUsage, activate);
-
-	for ( auto& w : {iExpSubjectSortName, iExpSubjectSortAge, iExpSubjectSortAdmissionDate, iExpSubjectSortAvgPower} )
-		g_signal_connect( w, "toggled",
-				  (GCallback)iExpSubjectSortAny_toggled_cb,
-				  this);
-	G_CONNECT_1 (iExpSubjectSortAscending, toggled);
-	G_CONNECT_1 (iExpSubjectSortSegregate, toggled);
+        if ( !AGH_GBGETOBJ (GtkWindow,                wMainWindow) ||
+             !AGH_GBGETOBJ (GtkVBox,                cMeasurements) )
+                throw runtime_error ("Failed to construct widgets");
+
+        wMainWindow_delete_event_cb_handler_id =
+                G_CONNECT_2 (wMainWindow, delete, event);
+        G_CONNECT_2 (wMainWindow, configure, event);
+        G_CONNECT_3 (wMainWindow, key, press, event);
+
+        G_CONNECT_3 (cMeasurements, drag, data, received);
+        G_CONNECT_2 (cMeasurements, drag, drop);
+
+        gtk_drag_dest_set( (GtkWidget*)cMeasurements, GTK_DEST_DEFAULT_ALL,
+                           NULL, 0, GDK_ACTION_COPY);
+        gtk_drag_dest_add_uri_targets( (GtkWidget*)(cMeasurements));
+
+        if ( !AGH_GBGETOBJ (GtkMenuItem,        iiMainMenu) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpRefresh) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpPurgeComputed) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpAnnotations) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iExpSubjectSortName) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iExpSubjectSortAge) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iExpSubjectSortAdmissionDate) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iExpSubjectSortAvgPower) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iExpSubjectSortAscending) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iExpSubjectSortSegregate) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpBasicSADetectUltradianCycles) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iiExpGlobalOperations) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpGloballyDetectArtifacts) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpGloballySetFilters) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iiExpSubjectSort) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iMontageSetDefaults) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpClose) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iExpQuit) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iHelpAbout) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iHelpUsage) )
+                throw runtime_error ("Failed to construct widgets");
+
+        G_CONNECT_1 (iExpClose, activate);
+        // g_signal_connect( iExpClose, "activate",
+        //                   (GCallback)iExpClose_activate_cb,
+        //                   this);
+        G_CONNECT_1 (iExpRefresh, activate);
+        G_CONNECT_1 (iExpPurgeComputed, activate);
+        G_CONNECT_1 (iExpAnnotations, activate);
+        G_CONNECT_1 (iExpBasicSADetectUltradianCycles, activate);
+        G_CONNECT_1 (iExpGloballyDetectArtifacts, activate);
+        G_CONNECT_1 (iExpGloballySetFilters, activate);
+        // G_CONNECT_1 (iMontageSetDefaults, activate);
+        G_CONNECT_1 (iExpQuit, activate);
+        G_CONNECT_1 (iHelpAbout, activate);
+        G_CONNECT_1 (iHelpUsage, activate);
+
+        for ( auto& w : {iExpSubjectSortName, iExpSubjectSortAge, iExpSubjectSortAdmissionDate, iExpSubjectSortAvgPower} )
+                g_signal_connect( w, "toggled",
+                                  (GCallback)iExpSubjectSortAny_toggled_cb,
+                                  this);
+        G_CONNECT_1 (iExpSubjectSortAscending, toggled);
+        G_CONNECT_1 (iExpSubjectSortSegregate, toggled);
 
      // --------- tabs
-	if ( !AGH_GBGETOBJ (GtkNotebook,	tTaskSelector) ||
-	     !AGH_GBGETOBJ (GtkNotebook,	tDesign) ||
-	     !AGH_GBGETOBJ (GtkNotebook,	tSimulations) ||
-	     !AGH_GBGETOBJ (GtkNotebook,	tSettings) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lTaskSelector1) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lTaskSelector2) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSettings) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkNotebook,        tTaskSelector) ||
+             !AGH_GBGETOBJ (GtkNotebook,        tDesign) ||
+             !AGH_GBGETOBJ (GtkNotebook,        tSimulations) ||
+             !AGH_GBGETOBJ (GtkNotebook,        tSettings) ||
+             !AGH_GBGETOBJ (GtkLabel,                lTaskSelector1) ||
+             !AGH_GBGETOBJ (GtkLabel,                lTaskSelector2) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSettings) )
+                throw runtime_error ("Failed to construct widgets");
 
-	G_CONNECT_2 (tTaskSelector, switch, page);
-	G_CONNECT_2 (tDesign, switch, page);
-	G_CONNECT_2 (tSimulations, switch, page);
+        G_CONNECT_2 (tTaskSelector, switch, page);
+        G_CONNECT_2 (tDesign, switch, page);
+        G_CONNECT_2 (tSimulations, switch, page);
 
 
      // ------------- eMsmtSession, eMsmtChannel
-	if ( !AGH_GBGETOBJ (GtkComboBox, eMsmtSession) ||
-	     !AGH_GBGETOBJ ( GtkComboBox, eMsmtChannel) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkComboBox, eMsmtSession) ||
+             !AGH_GBGETOBJ ( GtkComboBox, eMsmtChannel) )
+                throw runtime_error ("Failed to construct widgets");
 
-	gtk_combo_box_set_model_properly(
-		eMsmtSession, mSessions);
-	eMsmtSession_changed_cb_handler_id =
-		G_CONNECT_1 (eMsmtSession, changed);
+        gtk_combo_box_set_model_properly(
+                eMsmtSession, mSessions);
+        eMsmtSession_changed_cb_handler_id =
+                G_CONNECT_1 (eMsmtSession, changed);
 
-	gtk_combo_box_set_model_properly(
-		eMsmtChannel, mEEGChannels);
-	eMsmtChannel_changed_cb_handler_id =
-		G_CONNECT_1 (eMsmtChannel, changed);
+        gtk_combo_box_set_model_properly(
+                eMsmtChannel, mEEGChannels);
+        eMsmtChannel_changed_cb_handler_id =
+                G_CONNECT_1 (eMsmtChannel, changed);
 
      // ------------- eMsmtProfile*
-	if ( !AGH_GBGETOBJ (GtkToggleButton,	eMsmtProfileAutoscale) ||
-	     !AGH_GBGETOBJ (GtkScaleButton,	eMsmtProfileSmooth) ||
+        if ( !AGH_GBGETOBJ (GtkToggleButton,        eMsmtProfileAutoscale) ||
+             !AGH_GBGETOBJ (GtkScaleButton,        eMsmtProfileSmooth) ||
 
-	     !AGH_GBGETOBJ (GtkListStore,	mMsmtProfileType) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eMsmtProfileType) ||
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtProfileParamsContainer) ||
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtProfileParamsPSD) ||
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtProfileParamsSWU) ||
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtProfileParamsMC) ||
+             !AGH_GBGETOBJ (GtkListStore,        mMsmtProfileType) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eMsmtProfileType) ||
+             !AGH_GBGETOBJ (GtkBox,                cMsmtProfileParamsContainer) ||
+             !AGH_GBGETOBJ (GtkBox,                cMsmtProfileParamsPSD) ||
+             !AGH_GBGETOBJ (GtkBox,                cMsmtProfileParamsSWU) ||
+             !AGH_GBGETOBJ (GtkBox,                cMsmtProfileParamsMC) ||
 
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMsmtProfileParamsPSDFreqFrom)  ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMsmtProfileParamsPSDFreqWidth) ||
-	     !AGH_GBGETOBJ (GtkAdjustment,	jMsmtProfileParamsPSDFreqFrom)  ||
-	     !AGH_GBGETOBJ (GtkAdjustment,	jMsmtProfileParamsPSDFreqWidth) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMsmtProfileParamsPSDFreqFrom)  ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMsmtProfileParamsPSDFreqWidth) ||
+             !AGH_GBGETOBJ (GtkAdjustment,        jMsmtProfileParamsPSDFreqFrom)  ||
+             !AGH_GBGETOBJ (GtkAdjustment,        jMsmtProfileParamsPSDFreqWidth) ||
 
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMsmtProfileParamsSWUF0)  ||
-	     !AGH_GBGETOBJ (GtkAdjustment,	jMsmtProfileParamsSWUF0)  ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMsmtProfileParamsSWUF0)  ||
+             !AGH_GBGETOBJ (GtkAdjustment,        jMsmtProfileParamsSWUF0)  ||
 
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMsmtProfileParamsMCF0)  ||
-	     !AGH_GBGETOBJ (GtkAdjustment,	jMsmtProfileParamsMCF0)  ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMsmtProfileParamsMCF0)  ||
+             !AGH_GBGETOBJ (GtkAdjustment,        jMsmtProfileParamsMCF0)  ||
 
-	     !AGH_GBGETOBJ (GtkLabel,		lMsmtProfilePSDExtra) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lMsmtProfileSWUExtra) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lMsmtProfileMCExtra) ||
+             !AGH_GBGETOBJ (GtkLabel,                lMsmtProfilePSDExtra) ||
+             !AGH_GBGETOBJ (GtkLabel,                lMsmtProfileSWUExtra) ||
+             !AGH_GBGETOBJ (GtkLabel,                lMsmtProfileMCExtra) ||
 
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtMainToolbar) ||
-	     !AGH_GBGETOBJ (GtkBox,		cMsmtTopArea) )
-		throw runtime_error ("Failed to construct widgets");
+             !AGH_GBGETOBJ (GtkBox,                cMsmtMainToolbar) ||
+             !AGH_GBGETOBJ (GtkBox,                cMsmtTopArea) )
+                throw runtime_error ("Failed to construct widgets");
 
-	gtk_cell_layout_set_renderer( eMsmtProfileType);
-	// and when was the list store attached to it, eh?
+        gtk_cell_layout_set_renderer( eMsmtProfileType);
+        // and when was the list store attached to it, eh?
 
-	G_CONNECT_1 (eMsmtProfileType, changed);
-	G_CONNECT_1 (eMsmtProfileAutoscale, toggled);
-	G_CONNECT_2 (eMsmtProfileSmooth, value, changed);
+        G_CONNECT_1 (eMsmtProfileType, changed);
+        G_CONNECT_1 (eMsmtProfileAutoscale, toggled);
+        G_CONNECT_2 (eMsmtProfileSmooth, value, changed);
 
-	G_CONNECT_2 (eMsmtProfileParamsPSDFreqFrom, value, changed);
-	G_CONNECT_2 (eMsmtProfileParamsPSDFreqWidth, value, changed);
-	G_CONNECT_2 (eMsmtProfileParamsSWUF0, value, changed);
-	G_CONNECT_2 (eMsmtProfileParamsMCF0, value, changed);
+        G_CONNECT_2 (eMsmtProfileParamsPSDFreqFrom, value, changed);
+        G_CONNECT_2 (eMsmtProfileParamsPSDFreqWidth, value, changed);
+        G_CONNECT_2 (eMsmtProfileParamsSWUF0, value, changed);
+        G_CONNECT_2 (eMsmtProfileParamsMCF0, value, changed);
 
       // ------------ menus
-	if ( !(AGH_GBGETOBJ (GtkMenu,		iiSubjectTimeline)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineScore)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineDetectUltradianCycle)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineEDFInfo)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineSaveAsSVG)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineResetMontage)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSubjectTimelineBrowse)) )
-		throw runtime_error ("Failed to construct widgets");
-
-	g_object_ref( (GObject*)iiSubjectTimeline);
-	g_object_ref( (GObject*)iSubjectTimelineScore);
-	g_object_ref( (GObject*)iSubjectTimelineDetectUltradianCycle);
-	g_object_ref( (GObject*)iSubjectTimelineEDFInfo);
-	g_object_ref( (GObject*)iSubjectTimelineSaveAsSVG);
-	g_object_ref( (GObject*)iSubjectTimelineResetMontage);
-	g_object_ref( (GObject*)iSubjectTimelineBrowse);
-
-	G_CONNECT_1 (iSubjectTimelineScore, activate);
-	G_CONNECT_1 (iSubjectTimelineDetectUltradianCycle, activate);
-	G_CONNECT_1 (iSubjectTimelineEDFInfo, activate);
-	G_CONNECT_1 (iSubjectTimelineSaveAsSVG, activate);
-	G_CONNECT_1 (iSubjectTimelineBrowse, activate);
-	G_CONNECT_1 (iSubjectTimelineResetMontage, activate);
+        if ( !(AGH_GBGETOBJ (GtkMenu,                iiSubjectTimeline)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineScore)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineDetectUltradianCycle)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineEDFInfo)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineSaveAsSVG)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineResetMontage)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,        iSubjectTimelineBrowse)) )
+                throw runtime_error ("Failed to construct widgets");
+
+        g_object_ref( (GObject*)iiSubjectTimeline);
+        g_object_ref( (GObject*)iSubjectTimelineScore);
+        g_object_ref( (GObject*)iSubjectTimelineDetectUltradianCycle);
+        g_object_ref( (GObject*)iSubjectTimelineEDFInfo);
+        g_object_ref( (GObject*)iSubjectTimelineSaveAsSVG);
+        g_object_ref( (GObject*)iSubjectTimelineResetMontage);
+        g_object_ref( (GObject*)iSubjectTimelineBrowse);
+
+        G_CONNECT_1 (iSubjectTimelineScore, activate);
+        G_CONNECT_1 (iSubjectTimelineDetectUltradianCycle, activate);
+        G_CONNECT_1 (iSubjectTimelineEDFInfo, activate);
+        G_CONNECT_1 (iSubjectTimelineSaveAsSVG, activate);
+        G_CONNECT_1 (iSubjectTimelineBrowse, activate);
+        G_CONNECT_1 (iSubjectTimelineResetMontage, activate);
 
       // ------------ actions
-	if ( !(AGH_GBGETOBJ (GtkButton,		bMainCloseThatSF)) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(AGH_GBGETOBJ (GtkButton,                bMainCloseThatSF)) )
+                throw runtime_error ("Failed to construct widgets");
 
-	G_CONNECT_1 (bMainCloseThatSF, clicked);
+        G_CONNECT_1 (bMainCloseThatSF, clicked);
 
    // ================ 2. Simulations
      // ------------- tvSimulations & controls
-	if ( !(AGH_GBGETOBJ (GtkTreeView, tvSimulations)) )
-		throw runtime_error ("Failed to construct widgets");
-
-	gtk_tree_view_set_model( tvSimulations,
-				 (GtkTreeModel*)mSimulations);
-
-	g_object_set( (GObject*)tvSimulations,
-		      "expander-column", 0,
-		      "enable-tree-lines", FALSE,
-		      "headers-clickable", FALSE,
-		      NULL);
-	g_signal_connect( tvSimulations, "map",
-			  (GCallback)gtk_tree_view_expand_all,
-			  NULL);
-	G_CONNECT_2 (tvSimulations, row, activated);
-
-	for ( auto c = 0; c < msimulations_visibility_switch_col; ++c ) {
-		GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
-		g_object_set( (GObject*)renderer,
-			      "editable", FALSE,
-			      "xalign", (c >= 2) ? .5 : 0.,
-			      NULL);
-		g_object_set_data( (GObject*)renderer,
-				   "column", GINT_TO_POINTER (c));
-
-		col = gtk_tree_view_column_new_with_attributes(
-			"replaceme",
-			renderer,
-			"text", c,
-			NULL);
-		gtk_tree_view_column_set_expand( col, TRUE);
-		gtk_tree_view_column_set_alignment( col, (c >= 2) ? .5 : 0.);
-		GtkWidget *lbl = gtk_label_new( NULL);
-		gtk_label_set_markup(
-			(GtkLabel*)lbl,
-			(c == 0) ? "Id" : (c == 1) ? "Status" : agh::ach::tunable_pango_name(c-2).c_str());
-		gtk_widget_set_visible( lbl, TRUE);
-		gtk_tree_view_column_set_widget(
-			col, lbl);
-		gtk_tree_view_append_column( tvSimulations, col);
-	}
-	gtk_tree_view_append_column( tvSimulations,
-				     col = gtk_tree_view_column_new());
-	gtk_tree_view_column_set_visible( col, FALSE);
+        if ( !(AGH_GBGETOBJ (GtkTreeView, tvSimulations)) )
+                throw runtime_error ("Failed to construct widgets");
+
+        gtk_tree_view_set_model( tvSimulations,
+                                 (GtkTreeModel*)mSimulations);
+
+        g_object_set( (GObject*)tvSimulations,
+                      "expander-column", 0,
+                      "enable-tree-lines", FALSE,
+                      "headers-clickable", FALSE,
+                      NULL);
+        g_signal_connect( tvSimulations, "map",
+                          (GCallback)gtk_tree_view_expand_all,
+                          NULL);
+        G_CONNECT_2 (tvSimulations, row, activated);
+
+        for ( auto c = 0; c < msimulations_visibility_switch_col; ++c ) {
+                GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+                g_object_set( (GObject*)renderer,
+                              "editable", FALSE,
+                              "xalign", (c >= 2) ? .5 : 0.,
+                              NULL);
+                g_object_set_data( (GObject*)renderer,
+                                   "column", GINT_TO_POINTER (c));
+
+                col = gtk_tree_view_column_new_with_attributes(
+                        "replaceme",
+                        renderer,
+                        "text", c,
+                        NULL);
+                gtk_tree_view_column_set_expand( col, TRUE);
+                gtk_tree_view_column_set_alignment( col, (c >= 2) ? .5 : 0.);
+                GtkWidget *lbl = gtk_label_new( NULL);
+                gtk_label_set_markup(
+                        (GtkLabel*)lbl,
+                        (c == 0) ? "Id" : (c == 1) ? "Status" : agh::ach::tunable_pango_name(c-2).c_str());
+                gtk_widget_set_visible( lbl, TRUE);
+                gtk_tree_view_column_set_widget(
+                        col, lbl);
+                gtk_tree_view_append_column( tvSimulations, col);
+        }
+        gtk_tree_view_append_column( tvSimulations,
+                                     col = gtk_tree_view_column_new());
+        gtk_tree_view_column_set_visible( col, FALSE);
 
       // ------------ iSimulations*
-	if ( !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsRunBatch)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsRunClearAll)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsReportGenerate)) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsRunBatch)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsRunClearAll)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem, iSimulationsReportGenerate)) )
+                throw runtime_error ("Failed to construct widgets");
 
-	G_CONNECT_1 (iSimulationsRunBatch, activate);
-	G_CONNECT_1 (iSimulationsRunClearAll, activate);
-	G_CONNECT_1 (iSimulationsReportGenerate, activate);
+        G_CONNECT_1 (iSimulationsRunBatch, activate);
+        G_CONNECT_1 (iSimulationsRunClearAll, activate);
+        G_CONNECT_1 (iSimulationsReportGenerate, activate);
 
       // ------------- lSimulations{Session,Channel}
-	if ( !AGH_GBGETOBJ (GtkLabel, lSimulationsProfile) ||
-	     !AGH_GBGETOBJ (GtkLabel, lSimulationsChannel) ||
-	     !AGH_GBGETOBJ (GtkLabel, lSimulationsSession) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkLabel, lSimulationsProfile) ||
+             !AGH_GBGETOBJ (GtkLabel, lSimulationsChannel) ||
+             !AGH_GBGETOBJ (GtkLabel, lSimulationsSession) )
+                throw runtime_error ("Failed to construct widgets");
 
       // ------- statusbar
-	if ( !AGH_GBGETOBJ (GtkStatusbar,	sbMainStatusBar) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkStatusbar,        sbMainStatusBar) )
+                throw runtime_error ("Failed to construct widgets");
 
-	sbMainContextIdGeneral = gtk_statusbar_get_context_id( sbMainStatusBar, "General context");
+        sbMainContextIdGeneral = gtk_statusbar_get_context_id( sbMainStatusBar, "General context");
 
-	if ( !(AGH_GBGETOBJ (GtkDialog,		wScanLog)) ||
-	     !(AGH_GBGETOBJ (GtkTextView,	tScanLog)) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(AGH_GBGETOBJ (GtkDialog,                wScanLog)) ||
+             !(AGH_GBGETOBJ (GtkTextView,        tScanLog)) )
+                throw runtime_error ("Failed to construct widgets");
 
-	gtk_widget_override_font( (GtkWidget*)tScanLog, font_desc);
-	gtk_text_buffer_create_tag(
-		gtk_text_view_get_buffer( tScanLog),
-		"bold",
-		"weight", PANGO_WEIGHT_BOLD,
-		NULL);
-	gtk_text_buffer_create_tag(
-		gtk_text_view_get_buffer( tScanLog),
-		"italic",
-		"style", PANGO_STYLE_ITALIC,
-		NULL);
+        gtk_widget_override_font( (GtkWidget*)tScanLog, font_desc);
+        gtk_text_buffer_create_tag(
+                gtk_text_view_get_buffer( tScanLog),
+                "bold",
+                "weight", PANGO_WEIGHT_BOLD,
+                NULL);
+        gtk_text_buffer_create_tag(
+                gtk_text_view_get_buffer( tScanLog),
+                "italic",
+                "style", PANGO_STYLE_ITALIC,
+                NULL);
 
-	// free? unref? leak some?
+        // free? unref? leak some?
 
       // ****************** settings
-	if ( !AGH_GBGETOBJ (GtkSpinButton,	eSMPMaxThreads) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkSpinButton,        eSMPMaxThreads) )
+                throw runtime_error ("Failed to construct widgets");
 
       // ------------- fFFTParams
-	if ( !AGH_GBGETOBJ (GtkSpinButton,	eUltradianCycleDetectionAccuracy) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eFFTParamsBinSize) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eFFTParamsPageSize) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eFFTParamsPlanType) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eFFTParamsWindowType) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkSpinButton,        eUltradianCycleDetectionAccuracy) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eFFTParamsBinSize) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eFFTParamsPageSize) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eFFTParamsPlanType) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eFFTParamsWindowType) )
+                throw runtime_error ("Failed to construct widgets");
 
-	for ( auto& e : {eFFTParamsBinSize, eFFTParamsPageSize, eFFTParamsPlanType, eFFTParamsWindowType} )
-		gtk_cell_layout_set_renderer( e);
+        for ( auto& e : {eFFTParamsBinSize, eFFTParamsPageSize, eFFTParamsPlanType, eFFTParamsWindowType} )
+                gtk_cell_layout_set_renderer( e);
 
       // ------------- fArtifacts
-	if ( !AGH_GBGETOBJ (GtkComboBox,	eArtifDampenWindowType) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eArtifDampenFactor) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkComboBox,        eArtifDampenWindowType) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eArtifDampenFactor) )
+                throw runtime_error ("Failed to construct widgets");
 
-	gtk_cell_layout_set_renderer( eArtifDampenWindowType);
+        gtk_cell_layout_set_renderer( eArtifDampenWindowType);
 
       // ------------- fMicrocontinuity
-	if ( !AGH_GBGETOBJ (GtkSpinButton,	eMCParamBandWidth) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMCParamIIRBackpolate) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMCParamMCGain) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMCParamFreqInc) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eMCParamNBins) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSWUParamMinUpswingDuration) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkSpinButton,        eMCParamBandWidth) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMCParamIIRBackpolate) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMCParamMCGain) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMCParamFreqInc) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eMCParamNBins) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSWUParamMinUpswingDuration) )
+                throw runtime_error ("Failed to construct widgets");
 
       // ------- custom score codes
-	if ( !(eScoreCode[sigfile::SPage::TScore::none]		= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeUnscored")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::nrem1]	= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM1")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::nrem2]	= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM2")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::nrem3]	= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM3")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::nrem4]	= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM4")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::rem]		= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeREM")) ||
-	     !(eScoreCode[sigfile::SPage::TScore::wake]		= (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeWake")))
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(eScoreCode[sigfile::SPage::TScore::none]                = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeUnscored")) ||
+             !(eScoreCode[sigfile::SPage::TScore::nrem1]        = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM1")) ||
+             !(eScoreCode[sigfile::SPage::TScore::nrem2]        = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM2")) ||
+             !(eScoreCode[sigfile::SPage::TScore::nrem3]        = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM3")) ||
+             !(eScoreCode[sigfile::SPage::TScore::nrem4]        = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeNREM4")) ||
+             !(eScoreCode[sigfile::SPage::TScore::rem]                = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeREM")) ||
+             !(eScoreCode[sigfile::SPage::TScore::wake]                = (GtkEntry*)gtk_builder_get_object( builder, "eScoreCodeWake")))
+                throw runtime_error ("Failed to construct widgets");
 
       // --------- Bands
-	if ( !(eBand[metrics::TBand::delta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaFrom")) ||
-	     !(eBand[metrics::TBand::delta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaUpto")) ||
-	     !(eBand[metrics::TBand::theta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaFrom")) ||
-	     !(eBand[metrics::TBand::theta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaUpto")) ||
-	     !(eBand[metrics::TBand::alpha][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaFrom")) ||
-	     !(eBand[metrics::TBand::alpha][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaUpto")) ||
-	     !(eBand[metrics::TBand::beta ][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaFrom" )) ||
-	     !(eBand[metrics::TBand::beta ][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaUpto" )) ||
-	     !(eBand[metrics::TBand::gamma][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaFrom")) ||
-	     !(eBand[metrics::TBand::gamma][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaUpto")) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(eBand[metrics::TBand::delta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaFrom")) ||
+             !(eBand[metrics::TBand::delta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaUpto")) ||
+             !(eBand[metrics::TBand::theta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaFrom")) ||
+             !(eBand[metrics::TBand::theta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaUpto")) ||
+             !(eBand[metrics::TBand::alpha][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaFrom")) ||
+             !(eBand[metrics::TBand::alpha][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaUpto")) ||
+             !(eBand[metrics::TBand::beta ][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaFrom" )) ||
+             !(eBand[metrics::TBand::beta ][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaUpto" )) ||
+             !(eBand[metrics::TBand::gamma][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaFrom")) ||
+             !(eBand[metrics::TBand::gamma][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaUpto")) )
+                throw runtime_error ("Failed to construct widgets");
 
       // --------- Misc
-	if ( !AGH_GBGETOBJ (GtkSpinButton, eDAMsmtPPH) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eDAMsmtTLHeight) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eDAPageHeight) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eDAHypnogramHeight) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eDAEMGHeight) ||
-	     !AGH_GBGETOBJ (GtkCheckButton, eScanTreeStrict) ||
-	     !AGH_GBGETOBJ (GtkCheckButton, eScanTreeSuppressReport) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkSpinButton, eDAMsmtPPH) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eDAMsmtTLHeight) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eDAPageHeight) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eDAHypnogramHeight) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eDAEMGHeight) ||
+             !AGH_GBGETOBJ (GtkCheckButton, eScanTreeStrict) ||
+             !AGH_GBGETOBJ (GtkCheckButton, eScanTreeSuppressReport) )
+                throw runtime_error ("Failed to construct widgets");
 
-	if ( !AGH_GBGETOBJ (GtkEntry,	eBrowseCommand) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eScrollSpeedFactor) ||
-	     !AGH_GBGETOBJ (GtkSpinButton, eDAEMGHeight) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkEntry,        eBrowseCommand) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eScrollSpeedFactor) ||
+             !AGH_GBGETOBJ (GtkSpinButton, eDAEMGHeight) )
+                throw runtime_error ("Failed to construct widgets");
 
 
      // ------------- eCtrlParam*
-	if ( !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlNTries) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlItersFixedT) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlStepSize) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlBoltzmannk) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlDampingMu) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlTInitialMantissa) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlTInitialExponent) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlTMinMantissa) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamAnnlTMinExponent) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eCtlParamDBAmendment1) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eCtlParamDBAmendment2) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eCtlParamAZAmendment1) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lCtlParamDBAmendment1) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lCtlParamDBAmendment2) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lCtlParamAZAmendment1) ||
-	     !AGH_GBGETOBJ (GtkRadioButton,	eCtlParamScoreUnscoredAsWake) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamNSWAPpBeforeSimStart) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eCtlParamReqScoredPercent) )
-		throw runtime_error ("Failed to construct widgets");
-
-	G_CONNECT_1 (eCtlParamDBAmendment1, toggled);
-	G_CONNECT_1 (eCtlParamDBAmendment2, toggled);
-	G_CONNECT_1 (eCtlParamAZAmendment1, toggled);
+        if ( !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlNTries) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlItersFixedT) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlStepSize) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlBoltzmannk) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlDampingMu) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlTInitialMantissa) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlTInitialExponent) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlTMinMantissa) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamAnnlTMinExponent) ||
+             !AGH_GBGETOBJ (GtkCheckButton,        eCtlParamDBAmendment1) ||
+             !AGH_GBGETOBJ (GtkCheckButton,        eCtlParamDBAmendment2) ||
+             !AGH_GBGETOBJ (GtkCheckButton,        eCtlParamAZAmendment1) ||
+             !AGH_GBGETOBJ (GtkLabel,                lCtlParamDBAmendment1) ||
+             !AGH_GBGETOBJ (GtkLabel,                lCtlParamDBAmendment2) ||
+             !AGH_GBGETOBJ (GtkLabel,                lCtlParamAZAmendment1) ||
+             !AGH_GBGETOBJ (GtkRadioButton,        eCtlParamScoreUnscoredAsWake) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamNSWAPpBeforeSimStart) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eCtlParamReqScoredPercent) )
+                throw runtime_error ("Failed to construct widgets");
+
+        G_CONNECT_1 (eCtlParamDBAmendment1, toggled);
+        G_CONNECT_1 (eCtlParamDBAmendment2, toggled);
+        G_CONNECT_1 (eCtlParamAZAmendment1, toggled);
 
       // ------------- eTunable_*
-	using namespace agh::ach;
-	if ( !(eTunable[TTunable::rs][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs")) ||
-	     !(eTunable[TTunable::rs][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_min")) ||
-	     !(eTunable[TTunable::rs][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_max")) ||
-	     !(eTunable[TTunable::rs][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_step")) ||
-
-	     !(eTunable[TTunable::rc][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc")) ||
-	     !(eTunable[TTunable::rc][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_min")) ||
-	     !(eTunable[TTunable::rc][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_max")) ||
-	     !(eTunable[TTunable::rc][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_step")) ||
-
-	     !(eTunable[TTunable::fcR][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR")) ||
-	     !(eTunable[TTunable::fcR][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_min")) ||
-	     !(eTunable[TTunable::fcR][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_max")) ||
-	     !(eTunable[TTunable::fcR][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_step")) ||
-
-	     !(eTunable[TTunable::fcW][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW")) ||
-	     !(eTunable[TTunable::fcW][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_min")) ||
-	     !(eTunable[TTunable::fcW][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_max")) ||
-	     !(eTunable[TTunable::fcW][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_step")) ||
-
-	     !(eTunable[TTunable::S0][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0")) ||
-	     !(eTunable[TTunable::S0][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_min")) ||
-	     !(eTunable[TTunable::S0][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_max")) ||
-	     !(eTunable[TTunable::S0][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_step")) ||
-
-	     !(eTunable[TTunable::SU][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU")) ||
-	     !(eTunable[TTunable::SU][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_min")) ||
-	     !(eTunable[TTunable::SU][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_max")) ||
-	     !(eTunable[TTunable::SU][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_step")) ||
-
-	     !(eTunable[TTunable::ta][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta")) ||
-	     !(eTunable[TTunable::ta][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_min")) ||
-	     !(eTunable[TTunable::ta][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_max")) ||
-	     !(eTunable[TTunable::ta][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_step")) ||
-
-	     !(eTunable[TTunable::tp][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp")) ||
-	     !(eTunable[TTunable::tp][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_min")) ||
-	     !(eTunable[TTunable::tp][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_max")) ||
-	     !(eTunable[TTunable::tp][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_step")) ||
-
-	     !(eTunable[TTunable::gc][0]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc")) ||
-	     !(eTunable[TTunable::gc][1]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_min")) ||
-	     !(eTunable[TTunable::gc][2]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_max")) ||
-	     !(eTunable[TTunable::gc][3]	= (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_step")) )
-		throw runtime_error ("Failed to construct widgets");
-
-	for ( size_t t = 0; t < (size_t)TTunable::_basic_tunables; ++t )
-		for ( auto d = 0; d < 4; ++d )
-			jTunable[t][d] = gtk_spin_button_get_adjustment( eTunable[t][d]);
-
-
-	if ( !AGH_GBGETOBJ (GtkButton,	bSimParamRevertTunables) )
-		throw runtime_error ("Failed to construct widgets");
-	G_CONNECT_1 (bSimParamRevertTunables, clicked);
+        using namespace agh::ach;
+        if ( !(eTunable[TTunable::rs][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs")) ||
+             !(eTunable[TTunable::rs][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_min")) ||
+             !(eTunable[TTunable::rs][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_max")) ||
+             !(eTunable[TTunable::rs][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rs_step")) ||
+
+             !(eTunable[TTunable::rc][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc")) ||
+             !(eTunable[TTunable::rc][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_min")) ||
+             !(eTunable[TTunable::rc][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_max")) ||
+             !(eTunable[TTunable::rc][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_rc_step")) ||
+
+             !(eTunable[TTunable::fcR][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR")) ||
+             !(eTunable[TTunable::fcR][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_min")) ||
+             !(eTunable[TTunable::fcR][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_max")) ||
+             !(eTunable[TTunable::fcR][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcR_step")) ||
+
+             !(eTunable[TTunable::fcW][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW")) ||
+             !(eTunable[TTunable::fcW][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_min")) ||
+             !(eTunable[TTunable::fcW][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_max")) ||
+             !(eTunable[TTunable::fcW][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_fcW_step")) ||
+
+             !(eTunable[TTunable::S0][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0")) ||
+             !(eTunable[TTunable::S0][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_min")) ||
+             !(eTunable[TTunable::S0][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_max")) ||
+             !(eTunable[TTunable::S0][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_S0_step")) ||
+
+             !(eTunable[TTunable::SU][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU")) ||
+             !(eTunable[TTunable::SU][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_min")) ||
+             !(eTunable[TTunable::SU][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_max")) ||
+             !(eTunable[TTunable::SU][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_SU_step")) ||
+
+             !(eTunable[TTunable::ta][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta")) ||
+             !(eTunable[TTunable::ta][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_min")) ||
+             !(eTunable[TTunable::ta][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_max")) ||
+             !(eTunable[TTunable::ta][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_ta_step")) ||
+
+             !(eTunable[TTunable::tp][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp")) ||
+             !(eTunable[TTunable::tp][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_min")) ||
+             !(eTunable[TTunable::tp][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_max")) ||
+             !(eTunable[TTunable::tp][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_tp_step")) ||
+
+             !(eTunable[TTunable::gc][0]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc")) ||
+             !(eTunable[TTunable::gc][1]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_min")) ||
+             !(eTunable[TTunable::gc][2]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_max")) ||
+             !(eTunable[TTunable::gc][3]        = (GtkSpinButton*)gtk_builder_get_object( builder, "eTunable_gc_step")) )
+                throw runtime_error ("Failed to construct widgets");
+
+        for ( size_t t = 0; t < (size_t)TTunable::_basic_tunables; ++t )
+                for ( auto d = 0; d < 4; ++d )
+                        jTunable[t][d] = gtk_spin_button_get_adjustment( eTunable[t][d]);
+
+
+        if ( !AGH_GBGETOBJ (GtkButton,        bSimParamRevertTunables) )
+                throw runtime_error ("Failed to construct widgets");
+        G_CONNECT_1 (bSimParamRevertTunables, clicked);
 
       // ------ colours
-	if ( !(CwB[TColour::mw_night	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWNight")) ||
-	     !(CwB[TColour::mw_day	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWDay")) ||
-	     !(CwB[TColour::mw_profile	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWProfile")) ||
-	     !(CwB[TColour::mw_ticks	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWTicks")) ||
-	     !(CwB[TColour::mw_labels	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWLabels")) ||
-
-	     !(CwB[TColour::sf_profile_psd    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfilePSD")) ||
-	     !(CwB[TColour::sf_profile_mc     ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfileMC")) ||
-	     !(CwB[TColour::sf_profile_swu    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfileSWU")) ||
-	     !(CwB[TColour::sf_phasic_spindle ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicSpindle")) ||
-	     !(CwB[TColour::sf_phasic_Kcomplex].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicKComplex")) ||
-	     !(CwB[TColour::sf_phasic_eyeblink].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicEyeBlink")) ||
-	     !(CwB[TColour::sf_emg	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFEMG")) ||
-	     !(CwB[TColour::sf_hypnogram      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFHypnogram")) ||
-	     !(CwB[TColour::sf_artifact	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFArtifacts")) ||
-	     !(CwB[TColour::sf_annotations    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFAnnotations")) ||
-	     !(CwB[TColour::sf_embedded_annotations]
-					       .btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFEmbeddedAnnotations")) ||
-	     !(CwB[TColour::sf_selection      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFSelection")) ||
-	     !(CwB[TColour::sf_ticks	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFTicks")) ||
-	     !(CwB[TColour::sf_labels	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFLabels")) ||
-	     !(CwB[TColour::sf_cursor	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFCursor")) ||
-
-	     !(CwB[TColour::mf_swa	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFSWA")) ||
-	     !(CwB[TColour::mf_swa_sim	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFSWASim")) ||
-	     !(CwB[TColour::mf_process_s      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFProcessS")) ||
-	     !(CwB[TColour::mf_paper	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFPaper")) ||
-	     !(CwB[TColour::mf_ticks	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFTicks")) ||
-	     !(CwB[TColour::mf_labels	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFLabels")) ||
-
-	     !(CwB[TColour::score_none	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNONE")) ||
-	     !(CwB[TColour::score_nrem1	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM1")) ||
-	     !(CwB[TColour::score_nrem2	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM2")) ||
-	     !(CwB[TColour::score_nrem3	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM3")) ||
-	     !(CwB[TColour::score_nrem4	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM4")) ||
-	     !(CwB[TColour::score_rem	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreREM")) ||
-	     !(CwB[TColour::score_wake	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreWake")) ||
-
-	     !(CwB[TColour::band_delta	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandDelta")) ||
-	     !(CwB[TColour::band_theta	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandTheta")) ||
-	     !(CwB[TColour::band_alpha	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandAlpha")) ||
-	     !(CwB[TColour::band_beta	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandBeta")) ||
-	     !(CwB[TColour::band_gamma	      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandGamma")) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !(CwB[TColour::mw_night              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWNight")) ||
+             !(CwB[TColour::mw_day              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWDay")) ||
+             !(CwB[TColour::mw_profile              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWProfile")) ||
+             !(CwB[TColour::mw_ticks              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWTicks")) ||
+             !(CwB[TColour::mw_labels              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMWLabels")) ||
+
+             !(CwB[TColour::sf_profile_psd    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfilePSD")) ||
+             !(CwB[TColour::sf_profile_mc     ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfileMC")) ||
+             !(CwB[TColour::sf_profile_swu    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFProfileSWU")) ||
+             !(CwB[TColour::sf_phasic_spindle ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicSpindle")) ||
+             !(CwB[TColour::sf_phasic_Kcomplex].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicKComplex")) ||
+             !(CwB[TColour::sf_phasic_eyeblink].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFPhasicEyeBlink")) ||
+             !(CwB[TColour::sf_emg              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFEMG")) ||
+             !(CwB[TColour::sf_hypnogram      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFHypnogram")) ||
+             !(CwB[TColour::sf_artifact              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFArtifacts")) ||
+             !(CwB[TColour::sf_annotations    ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFAnnotations")) ||
+             !(CwB[TColour::sf_embedded_annotations]
+                                               .btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFEmbeddedAnnotations")) ||
+             !(CwB[TColour::sf_selection      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFSelection")) ||
+             !(CwB[TColour::sf_ticks              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFTicks")) ||
+             !(CwB[TColour::sf_labels              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFLabels")) ||
+             !(CwB[TColour::sf_cursor              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourSFCursor")) ||
+
+             !(CwB[TColour::mf_swa              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFSWA")) ||
+             !(CwB[TColour::mf_swa_sim              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFSWASim")) ||
+             !(CwB[TColour::mf_process_s      ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFProcessS")) ||
+             !(CwB[TColour::mf_paper              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFPaper")) ||
+             !(CwB[TColour::mf_ticks              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFTicks")) ||
+             !(CwB[TColour::mf_labels              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourMFLabels")) ||
+
+             !(CwB[TColour::score_none              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNONE")) ||
+             !(CwB[TColour::score_nrem1              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM1")) ||
+             !(CwB[TColour::score_nrem2              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM2")) ||
+             !(CwB[TColour::score_nrem3              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM3")) ||
+             !(CwB[TColour::score_nrem4              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreNREM4")) ||
+             !(CwB[TColour::score_rem              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreREM")) ||
+             !(CwB[TColour::score_wake              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourScoreWake")) ||
+
+             !(CwB[TColour::band_delta              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandDelta")) ||
+             !(CwB[TColour::band_theta              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandTheta")) ||
+             !(CwB[TColour::band_alpha              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandAlpha")) ||
+             !(CwB[TColour::band_beta              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandBeta")) ||
+             !(CwB[TColour::band_gamma              ].btn = (GtkColorButton*)gtk_builder_get_object( builder, "bColourBandGamma")) )
+                throw runtime_error ("Failed to construct widgets");
 
       // scrub colours
-	for ( auto &C : CwB ) {
-		g_signal_connect( C.second.btn, "color-set",
-				  (GCallback)bColourX_color_set_cb,
-				  &C.second);
-	}
-	// get CwB color values from glade
-	for ( auto &C : CwB )
-		g_signal_emit_by_name( C.second.btn, "color-set");
+        for ( auto &C : CwB ) {
+                g_signal_connect( C.second.btn, "color-set",
+                                  (GCallback)bColourX_color_set_cb,
+                                  &C.second);
+        }
+        // get CwB color values from glade
+        for ( auto &C : CwB )
+                g_signal_emit_by_name( C.second.btn, "color-set");
 
 
       // ========= child widgets
       // ----- wAbout
-	if ( !AGH_GBGETOBJ (GtkDialog,		wAbout) ||
-	     !AGH_GBGETOBJ (GtkNotebook,	cAboutTabs) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lAboutVersion) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkDialog,                wAbout) ||
+             !AGH_GBGETOBJ (GtkNotebook,        cAboutTabs) ||
+             !AGH_GBGETOBJ (GtkLabel,                lAboutVersion) )
+                throw runtime_error ("Failed to construct widgets");
 
       // ------- wEDFFileDetails
-	if ( !AGH_GBGETOBJ (GtkDialog,		wEDFFileDetails) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lEDFFileDetails) ||
-	     !AGH_GBGETOBJ (GtkTextView,	lEDFFileDetailsReport) )
-		throw runtime_error ("Failed to construct widgets");
-
-	// used by two GtkTextView's, lEDFFileDetailsReport and lEdfImportFileInfo
-	if ( !AGH_GBGETOBJ (GtkTextBuffer,	tEDFFileDetailsReport) )
-		throw runtime_error ("Failed to construct widgets");
-
-	gtk_widget_override_font( (GtkWidget*)lEDFFileDetailsReport, font_desc);
-	g_object_set( lEDFFileDetailsReport,
-		      "tabs", pango_tab_array_new_with_positions(
-			      2, TRUE,
-			      PANGO_TAB_LEFT, 180,
-			      PANGO_TAB_LEFT, 190),
-		      NULL);
+        if ( !AGH_GBGETOBJ (GtkDialog,                wEDFFileDetails) ||
+             !AGH_GBGETOBJ (GtkLabel,                lEDFFileDetails) ||
+             !AGH_GBGETOBJ (GtkTextView,        lEDFFileDetailsReport) )
+                throw runtime_error ("Failed to construct widgets");
+
+        // used by two GtkTextView's, lEDFFileDetailsReport and lEdfImportFileInfo
+        if ( !AGH_GBGETOBJ (GtkTextBuffer,        tEDFFileDetailsReport) )
+                throw runtime_error ("Failed to construct widgets");
+
+        gtk_widget_override_font( (GtkWidget*)lEDFFileDetailsReport, font_desc);
+        g_object_set( lEDFFileDetailsReport,
+                      "tabs", pango_tab_array_new_with_positions(
+                              2, TRUE,
+                              PANGO_TAB_LEFT, 180,
+                              PANGO_TAB_LEFT, 190),
+                      NULL);
 
       // ------- wEdfImport
-	if ( !AGH_GBGETOBJ (GtkDialog,		wEdfImport) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eEdfImportGroup) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eEdfImportSession) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eEdfImportEpisode) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eEdfImportGroupEntry) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eEdfImportSessionEntry) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eEdfImportEpisodeEntry) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lEdfImportSubject) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lEdfImportCaption) ||
-	     !AGH_GBGETOBJ (GtkTextView,	lEdfImportFileInfo) ||
-	     !AGH_GBGETOBJ (GtkButton,		bEdfImportAttachCopy) ||
-	     !AGH_GBGETOBJ (GtkButton,		bEdfImportAttachMove) ||
-	     !AGH_GBGETOBJ (GtkButton,		bEdfImportAdmit) ||
-	     !AGH_GBGETOBJ (GtkButton,		bEdfImportEdfhed) )
-		throw runtime_error ("Failed to construct widgets");
-
-
-	gtk_widget_override_font( (GtkWidget*)lEdfImportFileInfo, font_desc);
-
-	g_object_set( lEdfImportFileInfo,
-		      "tabs", pango_tab_array_new_with_positions(
-				2, TRUE,
-				PANGO_TAB_LEFT, 130,
-				PANGO_TAB_LEFT, 190),
-		      NULL);
-
-	g_signal_connect( eEdfImportGroupEntry,
-			  "changed", (GCallback)check_gtk_entry_nonempty_cb,
-			  this);
-	g_signal_connect( eEdfImportSessionEntry,
-			  "changed", (GCallback)check_gtk_entry_nonempty_cb,
-			  this);
-	g_signal_connect( eEdfImportEpisodeEntry,
-			  "changed", (GCallback)check_gtk_entry_nonempty_cb,
-			  this);
+        if ( !AGH_GBGETOBJ (GtkDialog,                wEdfImport) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eEdfImportGroup) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eEdfImportSession) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eEdfImportEpisode) ||
+             !AGH_GBGETOBJ (GtkEntry,                eEdfImportGroupEntry) ||
+             !AGH_GBGETOBJ (GtkEntry,                eEdfImportSessionEntry) ||
+             !AGH_GBGETOBJ (GtkEntry,                eEdfImportEpisodeEntry) ||
+             !AGH_GBGETOBJ (GtkLabel,                lEdfImportSubject) ||
+             !AGH_GBGETOBJ (GtkLabel,                lEdfImportCaption) ||
+             !AGH_GBGETOBJ (GtkTextView,        lEdfImportFileInfo) ||
+             !AGH_GBGETOBJ (GtkButton,                bEdfImportAttachCopy) ||
+             !AGH_GBGETOBJ (GtkButton,                bEdfImportAttachMove) ||
+             !AGH_GBGETOBJ (GtkButton,                bEdfImportAdmit) ||
+             !AGH_GBGETOBJ (GtkButton,                bEdfImportEdfhed) )
+                throw runtime_error ("Failed to construct widgets");
+
+
+        gtk_widget_override_font( (GtkWidget*)lEdfImportFileInfo, font_desc);
+
+        g_object_set( lEdfImportFileInfo,
+                      "tabs", pango_tab_array_new_with_positions(
+                                2, TRUE,
+                                PANGO_TAB_LEFT, 130,
+                                PANGO_TAB_LEFT, 190),
+                      NULL);
+
+        g_signal_connect( eEdfImportGroupEntry,
+                          "changed", (GCallback)check_gtk_entry_nonempty_cb,
+                          this);
+        g_signal_connect( eEdfImportSessionEntry,
+                          "changed", (GCallback)check_gtk_entry_nonempty_cb,
+                          this);
+        g_signal_connect( eEdfImportEpisodeEntry,
+                          "changed", (GCallback)check_gtk_entry_nonempty_cb,
+                          this);
 
       // ------------- wBatchSetup
-	if ( !AGH_GBGETOBJ (GtkDialog,		wBatchSetup) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eBatchSetupSubjects) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eBatchSetupSessions) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eBatchSetupChannels) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eBatchSetupRangeFrom) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eBatchSetupRangeWidth) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eBatchSetupRangeInc) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eBatchSetupRangeSteps) )
-		throw runtime_error ("Failed to construct widgets");
+        if ( !AGH_GBGETOBJ (GtkDialog,                wBatchSetup) ||
+             !AGH_GBGETOBJ (GtkEntry,                eBatchSetupSubjects) ||
+             !AGH_GBGETOBJ (GtkEntry,                eBatchSetupSessions) ||
+             !AGH_GBGETOBJ (GtkEntry,                eBatchSetupChannels) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eBatchSetupRangeFrom) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eBatchSetupRangeWidth) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eBatchSetupRangeInc) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eBatchSetupRangeSteps) )
+                throw runtime_error ("Failed to construct widgets");
 
       // // ------------- wMontageDefaults
-      // 	if ( !AGH_GBGETOBJ (GtkDialog,		wMontageDefaults) ||
-      // 	     !AGH_GBGETOBJ (GtkEntry,		eMontageDefaultsChannelList) ||
-      // 	     !AGH_GBGETOBJ (GtkCheckButton,	eMontageDefaultsShowPSD) ||
-      // 	     !AGH_GBGETOBJ (GtkCheckButton,	eMontageDefaultsShowPSDSpectrum) ||
-      // 	     !AGH_GBGETOBJ (GtkCheckButton,	eMontageDefaultsShowMC) ||
-      // 	     !AGH_GBGETOBJ (GtkCheckButton,	eMontageDefaultsShowEMG) )
-      // 		throw runtime_error ("Failed to construct widgets");
+      //         if ( !AGH_GBGETOBJ (GtkDialog,                wMontageDefaults) ||
+      //              !AGH_GBGETOBJ (GtkEntry,                eMontageDefaultsChannelList) ||
+      //              !AGH_GBGETOBJ (GtkCheckButton,        eMontageDefaultsShowPSD) ||
+      //              !AGH_GBGETOBJ (GtkCheckButton,        eMontageDefaultsShowPSDSpectrum) ||
+      //              !AGH_GBGETOBJ (GtkCheckButton,        eMontageDefaultsShowMC) ||
+      //              !AGH_GBGETOBJ (GtkCheckButton,        eMontageDefaultsShowEMG) )
+      //                 throw runtime_error ("Failed to construct widgets");
 
       // ----------- wGlobalFilters
-	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalFilters) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eGlobalFiltersLowPassCutoff) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eGlobalFiltersLowPassOrder) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eGlobalFiltersHighPassCutoff) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eGlobalFiltersHighPassOrder) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mGlobalFiltersNotchFilter) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eGlobalFiltersNotchFilter) )
-		throw runtime_error ("Failed to construct widgets");
-	gtk_combo_box_set_model_properly(
-		eGlobalFiltersNotchFilter, mGlobalFiltersNotchFilter);
+        if ( !AGH_GBGETOBJ (GtkDialog,                wGlobalFilters) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eGlobalFiltersLowPassCutoff) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eGlobalFiltersLowPassOrder) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eGlobalFiltersHighPassCutoff) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eGlobalFiltersHighPassOrder) ||
+             !AGH_GBGETOBJ (GtkListStore,        mGlobalFiltersNotchFilter) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eGlobalFiltersNotchFilter) )
+                throw runtime_error ("Failed to construct widgets");
+        gtk_combo_box_set_model_properly(
+                eGlobalFiltersNotchFilter, mGlobalFiltersNotchFilter);
 
       // ----------- wGlobalAnnotations
-	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalAnnotations) ||
-	     !AGH_GBGETOBJ (GtkTreeView,	tvGlobalAnnotations) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eGlobalAnnotationsShowPhasicEvents) )
-		throw runtime_error ("Failed to construct widgets");
-
-	gtk_tree_view_set_model( tvGlobalAnnotations,
-				 (GtkTreeModel*)mGlobalAnnotations);
-
-	g_object_set( (GObject*)tvGlobalAnnotations,
-		      "expander-column", 0,
-		      NULL);
-	g_signal_connect( tvGlobalAnnotations, "map",
-			  (GCallback)gtk_tree_view_expand_all,
-			  NULL);
-	G_CONNECT_2 (tvGlobalAnnotations, row, activated);
-
-	int c = 0;
-	for ( auto column : {"Recording", "Page(s)", "Channel", "Type", "Label"} ) {
-		GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
-		g_object_set( (GObject*)renderer,
-			      "editable", FALSE,
-			      NULL);
-		g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (c));
-		col = gtk_tree_view_column_new_with_attributes(
-			column,
-			renderer,
-			"text", c,
-			NULL);
-		gtk_tree_view_column_set_expand( col, TRUE);
-		gtk_tree_view_append_column( tvGlobalAnnotations, col);
-		++c;
-	}
-	gtk_tree_view_append_column( tvGlobalAnnotations,
-				     gtk_tree_view_column_new());
-
-	G_CONNECT_1 (eGlobalAnnotationsShowPhasicEvents, toggled);
+        if ( !AGH_GBGETOBJ (GtkDialog,                wGlobalAnnotations) ||
+             !AGH_GBGETOBJ (GtkTreeView,        tvGlobalAnnotations) ||
+             !AGH_GBGETOBJ (GtkCheckButton,        eGlobalAnnotationsShowPhasicEvents) )
+                throw runtime_error ("Failed to construct widgets");
+
+        gtk_tree_view_set_model( tvGlobalAnnotations,
+                                 (GtkTreeModel*)mGlobalAnnotations);
+
+        g_object_set( (GObject*)tvGlobalAnnotations,
+                      "expander-column", 0,
+                      NULL);
+        g_signal_connect( tvGlobalAnnotations, "map",
+                          (GCallback)gtk_tree_view_expand_all,
+                          NULL);
+        G_CONNECT_2 (tvGlobalAnnotations, row, activated);
+
+        int c = 0;
+        for ( auto column : {"Recording", "Page(s)", "Channel", "Type", "Label"} ) {
+                GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+                g_object_set( (GObject*)renderer,
+                              "editable", FALSE,
+                              NULL);
+                g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (c));
+                col = gtk_tree_view_column_new_with_attributes(
+                        column,
+                        renderer,
+                        "text", c,
+                        NULL);
+                gtk_tree_view_column_set_expand( col, TRUE);
+                gtk_tree_view_append_column( tvGlobalAnnotations, col);
+                ++c;
+        }
+        gtk_tree_view_append_column( tvGlobalAnnotations,
+                                     gtk_tree_view_column_new());
+
+        G_CONNECT_1 (eGlobalAnnotationsShowPhasicEvents, toggled);
 
       // ------------- wGlobalArtifactDetection
-	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalArtifactDetection) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eGlobalADProfiles) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eGlobalADKeepExisting) ||
-	     !AGH_GBGETOBJ (GtkButton,		bGlobalADOK) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lGlobalADHint) )
-		throw runtime_error ("Failed to construct widgets");
-
-	gtk_combo_box_set_model_properly(
-		eGlobalADProfiles, mGlobalADProfiles);
-	G_CONNECT_1 (eGlobalADProfiles, changed);
-
-	pango_font_description_free( font_desc);
+        if ( !AGH_GBGETOBJ (GtkDialog,                wGlobalArtifactDetection) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eGlobalADProfiles) ||
+             !AGH_GBGETOBJ (GtkCheckButton,        eGlobalADKeepExisting) ||
+             !AGH_GBGETOBJ (GtkButton,                bGlobalADOK) ||
+             !AGH_GBGETOBJ (GtkLabel,                lGlobalADHint) )
+                throw runtime_error ("Failed to construct widgets");
+
+        gtk_combo_box_set_model_properly(
+                eGlobalADProfiles, mGlobalADProfiles);
+        G_CONNECT_1 (eGlobalADProfiles, changed);
+
+        pango_font_description_free( font_desc);
 }
 
 
 SExpDesignUIWidgets::
 ~SExpDesignUIWidgets ()
 {
-	g_object_unref( (GObject*)builder);
+        g_object_unref( (GObject*)builder);
 
       // destroy toplevels
-	gtk_widget_destroy( (GtkWidget*)wMainWindow);
-	gtk_widget_destroy( (GtkWidget*)wAbout);
-	gtk_widget_destroy( (GtkWidget*)wScanLog);
-	gtk_widget_destroy( (GtkWidget*)wEDFFileDetails);
-	gtk_widget_destroy( (GtkWidget*)wEdfImport);
-	gtk_widget_destroy( (GtkWidget*)wGlobalAnnotations);
-	gtk_widget_destroy( (GtkWidget*)wGlobalFilters);
-	gtk_widget_destroy( (GtkWidget*)wBatchSetup);
+        gtk_widget_destroy( (GtkWidget*)wMainWindow);
+        gtk_widget_destroy( (GtkWidget*)wAbout);
+        gtk_widget_destroy( (GtkWidget*)wScanLog);
+        gtk_widget_destroy( (GtkWidget*)wEDFFileDetails);
+        gtk_widget_destroy( (GtkWidget*)wEdfImport);
+        gtk_widget_destroy( (GtkWidget*)wGlobalAnnotations);
+        gtk_widget_destroy( (GtkWidget*)wGlobalFilters);
+        gtk_widget_destroy( (GtkWidget*)wBatchSetup);
       // and models, etc
-	g_object_unref( (GObject*)mEEGChannels);
-	g_object_unref( (GObject*)mAllChannels);
-	g_object_unref( (GObject*)mSessions);
-	g_object_unref( (GObject*)mGlobalAnnotations);
-	g_object_unref( (GObject*)mGlobalADProfiles);
-	g_object_unref( (GObject*)mSimulations);
-
-	g_object_unref( (GObject*)mScoringPageSize);
-	g_object_unref( (GObject*)mFFTParamsPageSize);
-	g_object_unref( (GObject*)mFFTParamsBinSize);
-	g_object_unref( (GObject*)mFFTParamsWindowType);
-
-	g_object_unref( (GObject*)iiSubjectTimeline);
-	g_object_unref( (GObject*)iSubjectTimelineScore);
-	g_object_unref( (GObject*)iSubjectTimelineEDFInfo);
-	g_object_unref( (GObject*)iSubjectTimelineSaveAsSVG);
-	g_object_unref( (GObject*)iSubjectTimelineResetMontage);
-	g_object_unref( (GObject*)iSubjectTimelineBrowse);
-	// I'm quite possibly missing something
+        g_object_unref( (GObject*)mEEGChannels);
+        g_object_unref( (GObject*)mAllChannels);
+        g_object_unref( (GObject*)mSessions);
+        g_object_unref( (GObject*)mGlobalAnnotations);
+        g_object_unref( (GObject*)mGlobalADProfiles);
+        g_object_unref( (GObject*)mSimulations);
+
+        g_object_unref( (GObject*)mScoringPageSize);
+        g_object_unref( (GObject*)mFFTParamsPageSize);
+        g_object_unref( (GObject*)mFFTParamsBinSize);
+        g_object_unref( (GObject*)mFFTParamsWindowType);
+
+        g_object_unref( (GObject*)iiSubjectTimeline);
+        g_object_unref( (GObject*)iSubjectTimelineScore);
+        g_object_unref( (GObject*)iSubjectTimelineEDFInfo);
+        g_object_unref( (GObject*)iSubjectTimelineSaveAsSVG);
+        g_object_unref( (GObject*)iSubjectTimelineResetMontage);
+        g_object_unref( (GObject*)iSubjectTimelineBrowse);
+        // I'm quite possibly missing something
 }
 
 
@@ -726,53 +726,53 @@ void
 SExpDesignUIWidgets::
 set_wMainWindow_interactive( const bool indeed, const bool flush)
 {
-	set_cursor_busy( not indeed, (GtkWidget*)wMainWindow);
-	//gtk_widget_set_sensitive( (GtkWidget*)wMainWindow, indeed);
+        set_cursor_busy( not indeed, (GtkWidget*)wMainWindow);
+        //gtk_widget_set_sensitive( (GtkWidget*)wMainWindow, indeed);
 
-	gtk_widget_set_sensitive( (GtkWidget*)cMsmtMainToolbar, indeed);
-	gtk_widget_set_sensitive( (GtkWidget*)cMeasurements, indeed);
+        gtk_widget_set_sensitive( (GtkWidget*)cMsmtMainToolbar, indeed);
+        gtk_widget_set_sensitive( (GtkWidget*)cMeasurements, indeed);
 
-	gtk_widget_set_visible( (GtkWidget*)lTaskSelector2, indeed);
-	gtk_widget_set_visible( gtk_notebook_get_nth_page( tTaskSelector, 1), indeed);
-	gtk_widget_set_visible( (GtkWidget*)lSettings, indeed);
-	gtk_widget_set_visible( gtk_notebook_get_nth_page( tDesign, 1), indeed);
+        gtk_widget_set_visible( (GtkWidget*)lTaskSelector2, indeed);
+        gtk_widget_set_visible( gtk_notebook_get_nth_page( tTaskSelector, 1), indeed);
+        gtk_widget_set_visible( (GtkWidget*)lSettings, indeed);
+        gtk_widget_set_visible( gtk_notebook_get_nth_page( tDesign, 1), indeed);
 
-	gtk_widget_set_sensitive( (GtkWidget*)iiMainMenu, indeed);
-	gtk_widget_set_sensitive( (GtkWidget*)eMsmtSession, indeed);
-	gtk_widget_set_sensitive( (GtkWidget*)eMsmtChannel, indeed);
+        gtk_widget_set_sensitive( (GtkWidget*)iiMainMenu, indeed);
+        gtk_widget_set_sensitive( (GtkWidget*)eMsmtSession, indeed);
+        gtk_widget_set_sensitive( (GtkWidget*)eMsmtChannel, indeed);
 
-	gtk_widget_set_visible( (GtkWidget*)cMsmtTopArea, indeed);
+        gtk_widget_set_visible( (GtkWidget*)cMsmtTopArea, indeed);
 
-	if ( flush )
-		gtk_flush();
+        if ( flush )
+                gtk_flush();
 }
 
 void
 SExpDesignUIWidgets::
 set_controls_for_empty_experiment( bool indeed, const bool flush)
 {
-	indeed = not indeed;
-	gtk_widget_set_visible( (GtkWidget*)cMsmtMainToolbar, indeed);
+        indeed = not indeed;
+        gtk_widget_set_visible( (GtkWidget*)cMsmtMainToolbar, indeed);
 
-	gtk_widget_set_visible( (GtkWidget*)lTaskSelector2, indeed);
-	gtk_widget_set_visible( gtk_notebook_get_nth_page( tTaskSelector, 1), indeed);
+        gtk_widget_set_visible( (GtkWidget*)lTaskSelector2, indeed);
+        gtk_widget_set_visible( gtk_notebook_get_nth_page( tTaskSelector, 1), indeed);
 
-	gtk_widget_set_visible( (GtkWidget*)iExpAnnotations, indeed);
-	gtk_widget_set_visible( (GtkWidget*)iExpPurgeComputed, indeed);
-	gtk_widget_set_visible( (GtkWidget*)iiExpGlobalOperations, indeed);
-	gtk_widget_set_visible( (GtkWidget*)iiExpSubjectSort, indeed);
+        gtk_widget_set_visible( (GtkWidget*)iExpAnnotations, indeed);
+        gtk_widget_set_visible( (GtkWidget*)iExpPurgeComputed, indeed);
+        gtk_widget_set_visible( (GtkWidget*)iiExpGlobalOperations, indeed);
+        gtk_widget_set_visible( (GtkWidget*)iiExpSubjectSort, indeed);
 
-	gtk_widget_set_visible( (GtkWidget*)eMsmtSession, indeed);
-	gtk_widget_set_visible( (GtkWidget*)eMsmtChannel, indeed);
+        gtk_widget_set_visible( (GtkWidget*)eMsmtSession, indeed);
+        gtk_widget_set_visible( (GtkWidget*)eMsmtChannel, indeed);
 
-	if ( flush )
-		gtk_flush();
+        if ( flush )
+                gtk_flush();
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/loadsave.cc b/upstream/src/aghermann/ui/mw/loadsave.cc
index 43dee0e..112982f 100644
--- a/upstream/src/aghermann/ui/mw/loadsave.cc
+++ b/upstream/src/aghermann/ui/mw/loadsave.cc
@@ -26,55 +26,55 @@ namespace {
 forward_list<pair<const char*, SExpDesignUI::TColour>>
 saving_colors()
 {
-	using namespace agh::ui;
-	return move(
-		forward_list<pair<const char*, SExpDesignUI::TColour>>
-		({
-			{"MWNight",	SExpDesignUI::TColour::mw_night	   },
-			{"MWDay",	SExpDesignUI::TColour::mw_day	   },
-			{"MWTicks",	SExpDesignUI::TColour::mw_ticks    },
-			{"MWLabels",	SExpDesignUI::TColour::mw_labels   },
-			{"MWProfile",  	SExpDesignUI::TColour::mw_profile  },
-
-			{"ScoreNONE",	SExpDesignUI::TColour::score_none  },
-			{"ScorNeREM1",	SExpDesignUI::TColour::score_nrem1 },
-			{"ScoreNREM2",	SExpDesignUI::TColour::score_nrem2 },
-			{"ScoreNREM3",	SExpDesignUI::TColour::score_nrem3 },
-			{"ScoreNREM4",	SExpDesignUI::TColour::score_nrem4 },
-			{"ScoreREM",	SExpDesignUI::TColour::score_rem   },
-			{"ScoreWake",	SExpDesignUI::TColour::score_wake  },
-
-			{"SFProfilePSD",  SExpDesignUI::TColour::sf_profile_psd},
-			{"SFProfileSWU",  SExpDesignUI::TColour::sf_profile_swu},
-			{"SFProfileMC",	  SExpDesignUI::TColour::sf_profile_mc },
-
-			{"SFPhasicSpindle",  SExpDesignUI::TColour::sf_phasic_spindle},
-			{"SFPhasicKComplex", SExpDesignUI::TColour::sf_phasic_Kcomplex},
-			{"SFPhasicEyeBlink", SExpDesignUI::TColour::sf_phasic_eyeblink},
-
-			{"SFEMG",   	  SExpDesignUI::TColour::sf_emg        },
-			{"SFHypnogram",	  SExpDesignUI::TColour::sf_hypnogram  },
-			{"SFArtifacts",	  SExpDesignUI::TColour::sf_artifact   },
-			{"SFAnnotations", SExpDesignUI::TColour::sf_annotations},
-			{"SFEmbeddedAnnotations", SExpDesignUI::TColour::sf_embedded_annotations},
-			{"SFSelection",	  SExpDesignUI::TColour::sf_selection  },
-			{"SFTicks",	  SExpDesignUI::TColour::sf_ticks      },
-			{"SFLabels",	  SExpDesignUI::TColour::sf_labels     },
-			{"SFCursor",	  SExpDesignUI::TColour::sf_cursor     },
-
-			{"BandDelta",	SExpDesignUI::TColour::band_delta    },
-			{"BandTheta",	SExpDesignUI::TColour::band_theta    },
-			{"BandAlpha",	SExpDesignUI::TColour::band_alpha    },
-			{"BandBeta",	SExpDesignUI::TColour::band_beta     },
-			{"BandGamma",	SExpDesignUI::TColour::band_gamma    },
-
-			{"MFSWA",	SExpDesignUI::TColour::mf_swa        },
-			{"MFSWASim",	SExpDesignUI::TColour::mf_swa_sim    },
-			{"MFProcessS",	SExpDesignUI::TColour::mf_process_s  },
-			{"MFPaper",	SExpDesignUI::TColour::mf_paper      },
-			{"MFTicks",	SExpDesignUI::TColour::mf_ticks      },
-			{"MFLabels",	SExpDesignUI::TColour::mf_labels     }
-		}));
+        using namespace agh::ui;
+        return move(
+                forward_list<pair<const char*, SExpDesignUI::TColour>>
+                ({
+                        {"MWNight",        SExpDesignUI::TColour::mw_night           },
+                        {"MWDay",        SExpDesignUI::TColour::mw_day           },
+                        {"MWTicks",        SExpDesignUI::TColour::mw_ticks    },
+                        {"MWLabels",        SExpDesignUI::TColour::mw_labels   },
+                        {"MWProfile",          SExpDesignUI::TColour::mw_profile  },
+
+                        {"ScoreNONE",        SExpDesignUI::TColour::score_none  },
+                        {"ScorNeREM1",        SExpDesignUI::TColour::score_nrem1 },
+                        {"ScoreNREM2",        SExpDesignUI::TColour::score_nrem2 },
+                        {"ScoreNREM3",        SExpDesignUI::TColour::score_nrem3 },
+                        {"ScoreNREM4",        SExpDesignUI::TColour::score_nrem4 },
+                        {"ScoreREM",        SExpDesignUI::TColour::score_rem   },
+                        {"ScoreWake",        SExpDesignUI::TColour::score_wake  },
+
+                        {"SFProfilePSD",  SExpDesignUI::TColour::sf_profile_psd},
+                        {"SFProfileSWU",  SExpDesignUI::TColour::sf_profile_swu},
+                        {"SFProfileMC",          SExpDesignUI::TColour::sf_profile_mc },
+
+                        {"SFPhasicSpindle",  SExpDesignUI::TColour::sf_phasic_spindle},
+                        {"SFPhasicKComplex", SExpDesignUI::TColour::sf_phasic_Kcomplex},
+                        {"SFPhasicEyeBlink", SExpDesignUI::TColour::sf_phasic_eyeblink},
+
+                        {"SFEMG",             SExpDesignUI::TColour::sf_emg        },
+                        {"SFHypnogram",          SExpDesignUI::TColour::sf_hypnogram  },
+                        {"SFArtifacts",          SExpDesignUI::TColour::sf_artifact   },
+                        {"SFAnnotations", SExpDesignUI::TColour::sf_annotations},
+                        {"SFEmbeddedAnnotations", SExpDesignUI::TColour::sf_embedded_annotations},
+                        {"SFSelection",          SExpDesignUI::TColour::sf_selection  },
+                        {"SFTicks",          SExpDesignUI::TColour::sf_ticks      },
+                        {"SFLabels",          SExpDesignUI::TColour::sf_labels     },
+                        {"SFCursor",          SExpDesignUI::TColour::sf_cursor     },
+
+                        {"BandDelta",        SExpDesignUI::TColour::band_delta    },
+                        {"BandTheta",        SExpDesignUI::TColour::band_theta    },
+                        {"BandAlpha",        SExpDesignUI::TColour::band_alpha    },
+                        {"BandBeta",        SExpDesignUI::TColour::band_beta     },
+                        {"BandGamma",        SExpDesignUI::TColour::band_gamma    },
+
+                        {"MFSWA",        SExpDesignUI::TColour::mf_swa        },
+                        {"MFSWASim",        SExpDesignUI::TColour::mf_swa_sim    },
+                        {"MFProcessS",        SExpDesignUI::TColour::mf_process_s  },
+                        {"MFPaper",        SExpDesignUI::TColour::mf_paper      },
+                        {"MFTicks",        SExpDesignUI::TColour::mf_ticks      },
+                        {"MFLabels",        SExpDesignUI::TColour::mf_labels     }
+                }));
 }
 } // namespace
 
@@ -82,68 +82,68 @@ int
 SExpDesignUI::
 load_settings()
 {
-	libconfig::Config conf;
-
-	try {
-		conf.readFile( CONF_FILE);
-		agh::confval::get( config_keys_s, conf);
-		agh::confval::get( config_keys_b, conf);
-		agh::confval::get( config_keys_d, conf);
-		agh::confval::get( config_keys_g, conf);
-
-		try {
-			auto& SC = conf.lookup("ScoreCodes");
-			for ( size_t i = sigfile::SPage::TScore::none; i < sigfile::SPage::TScore::TScore_total; ++i )
-				ext_score_codes[i].assign( (const char*)SC[i]);
-		} catch (...) {
-			fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with section ScoreCodes in %s\n", CONF_FILE);
-		}
-		for( auto &p : saving_colors() ) {
-			try {
-				auto& V = conf.lookup(string("Color.")+p.first);
-				auto& C = CwB[p.second];
-				C.clr.red   = V[0];
-				C.clr.green = V[1];
-				C.clr.blue  = V[2];
-				C.clr.alpha = V[3];
-				gtk_color_chooser_set_rgba( GTK_COLOR_CHOOSER (CwB[p.second].btn), &C.clr);
-			} catch (...) {
-				fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with Color.%s in %s\n", p.first, CONF_FILE);
-			}
-		}
-	} catch (...) {
-		fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with %s\n", CONF_FILE);
-	}
+        libconfig::Config conf;
+
+        try {
+                conf.readFile( CONF_FILE);
+                agh::confval::get( config_keys_s, conf);
+                agh::confval::get( config_keys_b, conf);
+                agh::confval::get( config_keys_d, conf);
+                agh::confval::get( config_keys_g, conf);
+
+                try {
+                        auto& SC = conf.lookup("ScoreCodes");
+                        for ( size_t i = sigfile::SPage::TScore::none; i < sigfile::SPage::TScore::TScore_total; ++i )
+                                ext_score_codes[i].assign( (const char*)SC[i]);
+                } catch (...) {
+                        fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with section ScoreCodes in %s\n", CONF_FILE);
+                }
+                for( auto &p : saving_colors() ) {
+                        try {
+                                auto& V = conf.lookup(string("Color.")+p.first);
+                                auto& C = CwB[p.second];
+                                C.clr.red   = V[0];
+                                C.clr.green = V[1];
+                                C.clr.blue  = V[2];
+                                C.clr.alpha = V[3];
+                                gtk_color_chooser_set_rgba( GTK_COLOR_CHOOSER (CwB[p.second].btn), &C.clr);
+                        } catch (...) {
+                                fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with Color.%s in %s\n", p.first, CONF_FILE);
+                        }
+                }
+        } catch (...) {
+                fprintf( stderr, "SExpDesignUI::load_settings(): Something is wrong with %s\n", CONF_FILE);
+        }
 
       // plus postprocess and extra checks
-	{
-		int x, y, w, h;
-		if ( not _geometry_placeholder.empty()
-		     and sscanf( _geometry_placeholder.c_str(), "%ux%u+%u+%u", &w, &h, &x, &y) == 4 ) {
-			geometry.x = x;
-			geometry.y = y;
-			geometry.w = w;
-			geometry.h = h;
-		}
-	}
-	if ( active_profile_psd_freq_upto <= active_profile_psd_freq_from )
-		active_profile_psd_freq_from = 2., active_profile_psd_freq_upto = 3.;
+        {
+                int x, y, w, h;
+                if ( not _geometry_placeholder.empty()
+                     and sscanf( _geometry_placeholder.c_str(), "%ux%u+%u+%u", &w, &h, &x, &y) == 4 ) {
+                        geometry.x = x;
+                        geometry.y = y;
+                        geometry.w = w;
+                        geometry.h = h;
+                }
+        }
+        if ( active_profile_psd_freq_upto <= active_profile_psd_freq_from )
+                active_profile_psd_freq_from = 2., active_profile_psd_freq_upto = 3.;
 
       // make sure ED has been created
-	_AghDi = find( AghDD.begin(), AghDD.end(), _aghdd_placeholder);
-	if ( _AghDi == AghDD.end() )
-		_AghDi = AghDD.begin();
-	_AghTi = find( AghTT.begin(), AghTT.end(), sigfile::SChannel (_aghtt_placeholder));
-	if ( _AghTi == AghTT.end() )
-		_AghTi = AghTT.begin();
+        _AghDi = find( AghDD.begin(), AghDD.end(), _aghdd_placeholder);
+        if ( _AghDi == AghDD.end() )
+                _AghDi = AghDD.begin();
+        _AghTi = find( AghTT.begin(), AghTT.end(), sigfile::SChannel (_aghtt_placeholder));
+        if ( _AghTi == AghTT.end() )
+                _AghTi = AghTT.begin();
 
       // save scan_tree triggers
-	// pagesize and binsize not loaded, so their _saved counterparts saved in ctor
+        // pagesize and binsize not loaded, so their _saved counterparts saved in ctor
 
       // misc
-	adjust_op_freq_spinbuttons();
+        adjust_op_freq_spinbuttons();
 
-	return 0;
+        return 0;
 }
 
 
@@ -155,35 +155,35 @@ int
 SExpDesignUI::
 save_settings()
 {
-	libconfig::Config conf;
+        libconfig::Config conf;
 
-	_geometry_placeholder = agh::str::sasprintf(
-		"%dx%d+%d+%d", geometry.w, geometry.h, geometry.x, geometry.y);
-	_aghtt_placeholder = AghT();
-	_aghdd_placeholder = AghD();
+        _geometry_placeholder = agh::str::sasprintf(
+                "%dx%d+%d+%d", geometry.w, geometry.h, geometry.x, geometry.y);
+        _aghtt_placeholder = AghT();
+        _aghdd_placeholder = AghD();
 
-	agh::confval::put( config_keys_s, conf);
-	agh::confval::put( config_keys_b, conf);
-	agh::confval::put( config_keys_d, conf);
-	agh::confval::put( config_keys_g, conf);
+        agh::confval::put( config_keys_s, conf);
+        agh::confval::put( config_keys_b, conf);
+        agh::confval::put( config_keys_d, conf);
+        agh::confval::put( config_keys_g, conf);
 
-	agh::confval::put( conf, "ScoreCodes", ext_score_codes);
+        agh::confval::put( conf, "ScoreCodes", ext_score_codes);
 
-	for ( auto &p : saving_colors() ) {
-		auto& C = CwB[p.second];
-		agh::confval::put( conf, string("Color.") + p.first,
-			      forward_list<double> {C.clr.red, C.clr.green, C.clr.blue, C.clr.alpha});
-	}
+        for ( auto &p : saving_colors() ) {
+                auto& C = CwB[p.second];
+                agh::confval::put( conf, string("Color.") + p.first,
+                              forward_list<double> {C.clr.red, C.clr.green, C.clr.blue, C.clr.alpha});
+        }
 
-	conf.writeFile( CONF_FILE);
+        conf.writeFile( CONF_FILE);
 
-	return 0;
+        return 0;
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index 1ad9ca5..b5689db 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -22,74 +22,74 @@ extern "C" {
 
 void
 iExpRefresh_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.do_rescan_tree( true);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.do_rescan_tree( true);
 }
 
 void
 iExpPurgeComputed_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.do_purge_computed();
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.do_purge_computed();
 }
 
 
 
 void
 iExpSubjectSortAny_toggled_cb(
-	GtkCheckMenuItem* mi,
-	const gpointer userdata)
+        GtkCheckMenuItem* mi,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( ED.suppress_redraw )
-		return;
-
-	// only set ON
-	if ( gtk_check_menu_item_get_active( mi) == FALSE )
-		return;
-
-	if      ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortName )
-		ED.sort_by = SExpDesignUI::TSubjectSortBy::name;
-	else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAge )
-		ED.sort_by = SExpDesignUI::TSubjectSortBy::age;
-	else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAdmissionDate )
-		ED.sort_by = SExpDesignUI::TSubjectSortBy::admission_date;
-	else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAvgPower )
-		ED.sort_by = SExpDesignUI::TSubjectSortBy::avg_profile_power;
-
-	ED.populate_1();
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( ED.suppress_redraw )
+                return;
+
+        // only set ON
+        if ( gtk_check_menu_item_get_active( mi) == FALSE )
+                return;
+
+        if      ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortName )
+                ED.sort_by = SExpDesignUI::TSubjectSortBy::name;
+        else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAge )
+                ED.sort_by = SExpDesignUI::TSubjectSortBy::age;
+        else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAdmissionDate )
+                ED.sort_by = SExpDesignUI::TSubjectSortBy::admission_date;
+        else if ( mi == (GtkCheckMenuItem*)ED.iExpSubjectSortAvgPower )
+                ED.sort_by = SExpDesignUI::TSubjectSortBy::avg_profile_power;
+
+        ED.populate_1();
 }
 
 
 void
 iExpSubjectSortAscending_toggled_cb(
-	GtkCheckMenuItem*,
-	const gpointer userdata)
+        GtkCheckMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( ED.suppress_redraw )
-		return;
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( ED.suppress_redraw )
+                return;
 
-	ED.sort_ascending = !ED.sort_ascending;
-	ED.populate_1();
+        ED.sort_ascending = !ED.sort_ascending;
+        ED.populate_1();
 }
 
 void
 iExpSubjectSortSegregate_toggled_cb(
-	GtkCheckMenuItem*,
-	const gpointer userdata)
+        GtkCheckMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( ED.suppress_redraw )
-		return;
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( ED.suppress_redraw )
+                return;
 
-	ED.sort_segregate = !ED.sort_segregate;
-	ED.populate_1();
+        ED.sort_segregate = !ED.sort_segregate;
+        ED.populate_1();
 }
 
 
@@ -99,69 +99,69 @@ iExpSubjectSortSegregate_toggled_cb(
 
 void
 iExpAnnotations_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.suppress_redraw = true;
-	gtk_toggle_button_set_active( (GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents,  ED.only_plain_global_annotations);
-	gtk_toggle_button_set_active( (GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents, !ED.only_plain_global_annotations);
-	ED.suppress_redraw = false;
-	gtk_dialog_run( ED.wGlobalAnnotations);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.suppress_redraw = true;
+        gtk_toggle_button_set_active( (GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents,  ED.only_plain_global_annotations);
+        gtk_toggle_button_set_active( (GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents, !ED.only_plain_global_annotations);
+        ED.suppress_redraw = false;
+        gtk_dialog_run( ED.wGlobalAnnotations);
 }
 
 // annotations dialog
 
 void
 tvGlobalAnnotations_row_activated_cb(
-	GtkTreeView*,
-	GtkTreePath* path,
-	GtkTreeViewColumn*,
-	const gpointer userdata)
+        GtkTreeView*,
+        GtkTreePath* path,
+        GtkTreeViewColumn*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	SExpDesignUI::SAnnotation *ann;
-	GtkTreeIter iter;
-	gtk_tree_model_get_iter( (GtkTreeModel*)ED.mGlobalAnnotations, &iter, path);
-	gtk_tree_model_get( (GtkTreeModel*)ED.mGlobalAnnotations, &iter,
-			    ED.mannotations_ref_col, &ann,
-			    -1);
-	if ( ann == nullptr )
-		return;
-
-	gtk_widget_hide( (GtkWidget*)ED.wGlobalAnnotations);
-	SScoringFacility* found = nullptr;
-	for ( auto &F : ED.open_scoring_facilities )
-		if ( &F->csubject() == &ann->csubject
-		     && F->session() == ann->session
-		     && &F->sepisode() == &ann->sepisode ) {
-			found = F;
-			break;
-		}
-	if ( found ) {
-		auto pages = ann->page_span( found->vpagesize());
-		gtk_widget_show( (GtkWidget*)found->wSF);
-		found->set_cur_vpage( pages.a, true);
-	} else {
-		ED.using_subject = ED.subject_presentation_by_csubject( ann->csubject);
-		auto SF = new SScoringFacility( ann->csubject, ann->session, ann->sepisode.name(), ED);
-		auto pages = ann->page_span( SF->vpagesize());
-		SF->set_cur_vpage( pages.a, true);
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+        SExpDesignUI::SAnnotation *ann;
+        GtkTreeIter iter;
+        gtk_tree_model_get_iter( (GtkTreeModel*)ED.mGlobalAnnotations, &iter, path);
+        gtk_tree_model_get( (GtkTreeModel*)ED.mGlobalAnnotations, &iter,
+                            ED.mannotations_ref_col, &ann,
+                            -1);
+        if ( ann == nullptr )
+                return;
+
+        gtk_widget_hide( (GtkWidget*)ED.wGlobalAnnotations);
+        SScoringFacility* found = nullptr;
+        for ( auto &F : ED.open_scoring_facilities )
+                if ( &F->csubject() == &ann->csubject
+                     && F->session() == ann->session
+                     && &F->sepisode() == &ann->sepisode ) {
+                        found = F;
+                        break;
+                }
+        if ( found ) {
+                auto pages = ann->page_span( found->vpagesize());
+                gtk_widget_show( (GtkWidget*)found->wSF);
+                found->set_cur_vpage( pages.a, true);
+        } else {
+                ED.using_subject = ED.subject_presentation_by_csubject( ann->csubject);
+                auto SF = new SScoringFacility( ann->csubject, ann->session, ann->sepisode.name(), ED);
+                auto pages = ann->page_span( SF->vpagesize());
+                SF->set_cur_vpage( pages.a, true);
+        }
 }
 
 
 
 void
 eGlobalAnnotationsShowPhasicEvents_toggled_cb(
-	GtkToggleButton* b,
-	const gpointer userdata)
+        GtkToggleButton* b,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( ED.suppress_redraw )
-		return;
-	ED.only_plain_global_annotations = not gtk_toggle_button_get_active( b);
-	ED.populate_mGlobalAnnotations();
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( ED.suppress_redraw )
+                return;
+        ED.only_plain_global_annotations = not gtk_toggle_button_get_active( b);
+        ED.populate_mGlobalAnnotations();
 }
 
 
@@ -170,39 +170,39 @@ eGlobalAnnotationsShowPhasicEvents_toggled_cb(
 
 void
 iExpBasicSADetectUltradianCycles_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	SBusyBlock bb (ED.wMainWindow);
-
-	using namespace agh;
-	CExpDesign::TEpisodeFilterFun filter =
-		[&ED]( agh::SEpisode& E) -> bool
-		{
-			return E.recordings.find( *ED._AghHi) != E.recordings.end();
-		};
-	CExpDesign::TEpisodeOpFun F =
-		[&ED]( agh::SEpisode& E)
-		{
-			ED.do_detect_ultradian_cycle( E.recordings.at( *ED._AghHi));
-		};
-	CExpDesign::TEpisodeReportFun reporter =
-		[&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::SEpisode& E,
-		       size_t i, size_t n)
-		{
-			ED.sb_main_progress_indicator(
-				snprintf_buf(
-					"Detect ultradian cycle %s/%s/%s",
-					ED.ED->group_of(J), J.id.c_str(), E.name()),
-				n, i, TGtkRefreshMode::gtk);
-			gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
-		};
-
-	ED.ED->for_all_episodes( F, reporter, filter);
-
-	ED.sb_clear();
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        SBusyBlock bb (ED.wMainWindow);
+
+        using namespace agh;
+        CExpDesign::TEpisodeFilterFun filter =
+                [&ED]( agh::SEpisode& E) -> bool
+                {
+                        return E.recordings.find( *ED._AghHi) != E.recordings.end();
+                };
+        CExpDesign::TEpisodeOpFun F =
+                [&ED]( agh::SEpisode& E)
+                {
+                        ED.do_detect_ultradian_cycle( E.recordings.at( *ED._AghHi));
+                };
+        CExpDesign::TEpisodeReportFun reporter =
+                [&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::SEpisode& E,
+                       size_t i, size_t n)
+                {
+                        ED.sb_main_progress_indicator(
+                                snprintf_buf(
+                                        "Detect ultradian cycle %s/%s/%s",
+                                        ED.ED->group_of(J), J.id.c_str(), E.name()),
+                                n, i, TGtkRefreshMode::gtk);
+                        gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+                };
+
+        ED.ED->for_all_episodes( F, reporter, filter);
+
+        ED.sb_clear();
 }
 
 
@@ -212,126 +212,126 @@ iExpBasicSADetectUltradianCycles_activate_cb(
 
 void
 iExpGloballyDetectArtifacts_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	if ( ED.global_artifact_detection_profiles.size() < 1 ) {
-		pop_ok_message( ED.wMainWindow,
-				"Create some profiles first",
-				"You can do it by opening a recording in Scoring Facility and"
-				" tweaking default parameters in Artifact Detect dialog."
-				" After saving them as a profile, it will appear here.");
-		return;
-	}
-
-	gtk_label_set_markup(
-		ED.lGlobalADHint,
-		(ED.global_artifact_detection_profiles.size() < 2)
-		? "<small>You can create a custom profile in Scoring Facility,\n"
-		  "after tuning parameters on a real recording.</small>"
-		: ""); // good boy
-
-
-	auto response = gtk_dialog_run( ED.wGlobalArtifactDetection);
-	if ( response == GTK_RESPONSE_CANCEL ||
-	     response == GTK_RESPONSE_DELETE_EVENT )
-		return; // just to save on indents in those lambdas below
-
-	auto& P = ED.global_artifact_detection_profiles[
-		gtk_combo_box_get_active_id(ED.eGlobalADProfiles)];
-	bool keep_existing = gtk_toggle_button_get_active( (GtkToggleButton*)ED.eGlobalADKeepExisting);
-
-	SBusyBlock bb (ED.wMainWindow);
-
-	using namespace agh;
-	CExpDesign::TRecordingOpFun op;
-	CExpDesign::TRecordingFilterFun filter;
-	CExpDesign::TRecordingReportFun reporter =
-		[&]( const CJGroup&, const CSubject& J, const string& D, const SEpisode& E, const CRecording& R,
-		     size_t i, size_t total)
-		{
-			ED.sb_main_progress_indicator(
-				snprintf_buf(
-					"Detect artifacts in %s/%s/%s/%s:%s",
-					ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()).name()),
-				total, i, TGtkRefreshMode::gtk);
-		};
-	switch ( response ) {
-	case GTK_RESPONSE_OK:
-		op =
-		[&]( CRecording& R)
-		{
-			auto	sr = R.F().samplerate(R.h());
-			auto&	af = R.F().artifacts(R.h());
-
-			auto	signal_original = R.F().get_signal_original(R.h());
-
-			if ( not keep_existing )
-				af.clear_all();
-			auto	marked = metrics::mc::detect_artifacts( signal_original, sr, P);
-			for ( size_t p = 0; p < marked.size(); ++p )
-				af.mark_artifact(
-					marked[p] * P.scope * sr,
-					(marked[p]+1) * P.scope * sr);
-		};
-		filter =
-		[&]( CRecording& R)
-		{
-			return R.signal_type() == sigfile::SChannel::TType::eeg;
-		};
-	    break;
-	case 1: // "Clear All"
-		op =
-		[&]( CRecording& R)
-		{
-			auto& F = R.F();
-			for ( auto& H : F.channel_list() ) {
-				auto&	af = F.artifacts(F.channel_id(H));
-				af.clear_all();
-			}
-		};
-		filter =
-		[&]( CRecording&)
-		{
-			return true; // clear in all channels (mark in EEG channels only)
-		};
-	    break;
-	default:
-		throw runtime_error ("Fix AD dialog response?");
-	}
-
-	forward_list<SBusyBlock*> bbl;
-	for ( auto& SFp : ED.open_scoring_facilities )
-		bbl.push_front( new SBusyBlock (SFp->wSF));
-
-	ED.ED -> for_all_recordings( op, reporter, filter);
-	ED.sb_clear();
-
-	for ( auto& SF : ED.open_scoring_facilities ) {
-		for ( auto& H : SF->channels )
-			if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
-				H.get_signal_filtered();
-		SF->queue_redraw_all();
-	}
-
-	ED.populate_1();
-
-	for ( auto& bb : bbl )
-		delete bb;
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        if ( ED.global_artifact_detection_profiles.size() < 1 ) {
+                pop_ok_message( ED.wMainWindow,
+                                "Create some profiles first",
+                                "You can do it by opening a recording in Scoring Facility and"
+                                " tweaking default parameters in Artifact Detect dialog."
+                                " After saving them as a profile, it will appear here.");
+                return;
+        }
+
+        gtk_label_set_markup(
+                ED.lGlobalADHint,
+                (ED.global_artifact_detection_profiles.size() < 2)
+                ? "<small>You can create a custom profile in Scoring Facility,\n"
+                  "after tuning parameters on a real recording.</small>"
+                : ""); // good boy
+
+
+        auto response = gtk_dialog_run( ED.wGlobalArtifactDetection);
+        if ( response == GTK_RESPONSE_CANCEL ||
+             response == GTK_RESPONSE_DELETE_EVENT )
+                return; // just to save on indents in those lambdas below
+
+        auto& P = ED.global_artifact_detection_profiles[
+                gtk_combo_box_get_active_id(ED.eGlobalADProfiles)];
+        bool keep_existing = gtk_toggle_button_get_active( (GtkToggleButton*)ED.eGlobalADKeepExisting);
+
+        SBusyBlock bb (ED.wMainWindow);
+
+        using namespace agh;
+        CExpDesign::TRecordingOpFun op;
+        CExpDesign::TRecordingFilterFun filter;
+        CExpDesign::TRecordingReportFun reporter =
+                [&]( const CJGroup&, const CSubject& J, const string& D, const SEpisode& E, const CRecording& R,
+                     size_t i, size_t total)
+                {
+                        ED.sb_main_progress_indicator(
+                                snprintf_buf(
+                                        "Detect artifacts in %s/%s/%s/%s:%s",
+                                        ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()).name()),
+                                total, i, TGtkRefreshMode::gtk);
+                };
+        switch ( response ) {
+        case GTK_RESPONSE_OK:
+                op =
+                [&]( CRecording& R)
+                {
+                        auto        sr = R.F().samplerate(R.h());
+                        auto&        af = R.F().artifacts(R.h());
+
+                        auto        signal_original = R.F().get_signal_original(R.h());
+
+                        if ( not keep_existing )
+                                af.clear_all();
+                        auto        marked = metrics::mc::detect_artifacts( signal_original, sr, P);
+                        for ( size_t p = 0; p < marked.size(); ++p )
+                                af.mark_artifact(
+                                        marked[p] * P.scope * sr,
+                                        (marked[p]+1) * P.scope * sr);
+                };
+                filter =
+                [&]( CRecording& R)
+                {
+                        return R.signal_type() == sigfile::SChannel::TType::eeg;
+                };
+            break;
+        case 1: // "Clear All"
+                op =
+                [&]( CRecording& R)
+                {
+                        auto& F = R.F();
+                        for ( auto& H : F.channel_list() ) {
+                                auto&        af = F.artifacts(F.channel_id(H));
+                                af.clear_all();
+                        }
+                };
+                filter =
+                [&]( CRecording&)
+                {
+                        return true; // clear in all channels (mark in EEG channels only)
+                };
+            break;
+        default:
+                throw runtime_error ("Fix AD dialog response?");
+        }
+
+        forward_list<SBusyBlock*> bbl;
+        for ( auto& SFp : ED.open_scoring_facilities )
+                bbl.push_front( new SBusyBlock (SFp->wSF));
+
+        ED.ED -> for_all_recordings( op, reporter, filter);
+        ED.sb_clear();
+
+        for ( auto& SF : ED.open_scoring_facilities ) {
+                for ( auto& H : SF->channels )
+                        if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
+                                H.get_signal_filtered();
+                SF->queue_redraw_all();
+        }
+
+        ED.populate_1();
+
+        for ( auto& bb : bbl )
+                delete bb;
 }
 
 void
 eGlobalADProfiles_changed_cb(
-	GtkComboBox*,
-	const gpointer userdata)
+        GtkComboBox*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	gtk_widget_set_sensitive(
-		(GtkWidget*)ED.bGlobalADOK,
-		ED.global_artifact_detection_profiles.size() > 0);
+        gtk_widget_set_sensitive(
+                (GtkWidget*)ED.bGlobalADOK,
+                ED.global_artifact_detection_profiles.size() > 0);
 }
 
 
@@ -339,90 +339,90 @@ eGlobalADProfiles_changed_cb(
 
 void
 iExpGloballySetFilters_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	int LPO, HPO, NF;
-	double LPC, HPC;
-	SUIVarCollection W_V;
-	W_V.reg( ED.eGlobalFiltersLowPassCutoff, &LPC);
-	W_V.reg( ED.eGlobalFiltersLowPassOrder, &LPO);
-	W_V.reg( ED.eGlobalFiltersHighPassCutoff, &HPC);
-	W_V.reg( ED.eGlobalFiltersHighPassOrder, &HPO);
-	W_V.reg( ED.eGlobalFiltersNotchFilter, &NF);
-
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( ED.wGlobalFilters) ) {
-		forward_list<SBusyBlock*> bbl;
-		for ( auto& SFp : ED.open_scoring_facilities )
-			bbl.push_front( new SBusyBlock (SFp->wSF));
-		W_V.down();
-		for ( auto &G : ED.ED->groups )
-			for ( auto &J : G.second )
-				for ( auto &D : J.measurements )
-					for ( auto &E : D.second.episodes )
-						for ( auto &F : E.sources )
-							for ( auto &H : F().channel_list() ) {
-								auto& ff = F().filters(F().channel_id(H));
-								ff.low_pass_cutoff = LPC;
-								ff.low_pass_order = LPO;
-								ff.high_pass_cutoff = HPC;
-								ff.high_pass_order = HPO;
-								ff.notch_filter = (sigfile::SFilterPack::TNotchFilter)NF;
-							}
-		ED.ED->sync();
-
-		for ( auto& SF : ED.open_scoring_facilities ) {
-			for ( auto& H : SF->channels )
-				if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
-					H.get_signal_filtered();
-			SF->queue_redraw_all();
-		}
-		ED.populate_1();
-		for ( auto& bb : bbl )
-			delete bb;
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        int LPO, HPO, NF;
+        double LPC, HPC;
+        SUIVarCollection W_V;
+        W_V.reg( ED.eGlobalFiltersLowPassCutoff, &LPC);
+        W_V.reg( ED.eGlobalFiltersLowPassOrder, &LPO);
+        W_V.reg( ED.eGlobalFiltersHighPassCutoff, &HPC);
+        W_V.reg( ED.eGlobalFiltersHighPassOrder, &HPO);
+        W_V.reg( ED.eGlobalFiltersNotchFilter, &NF);
+
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( ED.wGlobalFilters) ) {
+                forward_list<SBusyBlock*> bbl;
+                for ( auto& SFp : ED.open_scoring_facilities )
+                        bbl.push_front( new SBusyBlock (SFp->wSF));
+                W_V.down();
+                for ( auto &G : ED.ED->groups )
+                        for ( auto &J : G.second )
+                                for ( auto &D : J.measurements )
+                                        for ( auto &E : D.second.episodes )
+                                                for ( auto &F : E.sources )
+                                                        for ( auto &H : F().channel_list() ) {
+                                                                auto& ff = F().filters(F().channel_id(H));
+                                                                ff.low_pass_cutoff = LPC;
+                                                                ff.low_pass_order = LPO;
+                                                                ff.high_pass_cutoff = HPC;
+                                                                ff.high_pass_order = HPO;
+                                                                ff.notch_filter = (sigfile::SFilterPack::TNotchFilter)NF;
+                                                        }
+                ED.ED->sync();
+
+                for ( auto& SF : ED.open_scoring_facilities ) {
+                        for ( auto& H : SF->channels )
+                                if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
+                                        H.get_signal_filtered();
+                        SF->queue_redraw_all();
+                }
+                ED.populate_1();
+                for ( auto& bb : bbl )
+                        delete bb;
+        }
 }
 
 void
 bGlobalMontageResetAll_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	snprintf_buf( "find '%s' -name '.*.montage' -delete",
-		      ED.ED->session_dir());
-	if ( system( global::buf) )
-		pop_ok_message(
-			ED.wMainWindow,
-			"How strange!", "Command '%s' returned a non-zero status. This is weird.", global::buf);
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        snprintf_buf( "find '%s' -name '.*.montage' -delete",
+                      ED.ED->session_dir());
+        if ( system( global::buf) )
+                pop_ok_message(
+                        ED.wMainWindow,
+                        "How strange!", "Command '%s' returned a non-zero status. This is weird.", global::buf);
 }
 
 
 
 void
 iHelpAbout_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	// auto w = gtk_widget_get_window( (GtkWidget*)ED.lAboutVersion);
-	// gdk_window_set_composited( w, TRUE);
-	// gdk_window_set_opacity( w, .7);
-	gtk_widget_show_all( (GtkWidget*)ED.wAbout);
+        auto& ED = *(SExpDesignUI*)userdata;
+        // auto w = gtk_widget_get_window( (GtkWidget*)ED.lAboutVersion);
+        // gdk_window_set_composited( w, TRUE);
+        // gdk_window_set_opacity( w, .7);
+        gtk_widget_show_all( (GtkWidget*)ED.wAbout);
 }
 
 void
 iHelpUsage_activate_cb(
-	GtkMenuItem*,
-	const gpointer)
+        GtkMenuItem*,
+        const gpointer)
 {
-	gtk_show_uri( NULL,
-		      "http://johnhommer.com/academic/code/aghermann/usage/",
-		      GDK_CURRENT_TIME, NULL);
+        gtk_show_uri( NULL,
+                      "http://johnhommer.com/academic/code/aghermann/usage/",
+                      GDK_CURRENT_TIME, NULL);
 }
 
 
@@ -431,32 +431,32 @@ namespace {
 void
 before_ED_close( SExpDesignUI& ED)
 {
-	gtk_window_get_position( ED.wMainWindow, &ED.geometry.x, &ED.geometry.y);
-	gtk_window_get_size( ED.wMainWindow, &ED.geometry.w, &ED.geometry.h);
+        gtk_window_get_position( ED.wMainWindow, &ED.geometry.x, &ED.geometry.y);
+        gtk_window_get_size( ED.wMainWindow, &ED.geometry.w, &ED.geometry.h);
 }
 
 } // namespace
 
 void
 iExpClose_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	before_ED_close( ED);
-	g_signal_emit_by_name( ED._p->bSessionChooserClose, "clicked");
+        before_ED_close( ED);
+        g_signal_emit_by_name( ED._p->bSessionChooserClose, "clicked");
 }
 
 void
 iExpQuit_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	before_ED_close( ED);
-	g_signal_emit_by_name( ED._p->bSessionChooserQuit, "clicked");
+        before_ED_close( ED);
+        g_signal_emit_by_name( ED._p->bSessionChooserQuit, "clicked");
 }
 
 
@@ -465,7 +465,7 @@ iExpQuit_activate_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/measurements.cc b/upstream/src/aghermann/ui/mw/measurements.cc
index b754fba..f4d612c 100644
--- a/upstream/src/aghermann/ui/mw/measurements.cc
+++ b/upstream/src/aghermann/ui/mw/measurements.cc
@@ -27,34 +27,34 @@ bool
 SExpDesignUI::SSubjectPresentation::
 get_episode_from_timeline_click( unsigned along)
 {
-	try {
-		along -= tl_left_margin();
-		for ( auto& E : csubject.measurements[*_p._p._AghDi].episodes )
-			if ( along >= _p._p.T2P(E.start_rel) && along <= _p._p.T2P(E.end_rel) ) {
-				using_episode = &E;
-				return true;
-			}
-		using_episode = nullptr;
-		return false;
-	} catch (...) {
-		using_episode = nullptr;
-		return false;
-	}
+        try {
+                along -= tl_left_margin();
+                for ( auto& E : csubject.measurements[*_p._p._AghDi].episodes )
+                        if ( along >= _p._p.T2P(E.start_rel) && along <= _p._p.T2P(E.end_rel) ) {
+                                using_episode = &E;
+                                return true;
+                        }
+                using_episode = nullptr;
+                return false;
+        } catch (...) {
+                using_episode = nullptr;
+                return false;
+        }
 }
 
 void
 SExpDesignUI::SSubjectPresentation::
 draw_timeline( const string& fname) const
 {
-	cairo_surface_t *cs =
-		cairo_svg_surface_create(
-			fname.c_str(),
-			tl_width() + tl_left_margin() + tl_right_margin(),
-			tl_height());
-	cairo_t *cr = cairo_create( cs);
-	draw_timeline( cr);
-	cairo_destroy( cr);
-	cairo_surface_destroy( cs);
+        cairo_surface_t *cs =
+                cairo_svg_surface_create(
+                        fname.c_str(),
+                        tl_width() + tl_left_margin() + tl_right_margin(),
+                        tl_height());
+        cairo_t *cr = cairo_create( cs);
+        draw_timeline( cr);
+        cairo_destroy( cr);
+        cairo_surface_destroy( cs);
 }
 
 
@@ -62,245 +62,245 @@ void
 SExpDesignUI::SSubjectPresentation::
 draw_timeline( cairo_t *cr) const
 {
-	bool have_episodes = cprofile && not cprofile->mm_list().empty();
-
-	if ( not have_episodes )
-		cairo_put_banner(
-			cr, 400, tl_height(), "(no episodes)", 24);
-
-	if ( have_episodes ) {
-	      // day and night
-		{
-			cairo_pattern_t *cp =
-				cairo_pattern_create_linear(
-					tl_left_margin(), 0.,
-					tl_width() - tl_right_margin(), 0.);
-			struct tm clock_time;
-			memcpy( &clock_time, localtime( &_p._p.timeline_start), sizeof(clock_time));
-			clock_time.tm_hour = 4;
-			clock_time.tm_min = clock_time.tm_sec = 0;
-			time_t	dawn = mktime( &clock_time),
-				t;
-			bool day = false;
-			for ( t = dawn; t < timeline_end(); t += 3600 * 12, day = !day )
-				if ( t > timeline_start() )
-					_p._p.CwB[day ? TColour::mw_day : TColour::mw_night].
-						pattern_add_color_stop_rgba(
-							cp, (double)_p._p.T2P(t) / tl_width());
-			cairo_set_source( cr, cp);
-			cairo_rectangle( cr, tl_left_margin(), 0.,
-					 tl_left_margin() + tl_width(), tl_height());
-			cairo_fill( cr);
-			cairo_stroke( cr);
-			cairo_pattern_destroy( cp);
-		}
-
-		struct tm tl_start_fixed_tm;
-		memcpy( &tl_start_fixed_tm, localtime( &_p._p.timeline_start), sizeof(struct tm));
-		// determine the latest full hour before timeline_start
-		tl_start_fixed_tm.tm_min = 0;
-		time_t tl_start_fixed = mktime( &tl_start_fixed_tm);
-
-		double	scale = 0.;
-		switch (_p._p.display_profile_type ) {
-		case metrics::TType::psd: scale = _p._p.profile_scale_psd; break;
-		case metrics::TType::swu: scale = _p._p.profile_scale_swu; break;
-		case metrics::TType::mc : scale = _p._p.profile_scale_mc;  break;
-		default: break;
-		}
-		if ( !isfinite(scale) || scale <= 0. )
-			scale = _p._p.calculate_profile_scale();
-
-	      // profile
-		auto& episodes = csubject.measurements[*_p._p._AghDi].episodes;
-	      // profile proper
-		unsigned
-			j_tl_pixel_start = _p._p.T2P( episodes.front().start_rel),
-			j_tl_pixel_end   = _p._p.T2P( episodes.back().end_rel),
-			j_tl_pixels = j_tl_pixel_end - j_tl_pixel_start;
-
-		_p._p.CwB[TColour::mw_profile].set_source_rgba( cr);
-		cairo_set_line_width( cr, .3);
-		cairo_move_to( cr, tl_left_margin() + j_tl_pixel_start, tl_height()-12);
-		{
-			valarray<TFloat>
-				tmp (cprofile->timeline().size());
-			for ( size_t i = 0; i < tmp.size(); ++i )
-				tmp[i] = (*cprofile)[i].metric;
-			sigproc::smooth( tmp, _p._p.smooth_profile);
-			for ( size_t i = 0; i < tmp.size(); ++i )
-				if ( isfinite(tmp[i]) )
-					cairo_line_to(
-						cr,
-						tl_left_margin() + j_tl_pixel_start + ((float)i)/tmp.size() * j_tl_pixels,
-						-tmp[i] * scale + tl_height()-12);
-		}
-		cairo_line_to( cr, j_tl_pixel_start + tl_left_margin() + j_tl_pixels, tl_height()-12);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-
-		// boundaries, with scored percentage bars
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-		cairo_set_font_size( cr, 11);
-		for ( auto& E : episodes ) {
-			unsigned
-				e_pixel_start = _p._p.T2P( E.start_rel),
-				e_pixel_end   = _p._p.T2P( E.end_rel),
-				e_pixels = e_pixel_end - e_pixel_start;
-
-			// episode start timestamp
-			time_t	dima = E.start_time();
-			strftime( global::buf, 79, "%F %T",
-				  localtime( &dima));
-			string ss = agh::str::sasprintf(
-				"%s | %s",
-				global::buf, E.name());
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2+1, 12+1);
-			cairo_set_source_rgb( cr, 0., 0., 0.);
-			cairo_show_text( cr, ss.c_str());
-			cairo_stroke( cr);
-			// offset
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, 12);
-			cairo_set_source_rgb( cr, 1., 1., 1.);
-			cairo_show_text( cr, ss.c_str());
-			cairo_stroke( cr);
-
-			// highlight
-			if ( is_focused && using_episode == &E ) {
-				const auto fuzz = 10;
-				cairo_pattern_t *cp =
-					cairo_pattern_create_linear(
-						tl_left_margin() + e_pixel_start - fuzz, 0,
-						tl_left_margin() + e_pixel_start + e_pixels + fuzz, 0);
-				cairo_pattern_add_color_stop_rgba( cp, 0.,					1., 1., 1., 0.);
-				cairo_pattern_add_color_stop_rgba( cp, 0. + (double)fuzz/(e_pixels + fuzz*2),	1., 1., 1., .3);
-				cairo_pattern_add_color_stop_rgba( cp, 1. - (double)fuzz/(e_pixels + fuzz*2),	1., 1., 1., .3);
-				cairo_pattern_add_color_stop_rgba( cp, 1.,					1., 1., 1., 0.);
-
-				cairo_set_line_width( cr, .2);
-				cairo_set_source( cr, cp);
-				cairo_rectangle( cr,
-						 tl_left_margin() + e_pixel_start - fuzz, 0,
-						 e_pixels + fuzz*2, tl_height());
-				cairo_fill( cr);
-				cairo_stroke( cr);
-				cairo_pattern_destroy( cp);
-			}
-
-			// percentage bar graph
-			float pc_scored, pc_nrem, pc_rem, pc_wake;
-			pc_scored = E.sources.front().percent_scored( &pc_nrem, &pc_rem, &pc_wake);
-			pc_scored *= e_pixels / 100.;
-			pc_nrem   *= e_pixels / 100.;
-			pc_rem    *= e_pixels / 100.;
-			pc_wake   *= e_pixels / 100.;
-
-			cairo_set_line_width( cr, 4);
-
-			cairo_set_source_rgb( cr, 0., .1, .9);
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
-			cairo_rel_line_to( cr, pc_nrem, 0);
-			cairo_stroke( cr);
-
-			cairo_set_source_rgb( cr, .9, .0, .5);
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem, tl_height()-5);
-			cairo_rel_line_to( cr, pc_rem, 0);
-			cairo_stroke( cr);
-
-			cairo_set_source_rgb( cr, 0., .9, .1);
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem + pc_rem, tl_height()-5);
-			cairo_rel_line_to( cr, pc_wake, 0);
-			cairo_stroke( cr);
-
-			cairo_set_line_width( cr, 10);
-			cairo_set_source_rgba( cr, 1., 1., 1., .5);
-			cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
-			cairo_rel_line_to( cr, pc_scored, 0);
-			cairo_stroke( cr);
-
-		      // ultradian cycle
-			if ( _p._p.draw_nremrem_cycles ) {
-				auto& M = E.recordings.at(*_p._p._AghTi);
-				if ( M.have_uc_determined() ) {
-					agh::beersma::FUltradianCycle F (*M.uc_params);
-					_p._p.CwB[TColour::mw_profile].set_source_rgba_contrasting( cr);
-					cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height() - 22);
-					cairo_show_text( cr, snprintf_buf( "T: %g  r: %g", F.T, F.r));
-					cairo_stroke( cr);
-
-					_p._p.CwB[TColour::mw_ticks /* bounds? */].set_source_rgba( cr, .7);
-					cairo_set_line_width( cr, .5);
-
-					auto	dxe = tl_left_margin() + e_pixel_start,
-						dye = tl_height() - 12;
-					cairo_move_to( cr, dxe, dye - F(0.) * tl_height()/2);
-					for ( size_t i = 0; i < M.total_pages(); ++i ) {
-						float t = i * M.pagesize() / 60.;
-						cairo_line_to( cr,
-							       dxe + (t*60/M.F().recording_time()) * e_pixels,
-							       dye + -F(t) * tl_height()/2);
-					}
-					cairo_stroke( cr);
-				}
-			}
-		}
-
-	      // ticks
-		if ( is_focused ) {
-			cairo_set_line_width( cr, .5);
-			_p._p.CwB[TColour::mw_ticks].set_source_rgb( cr);
-			cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			unsigned clock_d0 = localtime(&tl_start_fixed)->tm_mday + 1;
-			for ( time_t t = tl_start_fixed; t <= timeline_end(); t += 3600 ) {
-				size_t x = _p._p.T2P(t);
-				unsigned
-					clock_h  = localtime(&t)->tm_hour,
-					clock_d  = localtime(&t)->tm_mday;
-				if ( clock_h % 6 == 0 ) {
-					cairo_set_font_size( cr, (clock_h % 24 == 0) ? 10 : 8);
-					cairo_move_to( cr, tl_left_margin() + x, (clock_h % 24 == 0) ? 0 : tl_height() - 16);
-					cairo_line_to( cr, tl_left_margin() + x, tl_height() - 10);
-
-					snprintf_buf_ts_h( (clock_d - clock_d0 + 1) * 24 + clock_h);
-					cairo_text_extents_t extents;
-					cairo_text_extents( cr, global::buf, &extents);
-					cairo_move_to( cr, tl_left_margin() + x - extents.width/2, tl_height()-1);
-					cairo_show_text( cr, global::buf);
-
-				} else {
-					cairo_move_to( cr, tl_left_margin() + x, tl_height() - 14);
-					cairo_line_to( cr, tl_left_margin() + x, tl_height() - 7);
-				}
-			}
-			cairo_stroke( cr);
-		}
-	}
+        bool have_episodes = cprofile && not cprofile->mm_list().empty();
+
+        if ( not have_episodes )
+                cairo_put_banner(
+                        cr, 400, tl_height(), "(no episodes)", 24);
+
+        if ( have_episodes ) {
+              // day and night
+                {
+                        cairo_pattern_t *cp =
+                                cairo_pattern_create_linear(
+                                        tl_left_margin(), 0.,
+                                        tl_width() - tl_right_margin(), 0.);
+                        struct tm clock_time;
+                        memcpy( &clock_time, localtime( &_p._p.timeline_start), sizeof(clock_time));
+                        clock_time.tm_hour = 4;
+                        clock_time.tm_min = clock_time.tm_sec = 0;
+                        time_t        dawn = mktime( &clock_time),
+                                t;
+                        bool day = false;
+                        for ( t = dawn; t < timeline_end(); t += 3600 * 12, day = !day )
+                                if ( t > timeline_start() )
+                                        _p._p.CwB[day ? TColour::mw_day : TColour::mw_night].
+                                                pattern_add_color_stop_rgba(
+                                                        cp, (double)_p._p.T2P(t) / tl_width());
+                        cairo_set_source( cr, cp);
+                        cairo_rectangle( cr, tl_left_margin(), 0.,
+                                         tl_left_margin() + tl_width(), tl_height());
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+                        cairo_pattern_destroy( cp);
+                }
+
+                struct tm tl_start_fixed_tm;
+                memcpy( &tl_start_fixed_tm, localtime( &_p._p.timeline_start), sizeof(struct tm));
+                // determine the latest full hour before timeline_start
+                tl_start_fixed_tm.tm_min = 0;
+                time_t tl_start_fixed = mktime( &tl_start_fixed_tm);
+
+                double        scale = 0.;
+                switch (_p._p.display_profile_type ) {
+                case metrics::TType::psd: scale = _p._p.profile_scale_psd; break;
+                case metrics::TType::swu: scale = _p._p.profile_scale_swu; break;
+                case metrics::TType::mc : scale = _p._p.profile_scale_mc;  break;
+                default: break;
+                }
+                if ( !isfinite(scale) || scale <= 0. )
+                        scale = _p._p.calculate_profile_scale();
+
+              // profile
+                auto& episodes = csubject.measurements[*_p._p._AghDi].episodes;
+              // profile proper
+                unsigned
+                        j_tl_pixel_start = _p._p.T2P( episodes.front().start_rel),
+                        j_tl_pixel_end   = _p._p.T2P( episodes.back().end_rel),
+                        j_tl_pixels = j_tl_pixel_end - j_tl_pixel_start;
+
+                _p._p.CwB[TColour::mw_profile].set_source_rgba( cr);
+                cairo_set_line_width( cr, .3);
+                cairo_move_to( cr, tl_left_margin() + j_tl_pixel_start, tl_height()-12);
+                {
+                        valarray<TFloat>
+                                tmp (cprofile->timeline().size());
+                        for ( size_t i = 0; i < tmp.size(); ++i )
+                                tmp[i] = (*cprofile)[i].metric;
+                        sigproc::smooth( tmp, _p._p.smooth_profile);
+                        for ( size_t i = 0; i < tmp.size(); ++i )
+                                if ( isfinite(tmp[i]) )
+                                        cairo_line_to(
+                                                cr,
+                                                tl_left_margin() + j_tl_pixel_start + ((float)i)/tmp.size() * j_tl_pixels,
+                                                -tmp[i] * scale + tl_height()-12);
+                }
+                cairo_line_to( cr, j_tl_pixel_start + tl_left_margin() + j_tl_pixels, tl_height()-12);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+
+                // boundaries, with scored percentage bars
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+                cairo_set_font_size( cr, 11);
+                for ( auto& E : episodes ) {
+                        unsigned
+                                e_pixel_start = _p._p.T2P( E.start_rel),
+                                e_pixel_end   = _p._p.T2P( E.end_rel),
+                                e_pixels = e_pixel_end - e_pixel_start;
+
+                        // episode start timestamp
+                        time_t        dima = E.start_time();
+                        strftime( global::buf, 79, "%F %T",
+                                  localtime( &dima));
+                        string ss = agh::str::sasprintf(
+                                "%s | %s",
+                                global::buf, E.name());
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2+1, 12+1);
+                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                        cairo_show_text( cr, ss.c_str());
+                        cairo_stroke( cr);
+                        // offset
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, 12);
+                        cairo_set_source_rgb( cr, 1., 1., 1.);
+                        cairo_show_text( cr, ss.c_str());
+                        cairo_stroke( cr);
+
+                        // highlight
+                        if ( is_focused && using_episode == &E ) {
+                                const auto fuzz = 10;
+                                cairo_pattern_t *cp =
+                                        cairo_pattern_create_linear(
+                                                tl_left_margin() + e_pixel_start - fuzz, 0,
+                                                tl_left_margin() + e_pixel_start + e_pixels + fuzz, 0);
+                                cairo_pattern_add_color_stop_rgba( cp, 0.,                                        1., 1., 1., 0.);
+                                cairo_pattern_add_color_stop_rgba( cp, 0. + (double)fuzz/(e_pixels + fuzz*2),        1., 1., 1., .3);
+                                cairo_pattern_add_color_stop_rgba( cp, 1. - (double)fuzz/(e_pixels + fuzz*2),        1., 1., 1., .3);
+                                cairo_pattern_add_color_stop_rgba( cp, 1.,                                        1., 1., 1., 0.);
+
+                                cairo_set_line_width( cr, .2);
+                                cairo_set_source( cr, cp);
+                                cairo_rectangle( cr,
+                                                 tl_left_margin() + e_pixel_start - fuzz, 0,
+                                                 e_pixels + fuzz*2, tl_height());
+                                cairo_fill( cr);
+                                cairo_stroke( cr);
+                                cairo_pattern_destroy( cp);
+                        }
+
+                        // percentage bar graph
+                        float pc_scored, pc_nrem, pc_rem, pc_wake;
+                        pc_scored = E.sources.front().percent_scored( &pc_nrem, &pc_rem, &pc_wake);
+                        pc_scored *= e_pixels / 100.;
+                        pc_nrem   *= e_pixels / 100.;
+                        pc_rem    *= e_pixels / 100.;
+                        pc_wake   *= e_pixels / 100.;
+
+                        cairo_set_line_width( cr, 4);
+
+                        cairo_set_source_rgb( cr, 0., .1, .9);
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
+                        cairo_rel_line_to( cr, pc_nrem, 0);
+                        cairo_stroke( cr);
+
+                        cairo_set_source_rgb( cr, .9, .0, .5);
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem, tl_height()-5);
+                        cairo_rel_line_to( cr, pc_rem, 0);
+                        cairo_stroke( cr);
+
+                        cairo_set_source_rgb( cr, 0., .9, .1);
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem + pc_rem, tl_height()-5);
+                        cairo_rel_line_to( cr, pc_wake, 0);
+                        cairo_stroke( cr);
+
+                        cairo_set_line_width( cr, 10);
+                        cairo_set_source_rgba( cr, 1., 1., 1., .5);
+                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
+                        cairo_rel_line_to( cr, pc_scored, 0);
+                        cairo_stroke( cr);
+
+                      // ultradian cycle
+                        if ( _p._p.draw_nremrem_cycles ) {
+                                auto& M = E.recordings.at(*_p._p._AghTi);
+                                if ( M.have_uc_determined() ) {
+                                        agh::beersma::FUltradianCycle F (*M.uc_params);
+                                        _p._p.CwB[TColour::mw_profile].set_source_rgba_contrasting( cr);
+                                        cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height() - 22);
+                                        cairo_show_text( cr, snprintf_buf( "T: %g  r: %g", F.T, F.r));
+                                        cairo_stroke( cr);
+
+                                        _p._p.CwB[TColour::mw_ticks /* bounds? */].set_source_rgba( cr, .7);
+                                        cairo_set_line_width( cr, .5);
+
+                                        auto        dxe = tl_left_margin() + e_pixel_start,
+                                                dye = tl_height() - 12;
+                                        cairo_move_to( cr, dxe, dye - F(0.) * tl_height()/2);
+                                        for ( size_t i = 0; i < M.total_pages(); ++i ) {
+                                                float t = i * M.pagesize() / 60.;
+                                                cairo_line_to( cr,
+                                                               dxe + (t*60/M.F().recording_time()) * e_pixels,
+                                                               dye + -F(t) * tl_height()/2);
+                                        }
+                                        cairo_stroke( cr);
+                                }
+                        }
+                }
+
+              // ticks
+                if ( is_focused ) {
+                        cairo_set_line_width( cr, .5);
+                        _p._p.CwB[TColour::mw_ticks].set_source_rgb( cr);
+                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        unsigned clock_d0 = localtime(&tl_start_fixed)->tm_mday + 1;
+                        for ( time_t t = tl_start_fixed; t <= timeline_end(); t += 3600 ) {
+                                size_t x = _p._p.T2P(t);
+                                unsigned
+                                        clock_h  = localtime(&t)->tm_hour,
+                                        clock_d  = localtime(&t)->tm_mday;
+                                if ( clock_h % 6 == 0 ) {
+                                        cairo_set_font_size( cr, (clock_h % 24 == 0) ? 10 : 8);
+                                        cairo_move_to( cr, tl_left_margin() + x, (clock_h % 24 == 0) ? 0 : tl_height() - 16);
+                                        cairo_line_to( cr, tl_left_margin() + x, tl_height() - 10);
+
+                                        snprintf_buf_ts_h( (clock_d - clock_d0 + 1) * 24 + clock_h);
+                                        cairo_text_extents_t extents;
+                                        cairo_text_extents( cr, global::buf, &extents);
+                                        cairo_move_to( cr, tl_left_margin() + x - extents.width/2, tl_height()-1);
+                                        cairo_show_text( cr, global::buf);
+
+                                } else {
+                                        cairo_move_to( cr, tl_left_margin() + x, tl_height() - 14);
+                                        cairo_line_to( cr, tl_left_margin() + x, tl_height() - 7);
+                                }
+                        }
+                        cairo_stroke( cr);
+                }
+        }
 
       // draw subject name, gender and age
-	cairo_move_to( cr, 2, 12);
-	cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
-	cairo_set_font_size( cr, 12);
-	cairo_set_source_rgb( cr, 0., 0., 0.);
-	cairo_show_text( cr, csubject.id.c_str());
-	cairo_stroke( cr);
-
-	cairo_move_to( cr, 2, 25);
-	cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
-	cairo_set_font_size( cr, 9);
-	cairo_set_source_rgba( cr, .1, .1, .1, .5);
-	cairo_show_text( cr, csubject.name.c_str());
-	cairo_stroke( cr);
-
-	cairo_move_to( cr, 2, 35);
-	cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
-	cairo_set_font_size( cr, 9);
-	cairo_set_source_rgb( cr, .1, .1, .1);
-	cairo_show_text(
-		cr,
-		snprintf_buf(
-			"%c %d y.o.",
-			csubject.gender_sign(),
-			(int)csubject.age( *_p._p._AghDi)));
+        cairo_move_to( cr, 2, 12);
+        cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
+        cairo_set_font_size( cr, 12);
+        cairo_set_source_rgb( cr, 0., 0., 0.);
+        cairo_show_text( cr, csubject.id.c_str());
+        cairo_stroke( cr);
+
+        cairo_move_to( cr, 2, 25);
+        cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
+        cairo_set_font_size( cr, 9);
+        cairo_set_source_rgba( cr, .1, .1, .1, .5);
+        cairo_show_text( cr, csubject.name.c_str());
+        cairo_stroke( cr);
+
+        cairo_move_to( cr, 2, 35);
+        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
+        cairo_set_font_size( cr, 9);
+        cairo_set_source_rgb( cr, .1, .1, .1);
+        cairo_show_text(
+                cr,
+                snprintf_buf(
+                        "%c %d y.o.",
+                        csubject.gender_sign(),
+                        (int)csubject.age( *_p._p._AghDi)));
 }
 
 
@@ -308,28 +308,28 @@ void
 SExpDesignUI::
 modify_active_profile_scale( const GdkScrollDirection d)
 {
-	auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
-	switch ( display_profile_type ) {
-	case metrics::TType::psd: profile_scale_psd *= fac; break;
-	case metrics::TType::swu: profile_scale_swu *= fac; break;
-	case metrics::TType::mc : profile_scale_mc  *= fac; break;
-	default: break;
-	}
+        auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
+        switch ( display_profile_type ) {
+        case metrics::TType::psd: profile_scale_psd *= fac; break;
+        case metrics::TType::swu: profile_scale_swu *= fac; break;
+        case metrics::TType::mc : profile_scale_mc  *= fac; break;
+        default: break;
+        }
 }
 
 void
 SExpDesignUI::
 modify_profile_scales( const GdkScrollDirection d)
 {
-	auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
-	profile_scale_psd *= fac;
-	profile_scale_swu *= fac;
-	profile_scale_mc  *= fac;
+        auto fac = (d == GDK_SCROLL_DOWN) ? 1/scroll_factor : scroll_factor;
+        profile_scale_psd *= fac;
+        profile_scale_swu *= fac;
+        profile_scale_mc  *= fac;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/measurements_cb.cc b/upstream/src/aghermann/ui/mw/measurements_cb.cc
index f1a82ad..8aa893b 100644
--- a/upstream/src/aghermann/ui/mw/measurements_cb.cc
+++ b/upstream/src/aghermann/ui/mw/measurements_cb.cc
@@ -21,149 +21,149 @@ extern "C" {
 
 void
 cGroupExpander_activate_cb(
-	GtkExpander *wid,
-	const gpointer userdata)
+        GtkExpander *wid,
+        const gpointer userdata)
 {
-	auto& G = *(SExpDesignUI::SGroupPresentation*)userdata;
-	G._p.group_unvisibility[G.name()] = gtk_expander_get_expanded(wid);
+        auto& G = *(SExpDesignUI::SGroupPresentation*)userdata;
+        G._p.group_unvisibility[G.name()] = gtk_expander_get_expanded(wid);
 }
 
 // individual channel callbacks
 
 gboolean
 daSubjectTimeline_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	const auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        const auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
 
-	J.draw_timeline( cr);
+        J.draw_timeline( cr);
 
-	return TRUE;
+        return TRUE;
 }
 
 
 gboolean
 daSubjectTimeline_motion_notify_event_cb(
-	GtkWidget *wid,
-	const GdkEventMotion *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        const GdkEventMotion *event,
+        const gpointer userdata)
 {
-	auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
 
-	auto e_before = J.using_episode;
+        auto e_before = J.using_episode;
 
-	if ( J.get_episode_from_timeline_click( event->x), J.using_episode != e_before )
-		gtk_widget_queue_draw( wid);
+        if ( J.get_episode_from_timeline_click( event->x), J.using_episode != e_before )
+                gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 gboolean
 daSubjectTimeline_leave_notify_event_cb(
-	GtkWidget *wid,
-	const GdkEventCrossing *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        const GdkEventCrossing *event,
+        const gpointer userdata)
 {
-	if ( event->mode != GDK_CROSSING_NORMAL )
-		return TRUE;
+        if ( event->mode != GDK_CROSSING_NORMAL )
+                return TRUE;
 
-	auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
 
-	J.is_focused = false;
-	J.using_episode = nullptr;
-	gtk_widget_queue_draw( wid);
+        J.is_focused = false;
+        J.using_episode = nullptr;
+        gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 gboolean
 daSubjectTimeline_enter_notify_event_cb(
-	GtkWidget *wid,
-	const GdkEventCrossing *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        const GdkEventCrossing *event,
+        const gpointer userdata)
 {
-	auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
 
-	J.is_focused = true;
-	J.get_episode_from_timeline_click( event->x);
-	gtk_widget_queue_draw( wid);
+        J.is_focused = true;
+        J.get_episode_from_timeline_click( event->x);
+        gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 
 
 
 gboolean
 daSubjectTimeline_button_press_event_cb(
-	const GtkWidget*,
-	const GdkEventButton *event,
-	const gpointer userdata)
+        const GtkWidget*,
+        const GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
-	auto& ED = J._p._p;
-	ED.using_subject = &J;
-
-	if ( J.get_episode_from_timeline_click( event->x) ) {
-		// should some episodes be missing, we make sure the correct one gets identified by number
-		ED._AghEi = find( ED.AghEE.begin(), ED.AghEE.end(), J.using_episode->name());
-	} else
-		ED._AghEi = ED.AghEE.end();
-
-	switch ( event->button ) {
-	case 1:
-		if ( J.is_episode_focused() ) {
-			new SScoringFacility( J.csubject, *ED._AghDi, *ED._AghEi, ED);
-			// will be destroyed via its ui callbacks it has registered
-		}
-	    break;
-	case 2:
-	case 3:
-		bool episode_ops = J.is_episode_focused();
-		gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineScore, episode_ops);
-		gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineDetectUltradianCycle, episode_ops);
-		gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineEDFInfo, episode_ops);
-		gtk_menu_popup( ED.iiSubjectTimeline,
-				NULL, NULL, NULL, NULL, 3, event->time);
-	    break;
-	}
-
-	return TRUE;
+        auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        auto& ED = J._p._p;
+        ED.using_subject = &J;
+
+        if ( J.get_episode_from_timeline_click( event->x) ) {
+                // should some episodes be missing, we make sure the correct one gets identified by number
+                ED._AghEi = find( ED.AghEE.begin(), ED.AghEE.end(), J.using_episode->name());
+        } else
+                ED._AghEi = ED.AghEE.end();
+
+        switch ( event->button ) {
+        case 1:
+                if ( J.is_episode_focused() ) {
+                        new SScoringFacility( J.csubject, *ED._AghDi, *ED._AghEi, ED);
+                        // will be destroyed via its ui callbacks it has registered
+                }
+            break;
+        case 2:
+        case 3:
+                bool episode_ops = J.is_episode_focused();
+                gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineScore, episode_ops);
+                gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineDetectUltradianCycle, episode_ops);
+                gtk_widget_set_visible( (GtkWidget*)ED.iSubjectTimelineEDFInfo, episode_ops);
+                gtk_menu_popup( ED.iiSubjectTimeline,
+                                NULL, NULL, NULL, NULL, 3, event->time);
+            break;
+        }
+
+        return TRUE;
 }
 
 gboolean
 daSubjectTimeline_scroll_event_cb(
-	const GtkWidget*,
-	const GdkEventScroll *event,
-	const gpointer userdata)
+        const GtkWidget*,
+        const GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
-	auto& ED = J._p._p;
-
-	if ( event->state & GDK_SHIFT_MASK ) {
-		switch ( event->direction ) {
-		case GDK_SCROLL_UP:   if ( ED.tl_pph > 3 ) --ED.tl_pph; break;
-		case GDK_SCROLL_DOWN:                      ++ED.tl_pph; break;
-		default: break;
-		}
-
-		ED.tl_width = (ED.timeline_end - ED.timeline_start) / 3600 * ED.tl_pph;
-		for ( auto &G : ED.groups )
-			for ( auto &J : G )
-				g_object_set(
-					(GObject*)J.da,
-					"width-request", ED.tl_width + ED.tl_left_margin + ED.tl_right_margin,
-					NULL);
-
-		gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
-		return TRUE;
-
-	} else if ( event->state & GDK_CONTROL_MASK ) {
-		ED.modify_profile_scales( event->direction);
-		gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
-		return TRUE;
-
-	} else
-		return FALSE;
+        auto& J = *(SExpDesignUI::SSubjectPresentation*)userdata;
+        auto& ED = J._p._p;
+
+        if ( event->state & GDK_SHIFT_MASK ) {
+                switch ( event->direction ) {
+                case GDK_SCROLL_UP:   if ( ED.tl_pph > 3 ) --ED.tl_pph; break;
+                case GDK_SCROLL_DOWN:                      ++ED.tl_pph; break;
+                default: break;
+                }
+
+                ED.tl_width = (ED.timeline_end - ED.timeline_start) / 3600 * ED.tl_pph;
+                for ( auto &G : ED.groups )
+                        for ( auto &J : G )
+                                g_object_set(
+                                        (GObject*)J.da,
+                                        "width-request", ED.tl_width + ED.tl_left_margin + ED.tl_right_margin,
+                                        NULL);
+
+                gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+                return TRUE;
+
+        } else if ( event->state & GDK_CONTROL_MASK ) {
+                ED.modify_profile_scales( event->direction);
+                gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+                return TRUE;
+
+        } else
+                return FALSE;
 }
 
 
@@ -172,126 +172,126 @@ daSubjectTimeline_scroll_event_cb(
 // context cMeasurements menus
 void
 iiSubjectTimeline_show_cb(
-	const GtkWidget*,
-	const gpointer userdata)
+        const GtkWidget*,
+        const gpointer userdata)
 {
-	const auto& ED = *(SExpDesignUI*)userdata;
-	const auto J = ED.using_subject;
-	gtk_widget_set_sensitive(
-		(GtkWidget*)ED.iSubjectTimelineScore,
-		J->is_episode_focused());
+        const auto& ED = *(SExpDesignUI*)userdata;
+        const auto J = ED.using_subject;
+        gtk_widget_set_sensitive(
+                (GtkWidget*)ED.iSubjectTimelineScore,
+                J->is_episode_focused());
 }
 
 
 void
 iSubjectTimelineScore_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto J = ED.using_subject;
-	new SScoringFacility( J->csubject, *ED._AghDi, *ED._AghEi, ED);
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto J = ED.using_subject;
+        new SScoringFacility( J->csubject, *ED._AghDi, *ED._AghEi, ED);
 }
 
 
 void
 iSubjectTimelineDetectUltradianCycle_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	agh::SEpisode *Ep;
-	if ( ED.using_subject && (Ep = ED.using_subject->using_episode) ) {
-		auto& R = Ep->recordings.at(*ED._AghHi);
-		SBusyBlock bb (ED.wMainWindow);
-		ED.do_detect_ultradian_cycle( R);
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+        agh::SEpisode *Ep;
+        if ( ED.using_subject && (Ep = ED.using_subject->using_episode) ) {
+                auto& R = Ep->recordings.at(*ED._AghHi);
+                SBusyBlock bb (ED.wMainWindow);
+                ED.do_detect_ultradian_cycle( R);
+        }
 }
 
 
 
 void
 iSubjectTimelineEDFInfo_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto J = ED.using_subject;
-
-	const auto& F = J->using_episode->sources.front();
-	gtk_text_buffer_set_text(
-		ED.tEDFFileDetailsReport,
-		F().details( 0|sigfile::CSource::TDetails::with_channels).c_str(), -1);
-	gtk_label_set_markup(
-		ED.lEDFFileDetails,
-		snprintf_buf(
-			"<big>Header of\n"
-			"<i>%s</i></big>",
-			F().filename()));
-	gtk_widget_show_all( (GtkWidget*)ED.wEDFFileDetails);
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto J = ED.using_subject;
+
+        const auto& F = J->using_episode->sources.front();
+        gtk_text_buffer_set_text(
+                ED.tEDFFileDetailsReport,
+                F().details( 0|sigfile::CSource::TDetails::with_channels).c_str(), -1);
+        gtk_label_set_markup(
+                ED.lEDFFileDetails,
+                snprintf_buf(
+                        "<big>Header of\n"
+                        "<i>%s</i></big>",
+                        F().filename()));
+        gtk_widget_show_all( (GtkWidget*)ED.wEDFFileDetails);
 }
 
 
 void
 iSubjectTimelineSaveAsSVG_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto J = ED.using_subject;
-
-	string tmp = agh::str::sasprintf(
-		"%s/%s/%s/%s/%s.svg",
-		ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
-		ED.AghD(), ED.AghT());
-	J->is_focused = true;
-	J->draw_timeline( tmp);
-
-	ED.sb_message(
-		snprintf_buf( "Wrote \"%s\"", agh::str::homedir2tilda(tmp).c_str()));
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto J = ED.using_subject;
+
+        string tmp = agh::str::sasprintf(
+                "%s/%s/%s/%s/%s.svg",
+                ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
+                ED.AghD(), ED.AghT());
+        J->is_focused = true;
+        J->draw_timeline( tmp);
+
+        ED.sb_message(
+                snprintf_buf( "Wrote \"%s\"", agh::str::homedir2tilda(tmp).c_str()));
 }
 
 
 void
 iSubjectTimelineBrowse_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto J = ED.using_subject;
-
-	if ( system( agh::str::sasprintf(
-			     "%s '%s/%s/%s/%s' &",
-			     ED.browse_command.c_str(),
-			     ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
-		     .c_str()) ) {
-		pop_ok_message(
-			ED.wMainWindow,
-			"Error launching file browser",
-			"Command '%s' returned a non-zero status.",
-			ED.browse_command.c_str()) ;
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto J = ED.using_subject;
+
+        if ( system( agh::str::sasprintf(
+                             "%s '%s/%s/%s/%s' &",
+                             ED.browse_command.c_str(),
+                             ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
+                     .c_str()) ) {
+                pop_ok_message(
+                        ED.wMainWindow,
+                        "Error launching file browser",
+                        "Command '%s' returned a non-zero status.",
+                        ED.browse_command.c_str()) ;
+        }
 }
 
 void
 iSubjectTimelineResetMontage_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	const auto& ED = *(SExpDesignUI*)userdata;
-	const auto J = ED.using_subject;
-
-	string exec = (not J->is_episode_focused())
-		? agh::str::sasprintf(
-			"find '%s/%s/%s/%s' -name '.*.montage' -delete",
-			ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
-		: agh::str::sasprintf(
-			"rm -f '%s/%s/%s/%s/.%s.montage'",
-			ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD(), ED.AghE());
-
-	if ( system( exec.c_str()) )
-		pop_ok_message(
-			ED.wMainWindow, "Wow", "Command '%s' returned a non-zero status. This is weird.", global::buf);
+        const auto& ED = *(SExpDesignUI*)userdata;
+        const auto J = ED.using_subject;
+
+        string exec = (not J->is_episode_focused())
+                ? agh::str::sasprintf(
+                        "find '%s/%s/%s/%s' -name '.*.montage' -delete",
+                        ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD())
+                : agh::str::sasprintf(
+                        "rm -f '%s/%s/%s/%s/.%s.montage'",
+                        ED.ED->session_dir(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(), ED.AghD(), ED.AghE());
+
+        if ( system( exec.c_str()) )
+                pop_ok_message(
+                        ED.wMainWindow, "Wow", "Command '%s' returned a non-zero status. This is weird.", global::buf);
 }
 
 
@@ -299,7 +299,7 @@ iSubjectTimelineResetMontage_activate_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/mw.cc b/upstream/src/aghermann/ui/mw/mw.cc
index e1a1f6e..b68eaff 100644
--- a/upstream/src/aghermann/ui/mw/mw.cc
+++ b/upstream/src/aghermann/ui/mw/mw.cc
@@ -32,15 +32,15 @@ using namespace agh::ui;
 
 SExpDesignUI::SSubjectPresentation::
 SSubjectPresentation (agh::CSubject& _j,
-		      SGroupPresentation& parent)
+                      SGroupPresentation& parent)
       : csubject (_j),
-	using_episode (nullptr),
-	is_focused (false),
-	_p (parent),
-	da (nullptr)
+        using_episode (nullptr),
+        is_focused (false),
+        _p (parent),
+        da (nullptr)
 {
-	cprofile = nullptr;
-	create_cprofile();
+        cprofile = nullptr;
+        create_cprofile();
 }
 
 
@@ -48,22 +48,22 @@ agh::SProfileParamSet
 SExpDesignUI::
 make_active_profile_paramset() const
 {
-	switch ( display_profile_type ) {
-	case metrics::TType::psd:
-		return agh::SProfileParamSet (
-			agh::SProfileParamSet::PSD {active_profile_psd_freq_from, active_profile_psd_freq_upto}
-			);
-	case metrics::TType::swu:
-		return agh::SProfileParamSet (
-			agh::SProfileParamSet::SWU {active_profile_swu_f0}
-			);
-	case metrics::TType::mc:
-		return agh::SProfileParamSet (
-			agh::SProfileParamSet::MC {active_profile_mc_f0}
-			);
-	default:
-		throw runtime_error ("Which profile is this?");
-	}
+        switch ( display_profile_type ) {
+        case metrics::TType::psd:
+                return agh::SProfileParamSet (
+                        agh::SProfileParamSet::PSD {active_profile_psd_freq_from, active_profile_psd_freq_upto}
+                        );
+        case metrics::TType::swu:
+                return agh::SProfileParamSet (
+                        agh::SProfileParamSet::SWU {active_profile_swu_f0}
+                        );
+        case metrics::TType::mc:
+                return agh::SProfileParamSet (
+                        agh::SProfileParamSet::MC {active_profile_mc_f0}
+                        );
+        default:
+                throw runtime_error ("Which profile is this?");
+        }
 }
 
 
@@ -71,27 +71,27 @@ void
 SExpDesignUI::SSubjectPresentation::
 create_cprofile()
 {
-	if ( cprofile )
-		delete cprofile;
-	try {
-		agh::SProfileParamSet Pp;
-		cprofile =
-			new agh::CProfile (
-				csubject, *_p._p._AghDi, *_p._p._AghTi,
-				_p._p.make_active_profile_paramset());
-		tl_start = csubject.measurements[*_p._p._AghDi].episodes.front().start_rel;
-	} catch (...) {  // can be invalid_argument (no recording in such session/channel) or some TSimPrepError
-		cprofile = nullptr;
-		fprintf( stderr, "SSubjectPresentation::SSubjectPresentation(): subject \"%s\" has no recordings in session \"%s\" channel \"%s\"\n",
-			 csubject.id.c_str(), _p._p.AghD(), _p._p.AghT());
-	}
+        if ( cprofile )
+                delete cprofile;
+        try {
+                agh::SProfileParamSet Pp;
+                cprofile =
+                        new agh::CProfile (
+                                csubject, *_p._p._AghDi, *_p._p._AghTi,
+                                _p._p.make_active_profile_paramset());
+                tl_start = csubject.measurements[*_p._p._AghDi].episodes.front().start_rel;
+        } catch (...) {  // can be invalid_argument (no recording in such session/channel) or some TSimPrepError
+                cprofile = nullptr;
+                fprintf( stderr, "SSubjectPresentation::SSubjectPresentation(): subject \"%s\" has no recordings in session \"%s\" channel \"%s\"\n",
+                         csubject.id.c_str(), _p._p.AghD(), _p._p.AghT());
+        }
 }
 
 SExpDesignUI::SSubjectPresentation::
 ~SSubjectPresentation ()
 {
-	if ( cprofile )
-		delete cprofile;
+        if ( cprofile )
+                delete cprofile;
 }
 
 
@@ -103,19 +103,19 @@ __attribute__ ((pure))
 SExpDesignUI::
 subject_presentation_by_csubject( const agh::CSubject& j)
 {
-	for ( auto& G : groups )
-		for ( auto& J : G )
-			if ( j == J.csubject )
-				return &J;
-	return nullptr;
+        for ( auto& G : groups )
+                for ( auto& J : G )
+                        if ( j == J.csubject )
+                                return &J;
+        return nullptr;
 }
 
 
 
 const array<unsigned, 4>
-	SExpDesignUI::FFTPageSizeValues = {{4, 20, 30, 60}};
+        SExpDesignUI::FFTPageSizeValues = {{4, 20, 30, 60}};
 const array<double, 3>
-	SExpDesignUI::FFTBinSizeValues = {{.1, .25, .5}};
+        SExpDesignUI::FFTBinSizeValues = {{.1, .25, .5}};
 
 double SExpDesignUI::scroll_factor = 1.05;
 
@@ -123,266 +123,266 @@ using agh::confval::SValidator;
 
 SExpDesignUI::
 SExpDesignUI (SSessionChooser *parent,
-	      const string& dir)
+              const string& dir)
       : // let ED and cgroups be initialized after the UI gets constructed
-	// so we could entertain the user with progress_indicator
-	// ED (NULL),
-	// groups (*this),  // incomplete
-	_p (parent),
-	using_subject (nullptr),
-	draw_nremrem_cycles (true),
-	finalize_ui (false),
-	suppress_redraw (false),
-	dl_pid (-1),
-	close_this_SF_now (nullptr),
-	display_profile_type (metrics::TType::psd),
-	active_profile_psd_freq_from (2.),
-	active_profile_psd_freq_upto (3.),
-	active_profile_swu_f0 (.5),
-	active_profile_mc_f0 (.5),
-	only_plain_global_annotations (true),
-	strict_subject_id_checks (false),
-	suppress_scan_report (false),
-	uc_accuracy_factor (1.),
-	pagesize_item (2),
-	binsize_item (1),
-	ext_score_codes ({
-		{{" -0"}, {"1"}, {"2"}, {"3"}, {"4"}, {"6Rr8"}, {"Ww5"}}
-	}),
-	profile_scale_psd (0.),
-	profile_scale_swu (0.),
-	profile_scale_mc (0.),
-	autoscale (false),
-	smooth_profile (1),
-	tl_height (80),
-	tl_pph (30),
-	sort_by (TSubjectSortBy::name),
-	sort_ascending (true),
-	sort_segregate (false),
-	browse_command ("thunar"),
-	config_keys_s ({
-		SValidator<string>("WindowGeometry.Main",		&_geometry_placeholder),
-		SValidator<string>("Common.CurrentSession",		&_aghdd_placeholder),
-		SValidator<string>("Common.CurrentChannel",		&_aghtt_placeholder),
-		SValidator<string>("Measurements.BrowseCommand",	&browse_command),
-	}),
-	config_keys_b ({
-		SValidator<bool>("Common.OnlyPlainAnnotations",		&only_plain_global_annotations),
-		SValidator<bool>("ScanTree.StrictSubjectIdCheck",	&strict_subject_id_checks),
-		SValidator<bool>("ScanTree.SuppressScanReport",		&suppress_scan_report),
-	}),
-	config_keys_d ({
-		SValidator<int>("Common.Sort.By",		        (int*)&sort_by,		                        SValidator<int>::SVFRangeIn ( 0,   3)),
-		SValidator<int>("Common.Sort.Ascending",	        (int*)&sort_ascending,	                        SValidator<int>::SVFRangeIn ( 0,   1)),
-		SValidator<int>("Common.Sort.Segregate",	        (int*)&sort_segregate,	                        SValidator<int>::SVFRangeIn ( 0,   1)),
-		SValidator<int>("Measurements.DisplayProfileType",	(int*)&display_profile_type,			SValidator<int>::SVFRangeIn ( 0,   3)),
-		SValidator<int>("Measurements.SmoothSide",		(int*)&smooth_profile,				SValidator<int>::SVFRangeIn ( 1,  20)),
-		SValidator<int>("Measurements.TimelineHeight",		(int*)&tl_height,				SValidator<int>::SVFRangeIn (10, 600)),
-		SValidator<int>("Measurements.TimelinePPH",		(int*)&tl_pph,					SValidator<int>::SVFRangeIn (10, 600)),
-		SValidator<int>("ScoringFacility.IntersignalSpace",	(int*)&SScoringFacility::IntersignalSpace,	SValidator<int>::SVFRangeIn (10, 800)),
-		SValidator<int>("ScoringFacility.HypnogramHeight",	(int*)&SScoringFacility::HypnogramHeight,	SValidator<int>::SVFRangeIn (10, 300)),
-		SValidator<int>("ModelRun.SWASmoothOver",		(int*)&SModelrunFacility::swa_smoothover,	SValidator<int>::SVFRangeIn ( 1,   5)),
-	}),
-	config_keys_g ({
-		SValidator<double>("UltradianCycleDetectionAccuracy",	&uc_accuracy_factor,				SValidator<double>::SVFRangeIn (0.5, 20.)),
-		SValidator<double>("Measurements.ProfileScalePSD",	&profile_scale_psd,				SValidator<double>::SVFRangeIn (0., 1e10)), // can be 0, will trigger autoscale
-		SValidator<double>("Measurements.ProfileScaleSWU",	&profile_scale_swu,				SValidator<double>::SVFRangeIn (0., 1e10)),
-		SValidator<double>("Measurements.ProfileScaleMC",	&profile_scale_mc,				SValidator<double>::SVFRangeIn (0., 1e10)),
-		SValidator<double>("Profiles.PSD.FreqFrom",		&active_profile_psd_freq_from,			SValidator<double>::SVFRangeIn (0., 20.)),
-		SValidator<double>("Profiles.PSD.FreqUpto",		&active_profile_psd_freq_upto,			SValidator<double>::SVFRangeIn (0., 20.)),
-		SValidator<double>("Profiles.SWU.F0",			&active_profile_swu_f0,				SValidator<double>::SVFRangeIn (0., 20.)),
-		SValidator<double>("Profiles.MC.F0",			&active_profile_mc_f0,				SValidator<double>::SVFRangeIn (0., 20.)),
-		SValidator<double>("Common.ScrollFactor",		&scroll_factor,					SValidator<double>::SVFRangeIn (1.001, 1.5)),
-	})
+        // so we could entertain the user with progress_indicator
+        // ED (NULL),
+        // groups (*this),  // incomplete
+        _p (parent),
+        using_subject (nullptr),
+        draw_nremrem_cycles (true),
+        finalize_ui (false),
+        suppress_redraw (false),
+        dl_pid (-1),
+        close_this_SF_now (nullptr),
+        display_profile_type (metrics::TType::psd),
+        active_profile_psd_freq_from (2.),
+        active_profile_psd_freq_upto (3.),
+        active_profile_swu_f0 (.5),
+        active_profile_mc_f0 (.5),
+        only_plain_global_annotations (true),
+        strict_subject_id_checks (false),
+        suppress_scan_report (false),
+        uc_accuracy_factor (1.),
+        pagesize_item (2),
+        binsize_item (1),
+        ext_score_codes ({
+                {{" -0"}, {"1"}, {"2"}, {"3"}, {"4"}, {"6Rr8"}, {"Ww5"}}
+        }),
+        profile_scale_psd (0.),
+        profile_scale_swu (0.),
+        profile_scale_mc (0.),
+        autoscale (false),
+        smooth_profile (1),
+        tl_height (80),
+        tl_pph (30),
+        sort_by (TSubjectSortBy::name),
+        sort_ascending (true),
+        sort_segregate (false),
+        browse_command ("thunar"),
+        config_keys_s ({
+                SValidator<string>("WindowGeometry.Main",                &_geometry_placeholder),
+                SValidator<string>("Common.CurrentSession",                &_aghdd_placeholder),
+                SValidator<string>("Common.CurrentChannel",                &_aghtt_placeholder),
+                SValidator<string>("Measurements.BrowseCommand",        &browse_command),
+        }),
+        config_keys_b ({
+                SValidator<bool>("Common.OnlyPlainAnnotations",                &only_plain_global_annotations),
+                SValidator<bool>("ScanTree.StrictSubjectIdCheck",        &strict_subject_id_checks),
+                SValidator<bool>("ScanTree.SuppressScanReport",                &suppress_scan_report),
+        }),
+        config_keys_d ({
+                SValidator<int>("Common.Sort.By",                        (int*)&sort_by,                                        SValidator<int>::SVFRangeIn ( 0,   3)),
+                SValidator<int>("Common.Sort.Ascending",                (int*)&sort_ascending,                                SValidator<int>::SVFRangeIn ( 0,   1)),
+                SValidator<int>("Common.Sort.Segregate",                (int*)&sort_segregate,                                SValidator<int>::SVFRangeIn ( 0,   1)),
+                SValidator<int>("Measurements.DisplayProfileType",        (int*)&display_profile_type,                        SValidator<int>::SVFRangeIn ( 0,   3)),
+                SValidator<int>("Measurements.SmoothSide",                (int*)&smooth_profile,                                SValidator<int>::SVFRangeIn ( 1,  20)),
+                SValidator<int>("Measurements.TimelineHeight",                (int*)&tl_height,                                SValidator<int>::SVFRangeIn (10, 600)),
+                SValidator<int>("Measurements.TimelinePPH",                (int*)&tl_pph,                                        SValidator<int>::SVFRangeIn (10, 600)),
+                SValidator<int>("ScoringFacility.IntersignalSpace",        (int*)&SScoringFacility::IntersignalSpace,        SValidator<int>::SVFRangeIn (10, 800)),
+                SValidator<int>("ScoringFacility.HypnogramHeight",        (int*)&SScoringFacility::HypnogramHeight,        SValidator<int>::SVFRangeIn (10, 300)),
+                SValidator<int>("ModelRun.SWASmoothOver",                (int*)&SModelrunFacility::swa_smoothover,        SValidator<int>::SVFRangeIn ( 1,   5)),
+        }),
+        config_keys_g ({
+                SValidator<double>("UltradianCycleDetectionAccuracy",        &uc_accuracy_factor,                                SValidator<double>::SVFRangeIn (0.5, 20.)),
+                SValidator<double>("Measurements.ProfileScalePSD",        &profile_scale_psd,                                SValidator<double>::SVFRangeIn (0., 1e10)), // can be 0, will trigger autoscale
+                SValidator<double>("Measurements.ProfileScaleSWU",        &profile_scale_swu,                                SValidator<double>::SVFRangeIn (0., 1e10)),
+                SValidator<double>("Measurements.ProfileScaleMC",        &profile_scale_mc,                                SValidator<double>::SVFRangeIn (0., 1e10)),
+                SValidator<double>("Profiles.PSD.FreqFrom",                &active_profile_psd_freq_from,                        SValidator<double>::SVFRangeIn (0., 20.)),
+                SValidator<double>("Profiles.PSD.FreqUpto",                &active_profile_psd_freq_upto,                        SValidator<double>::SVFRangeIn (0., 20.)),
+                SValidator<double>("Profiles.SWU.F0",                        &active_profile_swu_f0,                                SValidator<double>::SVFRangeIn (0., 20.)),
+                SValidator<double>("Profiles.MC.F0",                        &active_profile_mc_f0,                                SValidator<double>::SVFRangeIn (0., 20.)),
+                SValidator<double>("Common.ScrollFactor",                &scroll_factor,                                        SValidator<double>::SVFRangeIn (1.001, 1.5)),
+        })
 {
-	nodestroy_by_cb = true;
-	suppress_redraw = true;
-
-	set_wMainWindow_interactive( false);
-	set_controls_for_empty_experiment( true, false);
-	gtk_widget_show( (GtkWidget*)wMainWindow);
-
-	if ( not dir.empty() and not agh::fs::exists_and_is_writable( dir) )
-		throw invalid_argument (string("Experiment directory ") + dir + " does not exist or is not writable");
-
-	string sure_dir;
-	if ( dir.empty() ) { // again? only happens when user has moved a previously valid expdir between sessions
-		sure_dir = string (getenv("HOME")) + "/EmptyDummy";
-		if ( agh::fs::mkdir_with_parents( sure_dir) != 0 )
-			throw invalid_argument ("The last used experiment directory does not exist (or is not writable),"
-						" and a dummy fallback directory could not be created in your $HOME."
-						" Whatever the reason, this is really too bad: I can't fix it for you.");
-	} else
-		sure_dir = dir;
-	ED = new agh::CExpDesign (sure_dir,
-				  bind( &SExpDesignUI::sb_main_progress_indicator, this,
-					placeholders::_1, placeholders::_2, placeholders::_3,
-					ui::TGtkRefreshMode::gtk));
-	load_artifact_detection_profiles();
-	if ( global_artifact_detection_profiles.empty() )
-		global_artifact_detection_profiles["default"] = metrics::mc::SArtifactDetectionPP ();
-
-	nodestroy_by_cb = false;
-
-	// bind fields to widgets
-	// tab 1
-	W_V1.reg( eSMPMaxThreads,		&ED->num_threads);
-	W_V1.reg( eScanTreeStrict,		&ED->strict_subject_id_checks);
-	W_V1.reg( eArtifDampenWindowType, (int*)&ED->af_dampen_window_type);
-	W_V1.reg( eArtifDampenFactor,		&ED->af_dampen_factor);
-	W_V1.reg( eFFTParamsWindowType,   (int*)&ED->fft_params.welch_window_type);
-	W_V1.reg( eMCParamIIRBackpolate,	&ED->mc_params.iir_backpolate);
-	W_V1.reg( eMCParamMCGain,		&ED->mc_params.mc_gain);
-	W_V1.reg( eMCParamBandWidth,		&ED->mc_params.bandwidth);
-	W_V1.reg( eMCParamFreqInc,		&ED->mc_params.freq_inc);
-	W_V1.reg( eMCParamNBins,		&ED->mc_params.n_bins);
-	W_V1.reg( eSWUParamMinUpswingDuration,	&ED->swu_params.min_upswing_duration);
-
-	W_V1.reg( eScanTreeSuppressReport,	&suppress_scan_report);
-	W_V1.reg( eFFTParamsPageSize,		&pagesize_item);
-	W_V1.reg( eFFTParamsBinSize,		&binsize_item);
-	W_V1.reg( eFFTParamsPlanType,	  (int*)&ED->fft_params.plan_type);
-	W_V1.reg( eUltradianCycleDetectionAccuracy, &uc_accuracy_factor);
-	for ( size_t i = 0; i < sigfile::SPage::TScore::TScore_total; ++i )
-		W_V1.reg( eScoreCode[i], &ext_score_codes[i]);
-	for ( size_t i = 0; i < metrics::TBand::TBand_total; ++i ) {
-		W_V1.reg( eBand[i][0], &ED->freq_bands[i][0]);
-		W_V1.reg( eBand[i][1], &ED->freq_bands[i][1]);
-	}
-	W_V1.reg( eDAMsmtPPH, (int*)&tl_pph);
-	W_V1.reg( eDAMsmtTLHeight, (int*)&tl_height);
-	W_V1.reg( eDAPageHeight, (int*)&SScoringFacility::IntersignalSpace);
-	W_V1.reg( eDAHypnogramHeight, (int*)&SScoringFacility::HypnogramHeight);
-	W_V1.reg( eDAEMGHeight, (int*)&SScoringFacility::EMGProfileHeight);
-	W_V1.reg( eBrowseCommand, &browse_command);
-	W_V1.reg( eScrollSpeedFactor, &scroll_factor);
-
-	// set _saved, too
-	fft_params_welch_window_type_saved	= ED->fft_params.welch_window_type;
-	fft_params_plan_type_saved		= ED->fft_params.plan_type;
-	af_dampen_window_type_saved		= ED->af_dampen_window_type;
-	af_dampen_factor_saved			= ED->af_dampen_factor;
-	mc_params_saved				= ED->mc_params;
-	pagesize_item_saved = pagesize_item	= figure_pagesize_item();
-	binsize_item_saved = binsize_item 	= figure_binsize_item();
-
-	// tab 2
-	W_V2.reg( eCtlParamAnnlNTries,		&ED->ctl_params0.siman_params.n_tries);
-	W_V2.reg( eCtlParamAnnlItersFixedT,	&ED->ctl_params0.siman_params.iters_fixed_T);
-	W_V2.reg( eCtlParamAnnlStepSize,	&ED->ctl_params0.siman_params.step_size);
-	W_V2.reg( eCtlParamAnnlBoltzmannk,	&ED->ctl_params0.siman_params.k);
-	W_V2.reg( eCtlParamAnnlDampingMu,	&ED->ctl_params0.siman_params.mu_t);
-	W_V2.reg( eCtlParamAnnlTMinMantissa,	&ctl_params0_siman_params_t_min_mantissa);
-	W_V2.reg( eCtlParamAnnlTMinExponent,	&ctl_params0_siman_params_t_min_exponent);
-	W_V2.reg( eCtlParamAnnlTInitialMantissa,&ctl_params0_siman_params_t_initial_mantissa);
-	W_V2.reg( eCtlParamAnnlTInitialExponent,&ctl_params0_siman_params_t_initial_exponent);
-
-	W_V2.reg( eCtlParamDBAmendment1,		&ED->ctl_params0.DBAmendment1);
-	W_V2.reg( eCtlParamDBAmendment2,		&ED->ctl_params0.DBAmendment2);
-	W_V2.reg( eCtlParamAZAmendment1,		&ED->ctl_params0.AZAmendment1);
-	W_V2.reg( eCtlParamNSWAPpBeforeSimStart,  (int*)&ED->swa_laden_pages_before_SWA_0);
-	W_V2.reg( eCtlParamReqScoredPercent,		&ED->req_percent_scored);
-	W_V2.reg( eCtlParamScoreUnscoredAsWake,		&ED->score_unscored_as_wake);
-
-	// tunables are isolated so they can be reset separately
-	for ( size_t t = 0; t < agh::ach::TTunable::_basic_tunables; ++t ) {
-		W_Vtunables.reg( eTunable[t][0], &ED->tunables0 [t]);
-		W_Vtunables.reg( eTunable[t][1], &ED->tlo       [t]);
-		W_Vtunables.reg( eTunable[t][2], &ED->thi       [t]);
-		W_Vtunables.reg( eTunable[t][3], &ED->tstep     [t]);
-	}
-
-	// for ( size_t i = metrics::psd::TBand::delta; i < metrics::psd::TBand::TBand_total; ++i ) {
-	// 	gtk_spin_button_set_value( eBand[i][0], ED->freq_bands[i][0]);
-	// 	gtk_spin_button_set_value( eBand[i][1], ED->freq_bands[i][1]);
-	// }
-
-	populate( true);
-
-	// set check and radio menuitems in global menu
-	switch ( sort_by ) {
-	case TSubjectSortBy::name:		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortName,		TRUE); break;
-	case TSubjectSortBy::age:		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAge,		TRUE); break;
-	case TSubjectSortBy::admission_date:	gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAdmissionDate,TRUE); break;
-	case TSubjectSortBy::avg_profile_power:	gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAvgPower,	TRUE); break;
-	}
-	gtk_check_menu_item_set_active( iExpSubjectSortAscending, sort_ascending);
-	gtk_check_menu_item_set_active( iExpSubjectSortSegregate, sort_segregate);
-
-	set_wMainWindow_interactive( true, false);
-	suppress_redraw = false;
+        nodestroy_by_cb = true;
+        suppress_redraw = true;
+
+        set_wMainWindow_interactive( false);
+        set_controls_for_empty_experiment( true, false);
+        gtk_widget_show( (GtkWidget*)wMainWindow);
+
+        if ( not dir.empty() and not agh::fs::exists_and_is_writable( dir) )
+                throw invalid_argument (string("Experiment directory ") + dir + " does not exist or is not writable");
+
+        string sure_dir;
+        if ( dir.empty() ) { // again? only happens when user has moved a previously valid expdir between sessions
+                sure_dir = string (getenv("HOME")) + "/EmptyDummy";
+                if ( agh::fs::mkdir_with_parents( sure_dir) != 0 )
+                        throw invalid_argument ("The last used experiment directory does not exist (or is not writable),"
+                                                " and a dummy fallback directory could not be created in your $HOME."
+                                                " Whatever the reason, this is really too bad: I can't fix it for you.");
+        } else
+                sure_dir = dir;
+        ED = new agh::CExpDesign (sure_dir,
+                                  bind( &SExpDesignUI::sb_main_progress_indicator, this,
+                                        placeholders::_1, placeholders::_2, placeholders::_3,
+                                        ui::TGtkRefreshMode::gtk));
+        load_artifact_detection_profiles();
+        if ( global_artifact_detection_profiles.empty() )
+                global_artifact_detection_profiles["default"] = metrics::mc::SArtifactDetectionPP ();
+
+        nodestroy_by_cb = false;
+
+        // bind fields to widgets
+        // tab 1
+        W_V1.reg( eSMPMaxThreads,                &ED->num_threads);
+        W_V1.reg( eScanTreeStrict,                &ED->strict_subject_id_checks);
+        W_V1.reg( eArtifDampenWindowType, (int*)&ED->af_dampen_window_type);
+        W_V1.reg( eArtifDampenFactor,                &ED->af_dampen_factor);
+        W_V1.reg( eFFTParamsWindowType,   (int*)&ED->fft_params.welch_window_type);
+        W_V1.reg( eMCParamIIRBackpolate,        &ED->mc_params.iir_backpolate);
+        W_V1.reg( eMCParamMCGain,                &ED->mc_params.mc_gain);
+        W_V1.reg( eMCParamBandWidth,                &ED->mc_params.bandwidth);
+        W_V1.reg( eMCParamFreqInc,                &ED->mc_params.freq_inc);
+        W_V1.reg( eMCParamNBins,                &ED->mc_params.n_bins);
+        W_V1.reg( eSWUParamMinUpswingDuration,        &ED->swu_params.min_upswing_duration);
+
+        W_V1.reg( eScanTreeSuppressReport,        &suppress_scan_report);
+        W_V1.reg( eFFTParamsPageSize,                &pagesize_item);
+        W_V1.reg( eFFTParamsBinSize,                &binsize_item);
+        W_V1.reg( eFFTParamsPlanType,          (int*)&ED->fft_params.plan_type);
+        W_V1.reg( eUltradianCycleDetectionAccuracy, &uc_accuracy_factor);
+        for ( size_t i = 0; i < sigfile::SPage::TScore::TScore_total; ++i )
+                W_V1.reg( eScoreCode[i], &ext_score_codes[i]);
+        for ( size_t i = 0; i < metrics::TBand::TBand_total; ++i ) {
+                W_V1.reg( eBand[i][0], &ED->freq_bands[i][0]);
+                W_V1.reg( eBand[i][1], &ED->freq_bands[i][1]);
+        }
+        W_V1.reg( eDAMsmtPPH, (int*)&tl_pph);
+        W_V1.reg( eDAMsmtTLHeight, (int*)&tl_height);
+        W_V1.reg( eDAPageHeight, (int*)&SScoringFacility::IntersignalSpace);
+        W_V1.reg( eDAHypnogramHeight, (int*)&SScoringFacility::HypnogramHeight);
+        W_V1.reg( eDAEMGHeight, (int*)&SScoringFacility::EMGProfileHeight);
+        W_V1.reg( eBrowseCommand, &browse_command);
+        W_V1.reg( eScrollSpeedFactor, &scroll_factor);
+
+        // set _saved, too
+        fft_params_welch_window_type_saved        = ED->fft_params.welch_window_type;
+        fft_params_plan_type_saved                = ED->fft_params.plan_type;
+        af_dampen_window_type_saved                = ED->af_dampen_window_type;
+        af_dampen_factor_saved                        = ED->af_dampen_factor;
+        mc_params_saved                                = ED->mc_params;
+        pagesize_item_saved = pagesize_item        = figure_pagesize_item();
+        binsize_item_saved = binsize_item         = figure_binsize_item();
+
+        // tab 2
+        W_V2.reg( eCtlParamAnnlNTries,                &ED->ctl_params0.siman_params.n_tries);
+        W_V2.reg( eCtlParamAnnlItersFixedT,        &ED->ctl_params0.siman_params.iters_fixed_T);
+        W_V2.reg( eCtlParamAnnlStepSize,        &ED->ctl_params0.siman_params.step_size);
+        W_V2.reg( eCtlParamAnnlBoltzmannk,        &ED->ctl_params0.siman_params.k);
+        W_V2.reg( eCtlParamAnnlDampingMu,        &ED->ctl_params0.siman_params.mu_t);
+        W_V2.reg( eCtlParamAnnlTMinMantissa,        &ctl_params0_siman_params_t_min_mantissa);
+        W_V2.reg( eCtlParamAnnlTMinExponent,        &ctl_params0_siman_params_t_min_exponent);
+        W_V2.reg( eCtlParamAnnlTInitialMantissa,&ctl_params0_siman_params_t_initial_mantissa);
+        W_V2.reg( eCtlParamAnnlTInitialExponent,&ctl_params0_siman_params_t_initial_exponent);
+
+        W_V2.reg( eCtlParamDBAmendment1,                &ED->ctl_params0.DBAmendment1);
+        W_V2.reg( eCtlParamDBAmendment2,                &ED->ctl_params0.DBAmendment2);
+        W_V2.reg( eCtlParamAZAmendment1,                &ED->ctl_params0.AZAmendment1);
+        W_V2.reg( eCtlParamNSWAPpBeforeSimStart,  (int*)&ED->swa_laden_pages_before_SWA_0);
+        W_V2.reg( eCtlParamReqScoredPercent,                &ED->req_percent_scored);
+        W_V2.reg( eCtlParamScoreUnscoredAsWake,                &ED->score_unscored_as_wake);
+
+        // tunables are isolated so they can be reset separately
+        for ( size_t t = 0; t < agh::ach::TTunable::_basic_tunables; ++t ) {
+                W_Vtunables.reg( eTunable[t][0], &ED->tunables0 [t]);
+                W_Vtunables.reg( eTunable[t][1], &ED->tlo       [t]);
+                W_Vtunables.reg( eTunable[t][2], &ED->thi       [t]);
+                W_Vtunables.reg( eTunable[t][3], &ED->tstep     [t]);
+        }
+
+        // for ( size_t i = metrics::psd::TBand::delta; i < metrics::psd::TBand::TBand_total; ++i ) {
+        //         gtk_spin_button_set_value( eBand[i][0], ED->freq_bands[i][0]);
+        //         gtk_spin_button_set_value( eBand[i][1], ED->freq_bands[i][1]);
+        // }
+
+        populate( true);
+
+        // set check and radio menuitems in global menu
+        switch ( sort_by ) {
+        case TSubjectSortBy::name:                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortName,                TRUE); break;
+        case TSubjectSortBy::age:                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAge,                TRUE); break;
+        case TSubjectSortBy::admission_date:        gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAdmissionDate,TRUE); break;
+        case TSubjectSortBy::avg_profile_power:        gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iExpSubjectSortAvgPower,        TRUE); break;
+        }
+        gtk_check_menu_item_set_active( iExpSubjectSortAscending, sort_ascending);
+        gtk_check_menu_item_set_active( iExpSubjectSortSegregate, sort_segregate);
+
+        set_wMainWindow_interactive( true, false);
+        suppress_redraw = false;
 }
 
 void
 SExpDesignUI::
 load_artifact_detection_profiles()
 {
-	FILE *domien = fopen( (string(ED->session_dir()) + "/.AD_profiles").c_str(), "r");
-	if ( domien ) {
-		while ( !feof (domien) ) {
-			metrics::mc::SArtifactDetectionPP P;
-			char *name = nullptr;
-			int int_estimate_E, int_use_range;
+        FILE *domien = fopen( (string(ED->session_dir()) + "/.AD_profiles").c_str(), "r");
+        if ( domien ) {
+                while ( !feof (domien) ) {
+                        metrics::mc::SArtifactDetectionPP P;
+                        char *name = nullptr;
+                        int int_estimate_E, int_use_range;
 // at least gcc 4.7.2 fails to recognize "%as" (dynamic allocation), so
 #pragma GCC diagnostic ignored "-Wformat"
 #pragma GCC diagnostic push
-			if ( 16 ==
-			     fscanf( domien, "%a[^\n]\n%la  %la %la  %la %la %la  %la %la  %la %la %la "
-				     "%zu %zu %d %d",
-				     &name,
-				     &P.scope,
-				     &P.upper_thr, &P.lower_thr,
-				     &P.f0, &P.fc, &P.bandwidth,
-				     &P.mc_gain, &P.iir_backpolate,
-				     &P.E, &P.dmin, &P.dmax,
-				     &P.sssu_hist_size,
-				     &P.smooth_side,
-				     &int_estimate_E,
-				     &int_use_range) ) {
-
-				P.estimate_E = (bool)int_estimate_E;
-				P.use_range = (bool)int_use_range;
-				global_artifact_detection_profiles[name] = P;
+                        if ( 16 ==
+                             fscanf( domien, "%a[^\n]\n%la  %la %la  %la %la %la  %la %la  %la %la %la "
+                                     "%zu %zu %d %d",
+                                     &name,
+                                     &P.scope,
+                                     &P.upper_thr, &P.lower_thr,
+                                     &P.f0, &P.fc, &P.bandwidth,
+                                     &P.mc_gain, &P.iir_backpolate,
+                                     &P.E, &P.dmin, &P.dmax,
+                                     &P.sssu_hist_size,
+                                     &P.smooth_side,
+                                     &int_estimate_E,
+                                     &int_use_range) ) {
+
+                                P.estimate_E = (bool)int_estimate_E;
+                                P.use_range = (bool)int_use_range;
+                                global_artifact_detection_profiles[name] = P;
 #pragma GCC diagnostic pop
-			} else
-				break;
+                        } else
+                                break;
 
-			free( (void*)name);
-		}
-		fclose( domien);
-	}
+                        free( (void*)name);
+                }
+                fclose( domien);
+        }
 }
 
 void
 SExpDesignUI::
 save_artifact_detection_profiles() const
 {
-	// libconfig::Config conf;
-	// auto&	root = conf.getRoot();
-	// auto&	profiles = root.add("profiles", libconfig::Setting::Type::TypeArray);
-	if ( global_artifact_detection_profiles.size() == 0 )
-		return;
-
-	FILE *domien = fopen( (string(ED->session_dir()) + "/.AD_profiles").c_str(), "w");
-	if ( domien ) {
-		for ( auto &P : global_artifact_detection_profiles ) {
-			fprintf( domien, "%s\n", P.first.c_str());
-			fprintf( domien, "%a  %a %a  %a %a %a  %a %a  %a %a %a "
-				 "%zu %zu %d %d\n",
-				 P.second.scope,
-				 P.second.upper_thr, P.second.lower_thr,
-				 P.second.f0, P.second.fc, P.second.bandwidth,
-				 P.second.mc_gain, P.second.iir_backpolate,
-				 P.second.E, P.second.dmin, P.second.dmax,
-				 P.second.sssu_hist_size,
-				 P.second.smooth_side,
-				 (int)P.second.estimate_E,
-				 (int)P.second.use_range);
-
-		}
-		fclose( domien);
-	} else
-		fprintf( stderr, "failed to open $EXPROOT/.AD_profiles for writing\n");
+        // libconfig::Config conf;
+        // auto&        root = conf.getRoot();
+        // auto&        profiles = root.add("profiles", libconfig::Setting::Type::TypeArray);
+        if ( global_artifact_detection_profiles.size() == 0 )
+                return;
+
+        FILE *domien = fopen( (string(ED->session_dir()) + "/.AD_profiles").c_str(), "w");
+        if ( domien ) {
+                for ( auto &P : global_artifact_detection_profiles ) {
+                        fprintf( domien, "%s\n", P.first.c_str());
+                        fprintf( domien, "%a  %a %a  %a %a %a  %a %a  %a %a %a "
+                                 "%zu %zu %d %d\n",
+                                 P.second.scope,
+                                 P.second.upper_thr, P.second.lower_thr,
+                                 P.second.f0, P.second.fc, P.second.bandwidth,
+                                 P.second.mc_gain, P.second.iir_backpolate,
+                                 P.second.E, P.second.dmin, P.second.dmax,
+                                 P.second.sssu_hist_size,
+                                 P.second.smooth_side,
+                                 (int)P.second.estimate_E,
+                                 (int)P.second.use_range);
+
+                }
+                fclose( domien);
+        } else
+                fprintf( stderr, "failed to open $EXPROOT/.AD_profiles for writing\n");
 }
 
 
@@ -391,20 +391,20 @@ __attribute__ ((pure))
 SExpDesignUI::
 figure_pagesize_item()
 {
-	size_t i = 0;
-	while ( FFTPageSizeValues[i] < ED->fft_params.pagesize )
-		++i;
-	return i;
+        size_t i = 0;
+        while ( FFTPageSizeValues[i] < ED->fft_params.pagesize )
+                ++i;
+        return i;
 }
 size_t
 __attribute__ ((pure))
 SExpDesignUI::
 figure_binsize_item()
 {
-	size_t i = 0;
-	while ( FFTBinSizeValues[i] < ED->fft_params.binsize )
-		++i;
-	return i;
+        size_t i = 0;
+        while ( FFTBinSizeValues[i] < ED->fft_params.binsize )
+                ++i;
+        return i;
 }
 
 
@@ -412,17 +412,17 @@ figure_binsize_item()
 SExpDesignUI::
 ~SExpDesignUI ()
 {
-	if ( dl_pid > 0 )
-		kill( dl_pid, SIGTERM);
+        if ( dl_pid > 0 )
+                kill( dl_pid, SIGTERM);
 
-	save_settings();
-	save_artifact_detection_profiles();
-	auto sielle = open_scoring_facilities;
-	// let SF dtor reach back and erase its own mention from open_scoring_facilities
-	for ( auto& SF : sielle )
-		delete SF;
+        save_settings();
+        save_artifact_detection_profiles();
+        auto sielle = open_scoring_facilities;
+        // let SF dtor reach back and erase its own mention from open_scoring_facilities
+        for ( auto& SF : sielle )
+                delete SF;
 
-	delete ED;
+        delete ED;
 }
 
 
@@ -434,17 +434,17 @@ void
 SExpDesignUI::
 do_rescan_tree( const bool with_update)
 {
-	ui::SBusyBlock bb (wMainWindow);
-
-	depopulate( false);
-	ED -> sync();
-	if ( with_update )
-		ED -> scan_tree( bind (&SExpDesignUI::sb_main_progress_indicator, this,
-				       placeholders::_1, placeholders::_2, placeholders::_3,
-				       ui::TGtkRefreshMode::gdk));
-	else
-		ED -> scan_tree();
-	populate( false);
+        ui::SBusyBlock bb (wMainWindow);
+
+        depopulate( false);
+        ED -> sync();
+        if ( with_update )
+                ED -> scan_tree( bind (&SExpDesignUI::sb_main_progress_indicator, this,
+                                       placeholders::_1, placeholders::_2, placeholders::_3,
+                                       ui::TGtkRefreshMode::gdk));
+        else
+                ED -> scan_tree();
+        populate( false);
 }
 
 
@@ -452,14 +452,14 @@ void
 SExpDesignUI::
 do_purge_computed()
 {
-	SBusyBlock bb (wMainWindow);
+        SBusyBlock bb (wMainWindow);
 
-	if ( ED->purge_cached_profiles() ) {
-		fprintf( stderr, "Command '%s' returned a non-zero status. This is suspicious.\n", ui::global::buf);
-		sb_message( "Failed to purge cache files. This is odd.");
-	}
+        if ( ED->purge_cached_profiles() ) {
+                fprintf( stderr, "Command '%s' returned a non-zero status. This is suspicious.\n", ui::global::buf);
+                sb_message( "Failed to purge cache files. This is odd.");
+        }
 
-	sb_message( "Purged computed files cache");
+        sb_message( "Purged computed files cache");
 }
 
 
@@ -467,23 +467,23 @@ void
 SExpDesignUI::
 do_detect_ultradian_cycle( agh::CRecording& M)
 {
-	gsl_siman_params_t siman_params;
-	// specially for ubuntu
-	siman_params.n_tries		=   (int)(5 * uc_accuracy_factor);
-	siman_params.iters_fixed_T	=   (int)(10 * uc_accuracy_factor);
-	siman_params.step_size		=    4;
-	siman_params.k			=    1.0;
-	siman_params.t_initial  	=   10 * uc_accuracy_factor;
-	siman_params.mu_t		=    1.003;
-	siman_params.t_min		=    5e-2;
-
-	agh::beersma::SUltradianCycle
-		L = agh::beersma::ultradian_cycles(
-			M, {make_active_profile_paramset(), .1, siman_params});
-
-	if ( M.uc_params )
-		delete M.uc_params;
-	M.uc_params = new agh::beersma::SUltradianCycle (L);
+        gsl_siman_params_t siman_params;
+        // specially for ubuntu
+        siman_params.n_tries                =   (int)(5 * uc_accuracy_factor);
+        siman_params.iters_fixed_T        =   (int)(10 * uc_accuracy_factor);
+        siman_params.step_size                =    4;
+        siman_params.k                        =    1.0;
+        siman_params.t_initial          =   10 * uc_accuracy_factor;
+        siman_params.mu_t                =    1.003;
+        siman_params.t_min                =    5e-2;
+
+        agh::beersma::SUltradianCycle
+                L = agh::beersma::ultradian_cycles(
+                        M, {make_active_profile_paramset(), .1, siman_params});
+
+        if ( M.uc_params )
+                delete M.uc_params;
+        M.uc_params = new agh::beersma::SUltradianCycle (L);
 }
 
 
@@ -493,22 +493,22 @@ void
 SExpDesignUI::
 adjust_op_freq_spinbuttons()
 {
-	suppress_redraw = true;
-
-	gtk_adjustment_set_step_increment( jMsmtProfileParamsPSDFreqFrom,  ED->fft_params.binsize);
-	gtk_adjustment_set_step_increment( jMsmtProfileParamsPSDFreqWidth, ED->fft_params.binsize);
-	if ( not used_eeg_samplerates.empty() )
-		gtk_adjustment_set_upper(
-			jMsmtProfileParamsPSDFreqFrom,
-			ED->fft_params.binsize * (ED->fft_params.compute_n_bins( used_eeg_samplerates.back()) - 1));
-
-	gtk_adjustment_set_step_increment( jMsmtProfileParamsMCF0,
-					   ED->mc_params.freq_inc); // matches the default in metrics/mc.cc
-	gtk_adjustment_set_upper( jMsmtProfileParamsMCF0,
-				  ED->mc_params.compute_n_bins(pagesize()) *
-				  ED->mc_params.freq_inc);
-
-	suppress_redraw = false;
+        suppress_redraw = true;
+
+        gtk_adjustment_set_step_increment( jMsmtProfileParamsPSDFreqFrom,  ED->fft_params.binsize);
+        gtk_adjustment_set_step_increment( jMsmtProfileParamsPSDFreqWidth, ED->fft_params.binsize);
+        if ( not used_eeg_samplerates.empty() )
+                gtk_adjustment_set_upper(
+                        jMsmtProfileParamsPSDFreqFrom,
+                        ED->fft_params.binsize * (ED->fft_params.compute_n_bins( used_eeg_samplerates.back()) - 1));
+
+        gtk_adjustment_set_step_increment( jMsmtProfileParamsMCF0,
+                                           ED->mc_params.freq_inc); // matches the default in metrics/mc.cc
+        gtk_adjustment_set_upper( jMsmtProfileParamsMCF0,
+                                  ED->mc_params.compute_n_bins(pagesize()) *
+                                  ED->mc_params.freq_inc);
+
+        suppress_redraw = false;
 }
 
 
@@ -517,37 +517,37 @@ double
 SExpDesignUI::
 calculate_profile_scale()
 {
-	double	avg_profile_height = 0.;
-	size_t	valid_episodes = 0;
-	for ( auto& G : groups )
-		for ( auto &J : G )
-			if ( J.cprofile && !J.cprofile->mm_list().empty() ) {
-				auto this_episode_avg = J.cprofile->metric_avg();
-				if ( isfinite(this_episode_avg) ) {
-					avg_profile_height += this_episode_avg;
-					++valid_episodes;
-				}
-			}
-	double value =
-		unlikely (valid_episodes == 0)
-		? 1.
-		: tl_height / valid_episodes / avg_profile_height * .9;
-
-	switch ( display_profile_type ) {
-	case metrics::TType::psd:
-		profile_scale_psd = value;
-	    break;
-	case metrics::TType::swu:
-		profile_scale_swu = value;
-	    break;
-	case metrics::TType::mc:
-		profile_scale_mc  = value;
-	    break;
-	default:
-	    break;
-	}
-
-	return value;
+        double        avg_profile_height = 0.;
+        size_t        valid_episodes = 0;
+        for ( auto& G : groups )
+                for ( auto &J : G )
+                        if ( J.cprofile && !J.cprofile->mm_list().empty() ) {
+                                auto this_episode_avg = J.cprofile->metric_avg();
+                                if ( isfinite(this_episode_avg) ) {
+                                        avg_profile_height += this_episode_avg;
+                                        ++valid_episodes;
+                                }
+                        }
+        double value =
+                unlikely (valid_episodes == 0)
+                ? 1.
+                : tl_height / valid_episodes / avg_profile_height * .9;
+
+        switch ( display_profile_type ) {
+        case metrics::TType::psd:
+                profile_scale_psd = value;
+            break;
+        case metrics::TType::swu:
+                profile_scale_swu = value;
+            break;
+        case metrics::TType::mc:
+                profile_scale_mc  = value;
+            break;
+        default:
+            break;
+        }
+
+        return value;
 }
 
 
@@ -556,8 +556,8 @@ void
 SExpDesignUI::
 show_changelog()
 {
-	gtk_widget_show_all( (GtkWidget*)wAbout);
-	gtk_notebook_set_current_page( cAboutTabs, 1);
+        gtk_widget_show_all( (GtkWidget*)wAbout);
+        gtk_notebook_set_current_page( cAboutTabs, 1);
 }
 
 
@@ -568,15 +568,15 @@ void
 SExpDesignUI::
 sb_message( const string& msg) const
 {
-	gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
-	gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral, msg.c_str());
+        gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
+        gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral, msg.c_str());
 }
 
 void
 SExpDesignUI::
 sb_clear() const
 {
-	gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
+        gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
 }
 
 
@@ -584,26 +584,26 @@ sb_clear() const
 void
 SExpDesignUI::
 sb_main_progress_indicator( const string& current,
-			    const size_t n, const size_t i,
-			    const TGtkRefreshMode mode)
+                            const size_t n, const size_t i,
+                            const TGtkRefreshMode mode)
 {
-	sb_message( agh::str::sasprintf( "(%zu of %zu) %s", i, n, current.c_str()));
-
-	switch ( mode ) {
-	case TGtkRefreshMode::gtk:
-		gtk_flush();  // this brings down the whole of GTK if called from a callback
-		break;
-	case TGtkRefreshMode::gdk:
-		gdk_window_process_all_updates(); // this, however, fails to do the update if called *not* from a callback
-		break;
-	}
+        sb_message( agh::str::sasprintf( "(%zu of %zu) %s", i, n, current.c_str()));
+
+        switch ( mode ) {
+        case TGtkRefreshMode::gtk:
+                gtk_flush();  // this brings down the whole of GTK if called from a callback
+                break;
+        case TGtkRefreshMode::gdk:
+                gdk_window_process_all_updates(); // this, however, fails to do the update if called *not* from a callback
+                break;
+        }
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/mw.hh b/upstream/src/aghermann/ui/mw/mw.hh
index ee35837..daa8fd9 100644
--- a/upstream/src/aghermann/ui/mw/mw.hh
+++ b/upstream/src/aghermann/ui/mw/mw.hh
@@ -42,325 +42,325 @@ namespace ui {
 
 class SExpDesignUI
   : public SExpDesignUIWidgets {
-	DELETE_DEFAULT_METHODS (SExpDesignUI);
+        DELETE_DEFAULT_METHODS (SExpDesignUI);
 
     public:
-	agh::CExpDesign
-		*ED;
-	agh::ui::SSessionChooser
-		*_p;
+        agh::CExpDesign
+                *ED;
+        agh::ui::SSessionChooser
+                *_p;
       // ctor, dtor
-	SExpDesignUI (agh::ui::SSessionChooser *parent, const string& dir);
+        SExpDesignUI (agh::ui::SSessionChooser *parent, const string& dir);
        ~SExpDesignUI ();
 
       // forward decl
-	class SGroupPresentation;
+        class SGroupPresentation;
 
       // contained classes
-	class SSubjectPresentation {
-		DELETE_DEFAULT_METHODS (SSubjectPresentation);
-
-	    public:
-		agh::CSubject&  // can't have it declared const due to CMSessionSet operator[] not permitting
-			csubject;
-		agh::CProfile // a shortcut
-			*cprofile;
-		void create_cprofile();
-
-		list<agh::SEpisode>&
-		sepisodesequence() const
-			{ return csubject.measurements[*_p._p._AghDi].episodes; }
-
-		agh::SEpisode
-			*using_episode;
-		bool is_episode_focused() const
-			{ return using_episode != nullptr; }
-		bool	is_focused;
-
-		bool get_episode_from_timeline_click( unsigned along);  // possibly sets episode_focused
-
-		time_t	tl_start,
-			admission_date;
-
-		time_t timeline_start()  const { return _p._p.timeline_start;  }
-		time_t timeline_end()    const { return _p._p.timeline_end;    }
-		size_t tl_width()        const { return _p._p.tl_width;  }
-		size_t tl_height()       const { return _p._p.tl_height; }
-		size_t tl_left_margin()  const { return _p._p.tl_left_margin;  }
-		size_t tl_right_margin() const { return _p._p.tl_right_margin; }
-
-		void draw_timeline( cairo_t*) const;
-		void draw_timeline( const string& fname) const;
-
-		SGroupPresentation& _p;
-		SSubjectPresentation (agh::CSubject&, SGroupPresentation& parent);
-	       ~SSubjectPresentation ();
-
-		// sort
-		bool operator<( const SSubjectPresentation& rv) const;
-
-		GtkWidget
-			*da;
-	};
-
-	class SGroupPresentation
-	      : public list<SSubjectPresentation> {
-		DELETE_DEFAULT_METHODS (SGroupPresentation);
-
-	    public:
-		friend class SSubjectPresentation;
-		friend class SExpDesignUI;
-
-		const char* name() const
-			{ return gi->first.c_str(); }
-		agh::CJGroup& cjgroup()
-			{ return gi->second; }
-		SGroupPresentation (agh::CExpDesign::TJGroups::iterator& gi_,
-				    SExpDesignUI& parent)
-		      : _p (parent),
-			gi (gi_)
-			{}
-
-		SExpDesignUI&
-			_p;
-
-	    private:
-		agh::CExpDesign::TJGroups::iterator gi;
-	};
-	list<SGroupPresentation>
-		groups;
-	// because groups are flushed clean routinely,
-	// here's this:
-	map<string, bool>
-		group_unvisibility;
-	SSubjectPresentation
-		*using_subject;
-	SSubjectPresentation*
-	subject_presentation_by_csubject( const agh::CSubject&);
+        class SSubjectPresentation {
+                DELETE_DEFAULT_METHODS (SSubjectPresentation);
+
+            public:
+                agh::CSubject&  // can't have it declared const due to CMSessionSet operator[] not permitting
+                        csubject;
+                agh::CProfile // a shortcut
+                        *cprofile;
+                void create_cprofile();
+
+                list<agh::SEpisode>&
+                sepisodesequence() const
+                        { return csubject.measurements[*_p._p._AghDi].episodes; }
+
+                agh::SEpisode
+                        *using_episode;
+                bool is_episode_focused() const
+                        { return using_episode != nullptr; }
+                bool        is_focused;
+
+                bool get_episode_from_timeline_click( unsigned along);  // possibly sets episode_focused
+
+                time_t        tl_start,
+                        admission_date;
+
+                time_t timeline_start()  const { return _p._p.timeline_start;  }
+                time_t timeline_end()    const { return _p._p.timeline_end;    }
+                size_t tl_width()        const { return _p._p.tl_width;  }
+                size_t tl_height()       const { return _p._p.tl_height; }
+                size_t tl_left_margin()  const { return _p._p.tl_left_margin;  }
+                size_t tl_right_margin() const { return _p._p.tl_right_margin; }
+
+                void draw_timeline( cairo_t*) const;
+                void draw_timeline( const string& fname) const;
+
+                SGroupPresentation& _p;
+                SSubjectPresentation (agh::CSubject&, SGroupPresentation& parent);
+               ~SSubjectPresentation ();
+
+                // sort
+                bool operator<( const SSubjectPresentation& rv) const;
+
+                GtkWidget
+                        *da;
+        };
+
+        class SGroupPresentation
+              : public list<SSubjectPresentation> {
+                DELETE_DEFAULT_METHODS (SGroupPresentation);
+
+            public:
+                friend class SSubjectPresentation;
+                friend class SExpDesignUI;
+
+                const char* name() const
+                        { return gi->first.c_str(); }
+                agh::CJGroup& cjgroup()
+                        { return gi->second; }
+                SGroupPresentation (agh::CExpDesign::TJGroups::iterator& gi_,
+                                    SExpDesignUI& parent)
+                      : _p (parent),
+                        gi (gi_)
+                        {}
+
+                SExpDesignUI&
+                        _p;
+
+            private:
+                agh::CExpDesign::TJGroups::iterator gi;
+        };
+        list<SGroupPresentation>
+                groups;
+        // because groups are flushed clean routinely,
+        // here's this:
+        map<string, bool>
+                group_unvisibility;
+        SSubjectPresentation
+                *using_subject;
+        SSubjectPresentation*
+        subject_presentation_by_csubject( const agh::CSubject&);
 
       // flags
-	bool	draw_nremrem_cycles;
-	bool	finalize_ui:1,
-		suppress_redraw:1,
-		nodestroy_by_cb:1;
+        bool        draw_nremrem_cycles;
+        bool        finalize_ui:1,
+                suppress_redraw:1,
+                nodestroy_by_cb:1;
 
       // populate
-	void show_changelog();
+        void show_changelog();
 
-	int populate( bool do_load);
-	void depopulate( bool do_save);
-	void populate_1();  // measurements
-	void populate_2();  // simulations
-	void cleanup_2();
-	void do_rescan_tree( bool with_progress_bar = true);
-	void do_purge_computed();
-	void do_detect_ultradian_cycle( agh::CRecording&);
+        int populate( bool do_load);
+        void depopulate( bool do_save);
+        void populate_1();  // measurements
+        void populate_2();  // simulations
+        void cleanup_2();
+        void do_rescan_tree( bool with_progress_bar = true);
+        void do_purge_computed();
+        void do_detect_ultradian_cycle( agh::CRecording&);
 
-	void show_empty_experiment_blurb();
-	int try_download();
-	GPid dl_pid;
+        void show_empty_experiment_blurb();
+        int try_download();
+        GPid dl_pid;
 
       // collected emumerated inventory items, purely informational
         // ED strings (channels, sessions, etc)
-	list<string>
-		AghDD,	AghGG,	AghEE;
-	list<sigfile::SChannel>
-		AghHH,	AghTT;
-	list<sigfile::SChannel>::iterator
-		_AghHi,	_AghTi;
-	list<string>::iterator
-		_AghGi,	_AghDi,	_AghEi;
-	const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->name() : "(invalid channel)"; }
-	const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->name() : "(invalid channel)"; }
-	const char* AghG() const { return (_AghGi != AghGG.end()) ? _AghGi->c_str() : "(invalid group)"; }
-	const char* AghD() const { return (_AghDi != AghDD.end()) ? _AghDi->c_str() : "(invalid session)"; }
-	const char* AghE() const { return (_AghEi != AghEE.end()) ? _AghEi->c_str() : "(invalid episode)"; }
-	int AghTi() const;
-	int AghDi() const;
-
-	// samplerates
-	vector<size_t>
-		used_samplerates,
-		used_eeg_samplerates;
+        list<string>
+                AghDD,        AghGG,        AghEE;
+        list<sigfile::SChannel>
+                AghHH,        AghTT;
+        list<sigfile::SChannel>::iterator
+                _AghHi,        _AghTi;
+        list<string>::iterator
+                _AghGi,        _AghDi,        _AghEi;
+        const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->name() : "(invalid channel)"; }
+        const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->name() : "(invalid channel)"; }
+        const char* AghG() const { return (_AghGi != AghGG.end()) ? _AghGi->c_str() : "(invalid group)"; }
+        const char* AghD() const { return (_AghDi != AghDD.end()) ? _AghDi->c_str() : "(invalid session)"; }
+        const char* AghE() const { return (_AghEi != AghEE.end()) ? _AghEi->c_str() : "(invalid episode)"; }
+        int AghTi() const;
+        int AghDi() const;
+
+        // samplerates
+        vector<size_t>
+                used_samplerates,
+                used_eeg_samplerates;
 
       // inventory
-	// full-path annotations
-	struct SAnnotation
-	      : public agh::SEpisode::SAnnotation {
-		agh::CSubject& csubject;
-		const string& session;
-		agh::SEpisode& sepisode;
-		SAnnotation (agh::CSubject& j, const string& d, agh::SEpisode& e,
-			     agh::SEpisode::SAnnotation& a)
-		      : agh::SEpisode::SAnnotation (a),
-			csubject (j), session (d), sepisode (e)
-			{}
-	};
-	forward_list<SAnnotation>
-		global_annotations;
-
-	// common artifact detection profiles
-	map<string, metrics::mc::SArtifactDetectionPP>
-		global_artifact_detection_profiles;
-	void load_artifact_detection_profiles();
-	void save_artifact_detection_profiles() const;
+        // full-path annotations
+        struct SAnnotation
+              : public agh::SEpisode::SAnnotation {
+                agh::CSubject& csubject;
+                const string& session;
+                agh::SEpisode& sepisode;
+                SAnnotation (agh::CSubject& j, const string& d, agh::SEpisode& e,
+                             agh::SEpisode::SAnnotation& a)
+                      : agh::SEpisode::SAnnotation (a),
+                        csubject (j), session (d), sepisode (e)
+                        {}
+        };
+        forward_list<SAnnotation>
+                global_annotations;
+
+        // common artifact detection profiles
+        map<string, metrics::mc::SArtifactDetectionPP>
+                global_artifact_detection_profiles;
+        void load_artifact_detection_profiles();
+        void save_artifact_detection_profiles() const;
 
       // currently open SF instances
-	list<agh::ui::SScoringFacility*>
-		open_scoring_facilities;
-	agh::ui::SScoringFacility
-		*close_this_SF_now;
+        list<agh::ui::SScoringFacility*>
+                open_scoring_facilities;
+        agh::ui::SScoringFacility
+                *close_this_SF_now;
 
       // displayed profile selector
-	metrics::TType
-		display_profile_type;
-	// profile-specific variable parameter(s) exposed on main toolbar
-	// 1. PSD
-	double	active_profile_psd_freq_from,
-		active_profile_psd_freq_upto;
-	// 2. SWU
-	double	active_profile_swu_f0; // has to be a frequency, no doubt
-	// 3. MC
-	double	active_profile_mc_f0;
-
-	agh::SProfileParamSet make_active_profile_paramset() const;
+        metrics::TType
+                display_profile_type;
+        // profile-specific variable parameter(s) exposed on main toolbar
+        // 1. PSD
+        double        active_profile_psd_freq_from,
+                active_profile_psd_freq_upto;
+        // 2. SWU
+        double        active_profile_swu_f0; // has to be a frequency, no doubt
+        // 3. MC
+        double        active_profile_mc_f0;
+
+        agh::SProfileParamSet make_active_profile_paramset() const;
 
       // own variables aka saved settings
-	bool	only_plain_global_annotations,
-		strict_subject_id_checks,
-		suppress_scan_report;
-
-	double	uc_accuracy_factor;
-	int	pagesize_item,
-		binsize_item;
-	size_t figure_pagesize_item(); // from corresponding ED->fft_params.* fields
-	size_t figure_binsize_item();
-	size_t pagesize() const
-		{
-			return FFTPageSizeValues[pagesize_item];
-		}
-	double binsize() const
-		{
-			return FFTBinSizeValues[binsize_item];
-		}
-
-	sigfile::CHypnogram::TCustomScoreCodes
-		ext_score_codes;
-
-	// scales
-	double	profile_scale_psd,
-		profile_scale_swu,
-		profile_scale_mc;
-	double calculate_profile_scale();
-	void modify_active_profile_scale( GdkScrollDirection);
-	void modify_profile_scales( GdkScrollDirection);
-
-	bool	autoscale;
-	size_t	smooth_profile;
-
-	// timeline
-	time_t	timeline_start,
-		timeline_end;
-	size_t T2P( time_t t) const
-		{
-			return difftime( t, timeline_start) / 3600. * tl_pph;
-		}
-	time_t P2T( int p) const
-		{
-			return p * 3600. / tl_pph + timeline_start;
-		}
-	size_t	tl_height,
-		tl_width,
-		tl_left_margin,
-		tl_right_margin,
-		tl_pages,
-		tl_pph;
-
-	// geometry
-	string	_geometry_placeholder,
-		_aghdd_placeholder,
-		_aghtt_placeholder;
-
-	// sort
-	enum TSubjectSortBy {
-		name, age, admission_date,
-		avg_profile_power
-	};
-	TSubjectSortBy sort_by;
-	bool	sort_ascending,
-		sort_segregate;
-	void sort_subjects();
-
-	// general scrolling responsiveness
-	static double scroll_factor;
-
-	// _saved items
-	size_t	tl_pph_saved,
-		tl_height_saved;
-	int	pagesize_item_saved,
-		binsize_item_saved;
-	sigproc::TWinType
-		fft_params_welch_window_type_saved,
-		af_dampen_window_type_saved;
-	metrics::psd::TFFTWPlanType
-		fft_params_plan_type_saved;
-	double	af_dampen_factor_saved;
-
-	// sigfile::SFFTParamSet
-	// 	fft_params_saved; // members not represented in widgets as is
-	metrics::mc::SPPack
-		mc_params_saved;
-
-	// bind fields to widgets
-	SUIVarCollection
-		W_V1,
-		W_V2, W_Vtunables;
-	double	ctl_params0_siman_params_t_min_mantissa;
-	double	ctl_params0_siman_params_t_initial_mantissa;
-	int	ctl_params0_siman_params_t_min_exponent;
-	int	ctl_params0_siman_params_t_initial_exponent;
+        bool        only_plain_global_annotations,
+                strict_subject_id_checks,
+                suppress_scan_report;
+
+        double        uc_accuracy_factor;
+        int        pagesize_item,
+                binsize_item;
+        size_t figure_pagesize_item(); // from corresponding ED->fft_params.* fields
+        size_t figure_binsize_item();
+        size_t pagesize() const
+                {
+                        return FFTPageSizeValues[pagesize_item];
+                }
+        double binsize() const
+                {
+                        return FFTBinSizeValues[binsize_item];
+                }
+
+        sigfile::CHypnogram::TCustomScoreCodes
+                ext_score_codes;
+
+        // scales
+        double        profile_scale_psd,
+                profile_scale_swu,
+                profile_scale_mc;
+        double calculate_profile_scale();
+        void modify_active_profile_scale( GdkScrollDirection);
+        void modify_profile_scales( GdkScrollDirection);
+
+        bool        autoscale;
+        size_t        smooth_profile;
+
+        // timeline
+        time_t        timeline_start,
+                timeline_end;
+        size_t T2P( time_t t) const
+                {
+                        return difftime( t, timeline_start) / 3600. * tl_pph;
+                }
+        time_t P2T( int p) const
+                {
+                        return p * 3600. / tl_pph + timeline_start;
+                }
+        size_t        tl_height,
+                tl_width,
+                tl_left_margin,
+                tl_right_margin,
+                tl_pages,
+                tl_pph;
+
+        // geometry
+        string        _geometry_placeholder,
+                _aghdd_placeholder,
+                _aghtt_placeholder;
+
+        // sort
+        enum TSubjectSortBy {
+                name, age, admission_date,
+                avg_profile_power
+        };
+        TSubjectSortBy sort_by;
+        bool        sort_ascending,
+                sort_segregate;
+        void sort_subjects();
+
+        // general scrolling responsiveness
+        static double scroll_factor;
+
+        // _saved items
+        size_t        tl_pph_saved,
+                tl_height_saved;
+        int        pagesize_item_saved,
+                binsize_item_saved;
+        sigproc::TWinType
+                fft_params_welch_window_type_saved,
+                af_dampen_window_type_saved;
+        metrics::psd::TFFTWPlanType
+                fft_params_plan_type_saved;
+        double        af_dampen_factor_saved;
+
+        // sigfile::SFFTParamSet
+        //         fft_params_saved; // members not represented in widgets as is
+        metrics::mc::SPPack
+                mc_params_saved;
+
+        // bind fields to widgets
+        SUIVarCollection
+                W_V1,
+                W_V2, W_Vtunables;
+        double        ctl_params0_siman_params_t_min_mantissa;
+        double        ctl_params0_siman_params_t_initial_mantissa;
+        int        ctl_params0_siman_params_t_min_exponent;
+        int        ctl_params0_siman_params_t_initial_exponent;
 
       // status bar bits
-	void sb_message( const string&) const;
-	void sb_clear() const;
-	void sb_main_progress_indicator( const string&, size_t n, size_t i,
-					 agh::ui::TGtkRefreshMode);
+        void sb_message( const string&) const;
+        void sb_clear() const;
+        void sb_main_progress_indicator( const string&, size_t n, size_t i,
+                                         agh::ui::TGtkRefreshMode);
 
       // dnd
-	struct SDndIface {
-		GtkTargetEntry
-			target_list[];
-		size_t	n_targets;
-	};
-	SDndIface
-		dnd;
-	int dnd_maybe_admit_one( const char* fname);
-
-	string	browse_command;
-
-	SGeometry
-		geometry;
-
-	forward_list<agh::confval::SValidator<string>>	config_keys_s;
-	forward_list<agh::confval::SValidator<bool>>	config_keys_b;
-	forward_list<agh::confval::SValidator<int>>	config_keys_d;
-	forward_list<agh::confval::SValidator<double>>	config_keys_g;
-	int load_settings();
-	int save_settings();
-
-	void populate_mSessions();
-	void populate_mChannels();
-	void populate_mGlobalAnnotations();
-	void populate_mGlobalADProfiles();
-	void adjust_op_freq_spinbuttons();
-	void __reconnect_channels_combo();
-	void __reconnect_sessions_combo();
+        struct SDndIface {
+                GtkTargetEntry
+                        target_list[];
+                size_t        n_targets;
+        };
+        SDndIface
+                dnd;
+        int dnd_maybe_admit_one( const char* fname);
+
+        string        browse_command;
+
+        SGeometry
+                geometry;
+
+        forward_list<agh::confval::SValidator<string>>        config_keys_s;
+        forward_list<agh::confval::SValidator<bool>>        config_keys_b;
+        forward_list<agh::confval::SValidator<int>>        config_keys_d;
+        forward_list<agh::confval::SValidator<double>>        config_keys_g;
+        int load_settings();
+        int save_settings();
+
+        void populate_mSessions();
+        void populate_mChannels();
+        void populate_mGlobalAnnotations();
+        void populate_mGlobalADProfiles();
+        void adjust_op_freq_spinbuttons();
+        void __reconnect_channels_combo();
+        void __reconnect_sessions_combo();
 
       // static const bits
-	static const array<unsigned, 4>
-		FFTPageSizeValues;
-	static const array<double, 3>
-		FFTBinSizeValues;
+        static const array<unsigned, 4>
+                FFTPageSizeValues;
+        static const array<double, 3>
+                FFTBinSizeValues;
 };
 
 
@@ -368,21 +368,21 @@ inline int
 __attribute__ ((pure))
 SExpDesignUI::AghTi() const
 {
-	int i = 0;
-	for ( auto Ti = AghTT.begin(); Ti != AghTT.end(); ++Ti, ++i )
-		if ( Ti == _AghTi )
-			return i;
-	return -1;
+        int i = 0;
+        for ( auto Ti = AghTT.begin(); Ti != AghTT.end(); ++Ti, ++i )
+                if ( Ti == _AghTi )
+                        return i;
+        return -1;
 }
 inline int
 __attribute__ ((pure))
 SExpDesignUI::AghDi() const
 {
-	int i = 0;
-	for ( auto Di = AghDD.begin(); Di != AghDD.end(); ++Di, ++i )
-		if ( Di == _AghDi )
-			return i;
-	return -1;
+        int i = 0;
+        for ( auto Di = AghDD.begin(); Di != AghDD.end(); ++Di, ++i )
+                if ( Di == _AghDi )
+                        return i;
+        return -1;
 }
 
 
@@ -393,7 +393,7 @@ SExpDesignUI::AghDi() const
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/mw_cb.cc b/upstream/src/aghermann/ui/mw/mw_cb.cc
index fb204c9..77dd7f1 100644
--- a/upstream/src/aghermann/ui/mw/mw_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mw_cb.cc
@@ -23,39 +23,39 @@ extern "C" {
 
 gboolean
 wMainWindow_configure_event_cb(
-	GtkWidget*,
-	GdkEventConfigure *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventConfigure *event,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( event->type == GDK_CONFIGURE )
-		ED.geometry = {
-			event -> x,
-			event -> y,
-			event -> width,
-			event -> height
-		};
-	return FALSE; // whatever
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( event->type == GDK_CONFIGURE )
+                ED.geometry = {
+                        event -> x,
+                        event -> y,
+                        event -> width,
+                        event -> height
+                };
+        return FALSE; // whatever
 }
 
 gboolean
 wMainWindow_delete_event_cb(
-	GtkWidget*,
-	GdkEvent*,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEvent*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( ED.nodestroy_by_cb )
-		return TRUE;
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( ED.nodestroy_by_cb )
+                return TRUE;
 
-	// if the user closes the main window while in a settings tab,
-	// ensure we switch away from it and trigger any saving callbacks
-	gtk_notebook_set_current_page( ED.tDesign, 0);
-	gtk_notebook_set_current_page( ED.tSimulations, 0);
+        // if the user closes the main window while in a settings tab,
+        // ensure we switch away from it and trigger any saving callbacks
+        gtk_notebook_set_current_page( ED.tDesign, 0);
+        gtk_notebook_set_current_page( ED.tSimulations, 0);
 
-	iExpClose_activate_cb( NULL, userdata);
+        iExpClose_activate_cb( NULL, userdata);
 
-	return TRUE; // whatever
+        return TRUE; // whatever
 }
 
 
@@ -64,70 +64,70 @@ namespace {
 inline void
 cycle_combo( GtkComboBox* c, const int n, const int by)
 {
-	gtk_combo_box_set_active(
-		c, (gtk_combo_box_get_active( c) + n + by) % n);
+        gtk_combo_box_set_active(
+                c, (gtk_combo_box_get_active( c) + n + by) % n);
 }
 }
 
 gboolean
 wMainWindow_key_press_event_cb(
-	GtkWidget*,
-	GdkEventKey* event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventKey* event,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	int by = (event->state & GDK_SHIFT_MASK) ? -1 : 1;
-
-	switch ( event->keyval ) {
-	case GDK_KEY_F1:
-		cycle_combo(
-			ED.eMsmtProfileType, 3, // three profiles
-			by);
-		return TRUE;
-	case GDK_KEY_F2:
-		cycle_combo(
-			ED.eMsmtSession, ED.AghDD.size(),
-			by);
-		return TRUE;
-	case GDK_KEY_F3:
-		cycle_combo(
-			ED.eMsmtChannel, ED.AghTT.size(),
-			by);
-		return TRUE;
-	}
-
-	return FALSE;
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        int by = (event->state & GDK_SHIFT_MASK) ? -1 : 1;
+
+        switch ( event->keyval ) {
+        case GDK_KEY_F1:
+                cycle_combo(
+                        ED.eMsmtProfileType, 3, // three profiles
+                        by);
+                return TRUE;
+        case GDK_KEY_F2:
+                cycle_combo(
+                        ED.eMsmtSession, ED.AghDD.size(),
+                        by);
+                return TRUE;
+        case GDK_KEY_F3:
+                cycle_combo(
+                        ED.eMsmtChannel, ED.AghTT.size(),
+                        by);
+                return TRUE;
+        }
+
+        return FALSE;
 }
 
 
 // tab switch
 void
 tTaskSelector_switch_page_cb(
-	GtkNotebook*,
-	gpointer,
-	const guint page_num,
-	const gpointer userdata)
+        GtkNotebook*,
+        gpointer,
+        const guint page_num,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( page_num == 1 ) {
-		//ED.populate( false);
-		gtk_label_set_markup(
-			ED.lSimulationsSession,
-			snprintf_buf( "Session: <b>%s</b>", ED.AghD()));
-		gtk_label_set_markup(
-			ED.lSimulationsChannel,
-			snprintf_buf( "Channel: <b>%s</b>", ED.AghT()));
-		gtk_label_set_markup(
-			ED.lSimulationsProfile,
-			snprintf_buf( "Metric: <b>%s</b>", metrics::name( ED.display_profile_type)));
-		gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, FALSE);
-		ED.populate_2();
-	} else if ( page_num == 0 ) {
-		// ED.ED->prune_untried_modruns(); // done in populate_2
-		// ED.populate( false);
-		gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, TRUE);
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( page_num == 1 ) {
+                //ED.populate( false);
+                gtk_label_set_markup(
+                        ED.lSimulationsSession,
+                        snprintf_buf( "Session: <b>%s</b>", ED.AghD()));
+                gtk_label_set_markup(
+                        ED.lSimulationsChannel,
+                        snprintf_buf( "Channel: <b>%s</b>", ED.AghT()));
+                gtk_label_set_markup(
+                        ED.lSimulationsProfile,
+                        snprintf_buf( "Metric: <b>%s</b>", metrics::name( ED.display_profile_type)));
+                gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, FALSE);
+                ED.populate_2();
+        } else if ( page_num == 0 ) {
+                // ED.ED->prune_untried_modruns(); // done in populate_2
+                // ED.populate( false);
+                gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, TRUE);
+        }
 }
 
 
@@ -136,114 +136,114 @@ tTaskSelector_switch_page_cb(
 
 void
 eMsmtProfileAutoscale_toggled_cb(
-	GtkToggleButton* b,
-	const gpointer userdata)
+        GtkToggleButton* b,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	if ( (ED.autoscale = (bool)gtk_toggle_button_get_active(b)) ) {
-		ED.calculate_profile_scale();
-		gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+        if ( (ED.autoscale = (bool)gtk_toggle_button_get_active(b)) ) {
+                ED.calculate_profile_scale();
+                gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+        }
 }
 
 void
 eMsmtProfileSmooth_value_changed_cb(
-	GtkScaleButton* b,
-	const gdouble v,
-	const gpointer userdata)
+        GtkScaleButton* b,
+        const gdouble v,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.smooth_profile = v;
-	gtk_button_set_label(
-		(GtkButton*)b,
-		snprintf_buf( "Smooth: %zu", ED.smooth_profile));
-	gtk_widget_queue_draw(
-		(GtkWidget*)ED.cMeasurements);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.smooth_profile = v;
+        gtk_button_set_label(
+                (GtkButton*)b,
+                snprintf_buf( "Smooth: %zu", ED.smooth_profile));
+        gtk_widget_queue_draw(
+                (GtkWidget*)ED.cMeasurements);
 }
 
 
 void
 eMsmtProfileType_changed_cb(
-	GtkComboBox* b,
-	const gpointer userdata)
+        GtkComboBox* b,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	switch ( gtk_combo_box_get_active( b) ) {
-	case 0:
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, TRUE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, FALSE);
-		ED.display_profile_type = metrics::TType::psd;
-	    break;
-	case 1:
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, TRUE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, FALSE);
-		ED.display_profile_type = metrics::TType::swu;
-		// set adjustment inc and upper like it's done for MC, below
-	    break;
-	case 2:
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, TRUE);
-		ED.display_profile_type = metrics::TType::mc;
-	    break;
-	}
-
-	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;
-
-	// collect profiles that need to be re-created
-	SBusyBlock *bb = nullptr;
-	vector<agh::CProfile*> redo_profiles;
-	for ( auto &G : ED.groups )
-		for ( auto &J : G )
-			if ( J.cprofile and J.cprofile->need_compute( params) ) {
-				if ( !bb )
-					bb = new SBusyBlock (ED.wMainWindow);
-				redo_profiles.push_back( J.cprofile);
-			}
-
-	size_t global_i = 0;
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        switch ( gtk_combo_box_get_active( b) ) {
+        case 0:
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, TRUE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, FALSE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, FALSE);
+                ED.display_profile_type = metrics::TType::psd;
+            break;
+        case 1:
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, FALSE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, TRUE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, FALSE);
+                ED.display_profile_type = metrics::TType::swu;
+                // set adjustment inc and upper like it's done for MC, below
+            break;
+        case 2:
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsPSD, FALSE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsSWU, FALSE);
+                gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParamsMC, TRUE);
+                ED.display_profile_type = metrics::TType::mc;
+            break;
+        }
+
+        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;
+
+        // collect profiles that need to be re-created
+        SBusyBlock *bb = nullptr;
+        vector<agh::CProfile*> redo_profiles;
+        for ( auto &G : ED.groups )
+                for ( auto &J : G )
+                        if ( J.cprofile and J.cprofile->need_compute( params) ) {
+                                if ( !bb )
+                                        bb = new SBusyBlock (ED.wMainWindow);
+                                redo_profiles.push_back( J.cprofile);
+                        }
+
+        size_t global_i = 0;
 #ifdef _OPENMP
 #pragma omp parallel for schedule(guided)
 #endif
-	for ( size_t i = 0; i < redo_profiles.size(); ++i ) {
+        for ( size_t i = 0; i < redo_profiles.size(); ++i ) {
 #ifdef _OPENMP
 #pragma omp critical
 #endif
-		{
-			auto& P = *redo_profiles[i];
-			ED.sb_main_progress_indicator(
-				(string ("Compute ") + P.subject() + "/" + P.session() + "/" + P.channel()).c_str(),
-				redo_profiles.size(), ++global_i,
-				TGtkRefreshMode::gtk);
-		}
+                {
+                        auto& P = *redo_profiles[i];
+                        ED.sb_main_progress_indicator(
+                                (string ("Compute ") + P.subject() + "/" + P.session() + "/" + P.channel()).c_str(),
+                                redo_profiles.size(), ++global_i,
+                                TGtkRefreshMode::gtk);
+                }
 
-		redo_profiles[i]->create_timeline( params);
-	}
-	ED.sb_clear();
+                redo_profiles[i]->create_timeline( params);
+        }
+        ED.sb_clear();
 
-	// do it for all the rest (those needing heavy recompute will be fetched from cache)
-	for ( auto &G : ED.groups )
-		for ( auto &J : G )
-			if ( J.cprofile )
-				J.cprofile->create_timeline( params);
+        // do it for all the rest (those needing heavy recompute will be fetched from cache)
+        for ( auto &G : ED.groups )
+                for ( auto &J : G )
+                        if ( J.cprofile )
+                                J.cprofile->create_timeline( params);
 
 
-	if ( ED.profile_scale_psd == 0. || ED.profile_scale_swu == 0. || ED.profile_scale_mc == 0. ||  // don't know which
-		ED.autoscale )
-		ED.calculate_profile_scale();
+        if ( ED.profile_scale_psd == 0. || ED.profile_scale_swu == 0. || ED.profile_scale_mc == 0. ||  // don't know which
+                ED.autoscale )
+                ED.calculate_profile_scale();
 
-	ED.adjust_op_freq_spinbuttons();
+        ED.adjust_op_freq_spinbuttons();
 
-	gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+        gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
 
-	if ( bb )
-		delete bb;
+        if ( bb )
+                delete bb;
 }
 
 
@@ -252,53 +252,53 @@ namespace {
 void
 mike_dewhirst_is_not_real( SExpDesignUI& ED)
 {
-	if ( ED.suppress_redraw )
-		return;
-
-	auto params = ED.make_active_profile_paramset();
-	params.req_percent_scored	    = 0.;
-	params.swa_laden_pages_before_SWA_0 = 0u;
-	params.score_unscored_as_wake	    = false;
-
-	for ( auto &G : ED.groups )
-		for ( auto &J : G )
-			if ( J.cprofile )
-				J.cprofile->create_timeline( params);
-	if ( ED.autoscale )
-		ED.calculate_profile_scale();
-
-	gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+        if ( ED.suppress_redraw )
+                return;
+
+        auto params = ED.make_active_profile_paramset();
+        params.req_percent_scored            = 0.;
+        params.swa_laden_pages_before_SWA_0 = 0u;
+        params.score_unscored_as_wake            = false;
+
+        for ( auto &G : ED.groups )
+                for ( auto &J : G )
+                        if ( J.cprofile )
+                                J.cprofile->create_timeline( params);
+        if ( ED.autoscale )
+                ED.calculate_profile_scale();
+
+        gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
 }
 
 }; // namespace
 
 void
 eMsmtProfileParamsPSDFreqFrom_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.active_profile_psd_freq_from = gtk_spin_button_get_value( spinbutton);
-	ED.active_profile_psd_freq_upto =
-		ED.active_profile_psd_freq_from + gtk_spin_button_get_value( ED.eMsmtProfileParamsPSDFreqWidth);
-	if ( ED.suppress_redraw )
-		return;
-
-	mike_dewhirst_is_not_real(ED);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.active_profile_psd_freq_from = gtk_spin_button_get_value( spinbutton);
+        ED.active_profile_psd_freq_upto =
+                ED.active_profile_psd_freq_from + gtk_spin_button_get_value( ED.eMsmtProfileParamsPSDFreqWidth);
+        if ( ED.suppress_redraw )
+                return;
+
+        mike_dewhirst_is_not_real(ED);
 }
 
 void
 eMsmtProfileParamsPSDFreqWidth_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.active_profile_psd_freq_upto =
-		ED.active_profile_psd_freq_from + gtk_spin_button_get_value( spinbutton);
-	if ( ED.suppress_redraw )
-		return;
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.active_profile_psd_freq_upto =
+                ED.active_profile_psd_freq_from + gtk_spin_button_get_value( spinbutton);
+        if ( ED.suppress_redraw )
+                return;
 
-	mike_dewhirst_is_not_real(ED);
+        mike_dewhirst_is_not_real(ED);
 }
 
 
@@ -306,13 +306,13 @@ eMsmtProfileParamsPSDFreqWidth_value_changed_cb(
 
 void
 eMsmtProfileParamsSWUF0_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.active_profile_swu_f0 = gtk_spin_button_get_value( spinbutton);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.active_profile_swu_f0 = gtk_spin_button_get_value( spinbutton);
 
-	mike_dewhirst_is_not_real(ED);
+        mike_dewhirst_is_not_real(ED);
 }
 
 
@@ -320,13 +320,13 @@ eMsmtProfileParamsSWUF0_value_changed_cb(
 
 void
 eMsmtProfileParamsMCF0_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.active_profile_mc_f0 = gtk_spin_button_get_value( spinbutton);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.active_profile_mc_f0 = gtk_spin_button_get_value( spinbutton);
 
-	mike_dewhirst_is_not_real(ED);
+        mike_dewhirst_is_not_real(ED);
 }
 
 
@@ -339,35 +339,35 @@ eMsmtProfileParamsMCF0_value_changed_cb(
 
 void
 eMsmtSession_changed_cb(
-	GtkComboBox *combobox,
-	const gpointer userdata)
+        GtkComboBox *combobox,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto oldval = ED._AghDi;
-	ED._AghDi = find( ED.AghDD.begin(), ED.AghDD.end(),
-			  gtk_combo_box_get_active_id( combobox));
-	if ( oldval != ED._AghDi )
-		ED.populate_1();
-	if ( ED.autoscale )
-		ED.calculate_profile_scale();
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto oldval = ED._AghDi;
+        ED._AghDi = find( ED.AghDD.begin(), ED.AghDD.end(),
+                          gtk_combo_box_get_active_id( combobox));
+        if ( oldval != ED._AghDi )
+                ED.populate_1();
+        if ( ED.autoscale )
+                ED.calculate_profile_scale();
 }
 
 void
 eMsmtChannel_changed_cb(
-	GtkComboBox *combobox,
-	const gpointer userdata)
+        GtkComboBox *combobox,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	auto oldval = ED._AghTi;
-	auto newval = gtk_combo_box_get_active_id( combobox);
-	ED._AghTi = find( ED.AghTT.begin(), ED.AghTT.end(),
-			  newval);
-	ED._AghHi = find( ED.AghHH.begin(), ED.AghHH.end(),
-			  newval);
-	if ( /* _AghTi != AghTT.end() && */ oldval != ED._AghTi )
-		ED.populate_1();
-	if ( ED.autoscale )
-		ED.calculate_profile_scale();
+        auto& ED = *(SExpDesignUI*)userdata;
+        auto oldval = ED._AghTi;
+        auto newval = gtk_combo_box_get_active_id( combobox);
+        ED._AghTi = find( ED.AghTT.begin(), ED.AghTT.end(),
+                          newval);
+        ED._AghHi = find( ED.AghHH.begin(), ED.AghHH.end(),
+                          newval);
+        if ( /* _AghTi != AghTT.end() && */ oldval != ED._AghTi )
+                ED.populate_1();
+        if ( ED.autoscale )
+                ED.calculate_profile_scale();
 }
 
 
@@ -376,25 +376,25 @@ eMsmtChannel_changed_cb(
 
 void
 bMainCloseThatSF_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	if ( ED.close_this_SF_now == nullptr ) {
-		fprintf( stderr, "Hey, keep your fingers off this button!\n");
-		return;
-	}
+        if ( ED.close_this_SF_now == nullptr ) {
+                fprintf( stderr, "Hey, keep your fingers off this button!\n");
+                return;
+        }
 
-	delete ED.close_this_SF_now;
-	ED.close_this_SF_now = nullptr;
+        delete ED.close_this_SF_now;
+        ED.close_this_SF_now = nullptr;
 }
 
 } // extern "C"
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/mw_cb.hh b/upstream/src/aghermann/ui/mw/mw_cb.hh
index f43c218..521124b 100644
--- a/upstream/src/aghermann/ui/mw/mw_cb.hh
+++ b/upstream/src/aghermann/ui/mw/mw_cb.hh
@@ -115,7 +115,7 @@ void bMainCloseThatSF_clicked_cb( GtkButton*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/populate.cc b/upstream/src/aghermann/ui/mw/populate.cc
index 9372f08..4b1e265 100644
--- a/upstream/src/aghermann/ui/mw/populate.cc
+++ b/upstream/src/aghermann/ui/mw/populate.cc
@@ -27,150 +27,150 @@ int
 SExpDesignUI::
 populate( bool do_load)
 {
-	printf( "\nSExpDesignUI::populate():\n");
-	AghDD = ED->enumerate_sessions();
-	_AghDi = AghDD.begin();
-	AghGG = ED->enumerate_groups();
-	_AghGi = AghGG.begin();
-	AghHH = ED->enumerate_all_channels();
-	_AghHi = AghHH.begin();
-	AghTT = ED->enumerate_eeg_channels();
-	_AghTi = AghTT.begin();
-	AghEE = ED->enumerate_episodes();
-	_AghEi = AghEE.begin();
-
-	printf( "*     Sessions: %s\n"
-		"*       Groups: %s\n"
-		"* All Channels: %s\n"
-		"* EEG Channels: %s\n"
-		"*     Episodes: %s\n",
-		agh::str::join( AghDD, "; ").c_str(),
-		agh::str::join( AghGG, "; ").c_str(),
-		sigfile::join_channel_names( AghHH, "; ").c_str(),
-		sigfile::join_channel_names( AghTT, "; ").c_str(),
-		agh::str::join( AghEE, "; ").c_str());
-
-	used_samplerates =
-		ED->used_samplerates();
-	used_eeg_samplerates =
-		ED->used_samplerates( sigfile::SChannel::TType::eeg);
-	if ( used_eeg_samplerates.size() == 1 )
-		printf( "* single common EEG samplerate: %zu\n", used_eeg_samplerates.front());
-	else
-		printf( "* multiple EEG samplerates (%zu)\n", used_eeg_samplerates.size());
-	printf( "* global AD profiles: %zu\n", global_artifact_detection_profiles.size());
-
-	if ( do_load ) {
-		if ( load_settings() )
-			fprintf( stderr, "load_settings() had issues\n");
-		if ( geometry.w > 0 ) {// implies the rest are, too
-			// gtk_window_parse_geometry( wMainWindow, _geometry_placeholder.c_str());
-			gtk_window_move( wMainWindow, geometry.x, geometry.y);
-			gtk_window_resize( wMainWindow, geometry.w, geometry.h);
-		}
-	}
-
-	gtk_window_set_title(
-		wMainWindow,
-		(string ("Aghermann: ") + agh::str::homedir2tilda( ED->session_dir())).c_str());
-
-	if ( ED->last_used_version != VERSION ) {
-		printf( "Upgrading from version %s, here's ChangeLog for you\n", ED->last_used_version.c_str());
-		show_changelog();
-	}
-	ED->last_used_version = VERSION;
-
-	gtk_button_set_label(
-		(GtkButton*)eMsmtProfileSmooth,
-		snprintf_buf( "Smooth: %zu", smooth_profile));
-
-	if ( AghTT.empty() )
-		pop_ok_message(
-			wMainWindow,
-			"No EEG channels",
-			"There are no EEG channels found in any recordings in the tree.");
-	if ( AghTT.empty() or AghGG.empty() ) {
-		show_empty_experiment_blurb();
-		set_controls_for_empty_experiment( true);
-	} else {
-		populate_mChannels();
-		populate_mSessions();
-		populate_mGlobalAnnotations();
-		populate_mGlobalADProfiles();
-		populate_1();
-
-		gtk_combo_box_set_active( eGlobalADProfiles, 0);
-
-		switch ( display_profile_type ) {
-		case metrics::TType::psd:
-			gtk_combo_box_set_active( eMsmtProfileType, 0);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, TRUE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, FALSE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, FALSE);
-			gtk_widget_grab_focus( (GtkWidget*)eMsmtProfileParamsPSDFreqFrom);
-		    break;
-		case metrics::TType::swu:
-			gtk_combo_box_set_active( eMsmtProfileType, 1);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, FALSE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, TRUE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, FALSE);
-			gtk_widget_grab_focus( (GtkWidget*)eMsmtProfileParamsPSDFreqFrom);
-		    break;
-		case metrics::TType::mc:
-			gtk_combo_box_set_active( eMsmtProfileType, 2);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, FALSE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, FALSE);
-			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, TRUE);
-		    break;
-		default:
-			// throw something
-		    break;
-		}
-
-		set_controls_for_empty_experiment( false);
-	}
-
-	if ( ED->error_log_n_messages() > 0 ) {
-		if ( not suppress_scan_report ) {
-			auto buffer = gtk_text_view_get_buffer( tScanLog);
-			for ( const auto& L : ED->error_log() ) {
-
-				GtkTextIter X0, X9;
-				gtk_text_buffer_get_end_iter(
-					buffer, &X0);
-				gint x0 = gtk_text_iter_get_offset( &X0);
-
-				gtk_text_buffer_insert_at_cursor(
-					buffer, (L.first + '\n').c_str(), -1);
-				gtk_text_buffer_get_iter_at_offset(
-					buffer, &X0, x0);
-				gtk_text_buffer_get_end_iter(
-					buffer, &X9);
-				// gtk_text_iter_backward_cursor_position(
-				// 	&X9);
-
-				switch ( L.second ) {
-				case agh::CExpDesign::TLogEntryStyle::bold:
-					gtk_text_buffer_apply_tag_by_name(
-						buffer, "bold",
-						&X0, &X9);
-					break;
-				case agh::CExpDesign::TLogEntryStyle::italic:
-					gtk_text_buffer_apply_tag_by_name(
-						buffer, "italic",
-						&X0, &X9);
-					break;
-				case agh::CExpDesign::TLogEntryStyle::plain:
-				default:
-					break;
-				}
-			}
-			gtk_widget_show_all( (GtkWidget*)wScanLog);
-		} else
-			gdk_window_beep( gtk_widget_get_window( (GtkWidget*)wMainWindow));
-	}
-
-	return 0;
+        printf( "\nSExpDesignUI::populate():\n");
+        AghDD = ED->enumerate_sessions();
+        _AghDi = AghDD.begin();
+        AghGG = ED->enumerate_groups();
+        _AghGi = AghGG.begin();
+        AghHH = ED->enumerate_all_channels();
+        _AghHi = AghHH.begin();
+        AghTT = ED->enumerate_eeg_channels();
+        _AghTi = AghTT.begin();
+        AghEE = ED->enumerate_episodes();
+        _AghEi = AghEE.begin();
+
+        printf( "*     Sessions: %s\n"
+                "*       Groups: %s\n"
+                "* All Channels: %s\n"
+                "* EEG Channels: %s\n"
+                "*     Episodes: %s\n",
+                agh::str::join( AghDD, "; ").c_str(),
+                agh::str::join( AghGG, "; ").c_str(),
+                sigfile::join_channel_names( AghHH, "; ").c_str(),
+                sigfile::join_channel_names( AghTT, "; ").c_str(),
+                agh::str::join( AghEE, "; ").c_str());
+
+        used_samplerates =
+                ED->used_samplerates();
+        used_eeg_samplerates =
+                ED->used_samplerates( sigfile::SChannel::TType::eeg);
+        if ( used_eeg_samplerates.size() == 1 )
+                printf( "* single common EEG samplerate: %zu\n", used_eeg_samplerates.front());
+        else
+                printf( "* multiple EEG samplerates (%zu)\n", used_eeg_samplerates.size());
+        printf( "* global AD profiles: %zu\n", global_artifact_detection_profiles.size());
+
+        if ( do_load ) {
+                if ( load_settings() )
+                        fprintf( stderr, "load_settings() had issues\n");
+                if ( geometry.w > 0 ) {// implies the rest are, too
+                        // gtk_window_parse_geometry( wMainWindow, _geometry_placeholder.c_str());
+                        gtk_window_move( wMainWindow, geometry.x, geometry.y);
+                        gtk_window_resize( wMainWindow, geometry.w, geometry.h);
+                }
+        }
+
+        gtk_window_set_title(
+                wMainWindow,
+                (string ("Aghermann: ") + agh::str::homedir2tilda( ED->session_dir())).c_str());
+
+        if ( ED->last_used_version != VERSION ) {
+                printf( "Upgrading from version %s, here's ChangeLog for you\n", ED->last_used_version.c_str());
+                show_changelog();
+        }
+        ED->last_used_version = VERSION;
+
+        gtk_button_set_label(
+                (GtkButton*)eMsmtProfileSmooth,
+                snprintf_buf( "Smooth: %zu", smooth_profile));
+
+        if ( AghTT.empty() )
+                pop_ok_message(
+                        wMainWindow,
+                        "No EEG channels",
+                        "There are no EEG channels found in any recordings in the tree.");
+        if ( AghTT.empty() or AghGG.empty() ) {
+                show_empty_experiment_blurb();
+                set_controls_for_empty_experiment( true);
+        } else {
+                populate_mChannels();
+                populate_mSessions();
+                populate_mGlobalAnnotations();
+                populate_mGlobalADProfiles();
+                populate_1();
+
+                gtk_combo_box_set_active( eGlobalADProfiles, 0);
+
+                switch ( display_profile_type ) {
+                case metrics::TType::psd:
+                        gtk_combo_box_set_active( eMsmtProfileType, 0);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, TRUE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, FALSE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, FALSE);
+                        gtk_widget_grab_focus( (GtkWidget*)eMsmtProfileParamsPSDFreqFrom);
+                    break;
+                case metrics::TType::swu:
+                        gtk_combo_box_set_active( eMsmtProfileType, 1);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, FALSE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, TRUE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, FALSE);
+                        gtk_widget_grab_focus( (GtkWidget*)eMsmtProfileParamsPSDFreqFrom);
+                    break;
+                case metrics::TType::mc:
+                        gtk_combo_box_set_active( eMsmtProfileType, 2);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsPSD, FALSE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsSWU, FALSE);
+                        gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParamsMC, TRUE);
+                    break;
+                default:
+                        // throw something
+                    break;
+                }
+
+                set_controls_for_empty_experiment( false);
+        }
+
+        if ( ED->error_log_n_messages() > 0 ) {
+                if ( not suppress_scan_report ) {
+                        auto buffer = gtk_text_view_get_buffer( tScanLog);
+                        for ( const auto& L : ED->error_log() ) {
+
+                                GtkTextIter X0, X9;
+                                gtk_text_buffer_get_end_iter(
+                                        buffer, &X0);
+                                gint x0 = gtk_text_iter_get_offset( &X0);
+
+                                gtk_text_buffer_insert_at_cursor(
+                                        buffer, (L.first + '\n').c_str(), -1);
+                                gtk_text_buffer_get_iter_at_offset(
+                                        buffer, &X0, x0);
+                                gtk_text_buffer_get_end_iter(
+                                        buffer, &X9);
+                                // gtk_text_iter_backward_cursor_position(
+                                //         &X9);
+
+                                switch ( L.second ) {
+                                case agh::CExpDesign::TLogEntryStyle::bold:
+                                        gtk_text_buffer_apply_tag_by_name(
+                                                buffer, "bold",
+                                                &X0, &X9);
+                                        break;
+                                case agh::CExpDesign::TLogEntryStyle::italic:
+                                        gtk_text_buffer_apply_tag_by_name(
+                                                buffer, "italic",
+                                                &X0, &X9);
+                                        break;
+                                case agh::CExpDesign::TLogEntryStyle::plain:
+                                default:
+                                        break;
+                                }
+                        }
+                        gtk_widget_show_all( (GtkWidget*)wScanLog);
+                } else
+                        gdk_window_beep( gtk_widget_get_window( (GtkWidget*)wMainWindow));
+        }
+
+        return 0;
 }
 
 
@@ -178,31 +178,31 @@ void
 SExpDesignUI::
 depopulate( bool do_save)
 {
-	if ( do_save )
-		save_settings();
-
-	ED->reset_error_log();
-
-	// these are freed on demand immediately before reuse; leave them alone
-	AghGG.clear();
-	AghDD.clear();
-	AghEE.clear();
-	AghHH.clear();
-	AghTT.clear();
-
-	g_signal_handler_block( eMsmtSession, eMsmtSession_changed_cb_handler_id);
-	g_signal_handler_block( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
-
-	gtk_list_store_clear( mSessions);
-	gtk_list_store_clear( mAllChannels);
-	gtk_list_store_clear( mEEGChannels);
-	gtk_tree_store_clear( mGlobalAnnotations);
-	gtk_list_store_clear( mGlobalADProfiles);
-
-	__reconnect_sessions_combo();
-	g_signal_handler_unblock( eMsmtSession, eMsmtSession_changed_cb_handler_id);
-	__reconnect_channels_combo();
-	g_signal_handler_unblock( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
+        if ( do_save )
+                save_settings();
+
+        ED->reset_error_log();
+
+        // these are freed on demand immediately before reuse; leave them alone
+        AghGG.clear();
+        AghDD.clear();
+        AghEE.clear();
+        AghHH.clear();
+        AghTT.clear();
+
+        g_signal_handler_block( eMsmtSession, eMsmtSession_changed_cb_handler_id);
+        g_signal_handler_block( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
+
+        gtk_list_store_clear( mSessions);
+        gtk_list_store_clear( mAllChannels);
+        gtk_list_store_clear( mEEGChannels);
+        gtk_tree_store_clear( mGlobalAnnotations);
+        gtk_list_store_clear( mGlobalADProfiles);
+
+        __reconnect_sessions_combo();
+        g_signal_handler_unblock( eMsmtSession, eMsmtSession_changed_cb_handler_id);
+        __reconnect_channels_combo();
+        g_signal_handler_unblock( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
 }
 
 
@@ -213,17 +213,17 @@ void
 SExpDesignUI::
 populate_mSessions()
 {
-	g_signal_handler_block( eMsmtSession, eMsmtSession_changed_cb_handler_id);
-	gtk_list_store_clear( mSessions);
-	GtkTreeIter iter;
-	for ( auto &D : AghDD ) {
-		gtk_list_store_append( mSessions, &iter);
-		gtk_list_store_set( mSessions, &iter,
-				    0, D.c_str(),
-				    -1);
-	}
-	__reconnect_sessions_combo();
-	g_signal_handler_unblock( eMsmtSession, eMsmtSession_changed_cb_handler_id);
+        g_signal_handler_block( eMsmtSession, eMsmtSession_changed_cb_handler_id);
+        gtk_list_store_clear( mSessions);
+        GtkTreeIter iter;
+        for ( auto &D : AghDD ) {
+                gtk_list_store_append( mSessions, &iter);
+                gtk_list_store_set( mSessions, &iter,
+                                    0, D.c_str(),
+                                    -1);
+        }
+        __reconnect_sessions_combo();
+        g_signal_handler_unblock( eMsmtSession, eMsmtSession_changed_cb_handler_id);
 }
 
 
@@ -235,29 +235,29 @@ void
 SExpDesignUI::
 populate_mChannels()
 {
-	g_signal_handler_block( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
-	gtk_list_store_clear( mEEGChannels);
-	gtk_list_store_clear( mAllChannels);
-	// users of mAllChannels (SF pattern) connect to model dynamically
-
-	for ( auto &H : AghTT ) {
-		GtkTreeIter iter;
-		gtk_list_store_append( mEEGChannels, &iter);
-		gtk_list_store_set( mEEGChannels, &iter,
-				    0, H.name(),
-				    -1);
-	}
-
-	for ( auto &H : AghHH ) {
-		GtkTreeIter iter;
-		gtk_list_store_append( mAllChannels, &iter);
-		gtk_list_store_set( mAllChannels, &iter,
-				    0, H.name(),
-				    -1);
-	}
-
-	__reconnect_channels_combo();
-	g_signal_handler_unblock( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
+        g_signal_handler_block( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
+        gtk_list_store_clear( mEEGChannels);
+        gtk_list_store_clear( mAllChannels);
+        // users of mAllChannels (SF pattern) connect to model dynamically
+
+        for ( auto &H : AghTT ) {
+                GtkTreeIter iter;
+                gtk_list_store_append( mEEGChannels, &iter);
+                gtk_list_store_set( mEEGChannels, &iter,
+                                    0, H.name(),
+                                    -1);
+        }
+
+        for ( auto &H : AghHH ) {
+                GtkTreeIter iter;
+                gtk_list_store_append( mAllChannels, &iter);
+                gtk_list_store_set( mAllChannels, &iter,
+                                    0, H.name(),
+                                    -1);
+        }
+
+        __reconnect_channels_combo();
+        g_signal_handler_unblock( eMsmtChannel, eMsmtChannel_changed_cb_handler_id);
 }
 
 
@@ -268,15 +268,15 @@ void
 SExpDesignUI::
 __reconnect_channels_combo()
 {
-	gtk_combo_box_set_model( eMsmtChannel, (GtkTreeModel*)mEEGChannels);
-
-	if ( !AghTT.empty() ) {
-		int Ti = AghTi();
-		if ( Ti != -1 )
-			gtk_combo_box_set_active( eMsmtChannel, Ti);
-		else
-			gtk_combo_box_set_active( eMsmtChannel, 0);
-	}
+        gtk_combo_box_set_model( eMsmtChannel, (GtkTreeModel*)mEEGChannels);
+
+        if ( !AghTT.empty() ) {
+                int Ti = AghTi();
+                if ( Ti != -1 )
+                        gtk_combo_box_set_active( eMsmtChannel, Ti);
+                else
+                        gtk_combo_box_set_active( eMsmtChannel, 0);
+        }
 }
 
 
@@ -284,15 +284,15 @@ void
 SExpDesignUI::
 __reconnect_sessions_combo()
 {
-	gtk_combo_box_set_model( eMsmtSession, (GtkTreeModel*)mSessions);
-
-	if ( !AghDD.empty() ) {
-		int Di = AghDi();
-		if ( Di != -1 )
-			gtk_combo_box_set_active( eMsmtSession, Di);
-		else
-			gtk_combo_box_set_active( eMsmtSession, 0);
-	}
+        gtk_combo_box_set_model( eMsmtSession, (GtkTreeModel*)mSessions);
+
+        if ( !AghDD.empty() ) {
+                int Di = AghDi();
+                if ( Di != -1 )
+                        gtk_combo_box_set_active( eMsmtSession, Di);
+                else
+                        gtk_combo_box_set_active( eMsmtSession, 0);
+        }
 }
 
 
@@ -300,8 +300,8 @@ namespace {
 const char*
 annotation_type_s( const sigfile::SAnnotation::TType t)
 {
-	static const char* types[] = {"", "S", "K", "E"};
-	return types[t];
+        static const char* types[] = {"", "S", "K", "E"};
+        return types[t];
 }
 }
 
@@ -309,80 +309,80 @@ void
 SExpDesignUI::
 populate_mGlobalAnnotations()
 {
-	gtk_tree_store_clear( mGlobalAnnotations);
+        gtk_tree_store_clear( mGlobalAnnotations);
       // apart from tree store, also refresh global list
-	global_annotations.clear();
-
-	GtkTreeIter
-		iter_g, iter_j, iter_d, iter_e, iter_a;
-	const char
-		*last_g = NULL, *last_j = NULL, *last_d = NULL, *last_e = NULL;
-
-	for ( auto &G : ED->groups ) {
-		for ( auto &J : G.second ) {
-			for ( auto &D : J.measurements ) {
-				for ( auto &E : D.second.episodes ) {
-					auto annotations = E.get_annotations();
-					if ( annotations.size() > 0 ) {
-						if ( last_g != G.first.c_str() ) {
-							gtk_tree_store_append( mGlobalAnnotations, &iter_g, NULL);
-							gtk_tree_store_set( mGlobalAnnotations, &iter_g,
-									    0, G.first.c_str(),
-									    mannotations_visibility_switch_col, TRUE,
-									    -1);
-							last_j = last_d = last_e = NULL;
-						}
-						if ( last_j != J.id.c_str() ) {  // comparing pointers here
-							gtk_tree_store_append( mGlobalAnnotations, &iter_j, &iter_g);
-							gtk_tree_store_set( mGlobalAnnotations, &iter_j,
-									    0, last_j = J.id.c_str(),
-									    mannotations_visibility_switch_col, TRUE,
-									    -1);
-							last_d = last_e = NULL;
-						}
-						if ( last_d != D.first.c_str() ) {
-							gtk_tree_store_append( mGlobalAnnotations, &iter_d, &iter_j);
-							gtk_tree_store_set( mGlobalAnnotations, &iter_d,
-									    0, last_d = D.first.c_str(),
-									    mannotations_visibility_switch_col, TRUE,
-									    -1);
-							last_e = NULL;
-						}
-						if ( last_e != E.name() ) {
-							gtk_tree_store_append( mGlobalAnnotations, &iter_e, &iter_d);
-							gtk_tree_store_set( mGlobalAnnotations, &iter_e,
-									    0, last_e = E.name(),
-									    mannotations_visibility_switch_col, TRUE,
-									    -1);
-						}
-
-						for ( auto &A : annotations )
-							if ( (only_plain_global_annotations and
-							      A.type == sigfile::SAnnotation::plain) or
-							     not only_plain_global_annotations ) {
-								global_annotations.emplace_front( J, D.first, E, A);
-
-								auto pages = A.page_span( pagesize()) * 1u;
-								if ( pages.a == pages.z )
-									snprintf_buf( "%u", pages.a + 1);
-								else
-									snprintf_buf( "%u-%u", pages.a + 1, pages.z + 1);
-								gtk_tree_store_append( mGlobalAnnotations, &iter_a, &iter_e);
-								gtk_tree_store_set( mGlobalAnnotations, &iter_a,
-										    1, global::buf,
-										    2, A.channel(),
-										    3, annotation_type_s(A.type),
-										    4, A.label.c_str(),
-										    mannotations_ref_col, (gpointer)&global_annotations.front(),
-										    mannotations_visibility_switch_col, TRUE,
-										    -1);
-							}
-					}
-				}
-			}
-		}
-	}
-	gtk_tree_view_expand_all( tvGlobalAnnotations);
+        global_annotations.clear();
+
+        GtkTreeIter
+                iter_g, iter_j, iter_d, iter_e, iter_a;
+        const char
+                *last_g = NULL, *last_j = NULL, *last_d = NULL, *last_e = NULL;
+
+        for ( auto &G : ED->groups ) {
+                for ( auto &J : G.second ) {
+                        for ( auto &D : J.measurements ) {
+                                for ( auto &E : D.second.episodes ) {
+                                        auto annotations = E.get_annotations();
+                                        if ( annotations.size() > 0 ) {
+                                                if ( last_g != G.first.c_str() ) {
+                                                        gtk_tree_store_append( mGlobalAnnotations, &iter_g, NULL);
+                                                        gtk_tree_store_set( mGlobalAnnotations, &iter_g,
+                                                                            0, G.first.c_str(),
+                                                                            mannotations_visibility_switch_col, TRUE,
+                                                                            -1);
+                                                        last_j = last_d = last_e = NULL;
+                                                }
+                                                if ( last_j != J.id.c_str() ) {  // comparing pointers here
+                                                        gtk_tree_store_append( mGlobalAnnotations, &iter_j, &iter_g);
+                                                        gtk_tree_store_set( mGlobalAnnotations, &iter_j,
+                                                                            0, last_j = J.id.c_str(),
+                                                                            mannotations_visibility_switch_col, TRUE,
+                                                                            -1);
+                                                        last_d = last_e = NULL;
+                                                }
+                                                if ( last_d != D.first.c_str() ) {
+                                                        gtk_tree_store_append( mGlobalAnnotations, &iter_d, &iter_j);
+                                                        gtk_tree_store_set( mGlobalAnnotations, &iter_d,
+                                                                            0, last_d = D.first.c_str(),
+                                                                            mannotations_visibility_switch_col, TRUE,
+                                                                            -1);
+                                                        last_e = NULL;
+                                                }
+                                                if ( last_e != E.name() ) {
+                                                        gtk_tree_store_append( mGlobalAnnotations, &iter_e, &iter_d);
+                                                        gtk_tree_store_set( mGlobalAnnotations, &iter_e,
+                                                                            0, last_e = E.name(),
+                                                                            mannotations_visibility_switch_col, TRUE,
+                                                                            -1);
+                                                }
+
+                                                for ( auto &A : annotations )
+                                                        if ( (only_plain_global_annotations and
+                                                              A.type == sigfile::SAnnotation::plain) or
+                                                             not only_plain_global_annotations ) {
+                                                                global_annotations.emplace_front( J, D.first, E, A);
+
+                                                                auto pages = A.page_span( pagesize()) * 1u;
+                                                                if ( pages.a == pages.z )
+                                                                        snprintf_buf( "%u", pages.a + 1);
+                                                                else
+                                                                        snprintf_buf( "%u-%u", pages.a + 1, pages.z + 1);
+                                                                gtk_tree_store_append( mGlobalAnnotations, &iter_a, &iter_e);
+                                                                gtk_tree_store_set( mGlobalAnnotations, &iter_a,
+                                                                                    1, global::buf,
+                                                                                    2, A.channel(),
+                                                                                    3, annotation_type_s(A.type),
+                                                                                    4, A.label.c_str(),
+                                                                                    mannotations_ref_col, (gpointer)&global_annotations.front(),
+                                                                                    mannotations_visibility_switch_col, TRUE,
+                                                                                    -1);
+                                                        }
+                                        }
+                                }
+                        }
+                }
+        }
+        gtk_tree_view_expand_all( tvGlobalAnnotations);
 }
 
 
@@ -391,15 +391,15 @@ void
 SExpDesignUI::
 populate_mGlobalADProfiles()
 {
-	gtk_list_store_clear( mGlobalADProfiles);
-	for ( auto &P : global_artifact_detection_profiles ) {
-		GtkTreeIter iter;
-		gtk_list_store_append( mGlobalADProfiles, &iter);
-		gtk_list_store_set( mGlobalADProfiles, &iter,
-				    0, P.first.c_str(),
-				    -1);
-	}
-	gtk_combo_box_set_model( eGlobalADProfiles, (GtkTreeModel*)mGlobalADProfiles);
+        gtk_list_store_clear( mGlobalADProfiles);
+        for ( auto &P : global_artifact_detection_profiles ) {
+                GtkTreeIter iter;
+                gtk_list_store_append( mGlobalADProfiles, &iter);
+                gtk_list_store_set( mGlobalADProfiles, &iter,
+                                    0, P.first.c_str(),
+                                    -1);
+        }
+        gtk_combo_box_set_model( eGlobalADProfiles, (GtkTreeModel*)mGlobalADProfiles);
 }
 
 
@@ -408,197 +408,197 @@ void
 SExpDesignUI::
 populate_1()
 {
-	if ( ED->groups.empty() )
-		return;
+        if ( ED->groups.empty() )
+                return;
 
       // touch toolbar controls
-	suppress_redraw = true;
-	gtk_spin_button_set_value( eMsmtProfileParamsPSDFreqFrom, active_profile_psd_freq_from);
-	gtk_spin_button_set_value( eMsmtProfileParamsPSDFreqWidth, active_profile_psd_freq_upto - active_profile_psd_freq_from);
-	gtk_spin_button_set_value( eMsmtProfileParamsSWUF0, active_profile_swu_f0);
-	gtk_spin_button_set_value( eMsmtProfileParamsMCF0, active_profile_mc_f0);
+        suppress_redraw = true;
+        gtk_spin_button_set_value( eMsmtProfileParamsPSDFreqFrom, active_profile_psd_freq_from);
+        gtk_spin_button_set_value( eMsmtProfileParamsPSDFreqWidth, active_profile_psd_freq_upto - active_profile_psd_freq_from);
+        gtk_spin_button_set_value( eMsmtProfileParamsSWUF0, active_profile_swu_f0);
+        gtk_spin_button_set_value( eMsmtProfileParamsMCF0, active_profile_mc_f0);
 
       // deal with the main drawing area
-	groups.clear();
-	gtk_container_foreach( (GtkContainer*)cMeasurements,
-			       (GtkCallback)gtk_widget_destroy,
-			       NULL);
+        groups.clear();
+        gtk_container_foreach( (GtkContainer*)cMeasurements,
+                               (GtkCallback)gtk_widget_destroy,
+                               NULL);
 
-	printf( "SExpDesignUI::populate_1(): session \"%s\", channel \"%s\"\n", AghD(), AghT());
+        printf( "SExpDesignUI::populate_1(): session \"%s\", channel \"%s\"\n", AghD(), AghT());
 
-	time_t	earliest_start = (time_t)-1,
-		latest_end = (time_t)-1;
+        time_t        earliest_start = (time_t)-1,
+                latest_end = (time_t)-1;
       // first pass: (1) create SSubjectPresentation's
       //             (2) determine common timeline
-	for ( auto Gi = ED->groups.begin(); Gi != ED->groups.end(); ++Gi ) {
-		groups.emplace_back( Gi, *this); // precisely need the iterator, not object by reference
-		SGroupPresentation& Gp = groups.back();
-		for ( auto &J : Gi->second ) {
-			Gp.emplace_back( J, Gp);
-			SSubjectPresentation& j = Gp.back(); // not const because admission_date is set right here:
-			j.admission_date = (time_t)0;
-			if ( j.cprofile && J.have_session(*_AghDi) ) {
-				auto& ee = J.measurements[*_AghDi].episodes;
-				if ( not ee.empty() ) {
-					// (2)
-					if ( earliest_start == (time_t)-1 || earliest_start > ee.front().start_rel )
-						earliest_start = ee.front().start_rel;
-					if ( latest_end == (time_t)-1 || latest_end < ee.back().end_rel )
-						latest_end = ee.back().end_rel;
-
-					j.admission_date = ee.front().start_time();
-				} else
-					fprintf( stderr, "SExpDesignUI::populate_1(): session \"%s\", channel \"%s\" for subject \"%s\" is empty\n",
-						 AghD(), AghT(), J.id.c_str());
-			}
-		}
-	}
-
-	sort_subjects();
-
-	timeline_start = earliest_start;
-	timeline_end   = latest_end;
-	tl_width = (timeline_end - timeline_start) / 3600 * tl_pph;
-	tl_pages = (timeline_end - timeline_start) / ED->fft_params.pagesize;
-
-	printf( "SExpDesignUI::populate_1(): common timeline:\n");
-	fputs( asctime( localtime(&earliest_start)), stdout);
-	fputs( asctime( localtime(&latest_end)), stdout);
-
-	tl_left_margin = tl_right_margin = 0;
+        for ( auto Gi = ED->groups.begin(); Gi != ED->groups.end(); ++Gi ) {
+                groups.emplace_back( Gi, *this); // precisely need the iterator, not object by reference
+                SGroupPresentation& Gp = groups.back();
+                for ( auto &J : Gi->second ) {
+                        Gp.emplace_back( J, Gp);
+                        SSubjectPresentation& j = Gp.back(); // not const because admission_date is set right here:
+                        j.admission_date = (time_t)0;
+                        if ( j.cprofile && J.have_session(*_AghDi) ) {
+                                auto& ee = J.measurements[*_AghDi].episodes;
+                                if ( not ee.empty() ) {
+                                        // (2)
+                                        if ( earliest_start == (time_t)-1 || earliest_start > ee.front().start_rel )
+                                                earliest_start = ee.front().start_rel;
+                                        if ( latest_end == (time_t)-1 || latest_end < ee.back().end_rel )
+                                                latest_end = ee.back().end_rel;
+
+                                        j.admission_date = ee.front().start_time();
+                                } else
+                                        fprintf( stderr, "SExpDesignUI::populate_1(): session \"%s\", channel \"%s\" for subject \"%s\" is empty\n",
+                                                 AghD(), AghT(), J.id.c_str());
+                        }
+                }
+        }
+
+        sort_subjects();
+
+        timeline_start = earliest_start;
+        timeline_end   = latest_end;
+        tl_width = (timeline_end - timeline_start) / 3600 * tl_pph;
+        tl_pages = (timeline_end - timeline_start) / ED->fft_params.pagesize;
+
+        printf( "SExpDesignUI::populate_1(): common timeline:\n");
+        fputs( asctime( localtime(&earliest_start)), stdout);
+        fputs( asctime( localtime(&latest_end)), stdout);
+
+        tl_left_margin = tl_right_margin = 0;
 
       // walk again thoroughly, set timeline drawing area length
-	for ( auto &G : groups ) {
-	      // convert avg episode times
-		ostringstream ss;
-		for ( auto &E : AghEE ) {
-			pair<float, float>& avge = G.cjgroup().avg_episode_times[*_AghDi][E];
-			unsigned seconds, h0, m0, s0, h9, m9, s9;
-			seconds = avge.first * 24 * 60 * 60;
-			h0 = seconds / 60 / 60;
-			m0  = seconds % 3600 / 60;
-			s0  = seconds % 60;
-			seconds = avge.second * 24 * 60 * 60;
-			h9 = seconds / 60 / 60;
-			m9  = seconds % 3600 / 60;
-			s9  = seconds % 60;
-
-			ss << agh::str::sasprintf(
-				"       <i>%s</i> %02d:%02d:%02d ~ %02d:%02d:%02d",
-				E.c_str(),
-				h0 % 24, m0, s0,
-				h9 % 24, m9, s9);
-		}
-
-		{
-			gchar *g_escaped = g_markup_escape_text( G.name(), -1);
-			snprintf_buf( "<b>%s</b> (%zu) %s", g_escaped, G.size(), ss.str().c_str());
-			g_free( g_escaped);
-		}
-
-		GtkExpander *expander = (GtkExpander*)gtk_expander_new( global::buf);
-		gtk_expander_set_use_markup( expander, TRUE);
-		g_object_set( (GObject*)expander,
-			      "visible", TRUE,
-			      "expanded", not group_unvisibility[G.name()],
-			      "height-request", -1,
-			      NULL);
-		g_signal_connect( expander, "activate",
-				  (GCallback)cGroupExpander_activate_cb,
-				  &G);
-		gtk_box_pack_start( (GtkBox*)cMeasurements,
-				    (GtkWidget*)expander, FALSE, TRUE, 3);
-		GtkWidget *vbox;
-		gtk_container_add( (GtkContainer*)expander,
-				   vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 1));
-		g_object_set( (GObject*)vbox,
-			      "height-request", -1,
-			      NULL);
-
-		for ( auto &J : G ) {
-			J.da = gtk_drawing_area_new();
-			gtk_box_pack_start( (GtkBox*)vbox,
-					    J.da, TRUE, TRUE, 2);
-
-			// determine tl_left_margin
-			{
-				cairo_t *cr = gdk_cairo_create( gtk_widget_get_window( J.da));
-				cairo_text_extents_t extents;
-				cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
-				cairo_set_font_size( cr, 11);
-				cairo_text_extents( cr, J.csubject.id.c_str(), &extents);
-				if ( tl_left_margin < extents.width )
-					tl_left_margin = extents.width;
-				cairo_destroy( cr);
-			}
-
-			gtk_widget_add_events( J.da,
-					       (GdkEventMask)
-					       GDK_EXPOSURE_MASK |
-					       GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
-					       GDK_SCROLL_MASK |
-					       GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
-					       GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
-					       GDK_POINTER_MOTION_MASK);
-			g_signal_connect( J.da, "draw",
-					  (GCallback)daSubjectTimeline_draw_cb,
-					  &J);
-			g_signal_connect( J.da, "enter-notify-event",
-					  (GCallback)daSubjectTimeline_enter_notify_event_cb,
-					  &J);
-			g_signal_connect( J.da, "leave-notify-event",
-					  (GCallback)daSubjectTimeline_leave_notify_event_cb,
-					  &J);
-			g_signal_connect( J.da, "scroll-event",
-					  (GCallback)daSubjectTimeline_scroll_event_cb,
-					  &J);
-			g_signal_connect( J.da, "button-press-event",
-					  (GCallback)daSubjectTimeline_button_press_event_cb,
-					  &J);
-			g_signal_connect( J.da, "motion-notify-event",
-					  (GCallback)daSubjectTimeline_motion_notify_event_cb,
-					  &J);
-
-			g_signal_connect( J.da, "drag-data-received",
-					  (GCallback)cMeasurements_drag_data_received_cb,
-					  this);
-			g_signal_connect( J.da, "drag-drop",
-					  (GCallback)cMeasurements_drag_drop_cb,
-					  this);
-			gtk_drag_dest_set( J.da, GTK_DEST_DEFAULT_ALL,
-					   NULL, 0, GDK_ACTION_COPY);
-			gtk_drag_dest_add_uri_targets( J.da);
-		}
-	}
+        for ( auto &G : groups ) {
+              // convert avg episode times
+                ostringstream ss;
+                for ( auto &E : AghEE ) {
+                        pair<float, float>& avge = G.cjgroup().avg_episode_times[*_AghDi][E];
+                        unsigned seconds, h0, m0, s0, h9, m9, s9;
+                        seconds = avge.first * 24 * 60 * 60;
+                        h0 = seconds / 60 / 60;
+                        m0  = seconds % 3600 / 60;
+                        s0  = seconds % 60;
+                        seconds = avge.second * 24 * 60 * 60;
+                        h9 = seconds / 60 / 60;
+                        m9  = seconds % 3600 / 60;
+                        s9  = seconds % 60;
+
+                        ss << agh::str::sasprintf(
+                                "       <i>%s</i> %02d:%02d:%02d ~ %02d:%02d:%02d",
+                                E.c_str(),
+                                h0 % 24, m0, s0,
+                                h9 % 24, m9, s9);
+                }
+
+                {
+                        gchar *g_escaped = g_markup_escape_text( G.name(), -1);
+                        snprintf_buf( "<b>%s</b> (%zu) %s", g_escaped, G.size(), ss.str().c_str());
+                        g_free( g_escaped);
+                }
+
+                GtkExpander *expander = (GtkExpander*)gtk_expander_new( global::buf);
+                gtk_expander_set_use_markup( expander, TRUE);
+                g_object_set( (GObject*)expander,
+                              "visible", TRUE,
+                              "expanded", not group_unvisibility[G.name()],
+                              "height-request", -1,
+                              NULL);
+                g_signal_connect( expander, "activate",
+                                  (GCallback)cGroupExpander_activate_cb,
+                                  &G);
+                gtk_box_pack_start( (GtkBox*)cMeasurements,
+                                    (GtkWidget*)expander, FALSE, TRUE, 3);
+                GtkWidget *vbox;
+                gtk_container_add( (GtkContainer*)expander,
+                                   vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 1));
+                g_object_set( (GObject*)vbox,
+                              "height-request", -1,
+                              NULL);
+
+                for ( auto &J : G ) {
+                        J.da = gtk_drawing_area_new();
+                        gtk_box_pack_start( (GtkBox*)vbox,
+                                            J.da, TRUE, TRUE, 2);
+
+                        // determine tl_left_margin
+                        {
+                                cairo_t *cr = gdk_cairo_create( gtk_widget_get_window( J.da));
+                                cairo_text_extents_t extents;
+                                cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
+                                cairo_set_font_size( cr, 11);
+                                cairo_text_extents( cr, J.csubject.id.c_str(), &extents);
+                                if ( tl_left_margin < extents.width )
+                                        tl_left_margin = extents.width;
+                                cairo_destroy( cr);
+                        }
+
+                        gtk_widget_add_events( J.da,
+                                               (GdkEventMask)
+                                               GDK_EXPOSURE_MASK |
+                                               GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+                                               GDK_SCROLL_MASK |
+                                               GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
+                                               GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+                                               GDK_POINTER_MOTION_MASK);
+                        g_signal_connect( J.da, "draw",
+                                          (GCallback)daSubjectTimeline_draw_cb,
+                                          &J);
+                        g_signal_connect( J.da, "enter-notify-event",
+                                          (GCallback)daSubjectTimeline_enter_notify_event_cb,
+                                          &J);
+                        g_signal_connect( J.da, "leave-notify-event",
+                                          (GCallback)daSubjectTimeline_leave_notify_event_cb,
+                                          &J);
+                        g_signal_connect( J.da, "scroll-event",
+                                          (GCallback)daSubjectTimeline_scroll_event_cb,
+                                          &J);
+                        g_signal_connect( J.da, "button-press-event",
+                                          (GCallback)daSubjectTimeline_button_press_event_cb,
+                                          &J);
+                        g_signal_connect( J.da, "motion-notify-event",
+                                          (GCallback)daSubjectTimeline_motion_notify_event_cb,
+                                          &J);
+
+                        g_signal_connect( J.da, "drag-data-received",
+                                          (GCallback)cMeasurements_drag_data_received_cb,
+                                          this);
+                        g_signal_connect( J.da, "drag-drop",
+                                          (GCallback)cMeasurements_drag_drop_cb,
+                                          this);
+                        gtk_drag_dest_set( J.da, GTK_DEST_DEFAULT_ALL,
+                                           NULL, 0, GDK_ACTION_COPY);
+                        gtk_drag_dest_add_uri_targets( J.da);
+                }
+        }
 
       // walk quickly one last time to set widget attributes (importantly, involving tl_left_margin)
-	tl_left_margin += 10;
-	for ( auto &G : groups )
-		for ( auto &J : G )
-			g_object_set( (GObject*)J.da,
-				      "can-focus", TRUE,
-				      "app-paintable", TRUE,
-				      "height-request", tl_height,
-				      "width-request", tl_width + tl_left_margin + tl_right_margin,
-				      NULL);
-
-	gtk_label_set_markup(
-		lMsmtProfilePSDExtra,
-		snprintf_buf( "<small>%gsec/%gHz/%s</small>",
-			      ED->fft_params.pagesize,
-			      ED->fft_params.binsize,
-			      sigproc::welch_window_type_names[ED->fft_params.welch_window_type]));
-
-	gtk_label_set_markup(
-		lMsmtProfileMCExtra,
-		snprintf_buf( "<small>%gHz/%g/%g</small>",
-			      ED->mc_params.bandwidth,
-			      ED->mc_params.iir_backpolate,
-			      ED->mc_params.mc_gain));
-
-	suppress_redraw = false;
-//	set_cursor_busy( false, (GtkWidget*)wMainWindow);
-	gtk_widget_show_all( (GtkWidget*)(cMeasurements));
+        tl_left_margin += 10;
+        for ( auto &G : groups )
+                for ( auto &J : G )
+                        g_object_set( (GObject*)J.da,
+                                      "can-focus", TRUE,
+                                      "app-paintable", TRUE,
+                                      "height-request", tl_height,
+                                      "width-request", tl_width + tl_left_margin + tl_right_margin,
+                                      NULL);
+
+        gtk_label_set_markup(
+                lMsmtProfilePSDExtra,
+                snprintf_buf( "<small>%gsec/%gHz/%s</small>",
+                              ED->fft_params.pagesize,
+                              ED->fft_params.binsize,
+                              sigproc::welch_window_type_names[ED->fft_params.welch_window_type]));
+
+        gtk_label_set_markup(
+                lMsmtProfileMCExtra,
+                snprintf_buf( "<small>%gHz/%g/%g</small>",
+                              ED->mc_params.bandwidth,
+                              ED->mc_params.iir_backpolate,
+                              ED->mc_params.mc_gain));
+
+        suppress_redraw = false;
+//        set_cursor_busy( false, (GtkWidget*)wMainWindow);
+        gtk_widget_show_all( (GtkWidget*)(cMeasurements));
 }
 
 
@@ -606,8 +606,8 @@ void
 SExpDesignUI::
 sort_subjects()
 {
-	for ( auto Gi = groups.begin(); Gi != groups.end(); ++Gi )
-		Gi->sort();
+        for ( auto Gi = groups.begin(); Gi != groups.end(); ++Gi )
+                Gi->sort();
 }
 
 
@@ -615,46 +615,46 @@ bool
 SExpDesignUI::SSubjectPresentation::
 operator<( const SSubjectPresentation& rv) const
 {
-	if ( _p._p.sort_segregate and csubject.gender != rv.csubject.gender )
-		return csubject.gender < rv.csubject.gender;
-
-	bool	result = false,
-		unsure = true; // avoid swapping if result == false
-	switch ( _p._p.sort_by ) {
-	case TSubjectSortBy::name:
-		result = csubject.id <  rv.csubject.id;
-		unsure = csubject.id == rv.csubject.id;
-		break;
-	case TSubjectSortBy::age:
-		result = csubject.age(*_p._p._AghDi) <  rv.csubject.age(*_p._p._AghDi);
-		unsure = csubject.age(*_p._p._AghDi) == rv.csubject.age(*_p._p._AghDi);
-		break;
-	case TSubjectSortBy::admission_date:
-		result = tl_start <  rv.tl_start;
-		unsure = tl_start == rv.tl_start;
-		break;
-	case TSubjectSortBy::avg_profile_power:
-		if ( cprofile and rv.cprofile ) {
-			result = cprofile->metric_avg() < rv.cprofile->metric_avg();
-			unsure = false;
-		} else {
-			result = false;
-			unsure = false;
-		}
-		break;
-	}
-
-	if ( unsure )
-		return false;
-	if ( _p._p.sort_ascending )
-		result = !result;
-
-	return result;
+        if ( _p._p.sort_segregate and csubject.gender != rv.csubject.gender )
+                return csubject.gender < rv.csubject.gender;
+
+        bool        result = false,
+                unsure = true; // avoid swapping if result == false
+        switch ( _p._p.sort_by ) {
+        case TSubjectSortBy::name:
+                result = csubject.id <  rv.csubject.id;
+                unsure = csubject.id == rv.csubject.id;
+                break;
+        case TSubjectSortBy::age:
+                result = csubject.age(*_p._p._AghDi) <  rv.csubject.age(*_p._p._AghDi);
+                unsure = csubject.age(*_p._p._AghDi) == rv.csubject.age(*_p._p._AghDi);
+                break;
+        case TSubjectSortBy::admission_date:
+                result = tl_start <  rv.tl_start;
+                unsure = tl_start == rv.tl_start;
+                break;
+        case TSubjectSortBy::avg_profile_power:
+                if ( cprofile and rv.cprofile ) {
+                        result = cprofile->metric_avg() < rv.cprofile->metric_avg();
+                        unsure = false;
+                } else {
+                        result = false;
+                        unsure = false;
+                }
+                break;
+        }
+
+        if ( unsure )
+                return false;
+        if ( _p._p.sort_ascending )
+                result = !result;
+
+        return result;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/settings_cb.cc b/upstream/src/aghermann/ui/mw/settings_cb.cc
index 62cfc19..2d2e8a0 100644
--- a/upstream/src/aghermann/ui/mw/settings_cb.cc
+++ b/upstream/src/aghermann/ui/mw/settings_cb.cc
@@ -28,78 +28,78 @@ extern "C" {
 
 void
 tDesign_switch_page_cb(
-	GtkNotebook*,
-	gpointer,
-	const guint page_num,
-	const gpointer userdata)
+        GtkNotebook*,
+        gpointer,
+        const guint page_num,
+        const gpointer userdata)
 {
-	using namespace sigfile;
-	auto& ED = *(SExpDesignUI*)userdata;
+        using namespace sigfile;
+        auto& ED = *(SExpDesignUI*)userdata;
 
       // save parameters changing which should trigger tree rescan
-	if ( page_num == 0 ) {  // switching back from settings tab
+        if ( page_num == 0 ) {  // switching back from settings tab
 
-	      // collect values from widgets
-		ED.W_V1.down();
+              // collect values from widgets
+                ED.W_V1.down();
 
-		ED.ED->fft_params.pagesize = ED.FFTPageSizeValues[ED.pagesize_item];
-		ED.ED->fft_params.binsize =  ED.FFTBinSizeValues [ED.binsize_item];
+                ED.ED->fft_params.pagesize = ED.FFTPageSizeValues[ED.pagesize_item];
+                ED.ED->fft_params.binsize =  ED.FFTBinSizeValues [ED.binsize_item];
 
-		try { ED.ED->fft_params.check(); }
-		catch (invalid_argument ex) {
-			pop_ok_message( ED.wMainWindow,
-					"Invalid FFT parameters", "Resetting to defaults.");
-			ED.ED->fft_params.reset();
-		}
+                try { ED.ED->fft_params.check(); }
+                catch (invalid_argument ex) {
+                        pop_ok_message( ED.wMainWindow,
+                                        "Invalid FFT parameters", "Resetting to defaults.");
+                        ED.ED->fft_params.reset();
+                }
 
-		try {
-			ED.ED->mc_params.check();
-		} catch (invalid_argument ex) {
-			pop_ok_message( ED.wMainWindow, "Invalid uC parameters", "Resetting to defaults.");
-			ED.ED->mc_params.reset();
-		}
+                try {
+                        ED.ED->mc_params.check();
+                } catch (invalid_argument ex) {
+                        pop_ok_message( ED.wMainWindow, "Invalid uC parameters", "Resetting to defaults.");
+                        ED.ED->mc_params.reset();
+                }
 
-		ED.adjust_op_freq_spinbuttons();
+                ED.adjust_op_freq_spinbuttons();
 
 #ifdef _OPENMP
-		omp_set_num_threads(
-			(ED.ED->num_threads == 0)
-			? agh::global::num_procs
-			: ED.ED->num_threads);
+                omp_set_num_threads(
+                        (ED.ED->num_threads == 0)
+                        ? agh::global::num_procs
+                        : ED.ED->num_threads);
 #endif
-	      // scan as necessary
-		if ( ED.pagesize_item_saved	  		!= ED.pagesize_item ||
-		     ED.binsize_item_saved	  		!= ED.binsize_item ||
-		     ED.fft_params_plan_type_saved  		!= ED.ED->fft_params.plan_type ||
-		     ED.fft_params_welch_window_type_saved  	!= ED.ED->fft_params.welch_window_type ||
-		     ED.af_dampen_window_type_saved  		!= ED.ED->af_dampen_window_type ||
-		     ED.af_dampen_factor_saved	  		!= ED.ED->af_dampen_factor ||
-		     !ED.ED->mc_params.same_as( ED.mc_params_saved) ) {
-		      // rescan tree
-			ED.do_rescan_tree(); // with populate
-		} else if ( ED.tl_height_saved			!= ED.tl_height ||
-			    // recalculte mesurements layout as necessary
-			    ED.tl_pph_saved			!= ED.tl_pph )
-			ED.populate_1();
-
-	} else {
-		ED.tl_pph_saved				= ED.tl_pph;
-		ED.tl_height_saved			= ED.tl_height;
-		ED.pagesize_item_saved			= ED.pagesize_item;
-		ED.binsize_item_saved			= ED.binsize_item;
-		ED.fft_params_welch_window_type_saved	= ED.ED->fft_params.welch_window_type;
-		ED.fft_params_plan_type_saved		= ED.ED->fft_params.plan_type;
-		ED.af_dampen_window_type_saved		= ED.ED->af_dampen_window_type;
-		ED.af_dampen_factor_saved		= ED.ED->af_dampen_factor;
-		ED.mc_params_saved			= ED.ED->mc_params;
-
-		ED.pagesize_item = ED.figure_pagesize_item();
-		ED.binsize_item = ED.figure_binsize_item();
-
-		ED.W_V1.up();
-
-		// colours are served specially elsewhere
-	}
+              // scan as necessary
+                if ( ED.pagesize_item_saved                          != ED.pagesize_item ||
+                     ED.binsize_item_saved                          != ED.binsize_item ||
+                     ED.fft_params_plan_type_saved                  != ED.ED->fft_params.plan_type ||
+                     ED.fft_params_welch_window_type_saved          != ED.ED->fft_params.welch_window_type ||
+                     ED.af_dampen_window_type_saved                  != ED.ED->af_dampen_window_type ||
+                     ED.af_dampen_factor_saved                          != ED.ED->af_dampen_factor ||
+                     !ED.ED->mc_params.same_as( ED.mc_params_saved) ) {
+                      // rescan tree
+                        ED.do_rescan_tree(); // with populate
+                } else if ( ED.tl_height_saved                        != ED.tl_height ||
+                            // recalculte mesurements layout as necessary
+                            ED.tl_pph_saved                        != ED.tl_pph )
+                        ED.populate_1();
+
+        } else {
+                ED.tl_pph_saved                                = ED.tl_pph;
+                ED.tl_height_saved                        = ED.tl_height;
+                ED.pagesize_item_saved                        = ED.pagesize_item;
+                ED.binsize_item_saved                        = ED.binsize_item;
+                ED.fft_params_welch_window_type_saved        = ED.ED->fft_params.welch_window_type;
+                ED.fft_params_plan_type_saved                = ED.ED->fft_params.plan_type;
+                ED.af_dampen_window_type_saved                = ED.ED->af_dampen_window_type;
+                ED.af_dampen_factor_saved                = ED.ED->af_dampen_factor;
+                ED.mc_params_saved                        = ED.ED->mc_params;
+
+                ED.pagesize_item = ED.figure_pagesize_item();
+                ED.binsize_item = ED.figure_binsize_item();
+
+                ED.W_V1.up();
+
+                // colours are served specially elsewhere
+        }
 }
 
 
@@ -117,107 +117,107 @@ namespace {
 void
 __adjust_adjustments( SExpDesignUI& ED)
 {
-	using namespace agh::ach;
-	for ( size_t t = 0; t < (size_t)TTunable::_basic_tunables; ++t ) {
-		gtk_adjustment_configure(
-			ED.jTunable[t][0],
-			stock[t].display_scale_factor * ED.ED->tunables0[t],
-			stock[t].display_scale_factor * ED.ED->tlo[t],
-			stock[t].display_scale_factor * ED.ED->thi[t],
-			stock[t].adj_step, 10 * stock[t].adj_step,
-			0);
-		gtk_adjustment_configure(
-			ED.jTunable[t][1],
-			stock[t].display_scale_factor * ED.ED->tlo[t],
-			0,
-			stock[t].display_scale_factor * ED.ED->thi[t],
-			stock[t].adj_step, 10 * stock[t].adj_step,
-			0);
-		gtk_adjustment_configure(
-			ED.jTunable[t][2],
-			stock[t].display_scale_factor * ED.ED->thi[t],
-			stock[t].display_scale_factor * ED.ED->tlo[t],
-			stock[t].display_scale_factor * ED.ED->thi[t] * 1.5,
-			stock[t].adj_step, 10 * stock[t].adj_step,
-			0);
-		gtk_adjustment_configure(
-			ED.jTunable[t][3],
-			stock[t].display_scale_factor * ED.ED->tstep[t],
-			stock[t].display_scale_factor * ED.ED->tunables0[t] / 1000.,
-			stock[t].display_scale_factor * ED.ED->tunables0[t] / 2,
-			stock[t].adj_step, 10 * stock[t].adj_step,
-			0);
-	}
+        using namespace agh::ach;
+        for ( size_t t = 0; t < (size_t)TTunable::_basic_tunables; ++t ) {
+                gtk_adjustment_configure(
+                        ED.jTunable[t][0],
+                        stock[t].display_scale_factor * ED.ED->tunables0[t],
+                        stock[t].display_scale_factor * ED.ED->tlo[t],
+                        stock[t].display_scale_factor * ED.ED->thi[t],
+                        stock[t].adj_step, 10 * stock[t].adj_step,
+                        0);
+                gtk_adjustment_configure(
+                        ED.jTunable[t][1],
+                        stock[t].display_scale_factor * ED.ED->tlo[t],
+                        0,
+                        stock[t].display_scale_factor * ED.ED->thi[t],
+                        stock[t].adj_step, 10 * stock[t].adj_step,
+                        0);
+                gtk_adjustment_configure(
+                        ED.jTunable[t][2],
+                        stock[t].display_scale_factor * ED.ED->thi[t],
+                        stock[t].display_scale_factor * ED.ED->tlo[t],
+                        stock[t].display_scale_factor * ED.ED->thi[t] * 1.5,
+                        stock[t].adj_step, 10 * stock[t].adj_step,
+                        0);
+                gtk_adjustment_configure(
+                        ED.jTunable[t][3],
+                        stock[t].display_scale_factor * ED.ED->tstep[t],
+                        stock[t].display_scale_factor * ED.ED->tunables0[t] / 1000.,
+                        stock[t].display_scale_factor * ED.ED->tunables0[t] / 2,
+                        stock[t].adj_step, 10 * stock[t].adj_step,
+                        0);
+        }
 }
 
 void
 __adjust_tunables_up( SExpDesignUI& ED)
 {
-	using namespace agh::ach;
-	for ( size_t t = 0; t < TTunable::_basic_tunables; ++t ) {
-		ED.ED->tunables0 [t] *= stock[t].display_scale_factor;
-		ED.ED->tlo       [t] *= stock[t].display_scale_factor;
-		ED.ED->thi       [t] *= stock[t].display_scale_factor;
-		ED.ED->tstep     [t] *= stock[t].display_scale_factor;
-	}
+        using namespace agh::ach;
+        for ( size_t t = 0; t < TTunable::_basic_tunables; ++t ) {
+                ED.ED->tunables0 [t] *= stock[t].display_scale_factor;
+                ED.ED->tlo       [t] *= stock[t].display_scale_factor;
+                ED.ED->thi       [t] *= stock[t].display_scale_factor;
+                ED.ED->tstep     [t] *= stock[t].display_scale_factor;
+        }
 }
 
 void
 __adjust_tunables_down( SExpDesignUI& ED)
 {
-	using namespace agh::ach;
-	for ( size_t t = 0; t < TTunable::_basic_tunables; ++t ) {
-		ED.ED->tunables0 [t] /= stock[t].display_scale_factor;
-		ED.ED->tlo       [t] /= stock[t].display_scale_factor;
-		ED.ED->thi       [t] /= stock[t].display_scale_factor;
-		ED.ED->tstep     [t] /= stock[t].display_scale_factor;
-	}
+        using namespace agh::ach;
+        for ( size_t t = 0; t < TTunable::_basic_tunables; ++t ) {
+                ED.ED->tunables0 [t] /= stock[t].display_scale_factor;
+                ED.ED->tlo       [t] /= stock[t].display_scale_factor;
+                ED.ED->thi       [t] /= stock[t].display_scale_factor;
+                ED.ED->tstep     [t] /= stock[t].display_scale_factor;
+        }
 }
 
 } // namespace
 
 void
 tSimulations_switch_page_cb(
-	GtkNotebook*,
-	gpointer,
-	const guint page_num,
-	const gpointer userdata)
+        GtkNotebook*,
+        gpointer,
+        const guint page_num,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	if ( page_num == 1 ) {  // switching to display parameters tab
-		agh::str::decompose_double(
-			ED.ED->ctl_params0.siman_params.t_min,
-			&ED.ctl_params0_siman_params_t_min_mantissa,
-			&ED.ctl_params0_siman_params_t_min_exponent);
-		agh::str::decompose_double(
-			ED.ED->ctl_params0.siman_params.t_initial,
-			&ED.ctl_params0_siman_params_t_initial_mantissa,
-			&ED.ctl_params0_siman_params_t_initial_exponent);
-		__adjust_adjustments( ED);
-		__adjust_tunables_up( ED);
-		ED.W_Vtunables.up();
-		ED.W_V2.up();
-		for ( auto& t : {ED.eCtlParamDBAmendment1,
-				 ED.eCtlParamDBAmendment2,
-				 ED.eCtlParamAZAmendment1} ) {
-			g_signal_emit_by_name( t, "toggled");
-			g_signal_emit_by_name( t, "toggled");
-		}
-	} else {
-		ED.W_V2.down();
-		ED.W_Vtunables.down();
-		__adjust_tunables_down( ED);
-		ED.ED->ctl_params0.siman_params.t_min =
-			ED.ctl_params0_siman_params_t_min_mantissa
-			* pow(10, ED.ctl_params0_siman_params_t_min_exponent);
-		ED.ED->ctl_params0.siman_params.t_initial =
-			ED.ctl_params0_siman_params_t_initial_mantissa
-			* pow(10, ED.ctl_params0_siman_params_t_initial_exponent);
-
-	      // for ctlparam changes to take effect on virgin modruns
-		ED.populate_2();
-	}
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        if ( page_num == 1 ) {  // switching to display parameters tab
+                agh::str::decompose_double(
+                        ED.ED->ctl_params0.siman_params.t_min,
+                        &ED.ctl_params0_siman_params_t_min_mantissa,
+                        &ED.ctl_params0_siman_params_t_min_exponent);
+                agh::str::decompose_double(
+                        ED.ED->ctl_params0.siman_params.t_initial,
+                        &ED.ctl_params0_siman_params_t_initial_mantissa,
+                        &ED.ctl_params0_siman_params_t_initial_exponent);
+                __adjust_adjustments( ED);
+                __adjust_tunables_up( ED);
+                ED.W_Vtunables.up();
+                ED.W_V2.up();
+                for ( auto& t : {ED.eCtlParamDBAmendment1,
+                                 ED.eCtlParamDBAmendment2,
+                                 ED.eCtlParamAZAmendment1} ) {
+                        g_signal_emit_by_name( t, "toggled");
+                        g_signal_emit_by_name( t, "toggled");
+                }
+        } else {
+                ED.W_V2.down();
+                ED.W_Vtunables.down();
+                __adjust_tunables_down( ED);
+                ED.ED->ctl_params0.siman_params.t_min =
+                        ED.ctl_params0_siman_params_t_min_mantissa
+                        * pow(10, ED.ctl_params0_siman_params_t_min_exponent);
+                ED.ED->ctl_params0.siman_params.t_initial =
+                        ED.ctl_params0_siman_params_t_initial_mantissa
+                        * pow(10, ED.ctl_params0_siman_params_t_initial_exponent);
+
+              // for ctlparam changes to take effect on virgin modruns
+                ED.populate_2();
+        }
 }
 
 
@@ -225,75 +225,75 @@ tSimulations_switch_page_cb(
 
 void
 bSimParamRevertTunables_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	ED.ED->tunables0.set_defaults();
-	ED.ED->tlo.set_defaults();
-	ED.ED->thi.set_defaults();
-	ED.ED->tstep.set_defaults();
+        ED.ED->tunables0.set_defaults();
+        ED.ED->tlo.set_defaults();
+        ED.ED->thi.set_defaults();
+        ED.ED->tstep.set_defaults();
 
-	__adjust_tunables_up( ED);
-	ED.W_Vtunables.up();
+        __adjust_tunables_up( ED);
+        ED.W_Vtunables.up();
 }
 
 
 void
 eCtlParamDBAmendment1_toggled_cb(
-	GtkToggleButton *button,
-	const gpointer userdata)
+        GtkToggleButton *button,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	gtk_label_set_markup(
-		ED.lCtlParamDBAmendment1,
-		gtk_toggle_button_get_active( button)
-		? "<small>Let SWA be affected by <i>S</i> at all times</small>"
-		: "<small>Cancel <i>rc</i>-dependent SWA increase in Wake</small>");
+        auto& ED = *(SExpDesignUI*)userdata;
+        gtk_label_set_markup(
+                ED.lCtlParamDBAmendment1,
+                gtk_toggle_button_get_active( button)
+                ? "<small>Let SWA be affected by <i>S</i> at all times</small>"
+                : "<small>Cancel <i>rc</i>-dependent SWA increase in Wake</small>");
 }
 
 void
 eCtlParamDBAmendment2_toggled_cb(
-	GtkToggleButton *button,
-	const gpointer userdata)
+        GtkToggleButton *button,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	gtk_label_set_markup(
-		ED.lCtlParamDBAmendment2,
-		gtk_toggle_button_get_active( button)
-		? "<small>Assume sleep homeostat is stable (<i>S</i><sub>24h</sub> = <i>S</i><sub>0</sub>)</small>"
-		: "<small>Don't assume <i>S</i><sub>24h</sub> = <i>S</i><sub>0</sub></small>");
+        auto& ED = *(SExpDesignUI*)userdata;
+        gtk_label_set_markup(
+                ED.lCtlParamDBAmendment2,
+                gtk_toggle_button_get_active( button)
+                ? "<small>Assume sleep homeostat is stable (<i>S</i><sub>24h</sub> = <i>S</i><sub>0</sub>)</small>"
+                : "<small>Don't assume <i>S</i><sub>24h</sub> = <i>S</i><sub>0</sub></small>");
 }
 
 void
 eCtlParamAZAmendment1_toggled_cb(
-	GtkToggleButton *button,
-	const gpointer userdata)
+        GtkToggleButton *button,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	gtk_label_set_markup(
-		ED.lCtlParamAZAmendment1,
-		gtk_toggle_button_get_active( button)
-		? "<small>Compute <i>gc</i> per-episode</small>"
-		: "<small>Assume <i>gc</i> is not variable across episodes</small>");
+        auto& ED = *(SExpDesignUI*)userdata;
+        gtk_label_set_markup(
+                ED.lCtlParamAZAmendment1,
+                gtk_toggle_button_get_active( button)
+                ? "<small>Compute <i>gc</i> per-episode</small>"
+                : "<small>Assume <i>gc</i> is not variable across episodes</small>");
 }
 
 // -------- colours
 void
 bColourX_color_set_cb(
-	GtkColorButton*,
-	const gpointer userdata)
+        GtkColorButton*,
+        const gpointer userdata)
 {
-	auto& mc = *(SManagedColor*)userdata;
-	mc.acquire();
+        auto& mc = *(SManagedColor*)userdata;
+        mc.acquire();
 }
 
 } // extern "C"
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/simulations.cc b/upstream/src/aghermann/ui/mw/simulations.cc
index 693c362..592b5dc 100644
--- a/upstream/src/aghermann/ui/mw/simulations.cc
+++ b/upstream/src/aghermann/ui/mw/simulations.cc
@@ -20,104 +20,104 @@ void
 SExpDesignUI::
 populate_2()
 {
-	gtk_tree_store_clear( mSimulations);
+        gtk_tree_store_clear( mSimulations);
 
       // clean up
-	ED->prune_untried_modruns();
-	GtkTreeIter iter_g, iter_j, iter_m, iter_h;
-
-	for ( auto &G : ED->groups ) {
-
-		gtk_tree_store_append( mSimulations, &iter_g, NULL);
-		gtk_tree_store_set( mSimulations, &iter_g,
-				    0, G.first.c_str(),
-				    msimulations_visibility_switch_col, TRUE,
-				    -1);
-
-		for ( auto &J : G.second ) {
-			auto& EE = J.measurements[*_AghDi];
-			if ( not J.have_session(*_AghDi) or
-			     EE.episodes.empty() ) // subject lacking one
-				continue;
-
-			gtk_tree_store_append( mSimulations, &iter_j, &iter_g);
-			gtk_tree_store_set( mSimulations, &iter_j,
-					    0, J.id.c_str(),
-					    msimulations_visibility_switch_col, TRUE,
-					    -1);
-
-		      // collect previously obtained modruns
-			for ( auto &MS : EE.modrun_sets ) {
-				const agh::SProfileParamSet& P = MS.first;
-				gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
-				gtk_tree_store_set( mSimulations, &iter_m,
-						    0, P.display_name().c_str(),
-						    msimulations_visibility_switch_col, TRUE,
-						    -1);
-
-				for ( auto &HS : MS.second ) {
-					const string& H = HS.first;
-					const agh::ach::CModelRun& M = HS.second;
-
-					gtk_tree_store_append( mSimulations, &iter_h, &iter_m);
-					gtk_tree_store_set( mSimulations, &iter_h,
-							    0, H.c_str(),
-							    msimulations_visibility_switch_col, TRUE,
-							    -1);
-
-					// status (put CF here)
-					snprintf_buf( "CF = %g", M.cf);
-					gtk_tree_store_set( mSimulations, &iter_h,
-							    1, global::buf,
-							    msimulations_modref_col, &M,
-							    -1);
-
-					// tunable columns
-					for ( size_t t = 0; t < M.tx.size(); ++t ) {
-						auto tg = min(t, (size_t)agh::ach::TTunable::_basic_tunables - 1);
-						const auto& td = agh::ach::stock[tg];
-						snprintf_buf( td.fmt,
-							      M.tx[t] * td.display_scale_factor);
-						gtk_tree_store_set( mSimulations, &iter_h,
-								    2+t, global::buf, -1);
-					}
-				}
-			}
-		      // and a virgin offering
-			auto P_new = make_active_profile_paramset();
-			auto Mi = EE.modrun_sets.find( P_new);
-			if ( Mi == EE.modrun_sets.end() ||
-			     Mi->second.find( AghT()) == Mi->second.end() ) {
-
-				gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
-				gtk_tree_store_set( mSimulations, &iter_m,
-						    0, P_new.display_name().c_str(),
-						    -1);
-				gtk_tree_store_append( mSimulations, &iter_h, &iter_m);
-				gtk_tree_store_set( mSimulations, &iter_h,
-						    0, AghT(),
-						    -1);
-
-				agh::ach::CModelRun *virgin;
-				int retval =
-					ED->setup_modrun( J.id.c_str(), AghD(), AghT(),
-							  P_new,
-							  &virgin);
-				if ( retval ) {
-					gtk_tree_store_set( mSimulations, &iter_h,
-							    1, agh::str::tokens_trimmed( agh::CProfile::explain_status( retval), ";").front().c_str(),
-							    msimulations_modref_col, NULL,
-							    -1);
-				} else {
-					gtk_tree_store_set( mSimulations, &iter_h,
-							    1, "(untried — dbl-click to run)",
-							    msimulations_modref_col, virgin,
-							    -1);
-				}
-			}
-		}
-	}
-	gtk_tree_view_expand_all( tvSimulations);
+        ED->prune_untried_modruns();
+        GtkTreeIter iter_g, iter_j, iter_m, iter_h;
+
+        for ( auto &G : ED->groups ) {
+
+                gtk_tree_store_append( mSimulations, &iter_g, NULL);
+                gtk_tree_store_set( mSimulations, &iter_g,
+                                    0, G.first.c_str(),
+                                    msimulations_visibility_switch_col, TRUE,
+                                    -1);
+
+                for ( auto &J : G.second ) {
+                        auto& EE = J.measurements[*_AghDi];
+                        if ( not J.have_session(*_AghDi) or
+                             EE.episodes.empty() ) // subject lacking one
+                                continue;
+
+                        gtk_tree_store_append( mSimulations, &iter_j, &iter_g);
+                        gtk_tree_store_set( mSimulations, &iter_j,
+                                            0, J.id.c_str(),
+                                            msimulations_visibility_switch_col, TRUE,
+                                            -1);
+
+                      // collect previously obtained modruns
+                        for ( auto &MS : EE.modrun_sets ) {
+                                const agh::SProfileParamSet& P = MS.first;
+                                gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
+                                gtk_tree_store_set( mSimulations, &iter_m,
+                                                    0, P.display_name().c_str(),
+                                                    msimulations_visibility_switch_col, TRUE,
+                                                    -1);
+
+                                for ( auto &HS : MS.second ) {
+                                        const string& H = HS.first;
+                                        const agh::ach::CModelRun& M = HS.second;
+
+                                        gtk_tree_store_append( mSimulations, &iter_h, &iter_m);
+                                        gtk_tree_store_set( mSimulations, &iter_h,
+                                                            0, H.c_str(),
+                                                            msimulations_visibility_switch_col, TRUE,
+                                                            -1);
+
+                                        // status (put CF here)
+                                        snprintf_buf( "CF = %g", M.cf);
+                                        gtk_tree_store_set( mSimulations, &iter_h,
+                                                            1, global::buf,
+                                                            msimulations_modref_col, &M,
+                                                            -1);
+
+                                        // tunable columns
+                                        for ( size_t t = 0; t < M.tx.size(); ++t ) {
+                                                auto tg = min(t, (size_t)agh::ach::TTunable::_basic_tunables - 1);
+                                                const auto& td = agh::ach::stock[tg];
+                                                snprintf_buf( td.fmt,
+                                                              M.tx[t] * td.display_scale_factor);
+                                                gtk_tree_store_set( mSimulations, &iter_h,
+                                                                    2+t, global::buf, -1);
+                                        }
+                                }
+                        }
+                      // and a virgin offering
+                        auto P_new = make_active_profile_paramset();
+                        auto Mi = EE.modrun_sets.find( P_new);
+                        if ( Mi == EE.modrun_sets.end() ||
+                             Mi->second.find( AghT()) == Mi->second.end() ) {
+
+                                gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
+                                gtk_tree_store_set( mSimulations, &iter_m,
+                                                    0, P_new.display_name().c_str(),
+                                                    -1);
+                                gtk_tree_store_append( mSimulations, &iter_h, &iter_m);
+                                gtk_tree_store_set( mSimulations, &iter_h,
+                                                    0, AghT(),
+                                                    -1);
+
+                                agh::ach::CModelRun *virgin;
+                                int retval =
+                                        ED->setup_modrun( J.id.c_str(), AghD(), AghT(),
+                                                          P_new,
+                                                          &virgin);
+                                if ( retval ) {
+                                        gtk_tree_store_set( mSimulations, &iter_h,
+                                                            1, agh::str::tokens_trimmed( agh::CProfile::explain_status( retval), ";").front().c_str(),
+                                                            msimulations_modref_col, NULL,
+                                                            -1);
+                                } else {
+                                        gtk_tree_store_set( mSimulations, &iter_h,
+                                                            1, "(untried — dbl-click to run)",
+                                                            msimulations_modref_col, virgin,
+                                                            -1);
+                                }
+                        }
+                }
+        }
+        gtk_tree_view_expand_all( tvSimulations);
 }
 
 
@@ -125,14 +125,14 @@ void
 SExpDesignUI::
 cleanup_2()
 {
-	ED->prune_untried_modruns();
-	//populate( false);
+        ED->prune_untried_modruns();
+        //populate( false);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/simulations_cb.cc b/upstream/src/aghermann/ui/mw/simulations_cb.cc
index c096470..82309ea 100644
--- a/upstream/src/aghermann/ui/mw/simulations_cb.cc
+++ b/upstream/src/aghermann/ui/mw/simulations_cb.cc
@@ -21,180 +21,180 @@ extern "C" {
 
 void
 tvSimulations_row_activated_cb(
-	GtkTreeView*,
-	GtkTreePath* path,
-	GtkTreeViewColumn*,
-	const gpointer userdata)
+        GtkTreeView*,
+        GtkTreePath* path,
+        GtkTreeViewColumn*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	agh::ach::CModelRun *modref;
-	GtkTreeIter iter;
-	gtk_tree_model_get_iter( (GtkTreeModel*)ED.mSimulations, &iter, path);
-	gtk_tree_model_get( (GtkTreeModel*)ED.mSimulations, &iter,
-			    ED.msimulations_modref_col, &modref,
-			    -1);
-	if ( modref )
-		new SModelrunFacility( *modref, ED);
+        auto& ED = *(SExpDesignUI*)userdata;
+        agh::ach::CModelRun *modref;
+        GtkTreeIter iter;
+        gtk_tree_model_get_iter( (GtkTreeModel*)ED.mSimulations, &iter, path);
+        gtk_tree_model_get( (GtkTreeModel*)ED.mSimulations, &iter,
+                            ED.msimulations_modref_col, &modref,
+                            -1);
+        if ( modref )
+                new SModelrunFacility( *modref, ED);
 }
 
 
 
 void
 iSimulationsRunBatch_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
+        auto& ED = *(SExpDesignUI*)userdata;
 
-	gtk_entry_set_text( ED.eBatchSetupSubjects, agh::str::join( ED.ED->enumerate_subjects(), "; ").c_str());
-	gtk_entry_set_text( ED.eBatchSetupSessions, agh::str::join( ED.ED->enumerate_sessions(), "; ").c_str());
-	gtk_entry_set_text( ED.eBatchSetupChannels, sigfile::join_channel_names( ED.ED->enumerate_eeg_channels(), "; ").c_str());
+        gtk_entry_set_text( ED.eBatchSetupSubjects, agh::str::join( ED.ED->enumerate_subjects(), "; ").c_str());
+        gtk_entry_set_text( ED.eBatchSetupSessions, agh::str::join( ED.ED->enumerate_sessions(), "; ").c_str());
+        gtk_entry_set_text( ED.eBatchSetupChannels, sigfile::join_channel_names( ED.ED->enumerate_eeg_channels(), "; ").c_str());
 
       // prevent inapplicable inputs when type == mc
-	switch ( ED.display_profile_type ) {
-	case metrics::TType::psd:
-	{	auto bw = ED.active_profile_psd_freq_upto - ED.active_profile_psd_freq_from;
-		gtk_spin_button_set_value( ED.eBatchSetupRangeWidth, bw);
-		gtk_spin_button_set_value( ED.eBatchSetupRangeInc, bw);
-	}
-		for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
-			gtk_widget_set_visible( (GtkWidget*)W, TRUE);
-	    break;
-	case metrics::TType::swu:
-		gtk_spin_button_set_value( ED.eBatchSetupRangeFrom, ED.active_profile_swu_f0);
-		for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
-			gtk_widget_set_visible( (GtkWidget*)W, FALSE);
-	    break;
-	case metrics::TType::mc:
-		gtk_spin_button_set_value( ED.eBatchSetupRangeFrom, ED.active_profile_mc_f0);
-		for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
-			gtk_widget_set_visible( (GtkWidget*)W, FALSE);
-	    break;
-	default:
-	    break;
-	}
-
-	if ( gtk_dialog_run( ED.wBatchSetup) == GTK_RESPONSE_OK ) {
-		SBusyBlock bb (ED.wMainWindow);
-
-		ED.ED->prune_untried_modruns();
-		ED.populate_2();
-
-		list<string>
-			use_subjects = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupSubjects), ";"),
-			use_sessions = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupSessions), ";"),
-			use_channels = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupChannels), ";");
-		double	freq_from  = gtk_spin_button_get_value( ED.eBatchSetupRangeFrom),
-			freq_width = gtk_spin_button_get_value( ED.eBatchSetupRangeWidth),
-			freq_inc   = gtk_spin_button_get_value( ED.eBatchSetupRangeInc);
-		size_t	freq_steps = gtk_spin_button_get_value( ED.eBatchSetupRangeSteps);
-
-		for ( auto& J : use_subjects )
-			for ( auto& D : use_sessions )
-				for ( auto& H : use_channels ) {
-					switch ( ED.display_profile_type ) {
-					case metrics::TType::psd:
-					{	auto	this_freq_from = freq_from,
-							this_freq_upto = freq_from + freq_width;
-						for ( size_t step = 0; step < freq_steps;
-						      ++step, this_freq_from += freq_inc, this_freq_upto += freq_inc ) {
-							ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
-									     agh::SProfileParamSet (
-										     agh::SProfileParamSet::PSD {
-											     this_freq_from, this_freq_upto
-										     }
-									     ),
-									     nullptr);
-						}
-					}   break;
-					case metrics::TType::swu:
-						ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
-								     agh::SProfileParamSet (
-									     agh::SProfileParamSet::SWU {freq_from}
-								     ),
-								     nullptr);
-					    break;
-					case metrics::TType::mc:
-						ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
-								     agh::SProfileParamSet (
-									     agh::SProfileParamSet::MC {freq_from}
-								     ),
-								     nullptr);
-					    break;
-					default:
-						throw runtime_error ("What metric is this?");
-					}
-				}
-		using namespace agh;
-		CExpDesign::TModelRunOpFun F =
-			[]( ach::CModelRun& R)
-			{
-				R.watch_simplex_move( nullptr);
-			};
-		CExpDesign::TModelRunReportFun report =
-			[&ED]( const CJGroup&,
-			       const CSubject& J,
-			       const string& D,
-			       const agh::SProfileParamSet& T,
-			       const string& H,
-			       const ach::CModelRun&,
-			       size_t i, size_t n)
-			{
-				ED.sb_message(
-					snprintf_buf(
-						"(%zu of %zu) Running simulation in channel %s (%s) for %s (session %s) ...",
-						i, n, H.c_str(), T.display_name().c_str(),
-						J.id.c_str(), D.c_str()));
-				gtk_flush();
-			};
-		CExpDesign::TModelRunFilterFun filter =
-			[]( ach::CModelRun&) -> bool
-			{
-				return true;
-			};
-		ED.ED->for_all_modruns( F, report, filter);
-
-		ED.populate_2();
-
-		ED.sb_message( "Done");
-	}
+        switch ( ED.display_profile_type ) {
+        case metrics::TType::psd:
+        {        auto bw = ED.active_profile_psd_freq_upto - ED.active_profile_psd_freq_from;
+                gtk_spin_button_set_value( ED.eBatchSetupRangeWidth, bw);
+                gtk_spin_button_set_value( ED.eBatchSetupRangeInc, bw);
+        }
+                for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
+                        gtk_widget_set_visible( (GtkWidget*)W, TRUE);
+            break;
+        case metrics::TType::swu:
+                gtk_spin_button_set_value( ED.eBatchSetupRangeFrom, ED.active_profile_swu_f0);
+                for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
+                        gtk_widget_set_visible( (GtkWidget*)W, FALSE);
+            break;
+        case metrics::TType::mc:
+                gtk_spin_button_set_value( ED.eBatchSetupRangeFrom, ED.active_profile_mc_f0);
+                for( auto& W : {ED.eBatchSetupRangeWidth, ED.eBatchSetupRangeInc, ED.eBatchSetupRangeSteps})
+                        gtk_widget_set_visible( (GtkWidget*)W, FALSE);
+            break;
+        default:
+            break;
+        }
+
+        if ( gtk_dialog_run( ED.wBatchSetup) == GTK_RESPONSE_OK ) {
+                SBusyBlock bb (ED.wMainWindow);
+
+                ED.ED->prune_untried_modruns();
+                ED.populate_2();
+
+                list<string>
+                        use_subjects = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupSubjects), ";"),
+                        use_sessions = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupSessions), ";"),
+                        use_channels = agh::str::tokens_trimmed( gtk_entry_get_text( ED.eBatchSetupChannels), ";");
+                double        freq_from  = gtk_spin_button_get_value( ED.eBatchSetupRangeFrom),
+                        freq_width = gtk_spin_button_get_value( ED.eBatchSetupRangeWidth),
+                        freq_inc   = gtk_spin_button_get_value( ED.eBatchSetupRangeInc);
+                size_t        freq_steps = gtk_spin_button_get_value( ED.eBatchSetupRangeSteps);
+
+                for ( auto& J : use_subjects )
+                        for ( auto& D : use_sessions )
+                                for ( auto& H : use_channels ) {
+                                        switch ( ED.display_profile_type ) {
+                                        case metrics::TType::psd:
+                                        {        auto        this_freq_from = freq_from,
+                                                        this_freq_upto = freq_from + freq_width;
+                                                for ( size_t step = 0; step < freq_steps;
+                                                      ++step, this_freq_from += freq_inc, this_freq_upto += freq_inc ) {
+                                                        ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
+                                                                             agh::SProfileParamSet (
+                                                                                     agh::SProfileParamSet::PSD {
+                                                                                             this_freq_from, this_freq_upto
+                                                                                     }
+                                                                             ),
+                                                                             nullptr);
+                                                }
+                                        }   break;
+                                        case metrics::TType::swu:
+                                                ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
+                                                                     agh::SProfileParamSet (
+                                                                             agh::SProfileParamSet::SWU {freq_from}
+                                                                     ),
+                                                                     nullptr);
+                                            break;
+                                        case metrics::TType::mc:
+                                                ED.ED->setup_modrun( J.c_str(), D.c_str(), H.c_str(),
+                                                                     agh::SProfileParamSet (
+                                                                             agh::SProfileParamSet::MC {freq_from}
+                                                                     ),
+                                                                     nullptr);
+                                            break;
+                                        default:
+                                                throw runtime_error ("What metric is this?");
+                                        }
+                                }
+                using namespace agh;
+                CExpDesign::TModelRunOpFun F =
+                        []( ach::CModelRun& R)
+                        {
+                                R.watch_simplex_move( nullptr);
+                        };
+                CExpDesign::TModelRunReportFun report =
+                        [&ED]( const CJGroup&,
+                               const CSubject& J,
+                               const string& D,
+                               const agh::SProfileParamSet& T,
+                               const string& H,
+                               const ach::CModelRun&,
+                               size_t i, size_t n)
+                        {
+                                ED.sb_message(
+                                        snprintf_buf(
+                                                "(%zu of %zu) Running simulation in channel %s (%s) for %s (session %s) ...",
+                                                i, n, H.c_str(), T.display_name().c_str(),
+                                                J.id.c_str(), D.c_str()));
+                                gtk_flush();
+                        };
+                CExpDesign::TModelRunFilterFun filter =
+                        []( ach::CModelRun&) -> bool
+                        {
+                                return true;
+                        };
+                ED.ED->for_all_modruns( F, report, filter);
+
+                ED.populate_2();
+
+                ED.sb_message( "Done");
+        }
 }
 
 
 void
 iSimulationsRunClearAll_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.ED->remove_all_modruns();
-	ED.populate_2();
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.ED->remove_all_modruns();
+        ED.populate_2();
 }
 
 
 
 void
 iSimulationsReportGenerate_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-
-	auto f_chooser =
-		(GtkDialog*)gtk_file_chooser_dialog_new(
-			"Export Simulation Details",
-			NULL,
-			GTK_FILE_CHOOSER_ACTION_SAVE,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-			NULL);
-	if ( gtk_dialog_run( f_chooser) == GTK_RESPONSE_ACCEPT ) {
-		string selected = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
-		if ( not agh::str::has_suffix( selected, ".tsv", agh::str::TStrCmpCaseOption::insensitive) )
-			selected += ".tsv";
-		ED.ED->export_all_modruns( selected);
-	}
-	gtk_widget_destroy( (GtkWidget*)f_chooser);
+        auto& ED = *(SExpDesignUI*)userdata;
+
+        auto f_chooser =
+                (GtkDialog*)gtk_file_chooser_dialog_new(
+                        "Export Simulation Details",
+                        NULL,
+                        GTK_FILE_CHOOSER_ACTION_SAVE,
+                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                        NULL);
+        if ( gtk_dialog_run( f_chooser) == GTK_RESPONSE_ACCEPT ) {
+                string selected = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
+                if ( not agh::str::has_suffix( selected, ".tsv", agh::str::TStrCmpCaseOption::insensitive) )
+                        selected += ".tsv";
+                ED.ED->export_all_modruns( selected);
+        }
+        gtk_widget_destroy( (GtkWidget*)f_chooser);
 }
 
 
@@ -205,26 +205,26 @@ iSimulationsReportGenerate_activate_cb(
 // void
 // bBatchRunStop_activate_cb()
 // {
-// 	__interrupt_batch = TRUE;
+//         __interrupt_batch = TRUE;
 // }
 
 
 // void
 // iBatchRun_activate_cb()
 // {
-// 	__interrupt_batch = FALSE;
+//         __interrupt_batch = FALSE;
 
-// 	set_cursor_busy( TRUE, wMainWindow);
-// 	simview::populate();
+//         set_cursor_busy( TRUE, wMainWindow);
+//         simview::populate();
 
-// 	set_cursor_busy( FALSE, wMainWindow);
+//         set_cursor_busy( FALSE, wMainWindow);
 // }
 
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/splash.cc b/upstream/src/aghermann/ui/mw/splash.cc
index 10af910..e817db2 100644
--- a/upstream/src/aghermann/ui/mw/splash.cc
+++ b/upstream/src/aghermann/ui/mw/splash.cc
@@ -26,31 +26,31 @@ extern "C" {
 
 void
 bDownload_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.try_download();
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.try_download();
 }
 
 void
 download_process_child_exited_cb(
-	VteTerminal *terminal,
-	const gpointer userdata)
+        VteTerminal *terminal,
+        const gpointer userdata)
 {
-	auto& ED = *(SExpDesignUI*)userdata;
-	ED.set_wMainWindow_interactive( true, true);
-	int exit_status = vte_terminal_get_child_exit_status( terminal);
-	if ( exit_status != 0 )
-		pop_ok_message(
-			ED.wMainWindow,
-			"Download failed",
-			"Exit status %d. Try again next time.", exit_status);
-	ED.dl_pid = -1;
-	ED.ED->scan_tree( bind (&SExpDesignUI::sb_main_progress_indicator, &ED,
-				placeholders::_1, placeholders::_2, placeholders::_3,
-				TGtkRefreshMode::gdk));
-	ED.populate( false);
+        auto& ED = *(SExpDesignUI*)userdata;
+        ED.set_wMainWindow_interactive( true, true);
+        int exit_status = vte_terminal_get_child_exit_status( terminal);
+        if ( exit_status != 0 )
+                pop_ok_message(
+                        ED.wMainWindow,
+                        "Download failed",
+                        "Exit status %d. Try again next time.", exit_status);
+        ED.dl_pid = -1;
+        ED.ED->scan_tree( bind (&SExpDesignUI::sb_main_progress_indicator, &ED,
+                                placeholders::_1, placeholders::_2, placeholders::_3,
+                                TGtkRefreshMode::gdk));
+        ED.populate( false);
 }
 
 } // extern "C"
@@ -63,47 +63,47 @@ void
 SExpDesignUI::
 show_empty_experiment_blurb()
 {
-	gtk_container_foreach( (GtkContainer*)cMeasurements,
-			       (GtkCallback) gtk_widget_destroy,
-			       NULL);
-	const char *blurb =
-		"<b><big>Empty experiment\n</big></b>\n"
-		"When you have your recordings ready as a set of .edf files,\n"
-		"• Create your experiment tree as follows: <i>Experiment/Group/Subject/Session</i>;\n"
-		"• Have your EDF sources named <i>Episode</i>.edf, and placed in the corresponding <i>Session</i> directory.\n"
-		"\n"
-		"Once set up, either:\n"
-		"• select <b>Experiment→Close this session</b> and then select in the Session Manager the top directory of the newly created experiment tree, or\n"
-		"• select <b>Experiment→Rescan Tree</b> if this is the tree you have just populated.\n"
-		"\n"
-		"Alternatively, <b>Drag-and-Drop</b> any EDF sources onto this window and identify and place them individually.\n"
-		"\n"
-		"Or, if you have none yet, here is a <a href=\"http://johnhommer.com/academic/code/aghermann/Experiment.tar.bz2\">set of EEG data</a>, for a primer;"
-		" push the button below to download it into the current directory:";
-	GtkLabel *blurb_label = (GtkLabel*)gtk_label_new( "");
-	gtk_label_set_markup( blurb_label, blurb);
-
-	gtk_box_pack_start( (GtkBox*)cMeasurements,
-			    (GtkWidget*)blurb_label,
-			    TRUE, TRUE, 10);
-	GtkWidget *bDownload = gtk_button_new_with_label("  Get sample dataset  ");
-	g_object_set( (GObject*)bDownload,
-		      "expand", FALSE,
-		      "halign", GTK_ALIGN_CENTER,
-		      NULL);
-	g_signal_connect( bDownload, "clicked",
-			  (GCallback)bDownload_clicked_cb,
-			  this);
-	gtk_box_pack_start( (GtkBox*)cMeasurements,
-			    bDownload,
-			    FALSE, FALSE, 0);
-
-	gtk_box_pack_start( (GtkBox*)cMeasurements,
-			    (GtkWidget*)gtk_image_new_from_file(
-					    PACKAGE_DATADIR "/" PACKAGE "/idle-bg.svg"),
-			    TRUE, FALSE, 0);
-
-	gtk_widget_show_all( (GtkWidget*)cMeasurements);
+        gtk_container_foreach( (GtkContainer*)cMeasurements,
+                               (GtkCallback) gtk_widget_destroy,
+                               NULL);
+        const char *blurb =
+                "<b><big>Empty experiment\n</big></b>\n"
+                "When you have your recordings ready as a set of .edf files,\n"
+                "• Create your experiment tree as follows: <i>Experiment/Group/Subject/Session</i>;\n"
+                "• Have your EDF sources named <i>Episode</i>.edf, and placed in the corresponding <i>Session</i> directory.\n"
+                "\n"
+                "Once set up, either:\n"
+                "• select <b>Experiment→Close this session</b> and then select in the Session Manager the top directory of the newly created experiment tree, or\n"
+                "• select <b>Experiment→Rescan Tree</b> if this is the tree you have just populated.\n"
+                "\n"
+                "Alternatively, <b>Drag-and-Drop</b> any EDF sources onto this window and identify and place them individually.\n"
+                "\n"
+                "Or, if you have none yet, here is a <a href=\"http://johnhommer.com/academic/code/aghermann/Experiment.tar.bz2\">set of EEG data</a>, for a primer;"
+                " push the button below to download it into the current directory:";
+        GtkLabel *blurb_label = (GtkLabel*)gtk_label_new( "");
+        gtk_label_set_markup( blurb_label, blurb);
+
+        gtk_box_pack_start( (GtkBox*)cMeasurements,
+                            (GtkWidget*)blurb_label,
+                            TRUE, TRUE, 10);
+        GtkWidget *bDownload = gtk_button_new_with_label("  Get sample dataset  ");
+        g_object_set( (GObject*)bDownload,
+                      "expand", FALSE,
+                      "halign", GTK_ALIGN_CENTER,
+                      NULL);
+        g_signal_connect( bDownload, "clicked",
+                          (GCallback)bDownload_clicked_cb,
+                          this);
+        gtk_box_pack_start( (GtkBox*)cMeasurements,
+                            bDownload,
+                            FALSE, FALSE, 0);
+
+        gtk_box_pack_start( (GtkBox*)cMeasurements,
+                            (GtkWidget*)gtk_image_new_from_file(
+                                            PACKAGE_DATADIR "/" PACKAGE "/idle-bg.svg"),
+                            TRUE, FALSE, 0);
+
+        gtk_widget_show_all( (GtkWidget*)cMeasurements);
 }
 
 
@@ -113,54 +113,54 @@ int
 SExpDesignUI::
 try_download()
 {
-	gtk_container_foreach( (GtkContainer*)cMeasurements,
-			       (GtkCallback) gtk_widget_destroy,
-			       NULL);
-	auto tTerm = (VteTerminal*)vte_terminal_new();
-	g_signal_connect( tTerm, "child-exited",
-			  (GCallback)download_process_child_exited_cb,
-			   this);
-	gtk_box_pack_start( (GtkBox*)cMeasurements,
-			    (GtkWidget*)tTerm,
-			    TRUE, FALSE, 0);
-	set_wMainWindow_interactive( false, true);
-	// punch a hole for VteTerminal for any user ^C
-	gtk_widget_set_sensitive( (GtkWidget*)cMeasurements, TRUE);
-	gtk_widget_show_all( (GtkWidget*)cMeasurements);
-	gtk_widget_grab_focus( (GtkWidget*)tTerm);
-	GError *Error = NULL;
-	const char *argv[] = {
-		"/bin/sh", // vte_get_user_shell(),
-		"-c",
-		"source " PACKAGE_DATADIR "/" PACKAGE "/experiment-dl.sh",
-		NULL
-	};
-	vte_terminal_fork_command_full(
-		tTerm,
-		VTE_PTY_DEFAULT,
-		ED->session_dir(),
-		const_cast<char**> (argv),
-		NULL, // char **envv,
-		(GSpawnFlags)G_SPAWN_DO_NOT_REAP_CHILD, // GSpawnFlags spawn_flags,
-		NULL, // GSpawnChildSetupFunc child_setup,
-		NULL, // gpointer child_setup_data,
-		&dl_pid,
-		&Error); // GError **error);
-	if ( Error ) {
-		pop_ok_message(
-			wMainWindow,
-			"Error",
-			"%s\n", Error->message);
-		return 1;
-	} else {
-		vte_terminal_watch_child( tTerm, dl_pid);
-		return 0;
-	}
+        gtk_container_foreach( (GtkContainer*)cMeasurements,
+                               (GtkCallback) gtk_widget_destroy,
+                               NULL);
+        auto tTerm = (VteTerminal*)vte_terminal_new();
+        g_signal_connect( tTerm, "child-exited",
+                          (GCallback)download_process_child_exited_cb,
+                           this);
+        gtk_box_pack_start( (GtkBox*)cMeasurements,
+                            (GtkWidget*)tTerm,
+                            TRUE, FALSE, 0);
+        set_wMainWindow_interactive( false, true);
+        // punch a hole for VteTerminal for any user ^C
+        gtk_widget_set_sensitive( (GtkWidget*)cMeasurements, TRUE);
+        gtk_widget_show_all( (GtkWidget*)cMeasurements);
+        gtk_widget_grab_focus( (GtkWidget*)tTerm);
+        GError *Error = NULL;
+        const char *argv[] = {
+                "/bin/sh", // vte_get_user_shell(),
+                "-c",
+                "source " PACKAGE_DATADIR "/" PACKAGE "/experiment-dl.sh",
+                NULL
+        };
+        vte_terminal_fork_command_full(
+                tTerm,
+                VTE_PTY_DEFAULT,
+                ED->session_dir(),
+                const_cast<char**> (argv),
+                NULL, // char **envv,
+                (GSpawnFlags)G_SPAWN_DO_NOT_REAP_CHILD, // GSpawnFlags spawn_flags,
+                NULL, // GSpawnChildSetupFunc child_setup,
+                NULL, // gpointer child_setup_data,
+                &dl_pid,
+                &Error); // GError **error);
+        if ( Error ) {
+                pop_ok_message(
+                        wMainWindow,
+                        "Error",
+                        "%s\n", Error->message);
+                return 1;
+        } else {
+                vte_terminal_watch_child( tTerm, dl_pid);
+                return 0;
+        }
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/mw/widgets.hh b/upstream/src/aghermann/ui/mw/widgets.hh
index 70386c3..1b88e68 100644
--- a/upstream/src/aghermann/ui/mw/widgets.hh
+++ b/upstream/src/aghermann/ui/mw/widgets.hh
@@ -34,358 +34,358 @@ namespace ui {
 
 struct SExpDesignUIWidgets {
 
-	SExpDesignUIWidgets ();
+        SExpDesignUIWidgets ();
        ~SExpDesignUIWidgets ();
 
-	GtkBuilder
-		*builder;
+        GtkBuilder
+                *builder;
 
       // storage
-	// dynamic
-	GtkListStore
-		*mSessions,
-		*mEEGChannels,
-		*mAllChannels,
-		*mGlobalADProfiles;
-	GtkTreeStore
-		*mGlobalAnnotations,
-		*mSimulations;
-
-	// static
-	GtkListStore
-		*mScoringPageSize,
-		*mFFTParamsPageSize,
-		*mFFTParamsBinSize,
-		*mFFTParamsWindowType,
-		*mFFTParamsPlanType,
-		*mMsmtProfileType,
-		*mGlobalFiltersNotchFilter;
-	static const auto
-		msimulations_visibility_switch_col = 14,
-		msimulations_modref_col = msimulations_visibility_switch_col + 1;
-	static const auto
-		mannotations_visibility_switch_col = 5,
-		mannotations_ref_col = mannotations_visibility_switch_col + 1;
+        // dynamic
+        GtkListStore
+                *mSessions,
+                *mEEGChannels,
+                *mAllChannels,
+                *mGlobalADProfiles;
+        GtkTreeStore
+                *mGlobalAnnotations,
+                *mSimulations;
+
+        // static
+        GtkListStore
+                *mScoringPageSize,
+                *mFFTParamsPageSize,
+                *mFFTParamsBinSize,
+                *mFFTParamsWindowType,
+                *mFFTParamsPlanType,
+                *mMsmtProfileType,
+                *mGlobalFiltersNotchFilter;
+        static const auto
+                msimulations_visibility_switch_col = 14,
+                msimulations_modref_col = msimulations_visibility_switch_col + 1;
+        static const auto
+                mannotations_visibility_switch_col = 5,
+                mannotations_ref_col = mannotations_visibility_switch_col + 1;
 
       // misc
-	gulong 	wMainWindow_delete_event_cb_handler_id,
-		eMsmtSession_changed_cb_handler_id,
-		eMsmtChannel_changed_cb_handler_id;
+        gulong         wMainWindow_delete_event_cb_handler_id,
+                eMsmtSession_changed_cb_handler_id,
+                eMsmtChannel_changed_cb_handler_id;
 
-	PangoFontDescription
-		*monofont;
+        PangoFontDescription
+                *monofont;
 
       // main toplevel
-	GtkWindow
-		*wMainWindow;
-	void
-	set_wMainWindow_interactive( bool indeed, bool flush = true);
-	void
-	set_controls_for_empty_experiment( bool indeed, bool flush = true);
-
-	// tabs
-	GtkNotebook
-		*tTaskSelector,
-		*tDesign, *tSimulations,
-		*tSettings;
-	GtkLabel
-		*lTaskSelector1, *lTaskSelector2,
-		*lSettings;
+        GtkWindow
+                *wMainWindow;
+        void
+        set_wMainWindow_interactive( bool indeed, bool flush = true);
+        void
+        set_controls_for_empty_experiment( bool indeed, bool flush = true);
+
+        // tabs
+        GtkNotebook
+                *tTaskSelector,
+                *tDesign, *tSimulations,
+                *tSettings;
+        GtkLabel
+                *lTaskSelector1, *lTaskSelector2,
+                *lSettings;
       // 1. Measurements
-	GtkMenuItem
-		*iiMainMenu,
-		*iExpRefresh, *iExpPurgeComputed, *iExpAnnotations,
-		*iExpClose, *iExpQuit,
-		*iExpBasicSADetectUltradianCycles,
-		*iiExpGlobalOperations,
-		*iiExpSubjectSort,
-		*iExpGloballyDetectArtifacts,
-		*iExpGloballySetFilters,
-		*iMontageSetDefaults,
-		*iHelpAbout,
-		*iHelpUsage;
-	GtkRadioMenuItem
-		*iExpSubjectSortName,
-		*iExpSubjectSortAge,
-		*iExpSubjectSortAdmissionDate,
-		*iExpSubjectSortAvgPower;
-	GtkCheckMenuItem
-		*iExpSubjectSortAscending,
-		*iExpSubjectSortSegregate;
-
-
-	// profile mode & parameters
-	GtkBox	*cMsmtTopArea,
-		*cMsmtMainToolbar,
-		*cMsmtProfileParamsContainer;
-	GtkComboBox
-		*eMsmtProfileType;
-	GtkBox	*cMsmtProfileParamsPSD,
-		*cMsmtProfileParamsSWU,
-		*cMsmtProfileParamsMC;
-	GtkSpinButton
-		*eMsmtProfileParamsPSDFreqFrom,
-		*eMsmtProfileParamsPSDFreqWidth,
-		*eMsmtProfileParamsSWUF0,
-		*eMsmtProfileParamsMCF0;
-	GtkAdjustment
-		*jMsmtProfileParamsPSDFreqFrom,
-		*jMsmtProfileParamsPSDFreqWidth,
-		*jMsmtProfileParamsSWUF0,
-		*jMsmtProfileParamsMCF0;
-
-	GtkLabel
-		*lMsmtProfilePSDExtra,
-		*lMsmtProfileSWUExtra,
-		*lMsmtProfileMCExtra;
-
-	GtkScaleButton
-		*eMsmtProfileSmooth;
-	GtkToggleButton
-		*eMsmtProfileAutoscale;
-	// view selectors
-	GtkComboBox
-		*eMsmtChannel,
-		*eMsmtSession;
-
-	// main area
-	GtkVBox
-		*cMeasurements;
-	GtkStatusbar
-		*sbMainStatusBar;
-	guint	sbMainContextIdGeneral;
-	// menus
-	GtkMenu
-		*iiSubjectTimeline;
-	GtkMenuItem
-		*iSubjectTimelineScore,
-		*iSubjectTimelineDetectUltradianCycle,
-		*iSubjectTimelineEDFInfo,
-		*iSubjectTimelineSaveAsSVG,
-		*iSubjectTimelineBrowse,
-		*iSubjectTimelineResetMontage;
-
-	// settings
-	GtkSpinButton
-		*eSMPMaxThreads;
-	GtkSpinButton
-		*eUltradianCycleDetectionAccuracy;
-	GtkCheckButton
-		*eScanTreeStrict,
-		*eScanTreeSuppressReport;
-	GtkComboBox
-		*eFFTParamsWindowType,
-		*eFFTParamsPageSize,
-		*eFFTParamsBinSize,
-		*eFFTParamsPlanType,
-		*eArtifDampenWindowType;
-	GtkEntry
-		*eScoreCode[sigfile::SPage::TScore_total];
-	GtkSpinButton
-		*eArtifDampenFactor,
-		*eMCParamBandWidth,
-		*eMCParamIIRBackpolate,
-		*eMCParamMCGain,
-		*eMCParamFreqInc,
-		*eMCParamNBins,
-		*eSWUParamMinUpswingDuration,
-		*eDAMsmtPPH,
-		*eDAMsmtTLHeight,
-		*eDAPageHeight,
-		*eDAHypnogramHeight,
-		*eDAEMGHeight,
-		*eScrollSpeedFactor;
-	GtkAdjustment
-		*jFreqFrom,
-		*jFreqWidth;
-	GtkSpinButton
-		*eBand[metrics::TBand_total][2];
-	GtkEntry
-		*eBrowseCommand;
-
-	GtkButton
-		*bMainCloseThatSF;
+        GtkMenuItem
+                *iiMainMenu,
+                *iExpRefresh, *iExpPurgeComputed, *iExpAnnotations,
+                *iExpClose, *iExpQuit,
+                *iExpBasicSADetectUltradianCycles,
+                *iiExpGlobalOperations,
+                *iiExpSubjectSort,
+                *iExpGloballyDetectArtifacts,
+                *iExpGloballySetFilters,
+                *iMontageSetDefaults,
+                *iHelpAbout,
+                *iHelpUsage;
+        GtkRadioMenuItem
+                *iExpSubjectSortName,
+                *iExpSubjectSortAge,
+                *iExpSubjectSortAdmissionDate,
+                *iExpSubjectSortAvgPower;
+        GtkCheckMenuItem
+                *iExpSubjectSortAscending,
+                *iExpSubjectSortSegregate;
+
+
+        // profile mode & parameters
+        GtkBox        *cMsmtTopArea,
+                *cMsmtMainToolbar,
+                *cMsmtProfileParamsContainer;
+        GtkComboBox
+                *eMsmtProfileType;
+        GtkBox        *cMsmtProfileParamsPSD,
+                *cMsmtProfileParamsSWU,
+                *cMsmtProfileParamsMC;
+        GtkSpinButton
+                *eMsmtProfileParamsPSDFreqFrom,
+                *eMsmtProfileParamsPSDFreqWidth,
+                *eMsmtProfileParamsSWUF0,
+                *eMsmtProfileParamsMCF0;
+        GtkAdjustment
+                *jMsmtProfileParamsPSDFreqFrom,
+                *jMsmtProfileParamsPSDFreqWidth,
+                *jMsmtProfileParamsSWUF0,
+                *jMsmtProfileParamsMCF0;
+
+        GtkLabel
+                *lMsmtProfilePSDExtra,
+                *lMsmtProfileSWUExtra,
+                *lMsmtProfileMCExtra;
+
+        GtkScaleButton
+                *eMsmtProfileSmooth;
+        GtkToggleButton
+                *eMsmtProfileAutoscale;
+        // view selectors
+        GtkComboBox
+                *eMsmtChannel,
+                *eMsmtSession;
+
+        // main area
+        GtkVBox
+                *cMeasurements;
+        GtkStatusbar
+                *sbMainStatusBar;
+        guint        sbMainContextIdGeneral;
+        // menus
+        GtkMenu
+                *iiSubjectTimeline;
+        GtkMenuItem
+                *iSubjectTimelineScore,
+                *iSubjectTimelineDetectUltradianCycle,
+                *iSubjectTimelineEDFInfo,
+                *iSubjectTimelineSaveAsSVG,
+                *iSubjectTimelineBrowse,
+                *iSubjectTimelineResetMontage;
+
+        // settings
+        GtkSpinButton
+                *eSMPMaxThreads;
+        GtkSpinButton
+                *eUltradianCycleDetectionAccuracy;
+        GtkCheckButton
+                *eScanTreeStrict,
+                *eScanTreeSuppressReport;
+        GtkComboBox
+                *eFFTParamsWindowType,
+                *eFFTParamsPageSize,
+                *eFFTParamsBinSize,
+                *eFFTParamsPlanType,
+                *eArtifDampenWindowType;
+        GtkEntry
+                *eScoreCode[sigfile::SPage::TScore_total];
+        GtkSpinButton
+                *eArtifDampenFactor,
+                *eMCParamBandWidth,
+                *eMCParamIIRBackpolate,
+                *eMCParamMCGain,
+                *eMCParamFreqInc,
+                *eMCParamNBins,
+                *eSWUParamMinUpswingDuration,
+                *eDAMsmtPPH,
+                *eDAMsmtTLHeight,
+                *eDAPageHeight,
+                *eDAHypnogramHeight,
+                *eDAEMGHeight,
+                *eScrollSpeedFactor;
+        GtkAdjustment
+                *jFreqFrom,
+                *jFreqWidth;
+        GtkSpinButton
+                *eBand[metrics::TBand_total][2];
+        GtkEntry
+                *eBrowseCommand;
+
+        GtkButton
+                *bMainCloseThatSF;
 
       // 2. Simulations
-	GtkTreeView
-		*tvSimulations;
-	GtkMenuItem
-		*iSimulationsRunBatch,
-		*iSimulationsRunClearAll,
-		*iSimulationsReportGenerate;
-	GtkLabel
-		*lSimulationsProfile,
-		*lSimulationsChannel,
-		*lSimulationsSession;
-
-	// settings
-	GtkSpinButton
-		*eCtlParamAnnlNTries,		*eCtlParamAnnlItersFixedT,
-		*eCtlParamAnnlStepSize,		*eCtlParamAnnlBoltzmannk,
-		*eCtlParamAnnlTInitialMantissa,	*eCtlParamAnnlTInitialExponent,
-		*eCtlParamAnnlDampingMu,	*eCtlParamAnnlTMinMantissa,
-		*eCtlParamAnnlTMinExponent,	*eCtlParamNSWAPpBeforeSimStart,
-		*eCtlParamReqScoredPercent;
-	GtkCheckButton
-		*eCtlParamDBAmendment1,		*eCtlParamDBAmendment2,
-		*eCtlParamAZAmendment1;
-	GtkLabel
-		*lCtlParamDBAmendment1,		*lCtlParamDBAmendment2,
-		*lCtlParamAZAmendment1;
-
-	GtkRadioButton
-		*eCtlParamScoreUnscoredAsWake;
-
-	GtkSpinButton
-		*eTunable[agh::ach::TTunable::_basic_tunables][4];
-	GtkAdjustment
-		*jTunable[agh::ach::TTunable::_basic_tunables][4];
-	GtkButton
-		*bSimParamRevertTunables;
+        GtkTreeView
+                *tvSimulations;
+        GtkMenuItem
+                *iSimulationsRunBatch,
+                *iSimulationsRunClearAll,
+                *iSimulationsReportGenerate;
+        GtkLabel
+                *lSimulationsProfile,
+                *lSimulationsChannel,
+                *lSimulationsSession;
+
+        // settings
+        GtkSpinButton
+                *eCtlParamAnnlNTries,                *eCtlParamAnnlItersFixedT,
+                *eCtlParamAnnlStepSize,                *eCtlParamAnnlBoltzmannk,
+                *eCtlParamAnnlTInitialMantissa,        *eCtlParamAnnlTInitialExponent,
+                *eCtlParamAnnlDampingMu,        *eCtlParamAnnlTMinMantissa,
+                *eCtlParamAnnlTMinExponent,        *eCtlParamNSWAPpBeforeSimStart,
+                *eCtlParamReqScoredPercent;
+        GtkCheckButton
+                *eCtlParamDBAmendment1,                *eCtlParamDBAmendment2,
+                *eCtlParamAZAmendment1;
+        GtkLabel
+                *lCtlParamDBAmendment1,                *lCtlParamDBAmendment2,
+                *lCtlParamAZAmendment1;
+
+        GtkRadioButton
+                *eCtlParamScoreUnscoredAsWake;
+
+        GtkSpinButton
+                *eTunable[agh::ach::TTunable::_basic_tunables][4];
+        GtkAdjustment
+                *jTunable[agh::ach::TTunable::_basic_tunables][4];
+        GtkButton
+                *bSimParamRevertTunables;
 
       // other toplevels
-	// about
-	GtkDialog
-		*wAbout;
-	GtkNotebook
-		*cAboutTabs;
-	GtkLabel
-		*lAboutVersion;
-
-	// scan log
-	GtkDialog
-		*wScanLog;
-	GtkTextView
-		*tScanLog;
-
-	// edf header
-	GtkDialog
-		*wEDFFileDetails;
-	GtkLabel
-		*lEDFFileDetails;
-	GtkTextView
-		*lEDFFileDetailsReport;
-	GtkTextBuffer
-		*tEDFFileDetailsReport;
-
-	// edf dnd import
-	GtkDialog
-		*wEdfImport;
-	GtkComboBox
-		*eEdfImportGroup,
-		*eEdfImportSession,
-		*eEdfImportEpisode;
-	GtkEntry
-		*eEdfImportGroupEntry,
-		*eEdfImportSessionEntry,
-		*eEdfImportEpisodeEntry;
-	GtkLabel
-		*lEdfImportSubject,
-		*lEdfImportCaption;
-	GtkTextView
-		*lEdfImportFileInfo;
-	GtkButton
-		*bEdfImportAdmit,
-		*bEdfImportEdfhed,
-		*bEdfImportAttachCopy,
-		*bEdfImportAttachMove;
-
-	// annotations
-	GtkDialog
-		*wGlobalAnnotations;
-	GtkTreeView
-		*tvGlobalAnnotations;
-	GtkCheckButton
-		*eGlobalAnnotationsShowPhasicEvents;
-
-	// batch setup
-	GtkDialog
-		*wBatchSetup;
-	GtkEntry
-		*eBatchSetupSubjects,
-		*eBatchSetupSessions,
-		*eBatchSetupChannels;
-	GtkSpinButton
-		*eBatchSetupRangeFrom,
-		*eBatchSetupRangeWidth,
-		*eBatchSetupRangeInc,
-		*eBatchSetupRangeSteps;
-
-	// // montage defaults
-	// GtkDialog
-	// 	*wMontageDefaults;
-	// GtkEntry
-	// 	*eMontageDefaultsChannelList;
-	// GtkCheckButton
-	// 	*eMontageDefaultsShowPSD,
-	// 	*eMontageDefaultsShowPSDSpectrum,
-	// 	*eMontageDefaultsShowMC,
-	// 	*eMontageDefaultsShowEMG;
-
-	// global artifact detection
-	GtkDialog
-		*wGlobalArtifactDetection;
-	GtkComboBox
-		*eGlobalADProfiles;
-	GtkCheckButton
-		*eGlobalADKeepExisting;
-	GtkLabel
-		*lGlobalADHint;
-	GtkButton
-		*bGlobalADOK;
-
-	// global filters
-	GtkDialog
-		*wGlobalFilters;
-	GtkSpinButton
-		*eGlobalFiltersLowPassCutoff, *eGlobalFiltersHighPassCutoff,
-		*eGlobalFiltersLowPassOrder, *eGlobalFiltersHighPassOrder;
-	GtkComboBox
-		*eGlobalFiltersNotchFilter;
+        // about
+        GtkDialog
+                *wAbout;
+        GtkNotebook
+                *cAboutTabs;
+        GtkLabel
+                *lAboutVersion;
+
+        // scan log
+        GtkDialog
+                *wScanLog;
+        GtkTextView
+                *tScanLog;
+
+        // edf header
+        GtkDialog
+                *wEDFFileDetails;
+        GtkLabel
+                *lEDFFileDetails;
+        GtkTextView
+                *lEDFFileDetailsReport;
+        GtkTextBuffer
+                *tEDFFileDetailsReport;
+
+        // edf dnd import
+        GtkDialog
+                *wEdfImport;
+        GtkComboBox
+                *eEdfImportGroup,
+                *eEdfImportSession,
+                *eEdfImportEpisode;
+        GtkEntry
+                *eEdfImportGroupEntry,
+                *eEdfImportSessionEntry,
+                *eEdfImportEpisodeEntry;
+        GtkLabel
+                *lEdfImportSubject,
+                *lEdfImportCaption;
+        GtkTextView
+                *lEdfImportFileInfo;
+        GtkButton
+                *bEdfImportAdmit,
+                *bEdfImportEdfhed,
+                *bEdfImportAttachCopy,
+                *bEdfImportAttachMove;
+
+        // annotations
+        GtkDialog
+                *wGlobalAnnotations;
+        GtkTreeView
+                *tvGlobalAnnotations;
+        GtkCheckButton
+                *eGlobalAnnotationsShowPhasicEvents;
+
+        // batch setup
+        GtkDialog
+                *wBatchSetup;
+        GtkEntry
+                *eBatchSetupSubjects,
+                *eBatchSetupSessions,
+                *eBatchSetupChannels;
+        GtkSpinButton
+                *eBatchSetupRangeFrom,
+                *eBatchSetupRangeWidth,
+                *eBatchSetupRangeInc,
+                *eBatchSetupRangeSteps;
+
+        // // montage defaults
+        // GtkDialog
+        //         *wMontageDefaults;
+        // GtkEntry
+        //         *eMontageDefaultsChannelList;
+        // GtkCheckButton
+        //         *eMontageDefaultsShowPSD,
+        //         *eMontageDefaultsShowPSDSpectrum,
+        //         *eMontageDefaultsShowMC,
+        //         *eMontageDefaultsShowEMG;
+
+        // global artifact detection
+        GtkDialog
+                *wGlobalArtifactDetection;
+        GtkComboBox
+                *eGlobalADProfiles;
+        GtkCheckButton
+                *eGlobalADKeepExisting;
+        GtkLabel
+                *lGlobalADHint;
+        GtkButton
+                *bGlobalADOK;
+
+        // global filters
+        GtkDialog
+                *wGlobalFilters;
+        GtkSpinButton
+                *eGlobalFiltersLowPassCutoff, *eGlobalFiltersHighPassCutoff,
+                *eGlobalFiltersLowPassOrder, *eGlobalFiltersHighPassOrder;
+        GtkComboBox
+                *eGlobalFiltersNotchFilter;
 
       // colours
-	enum TColour {
-		mw_night,	mw_day,
-		mw_profile,	mw_ticks,	mw_bounds,
-		mw_labels,
-
-		sf_artifact,
-		sf_annotations,
-		sf_embedded_annotations,
-		sf_selection,
-		sf_profile_psd,	sf_profile_mc, sf_profile_swu,
-		sf_phasic_spindle, sf_phasic_Kcomplex, sf_phasic_eyeblink,
-		sf_hypnogram,
-		sf_cursor,
-		sf_emg,
-		sf_labels,	sf_ticks,
-
-		mf_swa,		mf_swa_sim,	mf_process_s,
-		mf_paper,
-		mf_labels,
-		mf_ticks,
-
-		band_delta,	band_theta,	band_alpha,
-		band_beta,	band_gamma,
-
-		score_none,	score_nrem1,	score_nrem2,
-		score_nrem3,	score_nrem4,	score_rem,
-		score_wake,
-		score_invalid,  // has no color chooser
-	};
-	map<TColour, SManagedColor>
-		CwB;
-
-	static TColour
-	score2colour( sigfile::SPage::TScore s)
-		{
-			return (TColour)((unsigned)s + (unsigned)TColour::score_none);
-		}
-	static TColour
-	band2colour( metrics::TBand b)
-		{
-			return (TColour)((unsigned)b + (unsigned)TColour::band_delta);
-		}
+        enum TColour {
+                mw_night,        mw_day,
+                mw_profile,        mw_ticks,        mw_bounds,
+                mw_labels,
+
+                sf_artifact,
+                sf_annotations,
+                sf_embedded_annotations,
+                sf_selection,
+                sf_profile_psd,        sf_profile_mc, sf_profile_swu,
+                sf_phasic_spindle, sf_phasic_Kcomplex, sf_phasic_eyeblink,
+                sf_hypnogram,
+                sf_cursor,
+                sf_emg,
+                sf_labels,        sf_ticks,
+
+                mf_swa,                mf_swa_sim,        mf_process_s,
+                mf_paper,
+                mf_labels,
+                mf_ticks,
+
+                band_delta,        band_theta,        band_alpha,
+                band_beta,        band_gamma,
+
+                score_none,        score_nrem1,        score_nrem2,
+                score_nrem3,        score_nrem4,        score_rem,
+                score_wake,
+                score_invalid,  // has no color chooser
+        };
+        map<TColour, SManagedColor>
+                CwB;
+
+        static TColour
+        score2colour( sigfile::SPage::TScore s)
+                {
+                        return (TColour)((unsigned)s + (unsigned)TColour::score_none);
+                }
+        static TColour
+        band2colour( metrics::TBand b)
+                {
+                        return (TColour)((unsigned)b + (unsigned)TColour::band_delta);
+                }
 };
 
 }
@@ -395,7 +395,7 @@ struct SExpDesignUIWidgets {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index ff1160a..718ffd5 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -26,134 +26,134 @@ using namespace std;
 using namespace agh::ui;
 
 pattern::SPatternPPack<TFloat>
-	SScoringFacility::SChannel::pattern_params =
-		{.25,  0., 1.5, 1,  .1, .5, 3};
+        SScoringFacility::SChannel::pattern_params =
+                {.25,  0., 1.5, 1,  .1, .5, 3};
 
 using agh::confval::SValidator;
 
 SScoringFacility::SChannel::
 SChannel (agh::CRecording& r,
-	  SScoringFacility& parent,
-	  size_t y0,
-	  int seq)
+          SScoringFacility& parent,
+          size_t y0,
+          int seq)
       : crecording (r),
-	filters (r.F().filters(h())),
-	annotations (r.F().annotations(h())),
-	artifacts (r.F().artifacts(r.h())),
-	_p (parent),
-	signal_lowpass  ({signal_filtered, samplerate()}),
-	signal_bandpass ({signal_filtered, samplerate()}),
-	signal_envelope ({signal_filtered, samplerate()}),
-	signal_dzcdf    ({signal_filtered, samplerate()}),
-	zeroy (y0),
-	// let them be read or recalculated
-	signal_display_scale( NAN),
-	hidden (false),
-	draw_zeroline (true),
-	draw_original_signal (false),
-	draw_filtered_signal (true),
-	zeromean_original (true),
-	draw_psd (true),
-	draw_swu (false),
-	draw_mc (false),
-	draw_emg (true),
-	draw_psd_bands (true),
-	draw_spectrum (true),
-	resample_signal (true),
-	// resample_power (true), // set based on pages-per-pixel
-	draw_selection_course (false),
-	draw_selection_envelope (true),
-	draw_selection_dzcdf (false),
-	draw_phasic_spindle (true),
-	draw_phasic_Kcomplex (true),
-	draw_phasic_eyeblink (true),
-	apply_reconstituted (false),
-	config_keys_b ({
-		SValidator<bool>( string("h")+to_string(seq) + ".hidden",			&hidden),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_zeroline",		&draw_zeroline),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_original_signal",		&draw_original_signal),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_filtered_signal",		&draw_filtered_signal),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_emg",			&draw_emg),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_psd",			&draw_psd),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_swu",			&draw_swu),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_psd_bands",		&draw_psd_bands),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_spectrum",		&draw_spectrum),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_mc",			&draw_mc),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_spindle",		&draw_phasic_spindle),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_Kcomplex",		&draw_phasic_Kcomplex),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_eyeblink",		&draw_phasic_eyeblink),
-		SValidator<bool>( string("h")+to_string(seq) + ".autoscale_profile",		&autoscale_profile),
-		SValidator<bool>( string("h")+to_string(seq) + ".resample_signal",		&resample_signal),
-		SValidator<bool>( string("h")+to_string(seq) + ".resample_power",		&resample_power),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_course",	&draw_selection_course),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_envelope",	&draw_selection_envelope),
-		SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_dzcdf",		&draw_selection_dzcdf),
-	}),
-	config_keys_g ({
-		SValidator<double>( string("h")+to_string(seq) + ".zeroy",			&zeroy,			SValidator<double>::SVFRangeIn (-100., 4000.)),
-		SValidator<double>( string("h")+to_string(seq) + ".selection_start_time",	&selection_start_time),
-		SValidator<double>( string("h")+to_string(seq) + ".selection_end_time",		&selection_end_time),
-		SValidator<double>( string("h")+to_string(seq) + ".signal_display_scale",	&signal_display_scale,	SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
-		SValidator<double>( string("h")+to_string(seq) + ".psd_display_scale",		&psd.display_scale,	SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
-		SValidator<double>( string("h")+to_string(seq) + ".swu_display_scale",		&swu.display_scale,	SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
-		SValidator<double>( string("h")+to_string(seq) + ".mc_display_scale",		&mc.display_scale,	SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
-	}),
-	marquee_start (0.),
-	marquee_end (0.),
-	selection_start_time (0.),
-	selection_end_time (0.),
-	selection_start (0),
-	selection_end (0)
+        filters (r.F().filters(h())),
+        annotations (r.F().annotations(h())),
+        artifacts (r.F().artifacts(r.h())),
+        _p (parent),
+        signal_lowpass  ({signal_filtered, samplerate()}),
+        signal_bandpass ({signal_filtered, samplerate()}),
+        signal_envelope ({signal_filtered, samplerate()}),
+        signal_dzcdf    ({signal_filtered, samplerate()}),
+        zeroy (y0),
+        // let them be read or recalculated
+        signal_display_scale( NAN),
+        hidden (false),
+        draw_zeroline (true),
+        draw_original_signal (false),
+        draw_filtered_signal (true),
+        zeromean_original (true),
+        draw_psd (true),
+        draw_swu (false),
+        draw_mc (false),
+        draw_emg (true),
+        draw_psd_bands (true),
+        draw_spectrum (true),
+        resample_signal (true),
+        // resample_power (true), // set based on pages-per-pixel
+        draw_selection_course (false),
+        draw_selection_envelope (true),
+        draw_selection_dzcdf (false),
+        draw_phasic_spindle (true),
+        draw_phasic_Kcomplex (true),
+        draw_phasic_eyeblink (true),
+        apply_reconstituted (false),
+        config_keys_b ({
+                SValidator<bool>( string("h")+to_string(seq) + ".hidden",                        &hidden),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_zeroline",                &draw_zeroline),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_original_signal",                &draw_original_signal),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_filtered_signal",                &draw_filtered_signal),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_emg",                        &draw_emg),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_psd",                        &draw_psd),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_swu",                        &draw_swu),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_psd_bands",                &draw_psd_bands),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_spectrum",                &draw_spectrum),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_mc",                        &draw_mc),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_spindle",                &draw_phasic_spindle),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_Kcomplex",                &draw_phasic_Kcomplex),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_phasic_eyeblink",                &draw_phasic_eyeblink),
+                SValidator<bool>( string("h")+to_string(seq) + ".autoscale_profile",                &autoscale_profile),
+                SValidator<bool>( string("h")+to_string(seq) + ".resample_signal",                &resample_signal),
+                SValidator<bool>( string("h")+to_string(seq) + ".resample_power",                &resample_power),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_course",        &draw_selection_course),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_envelope",        &draw_selection_envelope),
+                SValidator<bool>( string("h")+to_string(seq) + ".draw_selection_dzcdf",                &draw_selection_dzcdf),
+        }),
+        config_keys_g ({
+                SValidator<double>( string("h")+to_string(seq) + ".zeroy",                        &zeroy,                        SValidator<double>::SVFRangeIn (-100., 4000.)),
+                SValidator<double>( string("h")+to_string(seq) + ".selection_start_time",        &selection_start_time),
+                SValidator<double>( string("h")+to_string(seq) + ".selection_end_time",                &selection_end_time),
+                SValidator<double>( string("h")+to_string(seq) + ".signal_display_scale",        &signal_display_scale,        SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
+                SValidator<double>( string("h")+to_string(seq) + ".psd_display_scale",                &psd.display_scale,        SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
+                SValidator<double>( string("h")+to_string(seq) + ".swu_display_scale",                &swu.display_scale,        SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
+                SValidator<double>( string("h")+to_string(seq) + ".mc_display_scale",                &mc.display_scale,        SValidator<double>::SVFRangeIn (DBL_MIN, INFINITY)),
+        }),
+        marquee_start (0.),
+        marquee_end (0.),
+        selection_start_time (0.),
+        selection_end_time (0.),
+        selection_start (0),
+        selection_end (0)
 {
-	get_signal_original();
-	get_signal_filtered();
+        get_signal_original();
+        get_signal_filtered();
 
       // irrespective (grown out of EMG, eventually for universal use)
-	// get_raw_profile(); // too heavy; make it on-demand
+        // get_raw_profile(); // too heavy; make it on-demand
 
       // psd power and spectrum, mc
-	if ( schannel().is_fftable() ) {
-	      // power in a single bin
-		psd.from = _p._p.active_profile_psd_freq_from;
-		psd.upto = _p._p.active_profile_psd_freq_upto;
-		get_psd_course();
-	      // power spectrum (for the first page)
-		spectrum_bins = last_spectrum_bin = crecording.psd_profile.bins();
-		get_spectrum( 0);
-		// will be reassigned in REDRAW_ALL
-		spectrum_upper_freq = spectrum_bins * crecording.psd_profile.Pp.binsize;
-
-	      // power in bands
-		size_t n_bands = 0;
-		while ( n_bands != metrics::TBand::TBand_total )
-			if ( _p._p.ED->freq_bands[n_bands][0] >= spectrum_upper_freq )
-				break;
-			else
-				++n_bands;
-		psd.uppermost_band = (n_bands-1);
-		get_psd_in_bands();
-
-	      // swu profile
-		swu.f0 = _p._p.active_profile_swu_f0;
-		get_swu_course();
-
-	      // mc profile
-		mc.f0 = _p._p.active_profile_mc_f0;
-		get_mc_course();
-
-	      // delta comes first, calibrate display scale against it
-		//update_profile_display_scales();
-		// don't: interchannel_gap is rubbish yet
-		psd.focused_band = metrics::TBand::delta;
-
-	} else if ( schannel().type() == sigfile::SChannel::TType::emg )
-		get_raw_profile();
+        if ( schannel().is_fftable() ) {
+              // power in a single bin
+                psd.from = _p._p.active_profile_psd_freq_from;
+                psd.upto = _p._p.active_profile_psd_freq_upto;
+                get_psd_course();
+              // power spectrum (for the first page)
+                spectrum_bins = last_spectrum_bin = crecording.psd_profile.bins();
+                get_spectrum( 0);
+                // will be reassigned in REDRAW_ALL
+                spectrum_upper_freq = spectrum_bins * crecording.psd_profile.Pp.binsize;
+
+              // power in bands
+                size_t n_bands = 0;
+                while ( n_bands != metrics::TBand::TBand_total )
+                        if ( _p._p.ED->freq_bands[n_bands][0] >= spectrum_upper_freq )
+                                break;
+                        else
+                                ++n_bands;
+                psd.uppermost_band = (n_bands-1);
+                get_psd_in_bands();
+
+              // swu profile
+                swu.f0 = _p._p.active_profile_swu_f0;
+                get_swu_course();
+
+              // mc profile
+                mc.f0 = _p._p.active_profile_mc_f0;
+                get_mc_course();
+
+              // delta comes first, calibrate display scale against it
+                //update_profile_display_scales();
+                // don't: interchannel_gap is rubbish yet
+                psd.focused_band = metrics::TBand::delta;
+
+        } else if ( schannel().type() == sigfile::SChannel::TType::emg )
+                get_raw_profile();
 
       // let it be so to avoid libconfig::readFile throwing exceptions
-	psd.display_scale = mc.display_scale = swu.display_scale =
-		DBL_MIN;
+        psd.display_scale = mc.display_scale = swu.display_scale =
+                DBL_MIN;
 
-	percent_dirty = calculate_dirty_percent();
+        percent_dirty = calculate_dirty_percent();
 }
 
 
@@ -165,24 +165,24 @@ void
 SScoringFacility::SChannel::
 get_signal_original()
 {
-	signal_original =
-		crecording.F().get_signal_original( h());
-	// signal_original_resampled =
-	// 	sigproc::resample( signal_original, 0, signal_original.size(),
-	// 			   signal_original.size() / spp());
-	if ( zeromean_original )
-		signal_original -=
-			signal_original.sum() / signal_original.size();
+        signal_original =
+                crecording.F().get_signal_original( h());
+        // signal_original_resampled =
+        //         sigproc::resample( signal_original, 0, signal_original.size(),
+        //                            signal_original.size() / spp());
+        if ( zeromean_original )
+                signal_original -=
+                        signal_original.sum() / signal_original.size();
 }
 
 void
 SScoringFacility::SChannel::
 get_signal_filtered()
 {
-	signal_filtered =
-		crecording.F().get_signal_filtered( h());
-	// filtered is already zeromean as shipped
-	drop_cached_signal_properties();
+        signal_filtered =
+                crecording.F().get_signal_filtered( h());
+        // filtered is already zeromean as shipped
+        drop_cached_signal_properties();
 }
 
 
@@ -194,15 +194,15 @@ list<sigfile::SAnnotation*>
 SScoringFacility::SChannel::
 in_annotations( const double time) const
 {
-	// select this channel's annotations
-	list<sigfile::SAnnotation*>
-		ret;
-	for ( auto &A : annotations )
-		if ( agh::alg::overlap(
-			     A.span.a, A.span.z,
-			     time, time) )
-			ret.push_back( &A);
-	return ret;
+        // select this channel's annotations
+        list<sigfile::SAnnotation*>
+                ret;
+        for ( auto &A : annotations )
+                if ( agh::alg::overlap(
+                             A.span.a, A.span.z,
+                             time, time) )
+                        ret.push_back( &A);
+        return ret;
 }
 
 
@@ -210,44 +210,44 @@ void
 SScoringFacility::SChannel::
 get_psd_course()
 {
-	//psd_profile.compute();
-	auto tmp = crecording.course(
-		agh::make_profile_paramset<metrics::TType::psd>( psd.from, psd.upto));
-	if ( resample_power ) {
-		auto xi = vector<unsigned long> (tmp.size());
-		for ( size_t i = 0; i < tmp.size(); ++i )
-			xi[i] = i;
-		psd.course = sigproc::interpolate<TFloat>( xi, 3600/_p.pagesize(), tmp, 3./3600);
-	} else
-		psd.course = tmp;
+        //psd_profile.compute();
+        auto tmp = crecording.course(
+                agh::make_profile_paramset<metrics::TType::psd>( psd.from, psd.upto));
+        if ( resample_power ) {
+                auto xi = vector<unsigned long> (tmp.size());
+                for ( size_t i = 0; i < tmp.size(); ++i )
+                        xi[i] = i;
+                psd.course = sigproc::interpolate<TFloat>( xi, 3600/_p.pagesize(), tmp, 3./3600);
+        } else
+                psd.course = tmp;
 }
 
 void
 SScoringFacility::SChannel::
 get_psd_in_bands()
 {
-	crecording.psd_profile.compute();
-	if ( resample_power ) {
-		auto xi = vector<unsigned long> (crecording.psd_profile.steps());
-		for ( size_t i = 0; i < xi.size(); ++i )
-			xi[i] = i;
-		for ( size_t b = 0; b <= psd.uppermost_band; ++b ) {
-			auto	_from = _p._p.ED->freq_bands[b][0],
-				_upto = _p._p.ED->freq_bands[b][1];
-			auto tmp = crecording.psd_profile.course( _from, _upto);
-			psd.course_in_bands[b] =
-				sigproc::interpolate<TFloat>(
-					xi, 3600/_p.pagesize(),
-					tmp,
-					3./3600);
-		}
-	} else
-		for ( size_t b = 0; b <= psd.uppermost_band; ++b ) {
-			auto	_from = _p._p.ED->freq_bands[b][0],
-				_upto = _p._p.ED->freq_bands[b][1];
-			psd.course_in_bands[b] =
-				crecording.psd_profile.course( _from, _upto);
-		}
+        crecording.psd_profile.compute();
+        if ( resample_power ) {
+                auto xi = vector<unsigned long> (crecording.psd_profile.steps());
+                for ( size_t i = 0; i < xi.size(); ++i )
+                        xi[i] = i;
+                for ( size_t b = 0; b <= psd.uppermost_band; ++b ) {
+                        auto        _from = _p._p.ED->freq_bands[b][0],
+                                _upto = _p._p.ED->freq_bands[b][1];
+                        auto tmp = crecording.psd_profile.course( _from, _upto);
+                        psd.course_in_bands[b] =
+                                sigproc::interpolate<TFloat>(
+                                        xi, 3600/_p.pagesize(),
+                                        tmp,
+                                        3./3600);
+                }
+        } else
+                for ( size_t b = 0; b <= psd.uppermost_band; ++b ) {
+                        auto        _from = _p._p.ED->freq_bands[b][0],
+                                _upto = _p._p.ED->freq_bands[b][1];
+                        psd.course_in_bands[b] =
+                                crecording.psd_profile.course( _from, _upto);
+                }
 }
 
 
@@ -255,16 +255,16 @@ void
 SScoringFacility::SChannel::
 get_swu_course()
 {
-	//swu_profile.compute();
-	auto tmp = crecording.course(
-		agh::make_profile_paramset<metrics::TType::swu>( swu.f0));
-	if ( resample_power ) {
-		auto xi = vector<unsigned long> (tmp.size());
-		for ( size_t i = 0; i < tmp.size(); ++i )
-			xi[i] = i;
-		swu.course = sigproc::interpolate<TFloat>( xi, 3600/_p.pagesize(), tmp, 3./3600);
-	} else
-		swu.course = tmp;
+        //swu_profile.compute();
+        auto tmp = crecording.course(
+                agh::make_profile_paramset<metrics::TType::swu>( swu.f0));
+        if ( resample_power ) {
+                auto xi = vector<unsigned long> (tmp.size());
+                for ( size_t i = 0; i < tmp.size(); ++i )
+                        xi[i] = i;
+                swu.course = sigproc::interpolate<TFloat>( xi, 3600/_p.pagesize(), tmp, 3./3600);
+        } else
+                swu.course = tmp;
 }
 
 
@@ -272,17 +272,17 @@ void
 SScoringFacility::SChannel::
 get_mc_course()
 {
-	//mc_profile.compute();
-	auto tmp = crecording.course(
-		agh::make_profile_paramset<metrics::TType::mc>( mc.f0));
-	if ( resample_power ) {
-		auto xi = vector<unsigned long> (tmp.size());
-		for ( size_t i = 0; i < tmp.size(); ++i )
-			xi[i] = i;
-		mc.course = sigproc::interpolate<TFloat>(
-			xi, 3600/_p.pagesize(), tmp, 3./3600);
-	} else
-		mc.course = tmp;
+        //mc_profile.compute();
+        auto tmp = crecording.course(
+                agh::make_profile_paramset<metrics::TType::mc>( mc.f0));
+        if ( resample_power ) {
+                auto xi = vector<unsigned long> (tmp.size());
+                for ( size_t i = 0; i < tmp.size(); ++i )
+                        xi[i] = i;
+                mc.course = sigproc::interpolate<TFloat>(
+                        xi, 3600/_p.pagesize(), tmp, 3./3600);
+        } else
+                mc.course = tmp;
 }
 
 
@@ -290,9 +290,9 @@ void
 SScoringFacility::SChannel::
 get_raw_profile()
 {
-	raw_profile = sigproc::raw_signal_profile<TFloat>(
-		{signal_filtered, samplerate()},
-		1., 3.);
+        raw_profile = sigproc::raw_signal_profile<TFloat>(
+                {signal_filtered, samplerate()},
+                1., 3.);
 }
 
 
@@ -300,25 +300,25 @@ tuple<metrics::TType, valarray<TFloat>&>
 SScoringFacility::SChannel::
 which_profile( const metrics::TType metric)
 {
-	switch ( schannel().type() ) {
-	case sigfile::SChannel::TType::eeg:
-		switch ( metric ) {
-		case metrics::TType::mc:
-			return tuple<metrics::TType, valarray<TFloat>&>(metric, mc.course);
-		case metrics::TType::psd:
-			return tuple<metrics::TType, valarray<TFloat>&>(metric, psd.course);
-		case metrics::TType::swu:
-			return tuple<metrics::TType, valarray<TFloat>&>(metric, swu.course);
-		case metrics::TType::raw:
-			if ( raw_profile.size() == 0 )
-				get_raw_profile();
-			return tuple<metrics::TType, valarray<TFloat>&>(metrics::TType::raw, raw_profile);
-		}
-	default:
-		if ( raw_profile.size() == 0 )
-			get_raw_profile();
-		return tuple<metrics::TType, valarray<TFloat>&>(metrics::TType::raw, raw_profile);
-	}
+        switch ( schannel().type() ) {
+        case sigfile::SChannel::TType::eeg:
+                switch ( metric ) {
+                case metrics::TType::mc:
+                        return tuple<metrics::TType, valarray<TFloat>&>(metric, mc.course);
+                case metrics::TType::psd:
+                        return tuple<metrics::TType, valarray<TFloat>&>(metric, psd.course);
+                case metrics::TType::swu:
+                        return tuple<metrics::TType, valarray<TFloat>&>(metric, swu.course);
+                case metrics::TType::raw:
+                        if ( raw_profile.size() == 0 )
+                                get_raw_profile();
+                        return tuple<metrics::TType, valarray<TFloat>&>(metrics::TType::raw, raw_profile);
+                }
+        default:
+                if ( raw_profile.size() == 0 )
+                        get_raw_profile();
+                return tuple<metrics::TType, valarray<TFloat>&>(metrics::TType::raw, raw_profile);
+        }
 }
 
 
@@ -326,13 +326,13 @@ void
 SScoringFacility::SChannel::
 get_spectrum( const size_t p)
 {
-	spectrum = crecording.psd_profile.spectrum( p);
+        spectrum = crecording.psd_profile.spectrum( p);
 }
 void
 SScoringFacility::SChannel::
 get_spectrum()
 {
-	spectrum = crecording.psd_profile.spectrum( _p.cur_page());
+        spectrum = crecording.psd_profile.spectrum( _p.cur_page());
 }
 
 
@@ -344,23 +344,23 @@ void
 SScoringFacility::SChannel::
 update_profile_display_scales()
 {
-	psd.display_scale =
-		agh::alg::calibrate_display_scale(
-			draw_psd_bands ? psd.course_in_bands[psd.focused_band] : psd.course,
-			psd.course.size(),
-			_p.interchannel_gap/2.);
-
-	mc.display_scale =
-		agh::alg::calibrate_display_scale(
-			mc.course,
-			mc.course.size(),
-			_p.interchannel_gap/2.);
-
-	swu.display_scale =
-		agh::alg::calibrate_display_scale(
-			swu.course,
-			swu.course.size(),
-			_p.interchannel_gap/2.);
+        psd.display_scale =
+                agh::alg::calibrate_display_scale(
+                        draw_psd_bands ? psd.course_in_bands[psd.focused_band] : psd.course,
+                        psd.course.size(),
+                        _p.interchannel_gap/2.);
+
+        mc.display_scale =
+                agh::alg::calibrate_display_scale(
+                        mc.course,
+                        mc.course.size(),
+                        _p.interchannel_gap/2.);
+
+        swu.display_scale =
+                agh::alg::calibrate_display_scale(
+                        swu.course,
+                        swu.course.size(),
+                        _p.interchannel_gap/2.);
 }
 
 
@@ -369,10 +369,10 @@ float
 SScoringFacility::SChannel::
 calculate_dirty_percent()
 {
-	size_t total = 0; // in samples
-	for ( auto &A : artifacts() )
-		total += A.size();
-	return percent_dirty = (float)total / n_samples();
+        size_t total = 0; // in samples
+        for ( auto &A : artifacts() )
+                total += A.size();
+        return percent_dirty = (float)total / n_samples();
 }
 
 
@@ -382,26 +382,26 @@ void
 SScoringFacility::SChannel::
 detect_artifacts( const metrics::mc::SArtifactDetectionPP& P)
 {
-	auto marked =
-		metrics::mc::detect_artifacts( signal_original, samplerate(), P);
-	for ( size_t p = 0; p < marked.size(); ++p )
-		artifacts.mark_artifact(
-			marked[p] * P.scope, (marked[p]+1) * P.scope);
-
-	calculate_dirty_percent();
-	get_signal_filtered();
-	if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
-		get_psd_course();
-		get_psd_in_bands();
-		get_spectrum( _p.cur_page());
-		get_swu_course();
-		get_mc_course();
-		get_raw_profile();
-
-		// if ( this == channel currently displayed on measurements overview )
-		if ( strcmp( name(), _p._p.AghH()) == 0 )
-			_p.redraw_ssubject_timeline();
-	}
+        auto marked =
+                metrics::mc::detect_artifacts( signal_original, samplerate(), P);
+        for ( size_t p = 0; p < marked.size(); ++p )
+                artifacts.mark_artifact(
+                        marked[p] * P.scope, (marked[p]+1) * P.scope);
+
+        calculate_dirty_percent();
+        get_signal_filtered();
+        if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+                get_psd_course();
+                get_psd_in_bands();
+                get_spectrum( _p.cur_page());
+                get_swu_course();
+                get_mc_course();
+                get_raw_profile();
+
+                // if ( this == channel currently displayed on measurements overview )
+                if ( strcmp( name(), _p._p.AghH()) == 0 )
+                        _p.redraw_ssubject_timeline();
+        }
 }
 
 
@@ -409,43 +409,43 @@ pair<double, double>
 SScoringFacility::SChannel::
 mark_flat_regions_as_artifacts( const double minsize, const double pad)
 {
-	double	total_before = artifacts.total();
-	size_t	marked_here = 0;
-	auto d =
-		sigproc::derivative( signal_original);
-	size_t	last_j = 0;
-	for ( size_t i = 0; i < d.size(); ++i )
-		if ( d[i] == 0. ) {
-			size_t j = i;
-			while ( j < d.size() && d[j] == 0. )
-				++j;
-			if ( j-i > minsize * samplerate() ) {
-				size_t extend_from = (i - last_j < .1) ? last_j : i;
-				artifacts.mark_artifact(
-					(double)extend_from/samplerate() - pad,
-					(double)j/samplerate() + pad);
-				marked_here += (j - extend_from);
-				last_j = j;
-			}
-			i = j;
-		}
-
-	calculate_dirty_percent();
-	get_signal_filtered();
-	if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
-		get_psd_course();
-		get_psd_in_bands();
-		get_spectrum( _p.cur_page());
-		get_swu_course();
-		get_mc_course();
-
-		// if ( this == channel currently displayed on measurements overview )
-		if ( strcmp( name(), _p._p.AghH()) == 0 )
-			_p.redraw_ssubject_timeline();
-	}
-
-	return { (double)marked_here/samplerate(),
-		 (double)(artifacts.total() - total_before) };
+        double        total_before = artifacts.total();
+        size_t        marked_here = 0;
+        auto d =
+                sigproc::derivative( signal_original);
+        size_t        last_j = 0;
+        for ( size_t i = 0; i < d.size(); ++i )
+                if ( d[i] == 0. ) {
+                        size_t j = i;
+                        while ( j < d.size() && d[j] == 0. )
+                                ++j;
+                        if ( j-i > minsize * samplerate() ) {
+                                size_t extend_from = (i - last_j < .1) ? last_j : i;
+                                artifacts.mark_artifact(
+                                        (double)extend_from/samplerate() - pad,
+                                        (double)j/samplerate() + pad);
+                                marked_here += (j - extend_from);
+                                last_j = j;
+                        }
+                        i = j;
+                }
+
+        calculate_dirty_percent();
+        get_signal_filtered();
+        if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+                get_psd_course();
+                get_psd_in_bands();
+                get_spectrum( _p.cur_page());
+                get_swu_course();
+                get_mc_course();
+
+                // if ( this == channel currently displayed on measurements overview )
+                if ( strcmp( name(), _p._p.AghH()) == 0 )
+                        _p.redraw_ssubject_timeline();
+        }
+
+        return { (double)marked_here/samplerate(),
+                 (double)(artifacts.total() - total_before) };
 }
 
 
@@ -455,41 +455,41 @@ void
 SScoringFacility::SChannel::
 mark_region_as_artifact( const bool do_mark)
 {
-	if ( do_mark )
-		artifacts.mark_artifact(
-			selection_start_time,
-			selection_end_time);
-	else
-		artifacts.clear_artifact(
-			selection_start_time,
-			selection_end_time);
-
-	calculate_dirty_percent();
-
-	get_signal_filtered();
-
-	if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
-		get_psd_course();
-		get_psd_in_bands();
-		get_spectrum( _p.cur_page());
-		get_swu_course();
-		get_mc_course();
-
-		if ( strcmp( name(), _p._p.AghH()) == 0 )
-			_p.redraw_ssubject_timeline();
-	}
+        if ( do_mark )
+                artifacts.mark_artifact(
+                        selection_start_time,
+                        selection_end_time);
+        else
+                artifacts.clear_artifact(
+                        selection_start_time,
+                        selection_end_time);
+
+        calculate_dirty_percent();
+
+        get_signal_filtered();
+
+        if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+                get_psd_course();
+                get_psd_in_bands();
+                get_spectrum( _p.cur_page());
+                get_swu_course();
+                get_mc_course();
+
+                if ( strcmp( name(), _p._p.AghH()) == 0 )
+                        _p.redraw_ssubject_timeline();
+        }
 }
 
 void
 SScoringFacility::SChannel::
 mark_region_as_annotation( const string& label,
-			   const sigfile::SAnnotation::TType type)
+                           const sigfile::SAnnotation::TType type)
 {
-	sigfile::mark_annotation(
-		annotations,
-		selection_start_time, selection_end_time,
-		label,
-		type);
+        sigfile::mark_annotation(
+                annotations,
+                selection_start_time, selection_end_time,
+                label,
+                type);
 }
 
 
@@ -497,8 +497,8 @@ void
 SScoringFacility::SChannel::
 mark_region_as_pattern()
 {
-	if ( _p.patterns_d().import_from_selection( *this) == 0 )
-		gtk_widget_show( (GtkWidget*)_p.patterns_d().wSFFD);
+        if ( _p.patterns_d().import_from_selection( *this) == 0 )
+                gtk_widget_show( (GtkWidget*)_p.patterns_d().wSFFD);
 }
 
 
@@ -507,73 +507,73 @@ void
 SScoringFacility::SChannel::
 update_channel_menu_items( const double x)
 {
-	_p.suppress_redraw = true;
+        _p.suppress_redraw = true;
 
-	bool	need_filtered = (have_low_pass() or have_high_pass() or have_notch_filter())
-		or (not artifacts().empty());
+        bool        need_filtered = (have_low_pass() or have_high_pass() or have_notch_filter())
+                or (not artifacts().empty());
 
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageShowOriginal, need_filtered);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageShowProcessed, need_filtered);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageShowOriginal, need_filtered);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageShowProcessed, need_filtered);
 
-	gtk_check_menu_item_set_active( _p.iSFPageShowOriginal,  draw_original_signal);
-	gtk_check_menu_item_set_active( _p.iSFPageShowProcessed, draw_filtered_signal);
-	gtk_check_menu_item_set_active( _p.iSFPageUseResample,   resample_signal);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawZeroline,  draw_zeroline);
+        gtk_check_menu_item_set_active( _p.iSFPageShowOriginal,  draw_original_signal);
+        gtk_check_menu_item_set_active( _p.iSFPageShowProcessed, draw_filtered_signal);
+        gtk_check_menu_item_set_active( _p.iSFPageUseResample,   resample_signal);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawZeroline,  draw_zeroline);
 
-	gtk_check_menu_item_set_active( _p.iSFPageDrawPSDProfile,  draw_psd);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawPSDSpectrum, draw_spectrum);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawMCProfile,   draw_mc);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawSWUProfile,  draw_swu);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawPSDProfile,  draw_psd);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawPSDSpectrum, draw_spectrum);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawMCProfile,   draw_mc);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawSWUProfile,  draw_swu);
 
-	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicSpindles,   draw_phasic_spindle);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicKComplexes, draw_phasic_Kcomplex);
-	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicEyeBlinks,  draw_phasic_eyeblink);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicSpindles,   draw_phasic_spindle);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicKComplexes, draw_phasic_Kcomplex);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicEyeBlinks,  draw_phasic_eyeblink);
 
-	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawCourse,   draw_selection_course);
-	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
-	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawDzxdf,    draw_selection_dzcdf);
+        gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawCourse,   draw_selection_course);
+        gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
+        gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawDzxdf,    draw_selection_dzcdf);
 
-	bool	is_eeg = (schannel().type() == sigfile::SChannel::TType::eeg),
-		is_emg = (schannel().type() == sigfile::SChannel::TType::emg),
-		have_profile = is_eeg or is_emg;
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageProfilesSubmenuSeparator, have_profile);
-	gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageProfiles,                have_profile);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDProfile,  is_eeg);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDSpectrum, is_eeg);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawSWUProfile,  is_eeg);
+        bool        is_eeg = (schannel().type() == sigfile::SChannel::TType::eeg),
+                is_emg = (schannel().type() == sigfile::SChannel::TType::emg),
+                have_profile = is_eeg or is_emg;
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageProfilesSubmenuSeparator, have_profile);
+        gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageProfiles,                have_profile);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDProfile,  is_eeg);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDSpectrum, is_eeg);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawSWUProfile,  is_eeg);
 
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg and not _p.artifacts_dialog_shown);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawMCProfile,   is_eeg);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGProfile,  is_emg);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg and not _p.artifacts_dialog_shown);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawMCProfile,   is_eeg);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGProfile,  is_emg);
 
-	double cpos = _p.time_at_click( x);
+        double cpos = _p.time_at_click( x);
 
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageHidden, _p.n_hidden > 0);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageHidden, _p.n_hidden > 0);
 
-	bool have_any = not annotations.empty();
-	bool over_any = not (_p.over_annotations = in_annotations( cpos)) . empty();
-	gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageAnnotation, have_any);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationEdit, over_any);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationDelete, over_any);
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationSeparator, over_any);
+        bool have_any = not annotations.empty();
+        bool over_any = not (_p.over_annotations = in_annotations( cpos)) . empty();
+        gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageAnnotation, have_any);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationEdit, over_any);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationDelete, over_any);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationSeparator, over_any);
 
-	_p.suppress_redraw = false;
+        _p.suppress_redraw = false;
 }
 
 void
 SScoringFacility::SChannel::
 update_power_menu_items()
 {
-	_p.suppress_redraw = true;
-	gtk_check_menu_item_set_active( _p.iSFPageDrawEMGProfile, (gboolean)draw_emg);
-	gtk_check_menu_item_set_active( _p.iSFPowerDrawBands,     (gboolean)draw_psd_bands);
-	gtk_check_menu_item_set_active( _p.iSFPowerSmooth,        (gboolean)resample_power);
-	gtk_check_menu_item_set_active( _p.iSFPowerAutoscale,     (gboolean)autoscale_profile);
-
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPowerDrawBands,
-				(schannel().type() == sigfile::SChannel::TType::eeg &&
-				 draw_psd));
-	_p.suppress_redraw = false;
+        _p.suppress_redraw = true;
+        gtk_check_menu_item_set_active( _p.iSFPageDrawEMGProfile, (gboolean)draw_emg);
+        gtk_check_menu_item_set_active( _p.iSFPowerDrawBands,     (gboolean)draw_psd_bands);
+        gtk_check_menu_item_set_active( _p.iSFPowerSmooth,        (gboolean)resample_power);
+        gtk_check_menu_item_set_active( _p.iSFPowerAutoscale,     (gboolean)autoscale_profile);
+
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPowerDrawBands,
+                                (schannel().type() == sigfile::SChannel::TType::eeg &&
+                                 draw_psd));
+        _p.suppress_redraw = false;
 }
 
 
@@ -582,9 +582,9 @@ void
 SScoringFacility::SChannel::
 selectively_enable_selection_menu_items()
 {
-	bool findable =
-		(selection_end_time - selection_start_time > .5);
-	gtk_widget_set_sensitive( (GtkWidget*)_p.iSFPageSelectionFindPattern, findable);
+        bool findable =
+                (selection_end_time - selection_start_time > .5);
+        gtk_widget_set_sensitive( (GtkWidget*)_p.iSFPageSelectionFindPattern, findable);
 }
 
 
@@ -592,45 +592,45 @@ void
 SScoringFacility::SChannel::
 put_selection( const size_t a, const size_t e)
 {
-	selection_start = a, selection_end = e;
-	selection_start_time = (double)a / samplerate();
-	selection_end_time = (double)e / samplerate();
-	_put_selection();
+        selection_start = a, selection_end = e;
+        selection_start_time = (double)a / samplerate();
+        selection_end_time = (double)e / samplerate();
+        _put_selection();
 }
 
 void
 SScoringFacility::SChannel::
 put_selection( const double a, const double e)
 {
-	selection_start_time = a, selection_end_time = e;
-	selection_start = a * samplerate();
-	selection_end = e * samplerate();
-	_put_selection();
+        selection_start_time = a, selection_end_time = e;
+        selection_start = a * samplerate();
+        selection_end = e * samplerate();
+        _put_selection();
 }
 
 void
 SScoringFacility::SChannel::
 _put_selection()
 {
-	if ( selection_end_time - selection_start_time > 1. ) {
-		auto& P = _p._p.global_artifact_detection_profiles["default"];
-		auto sssu =
-			metrics::mc::do_sssu_reduction(
-				valarray<TFloat> {signal_filtered[ slice (selection_start, (selection_end - selection_start), 1) ]},
-				samplerate(),
-				(selection_end - selection_start) / samplerate(),
-				(selection_end - selection_start) / samplerate(),
-				P.mc_gain, P.iir_backpolate,
-				P.f0, P.fc, P.bandwidth);
-		selection_SS = sssu.first[0];
-		selection_SU = sssu.second[0];
-	}
+        if ( selection_end_time - selection_start_time > 1. ) {
+                auto& P = _p._p.global_artifact_detection_profiles["default"];
+                auto sssu =
+                        metrics::mc::do_sssu_reduction(
+                                valarray<TFloat> {signal_filtered[ slice (selection_start, (selection_end - selection_start), 1) ]},
+                                samplerate(),
+                                (selection_end - selection_start) / samplerate(),
+                                (selection_end - selection_start) / samplerate(),
+                                P.mc_gain, P.iir_backpolate,
+                                P.f0, P.fc, P.bandwidth);
+                selection_SS = sssu.first[0];
+                selection_SU = sssu.second[0];
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/construct.cc b/upstream/src/aghermann/ui/sf/construct.cc
index 010d4ae..7001695 100644
--- a/upstream/src/aghermann/ui/sf/construct.cc
+++ b/upstream/src/aghermann/ui/sf/construct.cc
@@ -22,333 +22,333 @@ using namespace agh::ui;
 SScoringFacilityWidgets::
 SScoringFacilityWidgets ()
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf.glade", NULL) )
-		throw runtime_error( "Failed to load SF glade resource");
-
-	gtk_builder_connect_signals( builder, NULL);
-	//  we do it all mostly ourself, except for some delete-event binding to gtk_true()
-
-	// general & montage page navigation
-	if ( !AGH_GBGETOBJ (GtkWindow,		wSF) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFHint) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mSFScoringPageSize) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eSFPageSize) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFCurrentPage) ||
-	     !AGH_GBGETOBJ (GtkAdjustment,	jSFPageNo) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFTotalPages) ||
-	     !AGH_GBGETOBJ (GtkButton,		eSFCurrentPos) ||
-	     !AGH_GBGETOBJ (GtkExpander,	cSFHypnogram) ||
-	     !AGH_GBGETOBJ (GtkHBox,		cSFControlBar) ||
-	     !AGH_GBGETOBJ (GtkBox,		cSFScoringModeContainer) ||
-	     !AGH_GBGETOBJ (GtkBox,		cSFICAModeContainer) )
-		throw runtime_error ("Failed to construct SF widgets (0)");
-
-	if ( !AGH_GBGETOBJ (GtkButton,		bSFBack) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFForward) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFGotoPrevUnscored) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFGotoNextUnscored) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFGotoPrevArtifact) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFGotoNextArtifact) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	bSFDrawCrosshair) )
-		throw runtime_error ("Failed to construct SF widgets (0)");
-
-	if ( !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageMenu) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawOriginalSignal) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawProcessedSignal) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawZeroLine) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawFast) ||
-//	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDraw) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontagePatterns) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageICA) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontagePhaseDiff) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreAssist) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreImport) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreExport) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreClear) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageClose) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageCloseAndNext) )
-		throw runtime_error ("Failed to construct SF widgets (1)");
-
-	G_CONNECT_1 (iSFMontageMenu, activate);
-
-	G_CONNECT_2 (wSF, delete, event);
-	G_CONNECT_3 (wSF, key, press, event);
-
-	gtk_combo_box_set_model_properly(
-		eSFPageSize, mSFScoringPageSize);
-
-	G_CONNECT_1 (eSFPageSize, changed);
-	G_CONNECT_2 (eSFCurrentPage, value, changed);
-
-	G_CONNECT_1 (eSFCurrentPos, clicked);
-
-	G_CONNECT_1 (bSFForward, clicked);
-	G_CONNECT_1 (bSFBack, clicked);
-
-	G_CONNECT_1 (bSFGotoNextUnscored, clicked);
-	G_CONNECT_1 (bSFGotoPrevUnscored, clicked);
-	G_CONNECT_1 (bSFGotoNextArtifact, clicked);
-	G_CONNECT_1 (bSFGotoPrevArtifact, clicked);
-
-	G_CONNECT_1 (bSFDrawCrosshair, toggled);
-
-	G_CONNECT_1 (iSFMontageDrawOriginalSignal, toggled);
-	G_CONNECT_1 (iSFMontageDrawProcessedSignal, toggled);
-	G_CONNECT_1 (iSFMontageDrawFast, toggled);
-	G_CONNECT_1 (iSFMontageDrawZeroLine, toggled);
-	G_CONNECT_1 (iSFMontagePatterns, activate);
-	G_CONNECT_1 (iSFMontagePhaseDiff, activate);
-	G_CONNECT_1 (iSFMontageICA, activate);
-	G_CONNECT_1 (iSFMontageScoreAssist, activate);
-	G_CONNECT_1 (iSFMontageScoreImport, activate);
-	G_CONNECT_1 (iSFMontageScoreExport, activate);
-	G_CONNECT_1 (iSFMontageScoreClear, activate);
-	G_CONNECT_1 (iSFMontageClose, activate);
-	G_CONNECT_1 (iSFMontageCloseAndNext, activate);
-
-	if ( !(AGH_GBGETOBJ (GtkButton,		bSFScoreClear)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreNREM1)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreNREM2)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreNREM3)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreNREM4)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreREM))   ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreWake))  ||
-	     !(AGH_GBGETOBJ (GtkTable,		cSFSleepStageStats)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,		lSFPercentScored)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsNREMPercent)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsREMPercent)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsWakePercent)) )
-		throw runtime_error ("Failed to construct SF widgets (2)");
-
-	G_CONNECT_1 (bSFScoreClear, clicked);
-	G_CONNECT_1 (bSFScoreNREM1, clicked);
-	G_CONNECT_1 (bSFScoreNREM2, clicked);
-	G_CONNECT_1 (bSFScoreNREM3, clicked);
-	G_CONNECT_1 (bSFScoreNREM4, clicked);
-	G_CONNECT_1 (bSFScoreREM, clicked);
-	G_CONNECT_1 (bSFScoreWake, clicked);
-
-	if ( !(AGH_GBGETOBJ (GtkDrawingArea,	daSFMontage)) ||
-	     !(AGH_GBGETOBJ (GtkDrawingArea,	daSFHypnogram)) ||
-	     !(AGH_GBGETOBJ (GtkStatusbar,	sbSF)) )
-		throw runtime_error ("Failed to construct SF widgets (3)");
-
-	sbSFContextIdGeneral = gtk_statusbar_get_context_id( sbSF, "General context");
-
-	G_CONNECT_1 (daSFMontage, draw);
-	G_CONNECT_2 (daSFMontage, configure, event);
-	G_CONNECT_3 (daSFMontage, button, press, event);
-	G_CONNECT_3 (daSFMontage, button, release, event);
-	G_CONNECT_2 (daSFMontage, scroll, event);
-	G_CONNECT_3 (daSFMontage, motion, notify, event);
-	G_CONNECT_3 (daSFMontage, leave, notify, event);
-
-	G_CONNECT_1 (daSFHypnogram, draw);
-	G_CONNECT_3 (daSFHypnogram, button, press, event);
-	G_CONNECT_3 (daSFHypnogram, button, release, event);
-	G_CONNECT_3 (daSFHypnogram, motion, notify, event);
-
-	// ICA
-	if ( !(AGH_GBGETOBJ (GtkComboBox,	eSFICARemixMode)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,	eSFICANonlinearity)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,	eSFICAApproach)) ||
-	     !(AGH_GBGETOBJ (GtkListStore,	mSFICARemixMode)) ||
-	     !(AGH_GBGETOBJ (GtkListStore,	mSFICANonlinearity)) ||
-	     !(AGH_GBGETOBJ (GtkListStore,	mSFICAApproach)) ||
-	     !(AGH_GBGETOBJ (GtkCheckButton,	eSFICAFineTune)) ||
-	     !(AGH_GBGETOBJ (GtkCheckButton,	eSFICAStabilizationMode)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAa1)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAa2)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAmu)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAepsilon)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICANofICs)) ||
-	     !(AGH_GBGETOBJ (GtkAdjustment,	jSFICANofICs)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAEigVecFirst)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAEigVecLast)) ||
-	     !(AGH_GBGETOBJ (GtkAdjustment,	jSFICAEigVecFirst)) ||
-	     !(AGH_GBGETOBJ (GtkAdjustment,	jSFICAEigVecLast)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICASampleSizePercent)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFICAMaxIterations)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFICATry)) ||
-	     !(AGH_GBGETOBJ (GtkToggleButton,	bSFICAPreview)) ||
-	     !(AGH_GBGETOBJ (GtkToggleButton,	bSFICAShowMatrix)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFICAApply)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSFICACancel)) ||
-	     !(AGH_GBGETOBJ (GtkDialog,		wSFICAMatrix)) ||
-	     !(AGH_GBGETOBJ (GtkTextView,	tSFICAMatrix)) )
-		throw runtime_error ("Failed to construct SF widgets (4)");
-
-	gtk_combo_box_set_model_properly( eSFICANonlinearity, mSFICANonlinearity);
-	gtk_combo_box_set_model_properly( eSFICAApproach, mSFICAApproach);
-	gtk_combo_box_set_model_properly( eSFICARemixMode, mSFICARemixMode);
-
-	auto tabarray = pango_tab_array_new( 20, FALSE);  // 20 channels is good enough
-	for ( int t = 1; t < 20; ++t )
-		pango_tab_array_set_tab( tabarray, t-1, PANGO_TAB_LEFT, t * 12);
-	g_object_set( tSFICAMatrix,
-		      "tabs", tabarray,
-		      NULL);
-
-	G_CONNECT_1 (eSFICARemixMode, changed);
-	G_CONNECT_1 (eSFICANonlinearity, changed);
-	G_CONNECT_1 (eSFICAApproach, changed);
-	G_CONNECT_1 (eSFICAFineTune, toggled);
-	G_CONNECT_1 (eSFICAStabilizationMode, toggled);
-	G_CONNECT_2 (eSFICAa1, value, changed);
-	G_CONNECT_2 (eSFICAa2, value, changed);
-	G_CONNECT_2 (eSFICAmu, value, changed);
-	G_CONNECT_2 (eSFICAepsilon, value, changed);
-	G_CONNECT_2 (eSFICANofICs, value, changed);
-	G_CONNECT_2 (eSFICAEigVecFirst, value, changed);
-	G_CONNECT_2 (eSFICAEigVecLast, value, changed);
-	G_CONNECT_2 (eSFICASampleSizePercent, value, changed);
-	G_CONNECT_2 (eSFICAMaxIterations, value, changed);
-
-	G_CONNECT_1 (bSFICATry, clicked);
-	G_CONNECT_1 (bSFICAPreview, toggled);
-	G_CONNECT_1 (bSFICAShowMatrix, toggled);
-	G_CONNECT_1 (wSFICAMatrix, hide);
-
-	G_CONNECT_1 (bSFICAApply, clicked);
-	G_CONNECT_1 (bSFICACancel, clicked);
-
-	// ------- menus
-	if ( !(AGH_GBGETOBJ (GtkLabel, 		lSFOverChannel)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPage)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFICAPage)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPageSelection)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPageAnnotation)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPageProfiles)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPagePhasicEvents)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPageHidden)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFPower)) ||
-	     !(AGH_GBGETOBJ (GtkMenu, 		iiSFScore)) ||
-
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageShowOriginal)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageShowProcessed)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageUseResample)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageDrawZeroline)) ||
-	     !(AGH_GBGETOBJ (GtkSeparatorMenuItem,	iSFPageProfilesSubmenuSeparator)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPSDProfile)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPSDSpectrum)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawSWUProfile)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawMCProfile)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawEMGProfile)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicSpindles)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicKComplexes)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicEyeBlinks)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageFilter)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSaveChannelAsSVG)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSaveMontageAsSVG)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageExportSignal)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageUseThisScale)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageArtifactsDetect)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageArtifactsClear)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageArtifactsMarkFlat)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageHide)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem, 		iSFPageHidden)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem, 		iSFPageSpaceEvenly)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem, 		iSFPageLocateSelection)) ||
-
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationSeparator)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationDelete)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationEdit)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationClearAll)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationGotoNext)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationGotoPrev)) ||
-
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionMarkArtifact)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionClearArtifact)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionFindPattern)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionAnnotate)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageSelectionDrawCourse)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageSelectionDrawEnvelope)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPageSelectionDrawDzxdf)) ||
-
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPowerExportRange)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPowerExportAll)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPowerSmooth)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPowerDrawBands)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPowerUseThisScale)) ||
-	     !(AGH_GBGETOBJ (GtkCheckMenuItem,		iSFPowerAutoscale)) ||
-
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreAssist)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreImport)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreExport)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreClear)) )
-		throw runtime_error ("Failed to construct SF widgets (5)");
-
-	gtk_menu_item_set_submenu( iSFPageHidden, (GtkWidget*)iiSFPageHidden);
-
-	G_CONNECT_1 (iSFPageShowOriginal, toggled);
-	G_CONNECT_1 (iSFPageShowProcessed, toggled);
-	G_CONNECT_1 (iSFPageUseResample, toggled);
-	G_CONNECT_1 (iSFPageDrawZeroline, toggled);
-
-	G_CONNECT_1 (iSFPageAnnotationDelete, activate);
-	G_CONNECT_1 (iSFPageAnnotationEdit, activate);
-	G_CONNECT_1 (iSFPageAnnotationClearAll, activate);
-	G_CONNECT_1 (iSFPageAnnotationGotoPrev, activate);
-	G_CONNECT_1 (iSFPageAnnotationGotoNext, activate);
-
-	G_CONNECT_1 (iSFPageSelectionMarkArtifact, activate);
-	G_CONNECT_1 (iSFPageSelectionClearArtifact, activate);
-	G_CONNECT_1 (iSFPageSelectionFindPattern, activate);
-	G_CONNECT_1 (iSFPageSelectionAnnotate, activate);
-	G_CONNECT_1 (iSFPageSelectionDrawCourse, toggled);
-	G_CONNECT_1 (iSFPageSelectionDrawEnvelope, toggled);
-	G_CONNECT_1 (iSFPageSelectionDrawDzxdf, toggled);
-
-	G_CONNECT_1 (iSFPageFilter, activate);
-	G_CONNECT_1 (iSFPageSaveChannelAsSVG, activate);
-	G_CONNECT_1 (iSFPageSaveMontageAsSVG, activate);
-	G_CONNECT_1 (iSFPageExportSignal, activate);
-	G_CONNECT_1 (iSFPageUseThisScale, activate);
-	G_CONNECT_1 (iSFPageArtifactsDetect, activate);
-	G_CONNECT_1 (iSFPageArtifactsMarkFlat, activate);
-	G_CONNECT_1 (iSFPageArtifactsClear, activate);
-	G_CONNECT_1 (iSFPageHide, activate);
-
-	G_CONNECT_1 (iSFPageSpaceEvenly, activate);
-	G_CONNECT_1 (iSFPageLocateSelection, activate);
-
-	G_CONNECT_1 (iSFPageDrawPSDProfile, toggled);
-	G_CONNECT_1 (iSFPageDrawPSDSpectrum, toggled);
-	G_CONNECT_1 (iSFPageDrawMCProfile, toggled);
-	G_CONNECT_1 (iSFPageDrawSWUProfile, toggled);
-	G_CONNECT_1 (iSFPageDrawEMGProfile, toggled);
-
-	G_CONNECT_1 (iSFPageDrawPhasicSpindles, toggled);
-	G_CONNECT_1 (iSFPageDrawPhasicKComplexes, toggled);
-	G_CONNECT_1 (iSFPageDrawPhasicEyeBlinks, toggled);
-
-	G_CONNECT_1 (iSFPowerExportRange, activate);
-	G_CONNECT_1 (iSFPowerExportAll, activate);
-	G_CONNECT_1 (iSFPowerSmooth, toggled);
-	G_CONNECT_1 (iSFPowerDrawBands, toggled);
-	G_CONNECT_1 (iSFPowerUseThisScale, activate);
-	G_CONNECT_1 (iSFPowerAutoscale, toggled);
-
-	G_CONNECT_1 (iSFScoreAssist, activate);
-	G_CONNECT_1 (iSFScoreExport, activate);
-	G_CONNECT_1 (iSFScoreImport, activate);
-	G_CONNECT_1 (iSFScoreClear, activate);
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf.glade", NULL) )
+                throw runtime_error( "Failed to load SF glade resource");
+
+        gtk_builder_connect_signals( builder, NULL);
+        //  we do it all mostly ourself, except for some delete-event binding to gtk_true()
+
+        // general & montage page navigation
+        if ( !AGH_GBGETOBJ (GtkWindow,                wSF) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSFHint) ||
+             !AGH_GBGETOBJ (GtkListStore,        mSFScoringPageSize) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eSFPageSize) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFCurrentPage) ||
+             !AGH_GBGETOBJ (GtkAdjustment,        jSFPageNo) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSFTotalPages) ||
+             !AGH_GBGETOBJ (GtkButton,                eSFCurrentPos) ||
+             !AGH_GBGETOBJ (GtkExpander,        cSFHypnogram) ||
+             !AGH_GBGETOBJ (GtkHBox,                cSFControlBar) ||
+             !AGH_GBGETOBJ (GtkBox,                cSFScoringModeContainer) ||
+             !AGH_GBGETOBJ (GtkBox,                cSFICAModeContainer) )
+                throw runtime_error ("Failed to construct SF widgets (0)");
+
+        if ( !AGH_GBGETOBJ (GtkButton,                bSFBack) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFForward) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFGotoPrevUnscored) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFGotoNextUnscored) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFGotoPrevArtifact) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFGotoNextArtifact) ||
+             !AGH_GBGETOBJ (GtkToggleButton,        bSFDrawCrosshair) )
+                throw runtime_error ("Failed to construct SF widgets (0)");
+
+        if ( !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageMenu) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFMontageDrawOriginalSignal) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFMontageDrawProcessedSignal) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFMontageDrawZeroLine) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFMontageDrawFast) ||
+//             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFMontageDraw) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontagePatterns) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageICA) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontagePhaseDiff) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageScoreAssist) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageScoreImport) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageScoreExport) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageScoreClear) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageClose) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFMontageCloseAndNext) )
+                throw runtime_error ("Failed to construct SF widgets (1)");
+
+        G_CONNECT_1 (iSFMontageMenu, activate);
+
+        G_CONNECT_2 (wSF, delete, event);
+        G_CONNECT_3 (wSF, key, press, event);
+
+        gtk_combo_box_set_model_properly(
+                eSFPageSize, mSFScoringPageSize);
+
+        G_CONNECT_1 (eSFPageSize, changed);
+        G_CONNECT_2 (eSFCurrentPage, value, changed);
+
+        G_CONNECT_1 (eSFCurrentPos, clicked);
+
+        G_CONNECT_1 (bSFForward, clicked);
+        G_CONNECT_1 (bSFBack, clicked);
+
+        G_CONNECT_1 (bSFGotoNextUnscored, clicked);
+        G_CONNECT_1 (bSFGotoPrevUnscored, clicked);
+        G_CONNECT_1 (bSFGotoNextArtifact, clicked);
+        G_CONNECT_1 (bSFGotoPrevArtifact, clicked);
+
+        G_CONNECT_1 (bSFDrawCrosshair, toggled);
+
+        G_CONNECT_1 (iSFMontageDrawOriginalSignal, toggled);
+        G_CONNECT_1 (iSFMontageDrawProcessedSignal, toggled);
+        G_CONNECT_1 (iSFMontageDrawFast, toggled);
+        G_CONNECT_1 (iSFMontageDrawZeroLine, toggled);
+        G_CONNECT_1 (iSFMontagePatterns, activate);
+        G_CONNECT_1 (iSFMontagePhaseDiff, activate);
+        G_CONNECT_1 (iSFMontageICA, activate);
+        G_CONNECT_1 (iSFMontageScoreAssist, activate);
+        G_CONNECT_1 (iSFMontageScoreImport, activate);
+        G_CONNECT_1 (iSFMontageScoreExport, activate);
+        G_CONNECT_1 (iSFMontageScoreClear, activate);
+        G_CONNECT_1 (iSFMontageClose, activate);
+        G_CONNECT_1 (iSFMontageCloseAndNext, activate);
+
+        if ( !(AGH_GBGETOBJ (GtkButton,                bSFScoreClear)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreNREM1)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreNREM2)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreNREM3)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreNREM4)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreREM))   ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFScoreWake))  ||
+             !(AGH_GBGETOBJ (GtkTable,                cSFSleepStageStats)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                lSFPercentScored)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                lScoreStatsNREMPercent)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                lScoreStatsREMPercent)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                lScoreStatsWakePercent)) )
+                throw runtime_error ("Failed to construct SF widgets (2)");
+
+        G_CONNECT_1 (bSFScoreClear, clicked);
+        G_CONNECT_1 (bSFScoreNREM1, clicked);
+        G_CONNECT_1 (bSFScoreNREM2, clicked);
+        G_CONNECT_1 (bSFScoreNREM3, clicked);
+        G_CONNECT_1 (bSFScoreNREM4, clicked);
+        G_CONNECT_1 (bSFScoreREM, clicked);
+        G_CONNECT_1 (bSFScoreWake, clicked);
+
+        if ( !(AGH_GBGETOBJ (GtkDrawingArea,        daSFMontage)) ||
+             !(AGH_GBGETOBJ (GtkDrawingArea,        daSFHypnogram)) ||
+             !(AGH_GBGETOBJ (GtkStatusbar,        sbSF)) )
+                throw runtime_error ("Failed to construct SF widgets (3)");
+
+        sbSFContextIdGeneral = gtk_statusbar_get_context_id( sbSF, "General context");
+
+        G_CONNECT_1 (daSFMontage, draw);
+        G_CONNECT_2 (daSFMontage, configure, event);
+        G_CONNECT_3 (daSFMontage, button, press, event);
+        G_CONNECT_3 (daSFMontage, button, release, event);
+        G_CONNECT_2 (daSFMontage, scroll, event);
+        G_CONNECT_3 (daSFMontage, motion, notify, event);
+        G_CONNECT_3 (daSFMontage, leave, notify, event);
+
+        G_CONNECT_1 (daSFHypnogram, draw);
+        G_CONNECT_3 (daSFHypnogram, button, press, event);
+        G_CONNECT_3 (daSFHypnogram, button, release, event);
+        G_CONNECT_3 (daSFHypnogram, motion, notify, event);
+
+        // ICA
+        if ( !(AGH_GBGETOBJ (GtkComboBox,        eSFICARemixMode)) ||
+             !(AGH_GBGETOBJ (GtkComboBox,        eSFICANonlinearity)) ||
+             !(AGH_GBGETOBJ (GtkComboBox,        eSFICAApproach)) ||
+             !(AGH_GBGETOBJ (GtkListStore,        mSFICARemixMode)) ||
+             !(AGH_GBGETOBJ (GtkListStore,        mSFICANonlinearity)) ||
+             !(AGH_GBGETOBJ (GtkListStore,        mSFICAApproach)) ||
+             !(AGH_GBGETOBJ (GtkCheckButton,        eSFICAFineTune)) ||
+             !(AGH_GBGETOBJ (GtkCheckButton,        eSFICAStabilizationMode)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAa1)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAa2)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAmu)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAepsilon)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICANofICs)) ||
+             !(AGH_GBGETOBJ (GtkAdjustment,        jSFICANofICs)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAEigVecFirst)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAEigVecLast)) ||
+             !(AGH_GBGETOBJ (GtkAdjustment,        jSFICAEigVecFirst)) ||
+             !(AGH_GBGETOBJ (GtkAdjustment,        jSFICAEigVecLast)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICASampleSizePercent)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFICAMaxIterations)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFICATry)) ||
+             !(AGH_GBGETOBJ (GtkToggleButton,        bSFICAPreview)) ||
+             !(AGH_GBGETOBJ (GtkToggleButton,        bSFICAShowMatrix)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFICAApply)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSFICACancel)) ||
+             !(AGH_GBGETOBJ (GtkDialog,                wSFICAMatrix)) ||
+             !(AGH_GBGETOBJ (GtkTextView,        tSFICAMatrix)) )
+                throw runtime_error ("Failed to construct SF widgets (4)");
+
+        gtk_combo_box_set_model_properly( eSFICANonlinearity, mSFICANonlinearity);
+        gtk_combo_box_set_model_properly( eSFICAApproach, mSFICAApproach);
+        gtk_combo_box_set_model_properly( eSFICARemixMode, mSFICARemixMode);
+
+        auto tabarray = pango_tab_array_new( 20, FALSE);  // 20 channels is good enough
+        for ( int t = 1; t < 20; ++t )
+                pango_tab_array_set_tab( tabarray, t-1, PANGO_TAB_LEFT, t * 12);
+        g_object_set( tSFICAMatrix,
+                      "tabs", tabarray,
+                      NULL);
+
+        G_CONNECT_1 (eSFICARemixMode, changed);
+        G_CONNECT_1 (eSFICANonlinearity, changed);
+        G_CONNECT_1 (eSFICAApproach, changed);
+        G_CONNECT_1 (eSFICAFineTune, toggled);
+        G_CONNECT_1 (eSFICAStabilizationMode, toggled);
+        G_CONNECT_2 (eSFICAa1, value, changed);
+        G_CONNECT_2 (eSFICAa2, value, changed);
+        G_CONNECT_2 (eSFICAmu, value, changed);
+        G_CONNECT_2 (eSFICAepsilon, value, changed);
+        G_CONNECT_2 (eSFICANofICs, value, changed);
+        G_CONNECT_2 (eSFICAEigVecFirst, value, changed);
+        G_CONNECT_2 (eSFICAEigVecLast, value, changed);
+        G_CONNECT_2 (eSFICASampleSizePercent, value, changed);
+        G_CONNECT_2 (eSFICAMaxIterations, value, changed);
+
+        G_CONNECT_1 (bSFICATry, clicked);
+        G_CONNECT_1 (bSFICAPreview, toggled);
+        G_CONNECT_1 (bSFICAShowMatrix, toggled);
+        G_CONNECT_1 (wSFICAMatrix, hide);
+
+        G_CONNECT_1 (bSFICAApply, clicked);
+        G_CONNECT_1 (bSFICACancel, clicked);
+
+        // ------- menus
+        if ( !(AGH_GBGETOBJ (GtkLabel,                 lSFOverChannel)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPage)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFICAPage)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPageSelection)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPageAnnotation)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPageProfiles)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPagePhasicEvents)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPageHidden)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFPower)) ||
+             !(AGH_GBGETOBJ (GtkMenu,                 iiSFScore)) ||
+
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageShowOriginal)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageShowProcessed)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageUseResample)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageDrawZeroline)) ||
+             !(AGH_GBGETOBJ (GtkSeparatorMenuItem,        iSFPageProfilesSubmenuSeparator)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawPSDProfile)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawPSDSpectrum)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawSWUProfile)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawMCProfile)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawEMGProfile)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawPhasicSpindles)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawPhasicKComplexes)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                 iSFPageDrawPhasicEyeBlinks)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageFilter)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSaveChannelAsSVG)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSaveMontageAsSVG)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageExportSignal)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageUseThisScale)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageArtifactsDetect)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageArtifactsClear)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageArtifactsMarkFlat)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageHide)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                 iSFPageHidden)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                 iSFPageSpaceEvenly)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                 iSFPageLocateSelection)) ||
+
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationSeparator)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationDelete)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationEdit)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationClearAll)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationGotoNext)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageAnnotationGotoPrev)) ||
+
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSelectionMarkArtifact)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSelectionClearArtifact)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSelectionFindPattern)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPageSelectionAnnotate)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageSelectionDrawCourse)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageSelectionDrawEnvelope)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPageSelectionDrawDzxdf)) ||
+
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPowerExportRange)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPowerExportAll)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPowerSmooth)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPowerDrawBands)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFPowerUseThisScale)) ||
+             !(AGH_GBGETOBJ (GtkCheckMenuItem,                iSFPowerAutoscale)) ||
+
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFScoreAssist)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFScoreImport)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFScoreExport)) ||
+             !(AGH_GBGETOBJ (GtkMenuItem,                iSFScoreClear)) )
+                throw runtime_error ("Failed to construct SF widgets (5)");
+
+        gtk_menu_item_set_submenu( iSFPageHidden, (GtkWidget*)iiSFPageHidden);
+
+        G_CONNECT_1 (iSFPageShowOriginal, toggled);
+        G_CONNECT_1 (iSFPageShowProcessed, toggled);
+        G_CONNECT_1 (iSFPageUseResample, toggled);
+        G_CONNECT_1 (iSFPageDrawZeroline, toggled);
+
+        G_CONNECT_1 (iSFPageAnnotationDelete, activate);
+        G_CONNECT_1 (iSFPageAnnotationEdit, activate);
+        G_CONNECT_1 (iSFPageAnnotationClearAll, activate);
+        G_CONNECT_1 (iSFPageAnnotationGotoPrev, activate);
+        G_CONNECT_1 (iSFPageAnnotationGotoNext, activate);
+
+        G_CONNECT_1 (iSFPageSelectionMarkArtifact, activate);
+        G_CONNECT_1 (iSFPageSelectionClearArtifact, activate);
+        G_CONNECT_1 (iSFPageSelectionFindPattern, activate);
+        G_CONNECT_1 (iSFPageSelectionAnnotate, activate);
+        G_CONNECT_1 (iSFPageSelectionDrawCourse, toggled);
+        G_CONNECT_1 (iSFPageSelectionDrawEnvelope, toggled);
+        G_CONNECT_1 (iSFPageSelectionDrawDzxdf, toggled);
+
+        G_CONNECT_1 (iSFPageFilter, activate);
+        G_CONNECT_1 (iSFPageSaveChannelAsSVG, activate);
+        G_CONNECT_1 (iSFPageSaveMontageAsSVG, activate);
+        G_CONNECT_1 (iSFPageExportSignal, activate);
+        G_CONNECT_1 (iSFPageUseThisScale, activate);
+        G_CONNECT_1 (iSFPageArtifactsDetect, activate);
+        G_CONNECT_1 (iSFPageArtifactsMarkFlat, activate);
+        G_CONNECT_1 (iSFPageArtifactsClear, activate);
+        G_CONNECT_1 (iSFPageHide, activate);
+
+        G_CONNECT_1 (iSFPageSpaceEvenly, activate);
+        G_CONNECT_1 (iSFPageLocateSelection, activate);
+
+        G_CONNECT_1 (iSFPageDrawPSDProfile, toggled);
+        G_CONNECT_1 (iSFPageDrawPSDSpectrum, toggled);
+        G_CONNECT_1 (iSFPageDrawMCProfile, toggled);
+        G_CONNECT_1 (iSFPageDrawSWUProfile, toggled);
+        G_CONNECT_1 (iSFPageDrawEMGProfile, toggled);
+
+        G_CONNECT_1 (iSFPageDrawPhasicSpindles, toggled);
+        G_CONNECT_1 (iSFPageDrawPhasicKComplexes, toggled);
+        G_CONNECT_1 (iSFPageDrawPhasicEyeBlinks, toggled);
+
+        G_CONNECT_1 (iSFPowerExportRange, activate);
+        G_CONNECT_1 (iSFPowerExportAll, activate);
+        G_CONNECT_1 (iSFPowerSmooth, toggled);
+        G_CONNECT_1 (iSFPowerDrawBands, toggled);
+        G_CONNECT_1 (iSFPowerUseThisScale, activate);
+        G_CONNECT_1 (iSFPowerAutoscale, toggled);
+
+        G_CONNECT_1 (iSFScoreAssist, activate);
+        G_CONNECT_1 (iSFScoreExport, activate);
+        G_CONNECT_1 (iSFScoreImport, activate);
+        G_CONNECT_1 (iSFScoreClear, activate);
 
       // petty dialogs
-	// annotations
-	if ( !AGH_GBGETOBJ (GtkDialog,			wSFAnnotationLabel) ||
-	     !AGH_GBGETOBJ (GtkEntry,			eSFAnnotationLabel) ||
-	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypePlain) ||
-	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeSpindle) ||
-	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeKComplex) ||
-	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeBlink) ||
-	     !AGH_GBGETOBJ (GtkDialog,			wSFAnnotationSelector) ||
-	     !AGH_GBGETOBJ (GtkComboBox,		eSFAnnotationSelectorWhich) )
-		throw runtime_error ("Failed to construct SF widgets (6)");
-
-	mSFAnnotationsAtCursor = gtk_list_store_new(1, G_TYPE_STRING);
-	gtk_combo_box_set_model_properly( eSFAnnotationSelectorWhich, mSFAnnotationsAtCursor);
+        // annotations
+        if ( !AGH_GBGETOBJ (GtkDialog,                        wSFAnnotationLabel) ||
+             !AGH_GBGETOBJ (GtkEntry,                        eSFAnnotationLabel) ||
+             !AGH_GBGETOBJ (GtkRadioButton,                eSFAnnotationTypePlain) ||
+             !AGH_GBGETOBJ (GtkRadioButton,                eSFAnnotationTypeSpindle) ||
+             !AGH_GBGETOBJ (GtkRadioButton,                eSFAnnotationTypeKComplex) ||
+             !AGH_GBGETOBJ (GtkRadioButton,                eSFAnnotationTypeBlink) ||
+             !AGH_GBGETOBJ (GtkDialog,                        wSFAnnotationSelector) ||
+             !AGH_GBGETOBJ (GtkComboBox,                eSFAnnotationSelectorWhich) )
+                throw runtime_error ("Failed to construct SF widgets (6)");
+
+        mSFAnnotationsAtCursor = gtk_list_store_new(1, G_TYPE_STRING);
+        gtk_combo_box_set_model_properly( eSFAnnotationSelectorWhich, mSFAnnotationsAtCursor);
 }
 
 
@@ -357,13 +357,13 @@ SScoringFacilityWidgets ()
 SScoringFacilityWidgets::
 ~SScoringFacilityWidgets ()
 {
-	// destroy toplevels
-	gtk_widget_destroy( (GtkWidget*)wSF);
-	g_object_unref( (GObject*)builder);
+        // destroy toplevels
+        gtk_widget_destroy( (GtkWidget*)wSF);
+        g_object_unref( (GObject*)builder);
 }
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/controls_cb.cc b/upstream/src/aghermann/ui/sf/controls_cb.cc
index 4b1ef0f..98908b0 100644
--- a/upstream/src/aghermann/ui/sf/controls_cb.cc
+++ b/upstream/src/aghermann/ui/sf/controls_cb.cc
@@ -20,22 +20,22 @@ extern "C" {
 
 void
 eSFPageSize_changed_cb(
-	GtkComboBox *combobox,
-	gpointer userdata)
+        GtkComboBox *combobox,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	SF.set_vpagesize_item( gtk_combo_box_get_active( combobox), false);
-	SF.queue_redraw_all();
+        auto &SF = *(SScoringFacility*)userdata;
+        SF.set_vpagesize_item( gtk_combo_box_get_active( combobox), false);
+        SF.queue_redraw_all();
 }
 
 void
 eSFCurrentPage_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	gpointer userdata)
+        GtkSpinButton *spinbutton,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.set_cur_vpage( gtk_spin_button_get_value( spinbutton) - 1, false);
-	SF.queue_redraw_all();
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.set_cur_vpage( gtk_spin_button_get_value( spinbutton) - 1, false);
+        SF.queue_redraw_all();
 }
 
 
@@ -57,76 +57,76 @@ void bSFScoreClear_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)
 
 void
 bSFForward_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	auto current = SF.cur_vpage();
-	if ( current < SF.total_vpages() - 1 )
-		SF.set_cur_vpage( current+1);
-	SF.sb_clear();
+        auto &SF = *(SScoringFacility*)userdata;
+        auto current = SF.cur_vpage();
+        if ( current < SF.total_vpages() - 1 )
+                SF.set_cur_vpage( current+1);
+        SF.sb_clear();
 }
 
 void
 bSFBack_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	auto current = SF.cur_vpage();
-	if ( current > 0 )
-		SF.set_cur_vpage( current-1);
-	SF.sb_clear();
+        auto &SF = *(SScoringFacility*)userdata;
+        auto current = SF.cur_vpage();
+        if ( current > 0 )
+                SF.set_cur_vpage( current-1);
+        SF.sb_clear();
 }
 
 
 void
 eSFCurrentPos_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.show_cur_pos_time_relative = !SF.show_cur_pos_time_relative;
-	SF.draw_current_pos( NAN);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.show_cur_pos_time_relative = !SF.show_cur_pos_time_relative;
+        SF.draw_current_pos( NAN);
 }
 
 
 void
 bSFGotoPrevUnscored_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_page() == 0 )
-		return;
-
-	size_t p = SF.cur_page();
-	while ( --p != (size_t)-1 )
-		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
-			SF.sb_clear();
-			SF.set_cur_vpage( SF.p2ap(p));
-			return;
-		}
-	SF.sb_message( "No more unscored pages before this");
+        auto &SF = *(SScoringFacility*)userdata;
+        if ( SF.cur_page() == 0 )
+                return;
+
+        size_t p = SF.cur_page();
+        while ( --p != (size_t)-1 )
+                if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( SF.p2ap(p));
+                        return;
+                }
+        SF.sb_message( "No more unscored pages before this");
 }
 
 void
 bSFGotoNextUnscored_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_page() == SF.total_pages()-1 )
-		return;
-
-	size_t p = SF.cur_page();
-	while ( ++p < SF.total_pages() )
-		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
-			SF.sb_clear();
-			SF.set_cur_vpage( SF.p2ap(p));
-			return;
-		}
-	SF.sb_message( "No more unscored pages after this");
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.cur_page() == SF.total_pages()-1 )
+                return;
+
+        size_t p = SF.cur_page();
+        while ( ++p < SF.total_pages() )
+                if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( SF.p2ap(p));
+                        return;
+                }
+        SF.sb_message( "No more unscored pages after this");
 }
 
 
@@ -134,39 +134,39 @@ bSFGotoNextUnscored_clicked_cb(
 
 void
 bSFGotoPrevArtifact_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_vpage() == 0 )
-		return;
-
-	size_t p = SF.cur_vpage();
-	while ( --p != (size_t)-1 )
-		if ( SF.page_has_artifacts( p, false)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more dirty pages before this");
+        auto &SF = *(SScoringFacility*)userdata;
+        if ( SF.cur_vpage() == 0 )
+                return;
+
+        size_t p = SF.cur_vpage();
+        while ( --p != (size_t)-1 )
+                if ( SF.page_has_artifacts( p, false)) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( p);
+                        return;
+                }
+        SF.sb_message( "No more dirty pages before this");
 }
 
 void
 bSFGotoNextArtifact_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_vpage() == SF.total_vpages()-1 )
-		return;
-	size_t p = SF.cur_vpage();
-	while ( ++p < SF.total_vpages() )
-		if ( SF.page_has_artifacts( p)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more dirty pages after this");
+        auto &SF = *(SScoringFacility*)userdata;
+        if ( SF.cur_vpage() == SF.total_vpages()-1 )
+                return;
+        size_t p = SF.cur_vpage();
+        while ( ++p < SF.total_vpages() )
+                if ( SF.page_has_artifacts( p)) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( p);
+                        return;
+                }
+        SF.sb_message( "No more dirty pages after this");
 }
 
 
@@ -175,12 +175,12 @@ bSFGotoNextArtifact_clicked_cb(
 
 void
 bSFDrawCrosshair_toggled_cb(
-	GtkToggleButton*,
-	gpointer userdata)
+        GtkToggleButton*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.draw_crosshair = !SF.draw_crosshair;
-	SF.queue_redraw_all();
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.draw_crosshair = !SF.draw_crosshair;
+        SF.queue_redraw_all();
 }
 
 
@@ -189,7 +189,7 @@ bSFDrawCrosshair_toggled_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-construct.cc b/upstream/src/aghermann/ui/sf/d/artifacts-construct.cc
index 4e57cad..f7b0f62 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-construct.cc
@@ -21,73 +21,73 @@ using namespace agh::ui;
 SArtifactsDialogWidgets::
 SArtifactsDialogWidgets ()
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-artifacts.glade", NULL) )
-		throw runtime_error( "Failed to load SF::artifacts glade resource");
-	gtk_builder_connect_signals( builder, NULL);
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-artifacts.glade", NULL) )
+                throw runtime_error( "Failed to load SF::artifacts glade resource");
+        gtk_builder_connect_signals( builder, NULL);
 
-	if ( !(AGH_GBGETOBJ (GtkDialog,			wSFAD)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,		eSFADProfiles)) ||
-	     !(AGH_GBGETOBJ (GtkButton,			bSFADProfileSave)) ||
-	     !(AGH_GBGETOBJ (GtkButton,			bSFADProfileDelete)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADScope)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADUpperThr)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADLowerThr)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADF0)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADFc)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADBandwidth)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADMCGain)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADBackpolate)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADEValue)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADHistRangeMin)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADHistRangeMax)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADHistBins)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADSmoothSide)) ||
-	     !(AGH_GBGETOBJ (GtkCheckButton,		eSFADSingleChannelPreview)) ||
-	     !(AGH_GBGETOBJ (GtkCheckButton,		eSFADEstimateE)) ||
-	     !(AGH_GBGETOBJ (GtkRadioButton,		eSFADUseThisRange)) ||
-	     !(AGH_GBGETOBJ (GtkRadioButton,		eSFADUseComputedRange)) ||
-	     !(AGH_GBGETOBJ (GtkTable,			cSFADWhenEstimateEOn)) ||
-	     !(AGH_GBGETOBJ (GtkTable,			cSFADWhenEstimateEOff)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,			lSFADInfo)) ||
-	     !(AGH_GBGETOBJ (GtkLabel,			lSFADDirtyPercent)) ||
-	     !(AGH_GBGETOBJ (GtkToggleButton,		bSFADPreview)) ||
-	     !(AGH_GBGETOBJ (GtkButton,			bSFADApply)) ||
-	     !(AGH_GBGETOBJ (GtkButton,			bSFADCancel)) ||
-	     !(AGH_GBGETOBJ (GtkDialog,			wSFADSaveProfileName)) ||
-	     !(AGH_GBGETOBJ (GtkEntry,			eSFADSaveProfileNameName)) )
-		throw runtime_error ("Failed to construct SF widgets (7)");
+        if ( !(AGH_GBGETOBJ (GtkDialog,                        wSFAD)) ||
+             !(AGH_GBGETOBJ (GtkComboBox,                eSFADProfiles)) ||
+             !(AGH_GBGETOBJ (GtkButton,                        bSFADProfileSave)) ||
+             !(AGH_GBGETOBJ (GtkButton,                        bSFADProfileDelete)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADScope)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADUpperThr)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADLowerThr)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADF0)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADFc)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADBandwidth)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADMCGain)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADBackpolate)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADEValue)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADHistRangeMin)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADHistRangeMax)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADHistBins)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,                eSFADSmoothSide)) ||
+             !(AGH_GBGETOBJ (GtkCheckButton,                eSFADSingleChannelPreview)) ||
+             !(AGH_GBGETOBJ (GtkCheckButton,                eSFADEstimateE)) ||
+             !(AGH_GBGETOBJ (GtkRadioButton,                eSFADUseThisRange)) ||
+             !(AGH_GBGETOBJ (GtkRadioButton,                eSFADUseComputedRange)) ||
+             !(AGH_GBGETOBJ (GtkTable,                        cSFADWhenEstimateEOn)) ||
+             !(AGH_GBGETOBJ (GtkTable,                        cSFADWhenEstimateEOff)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                        lSFADInfo)) ||
+             !(AGH_GBGETOBJ (GtkLabel,                        lSFADDirtyPercent)) ||
+             !(AGH_GBGETOBJ (GtkToggleButton,                bSFADPreview)) ||
+             !(AGH_GBGETOBJ (GtkButton,                        bSFADApply)) ||
+             !(AGH_GBGETOBJ (GtkButton,                        bSFADCancel)) ||
+             !(AGH_GBGETOBJ (GtkDialog,                        wSFADSaveProfileName)) ||
+             !(AGH_GBGETOBJ (GtkEntry,                        eSFADSaveProfileNameName)) )
+                throw runtime_error ("Failed to construct SF widgets (7)");
 
-	mSFADProfiles = gtk_list_store_new( 1, G_TYPE_STRING);
-	// this GtkListStore is populated from the same source, but something
-	// haunting GTK+ forbids reuse of _p.mGlobalArtifactDetectionProfiles
-	gtk_combo_box_set_model_properly( eSFADProfiles, mSFADProfiles);
+        mSFADProfiles = gtk_list_store_new( 1, G_TYPE_STRING);
+        // this GtkListStore is populated from the same source, but something
+        // haunting GTK+ forbids reuse of _p.mGlobalArtifactDetectionProfiles
+        gtk_combo_box_set_model_properly( eSFADProfiles, mSFADProfiles);
 
-	G_CONNECT_1 (wSFAD, show);
-	G_CONNECT_1 (wSFAD, close);
-	G_CONNECT_2 (wSFAD, delete, event);
-	eSFADProfiles_changed_cb_handler_id =
-		G_CONNECT_1 (eSFADProfiles, changed);
-	G_CONNECT_1 (bSFADProfileSave, clicked);
-	G_CONNECT_1 (bSFADProfileDelete, clicked);
-	G_CONNECT_1 (eSFADEstimateE, toggled);
-	G_CONNECT_1 (eSFADUseThisRange, toggled);
-	G_CONNECT_1 (bSFADPreview, toggled);
-	G_CONNECT_1 (bSFADApply, clicked);
-	G_CONNECT_1 (bSFADCancel, clicked);
+        G_CONNECT_1 (wSFAD, show);
+        G_CONNECT_1 (wSFAD, close);
+        G_CONNECT_2 (wSFAD, delete, event);
+        eSFADProfiles_changed_cb_handler_id =
+                G_CONNECT_1 (eSFADProfiles, changed);
+        G_CONNECT_1 (bSFADProfileSave, clicked);
+        G_CONNECT_1 (bSFADProfileDelete, clicked);
+        G_CONNECT_1 (eSFADEstimateE, toggled);
+        G_CONNECT_1 (eSFADUseThisRange, toggled);
+        G_CONNECT_1 (bSFADPreview, toggled);
+        G_CONNECT_1 (bSFADApply, clicked);
+        G_CONNECT_1 (bSFADCancel, clicked);
 }
 
 
 SArtifactsDialogWidgets::
 ~SArtifactsDialogWidgets ()
 {
-	gtk_widget_destroy( (GtkWidget*)wSFAD);
-	g_object_unref( (GObject*)builder);
+        gtk_widget_destroy( (GtkWidget*)wSFAD);
+        g_object_unref( (GObject*)builder);
 }
 
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc b/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
index e9d2d4d..9490f7a 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
@@ -21,28 +21,28 @@ using namespace agh::ui;
 SArtifactsSimpleDialogWidgets::
 SArtifactsSimpleDialogWidgets ()
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-artifacts-simple.glade", NULL) )
-		throw runtime_error( "Failed to load SF::artifacts-simple glade resource");
-	gtk_builder_connect_signals( builder, NULL);
-
-	if ( !AGH_GBGETOBJ (GtkDialog,		wSFADS) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFADSMinFlatRegionSize) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFADSPad) )
-		throw runtime_error ("Failed to construct SF widgets (8)");
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-artifacts-simple.glade", NULL) )
+                throw runtime_error( "Failed to load SF::artifacts-simple glade resource");
+        gtk_builder_connect_signals( builder, NULL);
+
+        if ( !AGH_GBGETOBJ (GtkDialog,                wSFADS) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFADSMinFlatRegionSize) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFADSPad) )
+                throw runtime_error ("Failed to construct SF widgets (8)");
 }
 
 
 SArtifactsSimpleDialogWidgets::
 ~SArtifactsSimpleDialogWidgets ()
 {
-	gtk_widget_destroy( (GtkWidget*)wSFADS);
-	g_object_unref( (GObject*)builder);
+        gtk_widget_destroy( (GtkWidget*)wSFADS);
+        g_object_unref( (GObject*)builder);
 }
 
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc b/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
index 77727f1..e58203d 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
@@ -18,27 +18,27 @@ SScoringFacility::SArtifactsSimpleDialog&
 SScoringFacility::
 artifacts_simple_d()
 {
-	if ( not _artifacts_simple_d )
-		_artifacts_simple_d = new SArtifactsSimpleDialog(*this);
-	return *_artifacts_simple_d;
+        if ( not _artifacts_simple_d )
+                _artifacts_simple_d = new SArtifactsSimpleDialog(*this);
+        return *_artifacts_simple_d;
 }
 
 
 SScoringFacility::SArtifactsSimpleDialog::
 SArtifactsSimpleDialog (SScoringFacility& p_)
       : min_size (0.5),
-	pad (),
-	_p (p_)
+        pad (),
+        _p (p_)
 {
-	W_V.reg( eSFADSMinFlatRegionSize,	&min_size);
-	W_V.reg( eSFADSPad,			&pad);
+        W_V.reg( eSFADSMinFlatRegionSize,        &min_size);
+        W_V.reg( eSFADSPad,                        &pad);
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh b/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
index 511eb61..72a824f 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
@@ -28,33 +28,33 @@ namespace ui {
 
 struct SArtifactsSimpleDialogWidgets {
 
-	SArtifactsSimpleDialogWidgets ();
+        SArtifactsSimpleDialogWidgets ();
        ~SArtifactsSimpleDialogWidgets ();
 
-	GtkBuilder *builder;
+        GtkBuilder *builder;
 
-	GtkDialog
-		*wSFADS;
-	GtkSpinButton
-		*eSFADSMinFlatRegionSize,
-		*eSFADSPad;
+        GtkDialog
+                *wSFADS;
+        GtkSpinButton
+                *eSFADSMinFlatRegionSize,
+                *eSFADSPad;
 };
 
 struct SScoringFacility::SArtifactsSimpleDialog
   : public SArtifactsSimpleDialogWidgets {
 
-	DELETE_DEFAULT_METHODS (SArtifactsSimpleDialog);
+        DELETE_DEFAULT_METHODS (SArtifactsSimpleDialog);
 
-	SArtifactsSimpleDialog (SScoringFacility&);
+        SArtifactsSimpleDialog (SScoringFacility&);
 
-	double	min_size,
-		pad;
+        double        min_size,
+                pad;
 
-	SUIVarCollection
-		W_V;
+        SUIVarCollection
+                W_V;
 
-	SScoringFacility&
-		_p;
+        SScoringFacility&
+                _p;
 };
 
 }
@@ -63,7 +63,7 @@ struct SScoringFacility::SArtifactsSimpleDialog
 #endif // _AGH_UI_SF_FILTERS_H
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts.cc b/upstream/src/aghermann/ui/sf/d/artifacts.cc
index a2fb5fb..8e1c173 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts.cc
@@ -18,34 +18,34 @@ SScoringFacility::SArtifactsDialog&
 SScoringFacility::
 artifacts_d()
 {
-	if ( not _artifacts_d )
-		_artifacts_d = new SArtifactsDialog(*this);
-	return *_artifacts_d;
+        if ( not _artifacts_d )
+                _artifacts_d = new SArtifactsDialog(*this);
+        return *_artifacts_d;
 }
 
 
 SScoringFacility::SArtifactsDialog::
 SArtifactsDialog (SScoringFacility& p_)
       : using_channel (nullptr),
-	_p (p_)
+        _p (p_)
 {
-	W_V.reg( eSFADScope,		&P.scope);
-	W_V.reg( eSFADUpperThr,		&P.upper_thr);
-	W_V.reg( eSFADLowerThr,		&P.lower_thr);
-	W_V.reg( eSFADF0,		&P.f0);
-	W_V.reg( eSFADFc,		&P.fc);
-	W_V.reg( eSFADBandwidth,	&P.bandwidth);
-	W_V.reg( eSFADMCGain,		&P.mc_gain);
-	W_V.reg( eSFADBackpolate,	&P.iir_backpolate);
-	W_V.reg( eSFADEstimateE,	&P.estimate_E);
-	W_V.reg( eSFADEValue,		&P.E);
-	W_V.reg( eSFADHistRangeMin,	&P.dmin);
-	W_V.reg( eSFADHistRangeMax,	&P.dmax);
-	W_V.reg( eSFADHistBins,		(int*)&P.sssu_hist_size);
-	W_V.reg( eSFADSmoothSide,	(int*)&P.smooth_side);
-	W_V.reg( eSFADUseThisRange,	&P.use_range);
+        W_V.reg( eSFADScope,                &P.scope);
+        W_V.reg( eSFADUpperThr,                &P.upper_thr);
+        W_V.reg( eSFADLowerThr,                &P.lower_thr);
+        W_V.reg( eSFADF0,                &P.f0);
+        W_V.reg( eSFADFc,                &P.fc);
+        W_V.reg( eSFADBandwidth,        &P.bandwidth);
+        W_V.reg( eSFADMCGain,                &P.mc_gain);
+        W_V.reg( eSFADBackpolate,        &P.iir_backpolate);
+        W_V.reg( eSFADEstimateE,        &P.estimate_E);
+        W_V.reg( eSFADEValue,                &P.E);
+        W_V.reg( eSFADHistRangeMin,        &P.dmin);
+        W_V.reg( eSFADHistRangeMax,        &P.dmax);
+        W_V.reg( eSFADHistBins,                (int*)&P.sssu_hist_size);
+        W_V.reg( eSFADSmoothSide,        (int*)&P.smooth_side);
+        W_V.reg( eSFADUseThisRange,        &P.use_range);
 
-	populate_mSFADProfiles();
+        populate_mSFADProfiles();
 }
 
 
@@ -56,23 +56,23 @@ void
 SScoringFacility::SArtifactsDialog::
 populate_mSFADProfiles()
 {
-	g_signal_handler_block( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
-	gtk_list_store_clear( mSFADProfiles);
-	for ( auto &P : _p._p.global_artifact_detection_profiles ) {
-		GtkTreeIter iter;
-		gtk_list_store_append( mSFADProfiles, &iter);
-		gtk_list_store_set( mSFADProfiles, &iter,
-				    0, P.first.c_str(),
-				    -1);
-	}
-	gtk_combo_box_set_model( eSFADProfiles, (GtkTreeModel*)mSFADProfiles);
-	g_signal_handler_unblock( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
+        g_signal_handler_block( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
+        gtk_list_store_clear( mSFADProfiles);
+        for ( auto &P : _p._p.global_artifact_detection_profiles ) {
+                GtkTreeIter iter;
+                gtk_list_store_append( mSFADProfiles, &iter);
+                gtk_list_store_set( mSFADProfiles, &iter,
+                                    0, P.first.c_str(),
+                                    -1);
+        }
+        gtk_combo_box_set_model( eSFADProfiles, (GtkTreeModel*)mSFADProfiles);
+        g_signal_handler_unblock( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts.hh b/upstream/src/aghermann/ui/sf/d/artifacts.hh
index 6538cde..a780508 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts.hh
+++ b/upstream/src/aghermann/ui/sf/d/artifacts.hh
@@ -32,82 +32,82 @@ namespace ui {
 
 struct SArtifactsDialogWidgets {
 
-	SArtifactsDialogWidgets ();
+        SArtifactsDialogWidgets ();
        ~SArtifactsDialogWidgets ();
 
-	GtkBuilder *builder;
-
-	GtkDialog
-		*wSFAD;
-	GtkListStore
-		*mSFADProfiles;
-	GtkComboBox
-		*eSFADProfiles;
-	gulong	eSFADProfiles_changed_cb_handler_id;
-	GtkButton
-		*bSFADProfileSave,
-		*bSFADProfileDelete;
-	GtkSpinButton
-		*eSFADUpperThr,
-		*eSFADLowerThr,
-		*eSFADScope,
-		*eSFADF0,
-		*eSFADFc,
-		*eSFADBandwidth,
-		*eSFADMCGain,
-		*eSFADBackpolate,
-		*eSFADEValue,
-		*eSFADHistRangeMin,
-		*eSFADHistRangeMax,
-		*eSFADHistBins,
-		*eSFADSmoothSide;
-	GtkCheckButton
-		*eSFADEstimateE,
-		*eSFADSingleChannelPreview;
-	GtkRadioButton
-		*eSFADUseThisRange,
-		*eSFADUseComputedRange;
-	GtkTable
-		*cSFADWhenEstimateEOn,
-		*cSFADWhenEstimateEOff;
-	GtkLabel
-		*lSFADInfo,
-		*lSFADDirtyPercent;
-	GtkToggleButton
-		*bSFADPreview;
-	GtkButton
-		*bSFADApply,
-		*bSFADCancel;
-	GtkDialog
-		*wSFADSaveProfileName;
-	GtkEntry
-		*eSFADSaveProfileNameName;
+        GtkBuilder *builder;
+
+        GtkDialog
+                *wSFAD;
+        GtkListStore
+                *mSFADProfiles;
+        GtkComboBox
+                *eSFADProfiles;
+        gulong        eSFADProfiles_changed_cb_handler_id;
+        GtkButton
+                *bSFADProfileSave,
+                *bSFADProfileDelete;
+        GtkSpinButton
+                *eSFADUpperThr,
+                *eSFADLowerThr,
+                *eSFADScope,
+                *eSFADF0,
+                *eSFADFc,
+                *eSFADBandwidth,
+                *eSFADMCGain,
+                *eSFADBackpolate,
+                *eSFADEValue,
+                *eSFADHistRangeMin,
+                *eSFADHistRangeMax,
+                *eSFADHistBins,
+                *eSFADSmoothSide;
+        GtkCheckButton
+                *eSFADEstimateE,
+                *eSFADSingleChannelPreview;
+        GtkRadioButton
+                *eSFADUseThisRange,
+                *eSFADUseComputedRange;
+        GtkTable
+                *cSFADWhenEstimateEOn,
+                *cSFADWhenEstimateEOff;
+        GtkLabel
+                *lSFADInfo,
+                *lSFADDirtyPercent;
+        GtkToggleButton
+                *bSFADPreview;
+        GtkButton
+                *bSFADApply,
+                *bSFADCancel;
+        GtkDialog
+                *wSFADSaveProfileName;
+        GtkEntry
+                *eSFADSaveProfileNameName;
 };
 
 struct SScoringFacility::SArtifactsDialog
     : public SArtifactsDialogWidgets {
 
-	DELETE_DEFAULT_METHODS (SArtifactsDialog);
+        DELETE_DEFAULT_METHODS (SArtifactsDialog);
 
-	SArtifactsDialog (SScoringFacility&);
+        SArtifactsDialog (SScoringFacility&);
 
-	SScoringFacility::SChannel
-		*using_channel;
-	metrics::mc::SArtifactDetectionPP
-		P;
-	sigfile::SArtifacts
-		artifacts_backup;
-	bool	orig_signal_visible_backup;
-	list<pair<SScoringFacility::SChannel*, bool>>
-		channels_visible_backup;
-	bool	suppress_preview_handler;
-	SUIVarCollection
-		W_V;
+        SScoringFacility::SChannel
+                *using_channel;
+        metrics::mc::SArtifactDetectionPP
+                P;
+        sigfile::SArtifacts
+                artifacts_backup;
+        bool        orig_signal_visible_backup;
+        list<pair<SScoringFacility::SChannel*, bool>>
+                channels_visible_backup;
+        bool        suppress_preview_handler;
+        SUIVarCollection
+                W_V;
 
-	SScoringFacility&
-		_p;
+        SScoringFacility&
+                _p;
 
-	void populate_mSFADProfiles();
+        void populate_mSFADProfiles();
 };
 
 
@@ -132,7 +132,7 @@ void bSFADCancel_clicked_cb( GtkButton*, gpointer);
 #endif // _AGH_UI_SF_D_ARTIFACTS_H
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc b/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc
index c9d58fc..5d02c47 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc
@@ -20,254 +20,254 @@ using namespace agh::ui;
 
 void
 eSFADProfiles_changed_cb(
-	GtkComboBox* w,
-	const gpointer userdata)
+        GtkComboBox* w,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
-
-	if ( gtk_combo_box_get_active( w) != -1 ) {
-		AD.P = SF._p.global_artifact_detection_profiles[
-			gtk_combo_box_get_active_id(w)];
-		AD.W_V.up();
-		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADProfileDelete, TRUE);
-	} else
-		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADProfileDelete, FALSE);
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
+
+        if ( gtk_combo_box_get_active( w) != -1 ) {
+                AD.P = SF._p.global_artifact_detection_profiles[
+                        gtk_combo_box_get_active_id(w)];
+                AD.W_V.up();
+                gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADProfileDelete, TRUE);
+        } else
+                gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADProfileDelete, FALSE);
 }
 
 void
 bSFADProfileSave_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
-
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( AD.wSFADSaveProfileName) ) {
-		AD.W_V.down();
-		SF._p.global_artifact_detection_profiles[
-			gtk_entry_get_text( AD.eSFADSaveProfileNameName)] = AD.P;
-
-		SF._p.populate_mGlobalADProfiles();
-		AD.populate_mSFADProfiles(); // stupid
-
-		int now_active = SF._p.global_artifact_detection_profiles.size()-1;
-		gtk_combo_box_set_active( AD.eSFADProfiles, now_active);
-		gtk_combo_box_set_active( SF._p.eGlobalADProfiles, now_active);
-	}
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
+
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( AD.wSFADSaveProfileName) ) {
+                AD.W_V.down();
+                SF._p.global_artifact_detection_profiles[
+                        gtk_entry_get_text( AD.eSFADSaveProfileNameName)] = AD.P;
+
+                SF._p.populate_mGlobalADProfiles();
+                AD.populate_mSFADProfiles(); // stupid
+
+                int now_active = SF._p.global_artifact_detection_profiles.size()-1;
+                gtk_combo_box_set_active( AD.eSFADProfiles, now_active);
+                gtk_combo_box_set_active( SF._p.eGlobalADProfiles, now_active);
+        }
 }
 
 void
 bSFADProfileDelete_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
 
-	const gchar *deleting_id = gtk_combo_box_get_active_id( AD.eSFADProfiles);
-	int deleting = gtk_combo_box_get_active( AD.eSFADProfiles);
-	SF._p.global_artifact_detection_profiles.erase( deleting_id);
+        const gchar *deleting_id = gtk_combo_box_get_active_id( AD.eSFADProfiles);
+        int deleting = gtk_combo_box_get_active( AD.eSFADProfiles);
+        SF._p.global_artifact_detection_profiles.erase( deleting_id);
 
-	SF._p.populate_mGlobalADProfiles();
-	AD.populate_mSFADProfiles(); // stupid
+        SF._p.populate_mGlobalADProfiles();
+        AD.populate_mSFADProfiles(); // stupid
 
-	if ( SF._p.global_artifact_detection_profiles.size() > 0 &&
-	     deleting > (int)SF._p.global_artifact_detection_profiles.size()-1 )
-		gtk_combo_box_set_active( AD.eSFADProfiles, deleting-1);
+        if ( SF._p.global_artifact_detection_profiles.size() > 0 &&
+             deleting > (int)SF._p.global_artifact_detection_profiles.size()-1 )
+                gtk_combo_box_set_active( AD.eSFADProfiles, deleting-1);
 
-	g_signal_emit_by_name( AD.eSFADProfiles, "changed");
+        g_signal_emit_by_name( AD.eSFADProfiles, "changed");
 }
 
 
 void
 eSFADEstimateE_toggled_cb(
-	GtkToggleButton *b,
-	const gpointer userdata)
+        GtkToggleButton *b,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-
-	auto state = gtk_toggle_button_get_active( b);
-	gtk_widget_set_visible(
-		(GtkWidget*)AD.cSFADWhenEstimateEOn,
-		state);
-	gtk_widget_set_visible(
-		(GtkWidget*)AD.cSFADWhenEstimateEOff,
-		!state);
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+
+        auto state = gtk_toggle_button_get_active( b);
+        gtk_widget_set_visible(
+                (GtkWidget*)AD.cSFADWhenEstimateEOn,
+                state);
+        gtk_widget_set_visible(
+                (GtkWidget*)AD.cSFADWhenEstimateEOff,
+                !state);
 }
 
 void
 eSFADUseThisRange_toggled_cb(
-	GtkToggleButton *b,
-	const gpointer userdata)
+        GtkToggleButton *b,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-
-	auto state = gtk_toggle_button_get_active( b);
-	gtk_widget_set_sensitive(
-		(GtkWidget*)AD.eSFADHistRangeMin,
-		state);
-	gtk_widget_set_sensitive(
-		(GtkWidget*)AD.eSFADHistRangeMax,
-		state);
-
-	// if ( state ) {
-	// 	snprintf_buf( "Estimated <i>E</i> = %4.2f",
-	// 		      SF.using_channel -> estimate_E( P));
-	// }
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+
+        auto state = gtk_toggle_button_get_active( b);
+        gtk_widget_set_sensitive(
+                (GtkWidget*)AD.eSFADHistRangeMin,
+                state);
+        gtk_widget_set_sensitive(
+                (GtkWidget*)AD.eSFADHistRangeMax,
+                state);
+
+        // if ( state ) {
+        //         snprintf_buf( "Estimated <i>E</i> = %4.2f",
+        //                       SF.using_channel -> estimate_E( P));
+        // }
 }
 
 
 
 void
 bSFADApply_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
 
-	gtk_widget_hide( (GtkWidget*)AD.wSFAD);
+        gtk_widget_hide( (GtkWidget*)AD.wSFAD);
 
-	for ( auto& H : AD.channels_visible_backup )
-		H.first->hidden = H.second;
-	AD.channels_visible_backup.clear();
-	AD.artifacts_backup.clear_all();
+        for ( auto& H : AD.channels_visible_backup )
+                H.first->hidden = H.second;
+        AD.channels_visible_backup.clear();
+        AD.artifacts_backup.clear_all();
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
 
 void
 bSFADCancel_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
-	SF.artifacts_dialog_shown = false;
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
+        SF.artifacts_dialog_shown = false;
 
-	gtk_widget_hide( (GtkWidget*)AD.wSFAD);
+        gtk_widget_hide( (GtkWidget*)AD.wSFAD);
 
-	if ( gtk_toggle_button_get_active(AD.bSFADPreview) ) {
-		AD.using_channel->artifacts = AD.artifacts_backup;
-		AD.using_channel->get_signal_filtered();
+        if ( gtk_toggle_button_get_active(AD.bSFADPreview) ) {
+                AD.using_channel->artifacts = AD.artifacts_backup;
+                AD.using_channel->get_signal_filtered();
 
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
-	}
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        }
 
-	for ( auto& H : AD.channels_visible_backup )
-		H.first->hidden = H.second;
-	AD.channels_visible_backup.clear();
-	AD.artifacts_backup.clear_all();
+        for ( auto& H : AD.channels_visible_backup )
+                H.first->hidden = H.second;
+        AD.channels_visible_backup.clear();
+        AD.artifacts_backup.clear_all();
 }
 
 void
 bSFADPreview_toggled_cb(
-	GtkToggleButton *b,
-	const gpointer userdata)
+        GtkToggleButton *b,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
-
-	if ( AD.suppress_preview_handler )
-		return;
-
-	if ( gtk_toggle_button_get_active(b) ) {
-		SBusyBlock bb (AD.wSFAD);
-
-		AD.orig_signal_visible_backup = AD.using_channel->draw_original_signal;
-		AD.artifacts_backup = AD.using_channel->artifacts;
-
-		AD.using_channel->detect_artifacts( (AD.W_V.down(), AD.P));
-		AD.using_channel->draw_original_signal = true;
-		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, TRUE);
-
-		AD.channels_visible_backup.clear();
-		if ( gtk_toggle_button_get_active( (GtkToggleButton*)AD.eSFADSingleChannelPreview) )
-			for ( auto& H : SF.channels ) {
-				AD.channels_visible_backup.emplace_back(
-					&H, H.hidden);
-				if ( &H != AD.using_channel )
-					H.hidden = true;
-			}
-
-	} else {
-		AD.using_channel->artifacts = AD.artifacts_backup;
-		for ( auto& H : AD.channels_visible_backup )
-			H.first->hidden = H.second;
-		AD.using_channel->draw_original_signal = AD.orig_signal_visible_backup;
-		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE);
-	}
-
-	SF.using_channel -> get_signal_filtered();
-
-	gtk_label_set_markup(
-		AD.lSFADDirtyPercent,
-		snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
-
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
+
+        if ( AD.suppress_preview_handler )
+                return;
+
+        if ( gtk_toggle_button_get_active(b) ) {
+                SBusyBlock bb (AD.wSFAD);
+
+                AD.orig_signal_visible_backup = AD.using_channel->draw_original_signal;
+                AD.artifacts_backup = AD.using_channel->artifacts;
+
+                AD.using_channel->detect_artifacts( (AD.W_V.down(), AD.P));
+                AD.using_channel->draw_original_signal = true;
+                gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, TRUE);
+
+                AD.channels_visible_backup.clear();
+                if ( gtk_toggle_button_get_active( (GtkToggleButton*)AD.eSFADSingleChannelPreview) )
+                        for ( auto& H : SF.channels ) {
+                                AD.channels_visible_backup.emplace_back(
+                                        &H, H.hidden);
+                                if ( &H != AD.using_channel )
+                                        H.hidden = true;
+                        }
+
+        } else {
+                AD.using_channel->artifacts = AD.artifacts_backup;
+                for ( auto& H : AD.channels_visible_backup )
+                        H.first->hidden = H.second;
+                AD.using_channel->draw_original_signal = AD.orig_signal_visible_backup;
+                gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE);
+        }
+
+        SF.using_channel -> get_signal_filtered();
+
+        gtk_label_set_markup(
+                AD.lSFADDirtyPercent,
+                snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
+
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
 
 
 
 void
 wSFAD_show_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
-	auto& SF = AD._p;
-	SF.artifacts_dialog_shown = true;
-
-	AD.using_channel = AD._p.using_channel;  // because the latter is mutable, and AD isn't modal
-
-	AD.W_V.up();
-	AD.populate_mSFADProfiles();
-	g_signal_emit_by_name( AD.eSFADProfiles, "changed");
-
-	g_signal_emit_by_name( AD.eSFADEstimateE, "toggled");
-	g_signal_emit_by_name( AD.eSFADEstimateE, "toggled");
-	g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled");
-	g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled");
-
-	gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE);
-	AD.suppress_preview_handler = true;
-	gtk_toggle_button_set_active( AD.bSFADPreview, FALSE);
-	AD.suppress_preview_handler = false;
-
-	gtk_label_set_text(
-		AD.lSFADInfo,
-		snprintf_buf( "Artifact detection in channel %s", AD.using_channel->name()));
-	gtk_label_set_text(
-		AD.lSFADDirtyPercent,
-		snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
+        auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
+        auto& SF = AD._p;
+        SF.artifacts_dialog_shown = true;
+
+        AD.using_channel = AD._p.using_channel;  // because the latter is mutable, and AD isn't modal
+
+        AD.W_V.up();
+        AD.populate_mSFADProfiles();
+        g_signal_emit_by_name( AD.eSFADProfiles, "changed");
+
+        g_signal_emit_by_name( AD.eSFADEstimateE, "toggled");
+        g_signal_emit_by_name( AD.eSFADEstimateE, "toggled");
+        g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled");
+        g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled");
+
+        gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE);
+        AD.suppress_preview_handler = true;
+        gtk_toggle_button_set_active( AD.bSFADPreview, FALSE);
+        AD.suppress_preview_handler = false;
+
+        gtk_label_set_text(
+                AD.lSFADInfo,
+                snprintf_buf( "Artifact detection in channel %s", AD.using_channel->name()));
+        gtk_label_set_text(
+                AD.lSFADDirtyPercent,
+                snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
 }
 
 
 gboolean
 wSFAD_delete_event_cb(
-	GtkWidget*,
-	GdkEvent*,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEvent*,
+        const gpointer userdata)
 {
-	bSFADCancel_clicked_cb( NULL, userdata);
-	return TRUE;
+        bSFADCancel_clicked_cb( NULL, userdata);
+        return TRUE;
 }
 
 void
 wSFAD_close_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	bSFADCancel_clicked_cb( NULL, userdata);
+        bSFADCancel_clicked_cb( NULL, userdata);
 }
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/filters-construct.cc b/upstream/src/aghermann/ui/sf/d/filters-construct.cc
index d434f30..848d6e7 100644
--- a/upstream/src/aghermann/ui/sf/d/filters-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/filters-construct.cc
@@ -22,40 +22,40 @@ using namespace agh::ui;
 SFiltersDialogWidgets::
 SFiltersDialogWidgets ()
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-filters.glade", NULL) )
-		throw runtime_error( "Failed to load SF::artifacts glade resource");
-	gtk_builder_connect_signals( builder, NULL);
-
-	if ( !AGH_GBGETOBJ (GtkDialog,		wSFFilters) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFFilterCaption) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFilterLowPassCutoff) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFilterLowPassOrder) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFilterHighPassCutoff) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFilterHighPassOrder) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eSFFilterNotchFilter) ||
-	     !AGH_GBGETOBJ (GtkListStore,	mSFFilterNotchFilter) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFilterOK) )
-		throw runtime_error ("Failed to construct SF widgets (10)");
-
-	gtk_combo_box_set_model_properly(
-		eSFFilterNotchFilter, mSFFilterNotchFilter); // can't reuse _p.mNotchFilter
-
-	G_CONNECT_2 (eSFFilterHighPassCutoff, value, changed);
-	G_CONNECT_2 (eSFFilterLowPassCutoff, value, changed);
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-filters.glade", NULL) )
+                throw runtime_error( "Failed to load SF::artifacts glade resource");
+        gtk_builder_connect_signals( builder, NULL);
+
+        if ( !AGH_GBGETOBJ (GtkDialog,                wSFFilters) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSFFilterCaption) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFilterLowPassCutoff) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFilterLowPassOrder) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFilterHighPassCutoff) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFilterHighPassOrder) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eSFFilterNotchFilter) ||
+             !AGH_GBGETOBJ (GtkListStore,        mSFFilterNotchFilter) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFilterOK) )
+                throw runtime_error ("Failed to construct SF widgets (10)");
+
+        gtk_combo_box_set_model_properly(
+                eSFFilterNotchFilter, mSFFilterNotchFilter); // can't reuse _p.mNotchFilter
+
+        G_CONNECT_2 (eSFFilterHighPassCutoff, value, changed);
+        G_CONNECT_2 (eSFFilterLowPassCutoff, value, changed);
 }
 
 SFiltersDialogWidgets::
 ~SFiltersDialogWidgets ()
 {
-	// destroy toplevels
-	gtk_widget_destroy( (GtkWidget*)wSFFilters);
-	g_object_unref( (GObject*)builder);
+        // destroy toplevels
+        gtk_widget_destroy( (GtkWidget*)wSFFilters);
+        g_object_unref( (GObject*)builder);
 }
 
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/filters.cc b/upstream/src/aghermann/ui/sf/d/filters.cc
index f809230..2cdc425 100644
--- a/upstream/src/aghermann/ui/sf/d/filters.cc
+++ b/upstream/src/aghermann/ui/sf/d/filters.cc
@@ -19,25 +19,25 @@ SScoringFacility::SFiltersDialog&
 SScoringFacility::
 filters_d()
 {
-	if ( not _filters_d )
-		_filters_d = new SFiltersDialog(*this);
-	return *_filters_d;
+        if ( not _filters_d )
+                _filters_d = new SFiltersDialog(*this);
+        return *_filters_d;
 }
 
 SScoringFacility::SFiltersDialog::
 SFiltersDialog (SScoringFacility& p_)
       : _p (p_)
 {
-	W_V.reg( eSFFilterLowPassCutoff,  &P.low_pass_cutoff);
-	W_V.reg( eSFFilterLowPassOrder,   (int*)&P.low_pass_order);
-	W_V.reg( eSFFilterHighPassCutoff, &P.high_pass_cutoff);
-	W_V.reg( eSFFilterHighPassOrder,  (int*)&P.high_pass_order);
-	W_V.reg( eSFFilterNotchFilter,    (int*)&P.notch_filter);
+        W_V.reg( eSFFilterLowPassCutoff,  &P.low_pass_cutoff);
+        W_V.reg( eSFFilterLowPassOrder,   (int*)&P.low_pass_order);
+        W_V.reg( eSFFilterHighPassCutoff, &P.high_pass_cutoff);
+        W_V.reg( eSFFilterHighPassOrder,  (int*)&P.high_pass_order);
+        W_V.reg( eSFFilterNotchFilter,    (int*)&P.notch_filter);
 }
 
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/filters.hh b/upstream/src/aghermann/ui/sf/d/filters.hh
index 3ed7723..a1885e4 100644
--- a/upstream/src/aghermann/ui/sf/d/filters.hh
+++ b/upstream/src/aghermann/ui/sf/d/filters.hh
@@ -28,41 +28,41 @@ namespace ui {
 
 struct SFiltersDialogWidgets {
 
-	SFiltersDialogWidgets ();
+        SFiltersDialogWidgets ();
        ~SFiltersDialogWidgets ();
 
-	GtkBuilder *builder;
-
-	GtkDialog
-		*wSFFilters;
-	GtkLabel
-		*lSFFilterCaption;
-	GtkSpinButton
-		*eSFFilterLowPassCutoff, *eSFFilterHighPassCutoff,
-		*eSFFilterLowPassOrder, *eSFFilterHighPassOrder;
-	GtkComboBox
-		*eSFFilterNotchFilter;
-	GtkListStore
-		*mSFFilterNotchFilter;
-	GtkButton
-		*bSFFilterOK;
+        GtkBuilder *builder;
+
+        GtkDialog
+                *wSFFilters;
+        GtkLabel
+                *lSFFilterCaption;
+        GtkSpinButton
+                *eSFFilterLowPassCutoff, *eSFFilterHighPassCutoff,
+                *eSFFilterLowPassOrder, *eSFFilterHighPassOrder;
+        GtkComboBox
+                *eSFFilterNotchFilter;
+        GtkListStore
+                *mSFFilterNotchFilter;
+        GtkButton
+                *bSFFilterOK;
 };
 
 struct SScoringFacility::SFiltersDialog
   : public SFiltersDialogWidgets {
 
-	DELETE_DEFAULT_METHODS (SFiltersDialog);
+        DELETE_DEFAULT_METHODS (SFiltersDialog);
 
-	SFiltersDialog (SScoringFacility&);
+        SFiltersDialog (SScoringFacility&);
 
-	sigfile::SFilterPack
-		P;
+        sigfile::SFilterPack
+                P;
 
-	SUIVarCollection
-		W_V;
+        SUIVarCollection
+                W_V;
 
-	SScoringFacility&
-		_p;
+        SScoringFacility&
+                _p;
 };
 
 }
@@ -76,7 +76,7 @@ void eSFFilterLowPassCutoff_value_changed_cb( GtkSpinButton*, gpointer);
 #endif // AGH_AGHERMANN_UI_SF_D_FILTERS_H_
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/filters_cb.cc b/upstream/src/aghermann/ui/sf/d/filters_cb.cc
index 67774ae..816c8ac 100644
--- a/upstream/src/aghermann/ui/sf/d/filters_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/filters_cb.cc
@@ -22,24 +22,24 @@ extern "C" {
 
 void
 eSFFilterHighPassCutoff_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
-	double other_freq = gtk_spin_button_get_value( FD.eSFFilterLowPassCutoff);
-	gtk_widget_set_sensitive( (GtkWidget*)FD.bSFFilterOK,
-				  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) < other_freq);
+        auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
+        double other_freq = gtk_spin_button_get_value( FD.eSFFilterLowPassCutoff);
+        gtk_widget_set_sensitive( (GtkWidget*)FD.bSFFilterOK,
+                                  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) < other_freq);
 }
 
 void
 eSFFilterLowPassCutoff_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
-	gdouble other_freq = gtk_spin_button_get_value( FD.eSFFilterHighPassCutoff);
-	gtk_widget_set_sensitive( (GtkWidget*)FD.bSFFilterOK,
-				  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) > other_freq);
+        auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
+        gdouble other_freq = gtk_spin_button_get_value( FD.eSFFilterHighPassCutoff);
+        gtk_widget_set_sensitive( (GtkWidget*)FD.bSFFilterOK,
+                                  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) > other_freq);
 }
 
 
@@ -47,7 +47,7 @@ eSFFilterLowPassCutoff_value_changed_cb(
 
 
 // Local Variables:
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns-construct.cc b/upstream/src/aghermann/ui/sf/d/patterns-construct.cc
index 40a7ed8..c9b6445 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-construct.cc
@@ -19,143 +19,143 @@ using namespace agh::ui;
 SPatternsDialogWidgets::
 SPatternsDialogWidgets (SScoringFacility& SF)
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-patterns.glade", NULL) )
-		throw runtime_error( "Failed to load SF::patterns glade resource");
-	gtk_builder_connect_signals( builder, NULL);
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-patterns.glade", NULL) )
+                throw runtime_error( "Failed to load SF::patterns glade resource");
+        gtk_builder_connect_signals( builder, NULL);
 
-	mSFFDPatterns =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-	mSFFDChannels =
-		gtk_list_store_new( 1, G_TYPE_STRING);
+        mSFFDPatterns =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+        mSFFDChannels =
+                gtk_list_store_new( 1, G_TYPE_STRING);
 
-	if ( !AGH_GBGETOBJ (GtkDialog,		wSFFD) ||
-	     !AGH_GBGETOBJ (GtkDrawingArea,	daSFFDThing) ||
-	     !AGH_GBGETOBJ (GtkScrolledWindow,	swSFFDThing) ||
-	     !AGH_GBGETOBJ (GtkDrawingArea,	daSFFDField) ||
-	     !AGH_GBGETOBJ (GtkMenuBar,		iibSFFDMenu) ||
-	     !AGH_GBGETOBJ (GtkMenu,		iiSFFDField) ||
-	     !AGH_GBGETOBJ (GtkMenu,		iiSFFDFieldProfileTypes) ||
-	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFFDFieldDrawMatchIndex) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iSFFDFieldProfileTypeRaw) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iSFFDFieldProfileTypePSD) ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iSFFDFieldProfileTypeMC)  ||
-	     !AGH_GBGETOBJ (GtkRadioMenuItem,	iSFFDFieldProfileTypeSWU) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFFDMarkPhasicEventSpindles) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFFDMarkPhasicEventKComplexes) ||
-	     !AGH_GBGETOBJ (GtkMenuItem,	iSFFDMarkPlain) ||
-	     !AGH_GBGETOBJ (GtkScrolledWindow,	swSFFDField) ||
-	     !AGH_GBGETOBJ (GtkTable,		cSFFDSearchButton) ||
-	     !AGH_GBGETOBJ (GtkTable,		cSFFDAgainButton) ||
-	     !AGH_GBGETOBJ (GtkBox,		cSFFDSearching) ||
-	     !AGH_GBGETOBJ (GtkTable,		cSFFDParameters) ||
-	     !AGH_GBGETOBJ (GtkTable,		cSFFDCriteria) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDSearch) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDAgain) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDProfileSave) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDProfileDiscard) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDProfileRevert) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDEnvTightness) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDBandPassOrder) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDBandPassFrom) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDBandPassUpto) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDDZCDFStep) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDDZCDFSigma) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDDZCDFSmooth) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDParameterA) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDParameterB) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDParameterC) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDParameterD) ||
-	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDIncrement) ||
-	     !AGH_GBGETOBJ (GtkHBox,		cSFFDLabelBox) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFFDParametersBrief) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFFDFoundInfo) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eSFFDPatternList) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eSFFDChannel) ||
-	     !AGH_GBGETOBJ (GtkDialog,		wSFFDPatternSave) ||
-	     !AGH_GBGETOBJ (GtkEntry,		eSFFDPatternSaveName) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	eSFFDPatternSaveOriginSubject) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	eSFFDPatternSaveOriginExperiment) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	eSFFDPatternSaveOriginUser) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDPatternSaveOK) )
-		throw runtime_error ("Failed to construct SF widgets (9)");
+        if ( !AGH_GBGETOBJ (GtkDialog,                wSFFD) ||
+             !AGH_GBGETOBJ (GtkDrawingArea,        daSFFDThing) ||
+             !AGH_GBGETOBJ (GtkScrolledWindow,        swSFFDThing) ||
+             !AGH_GBGETOBJ (GtkDrawingArea,        daSFFDField) ||
+             !AGH_GBGETOBJ (GtkMenuBar,                iibSFFDMenu) ||
+             !AGH_GBGETOBJ (GtkMenu,                iiSFFDField) ||
+             !AGH_GBGETOBJ (GtkMenu,                iiSFFDFieldProfileTypes) ||
+             !AGH_GBGETOBJ (GtkCheckMenuItem,        iSFFDFieldDrawMatchIndex) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iSFFDFieldProfileTypeRaw) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iSFFDFieldProfileTypePSD) ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iSFFDFieldProfileTypeMC)  ||
+             !AGH_GBGETOBJ (GtkRadioMenuItem,        iSFFDFieldProfileTypeSWU) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFFDMarkPhasicEventSpindles) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFFDMarkPhasicEventKComplexes) ||
+             !AGH_GBGETOBJ (GtkMenuItem,        iSFFDMarkPlain) ||
+             !AGH_GBGETOBJ (GtkScrolledWindow,        swSFFDField) ||
+             !AGH_GBGETOBJ (GtkTable,                cSFFDSearchButton) ||
+             !AGH_GBGETOBJ (GtkTable,                cSFFDAgainButton) ||
+             !AGH_GBGETOBJ (GtkBox,                cSFFDSearching) ||
+             !AGH_GBGETOBJ (GtkTable,                cSFFDParameters) ||
+             !AGH_GBGETOBJ (GtkTable,                cSFFDCriteria) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDSearch) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDAgain) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDProfileSave) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDProfileDiscard) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDProfileRevert) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDEnvTightness) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDBandPassOrder) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDBandPassFrom) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDBandPassUpto) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDDZCDFStep) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDDZCDFSigma) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDDZCDFSmooth) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDParameterA) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDParameterB) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDParameterC) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDParameterD) ||
+             !AGH_GBGETOBJ (GtkSpinButton,        eSFFDIncrement) ||
+             !AGH_GBGETOBJ (GtkHBox,                cSFFDLabelBox) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSFFDParametersBrief) ||
+             !AGH_GBGETOBJ (GtkLabel,                lSFFDFoundInfo) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eSFFDPatternList) ||
+             !AGH_GBGETOBJ (GtkComboBox,        eSFFDChannel) ||
+             !AGH_GBGETOBJ (GtkDialog,                wSFFDPatternSave) ||
+             !AGH_GBGETOBJ (GtkEntry,                eSFFDPatternSaveName) ||
+             !AGH_GBGETOBJ (GtkToggleButton,        eSFFDPatternSaveOriginSubject) ||
+             !AGH_GBGETOBJ (GtkToggleButton,        eSFFDPatternSaveOriginExperiment) ||
+             !AGH_GBGETOBJ (GtkToggleButton,        eSFFDPatternSaveOriginUser) ||
+             !AGH_GBGETOBJ (GtkButton,                bSFFDPatternSaveOK) )
+                throw runtime_error ("Failed to construct SF widgets (9)");
 
-	gtk_combo_box_set_model_properly( eSFFDPatternList, mSFFDPatterns);
-	eSFFDPatternList_changed_cb_handler_id =
-		G_CONNECT_1 (eSFFDPatternList, changed);
+        gtk_combo_box_set_model_properly( eSFFDPatternList, mSFFDPatterns);
+        eSFFDPatternList_changed_cb_handler_id =
+                G_CONNECT_1 (eSFFDPatternList, changed);
 
-	// filter channels we don't have
-	for ( auto &H : SF.channels ) {
-		GtkTreeIter iter;
-		gtk_list_store_append( mSFFDChannels, &iter);
-		gtk_list_store_set( mSFFDChannels, &iter,
-				    0, H.name(),
-				    -1);
-	}
-	gtk_combo_box_set_model_properly( eSFFDChannel, mSFFDChannels);
-	eSFFDChannel_changed_cb_handler_id =
-		G_CONNECT_1 (eSFFDChannel, changed);
+        // filter channels we don't have
+        for ( auto &H : SF.channels ) {
+                GtkTreeIter iter;
+                gtk_list_store_append( mSFFDChannels, &iter);
+                gtk_list_store_set( mSFFDChannels, &iter,
+                                    0, H.name(),
+                                    -1);
+        }
+        gtk_combo_box_set_model_properly( eSFFDChannel, mSFFDChannels);
+        eSFFDChannel_changed_cb_handler_id =
+                G_CONNECT_1 (eSFFDChannel, changed);
 
-	G_CONNECT_2 (wSFFD, configure, event);
-	G_CONNECT_1 (daSFFDThing, draw);
-	G_CONNECT_3 (daSFFDThing, button, press, event);
-	G_CONNECT_2 (daSFFDThing, scroll, event);
-	G_CONNECT_1 (daSFFDField, draw);
-	G_CONNECT_2 (daSFFDField, scroll, event);
-	G_CONNECT_3 (daSFFDField, motion, notify, event);
-	G_CONNECT_3 (daSFFDField, button, press, event);
-	G_CONNECT_1 (bSFFDProfileSave, clicked);
-	G_CONNECT_1 (bSFFDProfileDiscard, clicked);
-	G_CONNECT_1 (bSFFDProfileRevert, clicked);
-	G_CONNECT_1 (bSFFDSearch, clicked);
-	G_CONNECT_1 (bSFFDAgain, clicked);
-	G_CONNECT_1 (eSFFDPatternSaveName, changed);
-	G_CONNECT_1 (iSFFDFieldDrawMatchIndex, toggled);
-	G_CONNECT_1 (iSFFDMarkPhasicEventSpindles, activate);
-	G_CONNECT_1 (iSFFDMarkPhasicEventKComplexes, activate);
-	G_CONNECT_1 (iSFFDMarkPlain, activate);
+        G_CONNECT_2 (wSFFD, configure, event);
+        G_CONNECT_1 (daSFFDThing, draw);
+        G_CONNECT_3 (daSFFDThing, button, press, event);
+        G_CONNECT_2 (daSFFDThing, scroll, event);
+        G_CONNECT_1 (daSFFDField, draw);
+        G_CONNECT_2 (daSFFDField, scroll, event);
+        G_CONNECT_3 (daSFFDField, motion, notify, event);
+        G_CONNECT_3 (daSFFDField, button, press, event);
+        G_CONNECT_1 (bSFFDProfileSave, clicked);
+        G_CONNECT_1 (bSFFDProfileDiscard, clicked);
+        G_CONNECT_1 (bSFFDProfileRevert, clicked);
+        G_CONNECT_1 (bSFFDSearch, clicked);
+        G_CONNECT_1 (bSFFDAgain, clicked);
+        G_CONNECT_1 (eSFFDPatternSaveName, changed);
+        G_CONNECT_1 (iSFFDFieldDrawMatchIndex, toggled);
+        G_CONNECT_1 (iSFFDMarkPhasicEventSpindles, activate);
+        G_CONNECT_1 (iSFFDMarkPhasicEventKComplexes, activate);
+        G_CONNECT_1 (iSFFDMarkPlain, activate);
 
-	for ( auto& W : {eSFFDEnvTightness,
-			 eSFFDBandPassFrom, eSFFDBandPassUpto, eSFFDBandPassOrder,
-			 eSFFDDZCDFStep, eSFFDDZCDFSigma, eSFFDDZCDFSmooth} )
-		g_signal_connect( W, "value-changed",
-				  (GCallback)eSFFD_any_pattern_value_changed_cb,
-				  this);
-	for ( auto& W : {eSFFDParameterA, eSFFDParameterB, eSFFDParameterC, eSFFDParameterD} ) {
-		g_signal_connect( W, "value-changed",
-				  (GCallback)eSFFD_any_criteria_value_changed_cb,
-				  this);
-		g_signal_connect( W, "focus-in-event",
-				  (GCallback)eSFFD_any_criteria_focus_in_event_cb,
-				  this);
-	}
-	for ( auto& W : {eSFFDPatternSaveOriginUser, eSFFDPatternSaveOriginExperiment, eSFFDPatternSaveOriginSubject} )
-		g_signal_connect( W, "toggled",
-				  (GCallback)eSFFD_any_pattern_origin_toggled_cb,
-				  this);
-	for ( auto& W : {iSFFDFieldProfileTypeRaw, iSFFDFieldProfileTypePSD, iSFFDFieldProfileTypeMC, iSFFDFieldProfileTypeSWU} )
-		g_signal_connect( W, "toggled",
-				  (GCallback)iSFFD_any_field_profile_type_toggled_cb,
-				  this);
+        for ( auto& W : {eSFFDEnvTightness,
+                         eSFFDBandPassFrom, eSFFDBandPassUpto, eSFFDBandPassOrder,
+                         eSFFDDZCDFStep, eSFFDDZCDFSigma, eSFFDDZCDFSmooth} )
+                g_signal_connect( W, "value-changed",
+                                  (GCallback)eSFFD_any_pattern_value_changed_cb,
+                                  this);
+        for ( auto& W : {eSFFDParameterA, eSFFDParameterB, eSFFDParameterC, eSFFDParameterD} ) {
+                g_signal_connect( W, "value-changed",
+                                  (GCallback)eSFFD_any_criteria_value_changed_cb,
+                                  this);
+                g_signal_connect( W, "focus-in-event",
+                                  (GCallback)eSFFD_any_criteria_focus_in_event_cb,
+                                  this);
+        }
+        for ( auto& W : {eSFFDPatternSaveOriginUser, eSFFDPatternSaveOriginExperiment, eSFFDPatternSaveOriginSubject} )
+                g_signal_connect( W, "toggled",
+                                  (GCallback)eSFFD_any_pattern_origin_toggled_cb,
+                                  this);
+        for ( auto& W : {iSFFDFieldProfileTypeRaw, iSFFDFieldProfileTypePSD, iSFFDFieldProfileTypeMC, iSFFDFieldProfileTypeSWU} )
+                g_signal_connect( W, "toggled",
+                                  (GCallback)iSFFD_any_field_profile_type_toggled_cb,
+                                  this);
 
-	G_CONNECT_1 (wSFFD, show);
-	G_CONNECT_1 (wSFFD, hide);
+        G_CONNECT_1 (wSFFD, show);
+        G_CONNECT_1 (wSFFD, hide);
 }
 
 SPatternsDialogWidgets::
 ~SPatternsDialogWidgets ()
 {
-	// destroy toplevels
-	gtk_widget_destroy( (GtkWidget*)wSFFD);
-	g_object_unref( (GObject*)mSFFDPatterns);
-	g_object_unref( (GObject*)mSFFDChannels);
-	g_object_unref( (GObject*)builder);
+        // destroy toplevels
+        gtk_widget_destroy( (GtkWidget*)wSFFD);
+        g_object_unref( (GObject*)mSFFDPatterns);
+        g_object_unref( (GObject*)mSFFDChannels);
+        g_object_unref( (GObject*)builder);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns-draw.cc b/upstream/src/aghermann/ui/sf/d/patterns-draw.cc
index 36d33c3..7183eba 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-draw.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-draw.cc
@@ -21,22 +21,22 @@ void
 SScoringFacility::SPatternsDialog::
 set_thing_da_width( const int width)
 {
-	static int scrollbar_width = 15;
-	g_object_set( (GObject*)daSFFDThing,
-		      "width-request", da_thing_wd = max( width-scrollbar_width, 600),
-		      "height-request", da_thing_ht,
-		      NULL);
+        static int scrollbar_width = 15;
+        g_object_set( (GObject*)daSFFDThing,
+                      "width-request", da_thing_wd = max( width-scrollbar_width, 600),
+                      "height-request", da_thing_ht,
+                      NULL);
 }
 
 void
 SScoringFacility::SPatternsDialog::
 set_field_da_width( const int width)
 {
-	static int scrollbar_width = 15;
-	g_object_set( (GObject*)daSFFDField,
-		      "width-request", da_field_wd = max( width-scrollbar_width, 600),
-		      "height-request", da_field_ht,
-		      NULL);
+        static int scrollbar_width = 15;
+        g_object_set( (GObject*)daSFFDField,
+                      "width-request", da_field_wd = max( width-scrollbar_width, 600),
+                      "height-request", da_field_ht,
+                      NULL);
 }
 
 
@@ -45,121 +45,121 @@ void
 SScoringFacility::SPatternsDialog::
 draw_thing( cairo_t *cr)
 {
-	if ( current_pattern == patterns.end() ) {
-		cairo_put_banner( cr, da_thing_wd, da_thing_ht, "(make a selection)");
-		return;
-	}
+        if ( current_pattern == patterns.end() ) {
+                cairo_put_banner( cr, da_thing_wd, da_thing_ht, "(make a selection)");
+                return;
+        }
 
       // ticks
-	cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-	cairo_set_font_size( cr, 9);
-	double	seconds = (double)current_pattern->thing.size() / current_pattern->samplerate;
-	for ( size_t i8 = 0; (float)i8 / 8 < seconds; ++i8 ) {
-		_p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
-		cairo_set_line_width( cr, (i8%8 == 0) ? 1. : (i8%4 == 0) ? .6 : .3);
-		guint x = (float)i8/8 / seconds * da_thing_wd;
-		cairo_move_to( cr, x, 0);
-		cairo_rel_line_to( cr, 0, da_thing_ht);
-		cairo_stroke( cr);
-
-		if ( i8 % 8 == 0 ) {
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
-			cairo_move_to( cr, x + 5, da_thing_ht-2);
-			cairo_show_text( cr, snprintf_buf( "%g", (float)i8/8));
-			cairo_stroke( cr);
-		}
-	}
-
-	size_t	run = current_pattern->pattern_size_essential();
+        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+        cairo_set_font_size( cr, 9);
+        double        seconds = (double)current_pattern->thing.size() / current_pattern->samplerate;
+        for ( size_t i8 = 0; (float)i8 / 8 < seconds; ++i8 ) {
+                _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
+                cairo_set_line_width( cr, (i8%8 == 0) ? 1. : (i8%4 == 0) ? .6 : .3);
+                guint x = (float)i8/8 / seconds * da_thing_wd;
+                cairo_move_to( cr, x, 0);
+                cairo_rel_line_to( cr, 0, da_thing_ht);
+                cairo_stroke( cr);
+
+                if ( i8 % 8 == 0 ) {
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
+                        cairo_move_to( cr, x + 5, da_thing_ht-2);
+                        cairo_show_text( cr, snprintf_buf( "%g", (float)i8/8));
+                        cairo_stroke( cr);
+                }
+        }
+
+        size_t        run = current_pattern->pattern_size_essential();
 
       // thing
-	int	zeroline = da_thing_ht/2;
-	cairo_set_source_rgb( cr, 0., 0., 0.);
-	cairo_set_line_width( cr, .8);
-	cairo_draw_signal( cr, current_pattern->thing, 0, current_pattern->thing.size(),
-			   da_thing_wd, 0, zeroline,
-			   thing_display_scale);
-	cairo_stroke( cr);
-
-	// lines marking out context
-	cairo_set_source_rgba( cr, 0.9, 0.9, 0.9, .5);
-	cairo_set_line_width( cr, 1.);
-	cairo_rectangle( cr, 0., 0., (float)current_pattern->context_before / current_pattern->thing.size() * da_thing_wd, da_thing_ht);
-	cairo_rectangle( cr, (float)(current_pattern->context_before + run) / current_pattern->thing.size() * da_thing_wd, 0,
-			 (float)(current_pattern->context_after) / current_pattern->thing.size() * da_thing_wd, da_thing_ht);
-	cairo_fill( cr);
-	cairo_stroke( cr);
-
-	if ( draw_details ) {
-		valarray<TFloat>
-			env_u, env_l,
-			target_freq,
-			dzcdf;
-	      // envelope
-		{
-			if ( 0 == sigproc::envelope(
-				     {current_pattern->thing, current_pattern->samplerate}, Pp2.env_scope,
-				     1./current_pattern->samplerate,
-				     &env_l, &env_u) ) {
-				cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Pattern is too short for this envelope scope");
-				goto out;
-			}
-
-			_p._p.CwB[SExpDesignUI::TColour::sf_selection].set_source_rgba_contrasting( cr, .3);
-			cairo_draw_signal(
-				cr, env_u, 0, env_u.size(),
-				da_thing_wd, 0, zeroline, thing_display_scale);
-			cairo_draw_signal(
-				cr, env_l, 0, env_l.size(),
-				da_thing_wd, 0, zeroline, thing_display_scale,
-				1, TDrawSignalDirection::backward);
-			cairo_close_path( cr);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-		}
-	      // target frequency
-		{
-			if ( Pp2.bwf_ffrom >= Pp2.bwf_fupto ) {
-				cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Bad band-pass range");
-				goto out;
-			}
-			target_freq = exstrom::band_pass(
-				current_pattern->thing, current_pattern->samplerate,
-				Pp2.bwf_ffrom, Pp2.bwf_fupto, Pp2.bwf_order, true);
-
-			cairo_set_source_rgba( cr, 0.3, 0.3, 0.3, .5);
-			cairo_set_line_width( cr, 3.);
-			cairo_draw_signal(
-				cr, target_freq, 0, target_freq.size(),
-				da_thing_wd, 0, zeroline, thing_display_scale);
-			cairo_stroke( cr);
-		}
-
-	      // dzcdf
-		{
-			if ( current_pattern->samplerate < 10 ) {
-				cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Samplerate is too low");
-				goto out;
-			}
-			if ( Pp2.dzcdf_step * 10 > current_pattern->pattern_length() ) { // require at least 10 dzcdf points
-				cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Selection is too short for DZCDF");
-				goto out;
-			}
-
-			dzcdf = sigproc::dzcdf( sigproc::SSignalRef<TFloat> {current_pattern->thing, current_pattern->samplerate},
-						Pp2.dzcdf_step, Pp2.dzcdf_sigma, Pp2.dzcdf_smooth);
-			float	dzcdf_display_scale = da_thing_ht/4. / dzcdf.max();
-
-			cairo_set_source_rgba( cr, 0.3, 0.3, 0.99, .8);
-			cairo_set_line_width( cr, 1.);
-			cairo_draw_signal(
-				cr, dzcdf, 0, dzcdf.size(),
-				da_thing_wd, 0, zeroline, dzcdf_display_scale);
-			cairo_stroke( cr);
-		}
-	}
+        int        zeroline = da_thing_ht/2;
+        cairo_set_source_rgb( cr, 0., 0., 0.);
+        cairo_set_line_width( cr, .8);
+        cairo_draw_signal( cr, current_pattern->thing, 0, current_pattern->thing.size(),
+                           da_thing_wd, 0, zeroline,
+                           thing_display_scale);
+        cairo_stroke( cr);
+
+        // lines marking out context
+        cairo_set_source_rgba( cr, 0.9, 0.9, 0.9, .5);
+        cairo_set_line_width( cr, 1.);
+        cairo_rectangle( cr, 0., 0., (float)current_pattern->context_before / current_pattern->thing.size() * da_thing_wd, da_thing_ht);
+        cairo_rectangle( cr, (float)(current_pattern->context_before + run) / current_pattern->thing.size() * da_thing_wd, 0,
+                         (float)(current_pattern->context_after) / current_pattern->thing.size() * da_thing_wd, da_thing_ht);
+        cairo_fill( cr);
+        cairo_stroke( cr);
+
+        if ( draw_details ) {
+                valarray<TFloat>
+                        env_u, env_l,
+                        target_freq,
+                        dzcdf;
+              // envelope
+                {
+                        if ( 0 == sigproc::envelope(
+                                     {current_pattern->thing, current_pattern->samplerate}, Pp2.env_scope,
+                                     1./current_pattern->samplerate,
+                                     &env_l, &env_u) ) {
+                                cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Pattern is too short for this envelope scope");
+                                goto out;
+                        }
+
+                        _p._p.CwB[SExpDesignUI::TColour::sf_selection].set_source_rgba_contrasting( cr, .3);
+                        cairo_draw_signal(
+                                cr, env_u, 0, env_u.size(),
+                                da_thing_wd, 0, zeroline, thing_display_scale);
+                        cairo_draw_signal(
+                                cr, env_l, 0, env_l.size(),
+                                da_thing_wd, 0, zeroline, thing_display_scale,
+                                1, TDrawSignalDirection::backward);
+                        cairo_close_path( cr);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+                }
+              // target frequency
+                {
+                        if ( Pp2.bwf_ffrom >= Pp2.bwf_fupto ) {
+                                cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Bad band-pass range");
+                                goto out;
+                        }
+                        target_freq = exstrom::band_pass(
+                                current_pattern->thing, current_pattern->samplerate,
+                                Pp2.bwf_ffrom, Pp2.bwf_fupto, Pp2.bwf_order, true);
+
+                        cairo_set_source_rgba( cr, 0.3, 0.3, 0.3, .5);
+                        cairo_set_line_width( cr, 3.);
+                        cairo_draw_signal(
+                                cr, target_freq, 0, target_freq.size(),
+                                da_thing_wd, 0, zeroline, thing_display_scale);
+                        cairo_stroke( cr);
+                }
+
+              // dzcdf
+                {
+                        if ( current_pattern->samplerate < 10 ) {
+                                cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Samplerate is too low");
+                                goto out;
+                        }
+                        if ( Pp2.dzcdf_step * 10 > current_pattern->pattern_length() ) { // require at least 10 dzcdf points
+                                cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Selection is too short for DZCDF");
+                                goto out;
+                        }
+
+                        dzcdf = sigproc::dzcdf( sigproc::SSignalRef<TFloat> {current_pattern->thing, current_pattern->samplerate},
+                                                Pp2.dzcdf_step, Pp2.dzcdf_sigma, Pp2.dzcdf_smooth);
+                        float        dzcdf_display_scale = da_thing_ht/4. / dzcdf.max();
+
+                        cairo_set_source_rgba( cr, 0.3, 0.3, 0.99, .8);
+                        cairo_set_line_width( cr, 1.);
+                        cairo_draw_signal(
+                                cr, dzcdf, 0, dzcdf.size(),
+                                da_thing_wd, 0, zeroline, dzcdf_display_scale);
+                        cairo_stroke( cr);
+                }
+        }
 out:
-	;
+        ;
 }
 
 void
@@ -167,86 +167,86 @@ SScoringFacility::SPatternsDialog::
 draw_field( cairo_t *cr)
 {
       // field
-	_p._p.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
-	cairo_set_line_width( cr, 1.);
-
-	auto profile_with_corrected_type = field_channel->which_profile( field_profile_type);
-	field_profile_type = get<0>(profile_with_corrected_type);
-	auto& profile = get<1>(profile_with_corrected_type);
-	if ( field_profile_type == metrics::TType::raw )
-		cairo_draw_envelope(
-			cr,
-			profile, 0, profile.size(),
-			da_field_wd, 0., da_field_ht/4,
-			field_display_scale);
-	else {
-		cairo_draw_signal(
-			cr,
-			profile, 0, profile.size(),
-			da_field_wd, 0., da_field_ht/2,
-			field_display_scale);
-		cairo_line_to( cr, da_field_wd, da_field_ht/2);
-		cairo_line_to( cr, 0, da_field_ht/2);
-		cairo_close_path( cr);
-		cairo_fill( cr);
-	}
-	cairo_stroke( cr);
+        _p._p.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
+        cairo_set_line_width( cr, 1.);
+
+        auto profile_with_corrected_type = field_channel->which_profile( field_profile_type);
+        field_profile_type = get<0>(profile_with_corrected_type);
+        auto& profile = get<1>(profile_with_corrected_type);
+        if ( field_profile_type == metrics::TType::raw )
+                cairo_draw_envelope(
+                        cr,
+                        profile, 0, profile.size(),
+                        da_field_wd, 0., da_field_ht/4,
+                        field_display_scale);
+        else {
+                cairo_draw_signal(
+                        cr,
+                        profile, 0, profile.size(),
+                        da_field_wd, 0., da_field_ht/2,
+                        field_display_scale);
+                cairo_line_to( cr, da_field_wd, da_field_ht/2);
+                cairo_line_to( cr, 0, da_field_ht/2);
+                cairo_close_path( cr);
+                cairo_fill( cr);
+        }
+        cairo_stroke( cr);
 
       // occurrences
-	if ( occurrences.size() > 500 )
-		cairo_put_banner(
-			cr, da_field_wd, da_field_ht / .75, "Too many; reduce strictness?");
-	else if ( occurrences.size() > 0 ) {
-		cairo_set_line_width( cr, 1.);
-		for ( size_t o = 0; o < occurrences.size(); ++o ) {
-			auto x = (double)occurrences[o]/diff_line.size() * da_field_wd;
-			if ( o == highlighted_occurrence )
-				cairo_set_source_rgba( cr, .1, .3, .5, 1.);
-			else
-				cairo_set_source_rgba( cr, .1, .3, .5, .4);
-
-			cairo_rectangle(
-				cr,
-				x - 1, da_field_ht/2 + 5,
-				2, 10);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-		}
-	} else
-		cairo_put_banner(
-			cr, da_field_wd, da_field_ht / .75, "Nothing found");
+        if ( occurrences.size() > 500 )
+                cairo_put_banner(
+                        cr, da_field_wd, da_field_ht / .75, "Too many; reduce strictness?");
+        else if ( occurrences.size() > 0 ) {
+                cairo_set_line_width( cr, 1.);
+                for ( size_t o = 0; o < occurrences.size(); ++o ) {
+                        auto x = (double)occurrences[o]/diff_line.size() * da_field_wd;
+                        if ( o == highlighted_occurrence )
+                                cairo_set_source_rgba( cr, .1, .3, .5, 1.);
+                        else
+                                cairo_set_source_rgba( cr, .1, .3, .5, .4);
+
+                        cairo_rectangle(
+                                cr,
+                                x - 1, da_field_ht/2 + 5,
+                                2, 10);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+                }
+        } else
+                cairo_put_banner(
+                        cr, da_field_wd, da_field_ht / .75, "Nothing found");
 
       // diff line with degree of criteria attainment
-	cairo_set_line_width( cr, .2);
-	valarray<TFloat> tmp (diff_line.size());
-
-	cairo_move_to( cr, 0, da_field_ht-25);
-	cairo_rel_line_to( cr, da_field_wd, 0);
-	cairo_stroke( cr);
-
-#define KEKE(R,G,B,N)							\
-	{cairo_set_source_rgba( cr, R, G, B, .5);			\
-		cairo_move_to( cr, 0, da_field_ht-5);			\
-		size_t inc = max((int)(increment * current_pattern->samplerate), 1); \
-		for ( size_t i = 0; i < diff_line.size(); i += inc )	\
-			cairo_line_to( cr, ((double)i)/diff_line.size() * da_field_wd, \
-				       da_field_ht - 5 - get<N>(criteria) / get<N>(diff_line[i]) * 20); \
-	cairo_stroke( cr); }
-
-	if ( draw_match_index )
-		switch ( now_tweaking ) {
-		case 1: KEKE(.1, .5, .8, 0); break;
-		case 2: KEKE(.5, .1, .8, 1); break;
-		case 3: KEKE(.1, .8, .5, 2); break;
-		case 4: KEKE(.5, .8, .1, 3); break;
-		}
+        cairo_set_line_width( cr, .2);
+        valarray<TFloat> tmp (diff_line.size());
+
+        cairo_move_to( cr, 0, da_field_ht-25);
+        cairo_rel_line_to( cr, da_field_wd, 0);
+        cairo_stroke( cr);
+
+#define KEKE(R,G,B,N)                                                        \
+        {cairo_set_source_rgba( cr, R, G, B, .5);                        \
+                cairo_move_to( cr, 0, da_field_ht-5);                        \
+                size_t inc = max((int)(increment * current_pattern->samplerate), 1); \
+                for ( size_t i = 0; i < diff_line.size(); i += inc )        \
+                        cairo_line_to( cr, ((double)i)/diff_line.size() * da_field_wd, \
+                                       da_field_ht - 5 - get<N>(criteria) / get<N>(diff_line[i]) * 20); \
+        cairo_stroke( cr); }
+
+        if ( draw_match_index )
+                switch ( now_tweaking ) {
+                case 1: KEKE(.1, .5, .8, 0); break;
+                case 2: KEKE(.5, .1, .8, 1); break;
+                case 3: KEKE(.1, .8, .5, 2); break;
+                case 4: KEKE(.5, .8, .1, 3); break;
+                }
 #undef KEKE
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc b/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
index 17e6c76..09ba44b 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-profiles.cc
@@ -23,93 +23,93 @@ int
 SScoringFacility::SPatternsDialog::
 import_from_selection( SScoringFacility::SChannel& field)
 {
-	// double check, possibly redundant after due check in callback
-	double	run_time = field.selection_end_time - field.selection_start_time;
-	size_t	run = field.selection_end - field.selection_start;
-	if ( run == 0 )
-		return -1;
-	if ( run_time > 60. ) {
-		pop_ok_message(
-			(GtkWindow*)wSFFD,
-			"<b>Selection greater than a minute</b>",
-			"This is surely the single occurrence, I tell you!");
-		return -2;
-	}
-	if ( run_time > 10. and
-	     GTK_RESPONSE_YES !=
-	     pop_question(
-		     (GtkWindow*)wSFFD,
-		     "<b>The selection is greater than 10 sec</b>",
-		     "Sure to proceed with search?") )
-		return -3;
-
-	size_t	context_before = // agh::alg::ensure_within(
-		(field.selection_start < current_pattern->context_pad)
-		? pattern::SPattern<TFloat>::context_pad - field.selection_start
-		: pattern::SPattern<TFloat>::context_pad,
-		context_after  = (field.selection_end + pattern::SPattern<TFloat>::context_pad > field.n_samples())
-		? field.n_samples() - field.selection_end
-		: pattern::SPattern<TFloat>::context_pad,
-		full_sample = run + context_before + context_after;
-	pattern::SPattern<TFloat> tim {
-		"(unnamed)", "", pattern::TOrigin::transient, false,
-		{field.signal_filtered[ slice (field.selection_start - context_before, full_sample, 1) ]},
-		field.samplerate(),
-		context_before, context_after,
-		Pp2, criteria};
-	// transient is always the last
-	((not patterns.empty() and patterns.back().origin == pattern::TOrigin::transient)
-	 ? patterns.back()
-	 : (patterns.push_back( pattern::SPattern<TFloat> ()), patterns.back())
-		) = tim;
-	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();
-
-	gtk_widget_queue_draw( (GtkWidget*)daSFFDThing);
-
-	return 0;
+        // double check, possibly redundant after due check in callback
+        double        run_time = field.selection_end_time - field.selection_start_time;
+        size_t        run = field.selection_end - field.selection_start;
+        if ( run == 0 )
+                return -1;
+        if ( run_time > 60. ) {
+                pop_ok_message(
+                        (GtkWindow*)wSFFD,
+                        "<b>Selection greater than a minute</b>",
+                        "This is surely the single occurrence, I tell you!");
+                return -2;
+        }
+        if ( run_time > 10. and
+             GTK_RESPONSE_YES !=
+             pop_question(
+                     (GtkWindow*)wSFFD,
+                     "<b>The selection is greater than 10 sec</b>",
+                     "Sure to proceed with search?") )
+                return -3;
+
+        size_t        context_before = // agh::alg::ensure_within(
+                (field.selection_start < current_pattern->context_pad)
+                ? pattern::SPattern<TFloat>::context_pad - field.selection_start
+                : pattern::SPattern<TFloat>::context_pad,
+                context_after  = (field.selection_end + pattern::SPattern<TFloat>::context_pad > field.n_samples())
+                ? field.n_samples() - field.selection_end
+                : pattern::SPattern<TFloat>::context_pad,
+                full_sample = run + context_before + context_after;
+        pattern::SPattern<TFloat> tim {
+                "(unnamed)", "", pattern::TOrigin::transient, false,
+                {field.signal_filtered[ slice (field.selection_start - context_before, full_sample, 1) ]},
+                field.samplerate(),
+                context_before, context_after,
+                Pp2, criteria};
+        // transient is always the last
+        ((not patterns.empty() and patterns.back().origin == pattern::TOrigin::transient)
+         ? patterns.back()
+         : (patterns.push_back( pattern::SPattern<TFloat> ()), patterns.back())
+                ) = tim;
+        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();
+
+        gtk_widget_queue_draw( (GtkWidget*)daSFFDThing);
+
+        return 0;
 }
 
 
 
 
 const char*
-	origin_markers[5] = {
-	"~", "[S]", "[E]", "[U]", "<S>",
+        origin_markers[5] = {
+        "~", "[S]", "[E]", "[U]", "<S>",
 };
 
 string
 make_system_patterns_location()
 {
-	return agh::str::sasprintf( "%s/patterns", PACKAGE_DATADIR);
+        return agh::str::sasprintf( "%s/patterns", PACKAGE_DATADIR);
 }
 
 string
 make_user_patterns_location()
 {
-	return agh::str::sasprintf( "%s/.local/share/aghermann/patterns", getenv("HOME"));
+        return agh::str::sasprintf( "%s/.local/share/aghermann/patterns", getenv("HOME"));
 }
 
 string
 make_experiment_patterns_location( const agh::CExpDesign& ED)
 {
-	return agh::str::sasprintf( "%s/.patterns", ED.session_dir());
+        return agh::str::sasprintf( "%s/.patterns", ED.session_dir());
 }
 
 string
 make_subject_patterns_location( const agh::CExpDesign& ED, const agh::CSubject& J)
 {
-	return agh::str::sasprintf( "%s/.patterns", ED.subject_dir( J).c_str());
+        return agh::str::sasprintf( "%s/.patterns", ED.subject_dir( J).c_str());
 }
 
 
@@ -118,26 +118,26 @@ void
 SScoringFacility::SPatternsDialog::
 load_patterns()
 {
-	patterns.clear();
-
-	patterns.splice(
-		patterns.end(), pattern::load_patterns_from_location<TFloat>(
-			make_system_patterns_location(),
-			pattern::TOrigin::system));
-	patterns.splice(
-		patterns.end(), pattern::load_patterns_from_location<TFloat>(
-			make_user_patterns_location(),
-			pattern::TOrigin::user));
-	patterns.splice(
-		patterns.end(), pattern::load_patterns_from_location<TFloat>(
-			make_experiment_patterns_location( *_p._p.ED),
-			pattern::TOrigin::experiment));
-	patterns.splice(
-		patterns.end(), pattern::load_patterns_from_location<TFloat>(
-			make_subject_patterns_location( *_p._p.ED, _p.csubject()),
-			pattern::TOrigin::subject));
-
-	current_pattern = patterns.end();
+        patterns.clear();
+
+        patterns.splice(
+                patterns.end(), pattern::load_patterns_from_location<TFloat>(
+                        make_system_patterns_location(),
+                        pattern::TOrigin::system));
+        patterns.splice(
+                patterns.end(), pattern::load_patterns_from_location<TFloat>(
+                        make_user_patterns_location(),
+                        pattern::TOrigin::user));
+        patterns.splice(
+                patterns.end(), pattern::load_patterns_from_location<TFloat>(
+                        make_experiment_patterns_location( *_p._p.ED),
+                        pattern::TOrigin::experiment));
+        patterns.splice(
+                patterns.end(), pattern::load_patterns_from_location<TFloat>(
+                        make_subject_patterns_location( *_p._p.ED, _p.csubject()),
+                        pattern::TOrigin::subject));
+
+        current_pattern = patterns.end();
 }
 
 
@@ -145,26 +145,26 @@ void
 SScoringFacility::SPatternsDialog::
 populate_combo()
 {
-	g_signal_handler_block( eSFFDPatternList, eSFFDPatternList_changed_cb_handler_id);
-	gtk_list_store_clear( mSFFDPatterns);
-
-	if ( not patterns.empty() ) {
-		GtkTreeIter iter, current_pattern_iter;
-		for ( auto I = patterns.begin(); I != patterns.end(); ++I ) {
-			gtk_list_store_append( mSFFDPatterns, &iter);
-			gtk_list_store_set(
-				mSFFDPatterns, &iter,
-				0, snprintf_buf( "%s %s", origin_markers[I->origin], I->name.c_str()),
-				-1);
-			if ( I == current_pattern )
-				current_pattern_iter = iter;
-		}
-
-		gtk_combo_box_set_active_iter( eSFFDPatternList, &current_pattern_iter);
-	} else
-		gtk_combo_box_set_active_iter( eSFFDPatternList, NULL);
-
-	g_signal_handler_unblock( eSFFDPatternList, eSFFDPatternList_changed_cb_handler_id);
+        g_signal_handler_block( eSFFDPatternList, eSFFDPatternList_changed_cb_handler_id);
+        gtk_list_store_clear( mSFFDPatterns);
+
+        if ( not patterns.empty() ) {
+                GtkTreeIter iter, current_pattern_iter;
+                for ( auto I = patterns.begin(); I != patterns.end(); ++I ) {
+                        gtk_list_store_append( mSFFDPatterns, &iter);
+                        gtk_list_store_set(
+                                mSFFDPatterns, &iter,
+                                0, snprintf_buf( "%s %s", origin_markers[I->origin], I->name.c_str()),
+                                -1);
+                        if ( I == current_pattern )
+                                current_pattern_iter = iter;
+                }
+
+                gtk_combo_box_set_active_iter( eSFFDPatternList, &current_pattern_iter);
+        } else
+                gtk_combo_box_set_active_iter( eSFFDPatternList, NULL);
+
+        g_signal_handler_unblock( eSFFDPatternList, eSFFDPatternList_changed_cb_handler_id);
 }
 
 
@@ -173,24 +173,24 @@ void
 SScoringFacility::SPatternsDialog::
 save_patterns()
 {
-	for ( auto& P : patterns )
-		if ( not P.saved ) {
-			switch ( P.origin ) {
-			case pattern::TOrigin::transient: // never save these two
-			case pattern::TOrigin::system:
-			    break;
-			case pattern::TOrigin::user:
-				pattern::save_pattern( P, (make_user_patterns_location() + '/' + P.name).c_str());
-			    break;
-			case pattern::TOrigin::experiment:
-				pattern::save_pattern( P, (make_experiment_patterns_location(*_p._p.ED) + '/' + P.name).c_str());
-			    break;
-			case pattern::TOrigin::subject:
-				pattern::save_pattern( P, (make_subject_patterns_location(*_p._p.ED, _p.csubject()) + '/' + P.name).c_str());
-			    break;
-			}
-			P.saved = true;
-		}
+        for ( auto& P : patterns )
+                if ( not P.saved ) {
+                        switch ( P.origin ) {
+                        case pattern::TOrigin::transient: // never save these two
+                        case pattern::TOrigin::system:
+                            break;
+                        case pattern::TOrigin::user:
+                                pattern::save_pattern( P, (make_user_patterns_location() + '/' + P.name).c_str());
+                            break;
+                        case pattern::TOrigin::experiment:
+                                pattern::save_pattern( P, (make_experiment_patterns_location(*_p._p.ED) + '/' + P.name).c_str());
+                            break;
+                        case pattern::TOrigin::subject:
+                                pattern::save_pattern( P, (make_subject_patterns_location(*_p._p.ED, _p.csubject()) + '/' + P.name).c_str());
+                            break;
+                        }
+                        P.saved = true;
+                }
 }
 
 
@@ -198,19 +198,19 @@ void
 SScoringFacility::SPatternsDialog::
 discard_current_pattern()
 {
-	if ( current_pattern == patterns.end() )
-		return;
+        if ( current_pattern == patterns.end() )
+                return;
 
-	auto todelete = current_pattern;
-	current_pattern = next(current_pattern);
-	pattern::delete_pattern( *todelete);
-	patterns.erase( todelete);
+        auto todelete = current_pattern;
+        current_pattern = next(current_pattern);
+        pattern::delete_pattern( *todelete);
+        patterns.erase( todelete);
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
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 a89ec8c..35e7460 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns-profiles_cb.cc
@@ -23,66 +23,66 @@ extern "C" {
 
 void
 eSFFDPatternList_changed_cb(
-	GtkComboBox *combo,
-	const gpointer userdata)
+        GtkComboBox *combo,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	if ( FD.current_pattern != FD.patterns.end() ) {
-		FD.current_pattern->Pp = FD.Pp2;
-		FD.current_pattern->criteria = FD.criteria;
-	}
-
-	gint ci = gtk_combo_box_get_active( combo);
-	if ( ci != -1 ) {
-		FD.current_pattern = FD.pattern_by_idx(ci);
-		FD.Pp2 = FD.current_pattern->Pp;
-		FD.criteria = FD.current_pattern->criteria;
-		FD.atomic_up();
-		FD.thing_display_scale = FD.field_channel->signal_display_scale;
-	} else
-		gtk_label_set_text( FD.lSFFDParametersBrief, "");
-
-	FD.setup_controls_for_find();
-	FD.set_profile_manage_buttons_visibility();
-
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        if ( FD.current_pattern != FD.patterns.end() ) {
+                FD.current_pattern->Pp = FD.Pp2;
+                FD.current_pattern->criteria = FD.criteria;
+        }
+
+        gint ci = gtk_combo_box_get_active( combo);
+        if ( ci != -1 ) {
+                FD.current_pattern = FD.pattern_by_idx(ci);
+                FD.Pp2 = FD.current_pattern->Pp;
+                FD.criteria = FD.current_pattern->criteria;
+                FD.atomic_up();
+                FD.thing_display_scale = FD.field_channel->signal_display_scale;
+        } else
+                gtk_label_set_text( FD.lSFFDParametersBrief, "");
+
+        FD.setup_controls_for_find();
+        FD.set_profile_manage_buttons_visibility();
+
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
 }
 
 
 
 void
 bSFFDProfileSave_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	g_signal_emit_by_name( FD.eSFFDPatternSaveName, "changed");
-
-	if ( gtk_dialog_run( FD.wSFFDPatternSave) == GTK_RESPONSE_OK ) {
-		pattern::SPattern<TFloat> P (*FD.current_pattern);
-		P.name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
-		P.origin = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
-			? pattern::TOrigin::subject
-			: gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
-			? pattern::TOrigin::experiment
-			: pattern::TOrigin::user;
-		P.saved = false;
-
-		if ( FD.current_pattern->origin == pattern::TOrigin::transient ) // replace unnamed
-			FD.patterns.back() = P;
-		else {
-			auto found = find( FD.patterns.begin(), FD.patterns.end(), P);
-			if ( found == FD.patterns.end() )
-				FD.patterns.insert( FD.current_pattern, move(P));
-			else
-				*(FD.current_pattern = found) = P;
-		}
-
-		FD.populate_combo();
-		FD.set_profile_manage_buttons_visibility();
-	}
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        g_signal_emit_by_name( FD.eSFFDPatternSaveName, "changed");
+
+        if ( gtk_dialog_run( FD.wSFFDPatternSave) == GTK_RESPONSE_OK ) {
+                pattern::SPattern<TFloat> P (*FD.current_pattern);
+                P.name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
+                P.origin = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
+                        ? pattern::TOrigin::subject
+                        : gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
+                        ? pattern::TOrigin::experiment
+                        : pattern::TOrigin::user;
+                P.saved = false;
+
+                if ( FD.current_pattern->origin == pattern::TOrigin::transient ) // replace unnamed
+                        FD.patterns.back() = P;
+                else {
+                        auto found = find( FD.patterns.begin(), FD.patterns.end(), P);
+                        if ( found == FD.patterns.end() )
+                                FD.patterns.insert( FD.current_pattern, move(P));
+                        else
+                                *(FD.current_pattern = found) = P;
+                }
+
+                FD.populate_combo();
+                FD.set_profile_manage_buttons_visibility();
+        }
 }
 
 
@@ -90,93 +90,93 @@ namespace {
 void
 hildebranden( const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	gtk_widget_set_sensitive(
-		(GtkWidget*)FD.bSFFDPatternSaveOK,
-		gtk_entry_get_text_length( FD.eSFFDPatternSaveName) > 0);
-
-	auto this_name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
-	auto this_origin = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
-			? pattern::TOrigin::subject
-			: gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
-			? pattern::TOrigin::experiment
-			: pattern::TOrigin::user;
-
-	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; })
-		!= FD.patterns.end();
-	gtk_button_set_label(
-		FD.bSFFDPatternSaveOK,
-		overwriting ? "Overwrite" : "Save");
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        gtk_widget_set_sensitive(
+                (GtkWidget*)FD.bSFFDPatternSaveOK,
+                gtk_entry_get_text_length( FD.eSFFDPatternSaveName) > 0);
+
+        auto this_name = gtk_entry_get_text( FD.eSFFDPatternSaveName);
+        auto this_origin = gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginSubject)
+                        ? pattern::TOrigin::subject
+                        : gtk_toggle_button_get_active( FD.eSFFDPatternSaveOriginExperiment)
+                        ? pattern::TOrigin::experiment
+                        : pattern::TOrigin::user;
+
+        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; })
+                != FD.patterns.end();
+        gtk_button_set_label(
+                FD.bSFFDPatternSaveOK,
+                overwriting ? "Overwrite" : "Save");
 }
 }
 
 void eSFFDPatternSaveName_changed_cb(
-	GtkEditable*,
-	const gpointer userdata)
+        GtkEditable*,
+        const gpointer userdata)
 {
-	hildebranden(userdata);
+        hildebranden(userdata);
 }
 
 void
 eSFFD_any_pattern_origin_toggled_cb(
-	GtkRadioButton*,
-	const gpointer userdata)
+        GtkRadioButton*,
+        const gpointer userdata)
 {
-	hildebranden(userdata);
+        hildebranden(userdata);
 }
 
 
 void
 bSFFDProfileDiscard_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	gint ci = gtk_combo_box_get_active( FD.eSFFDPatternList);
+        gint ci = gtk_combo_box_get_active( FD.eSFFDPatternList);
 
-	assert ( FD.current_pattern != FD.patterns.end() );
-	assert ( FD.current_pattern->origin != pattern::TOrigin::transient );
-	assert ( ci != -1 );
-	assert ( ci < (int)FD.patterns.size() );
+        assert ( FD.current_pattern != FD.patterns.end() );
+        assert ( FD.current_pattern->origin != pattern::TOrigin::transient );
+        assert ( ci != -1 );
+        assert ( ci < (int)FD.patterns.size() );
 
-	FD.discard_current_pattern();
+        FD.discard_current_pattern();
 
-	if ( not FD.patterns.empty() ) {
-		FD.Pp2 = FD.current_pattern->Pp;
-		FD.criteria = FD.current_pattern->criteria;
+        if ( not FD.patterns.empty() ) {
+                FD.Pp2 = FD.current_pattern->Pp;
+                FD.criteria = FD.current_pattern->criteria;
 
-		FD.atomic_up();
-	}
+                FD.atomic_up();
+        }
 
-	FD.populate_combo();
-	FD.set_profile_manage_buttons_visibility();
-	FD.setup_controls_for_find();
+        FD.populate_combo();
+        FD.set_profile_manage_buttons_visibility();
+        FD.setup_controls_for_find();
 
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
 }
 
 
 void
 bSFFDProfileRevert_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	assert ( FD.current_pattern != FD.patterns.end() );
-	assert ( FD.current_pattern->origin != pattern::TOrigin::transient );
+        assert ( FD.current_pattern != FD.patterns.end() );
+        assert ( FD.current_pattern->origin != pattern::TOrigin::transient );
 
-	FD.Pp2 = FD.current_pattern->Pp;
-	FD.criteria = FD.current_pattern->criteria;
+        FD.Pp2 = FD.current_pattern->Pp;
+        FD.criteria = FD.current_pattern->criteria;
 
-	FD.atomic_up();
+        FD.atomic_up();
 
-	FD.set_profile_manage_buttons_visibility();
+        FD.set_profile_manage_buttons_visibility();
 }
 
 } // extern "C"
@@ -185,7 +185,7 @@ bSFFDProfileRevert_clicked_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.cc b/upstream/src/aghermann/ui/sf/d/patterns.cc
index e48d233..47d1185 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns.cc
@@ -21,50 +21,50 @@ SScoringFacility::SPatternsDialog&
 SScoringFacility::
 patterns_d()
 {
-	if ( not _patterns_d )
-		_patterns_d = new SPatternsDialog(*this);
-	return *_patterns_d;
+        if ( not _patterns_d )
+                _patterns_d = new SPatternsDialog(*this);
+        return *_patterns_d;
 }
 
 SScoringFacility::SPatternsDialog::
 SPatternsDialog (SScoringFacility& parent)
       : SPatternsDialogWidgets (parent),
-	Pp2 {.25,  0., 1.5, 1,  .1, .5, 3},
-	increment (.03),
-	field_profile_type (metrics::TType::mc),
-	suppress_redraw (false),
-	draw_details (true),
-	draw_match_index (true),
-	_p (parent)
+        Pp2 {.25,  0., 1.5, 1,  .1, .5, 3},
+        increment (.03),
+        field_profile_type (metrics::TType::mc),
+        suppress_redraw (false),
+        draw_details (true),
+        draw_match_index (true),
+        _p (parent)
 {
-	W_V.reg( eSFFDEnvTightness, 	&Pp2.env_scope);
-	W_V.reg( eSFFDBandPassOrder,	&Pp2.bwf_order);
-	W_V.reg( eSFFDBandPassFrom, 	&Pp2.bwf_ffrom);
-	W_V.reg( eSFFDBandPassUpto, 	&Pp2.bwf_fupto);
-	W_V.reg( eSFFDDZCDFStep, 	&Pp2.dzcdf_step);
-	W_V.reg( eSFFDDZCDFSigma, 	&Pp2.dzcdf_sigma);
-	W_V.reg( eSFFDDZCDFSmooth, 	&Pp2.dzcdf_smooth);
+        W_V.reg( eSFFDEnvTightness,         &Pp2.env_scope);
+        W_V.reg( eSFFDBandPassOrder,        &Pp2.bwf_order);
+        W_V.reg( eSFFDBandPassFrom,         &Pp2.bwf_ffrom);
+        W_V.reg( eSFFDBandPassUpto,         &Pp2.bwf_fupto);
+        W_V.reg( eSFFDDZCDFStep,         &Pp2.dzcdf_step);
+        W_V.reg( eSFFDDZCDFSigma,         &Pp2.dzcdf_sigma);
+        W_V.reg( eSFFDDZCDFSmooth,         &Pp2.dzcdf_smooth);
 
-	W_V.reg( eSFFDParameterA, 	&get<0>(criteria));
-	W_V.reg( eSFFDParameterB, 	&get<1>(criteria));
-	W_V.reg( eSFFDParameterC, 	&get<2>(criteria));
-	W_V.reg( eSFFDParameterD, 	&get<3>(criteria));
+        W_V.reg( eSFFDParameterA,         &get<0>(criteria));
+        W_V.reg( eSFFDParameterB,         &get<1>(criteria));
+        W_V.reg( eSFFDParameterC,         &get<2>(criteria));
+        W_V.reg( eSFFDParameterD,         &get<3>(criteria));
 
-	W_V.reg( eSFFDIncrement, 	&increment);
+        W_V.reg( eSFFDIncrement,         &increment);
 
-	atomic_up();
+        atomic_up();
 
-	load_patterns();
+        load_patterns();
 }
 
 SScoringFacility::SPatternsDialog::
 ~SPatternsDialog ()
 {
-	save_patterns();
+        save_patterns();
 
-	// g_object_unref( mPatterns);
-	gtk_widget_destroy( (GtkWidget*)wSFFDPatternSave);
-	gtk_widget_destroy( (GtkWidget*)wSFFD);
+        // g_object_unref( mPatterns);
+        gtk_widget_destroy( (GtkWidget*)wSFFDPatternSave);
+        gtk_widget_destroy( (GtkWidget*)wSFFD);
 }
 
 
@@ -73,13 +73,13 @@ list<pattern::SPattern<TFloat>>::iterator
 SScoringFacility::SPatternsDialog::
 pattern_by_idx( size_t idx)
 {
-	size_t i = 0;
-	for ( auto I = patterns.begin(); I != patterns.end(); ++I )
-		if ( i == idx )
-			return I;
-		else
-			++i;
-	throw invalid_argument ("Current pattern index invalid");
+        size_t i = 0;
+        for ( auto I = patterns.begin(); I != patterns.end(); ++I )
+                if ( i == idx )
+                        return I;
+                else
+                        ++i;
+        throw invalid_argument ("Current pattern index invalid");
 }
 
 
@@ -89,23 +89,23 @@ void
 SScoringFacility::SPatternsDialog::
 search()
 {
-	assert (field_channel and current_pattern != patterns.end());
-
-	if ( field_channel != field_channel_saved )
-		field_channel_saved = field_channel;
-
-	pattern::CPatternTool<TFloat> cpattern
-		({current_pattern->thing, current_pattern->samplerate},
-		 current_pattern->context_before, current_pattern->context_after,
-		 Pp2); // use this for the case when modiified current_pattern changes have not been committed
-	diff_line =
-		(cpattern.do_search(
-			field_channel->signal_envelope( Pp2.env_scope).first,
-			field_channel->signal_envelope( Pp2.env_scope).second,
-			field_channel->signal_bandpass( Pp2.bwf_ffrom, Pp2.bwf_fupto, Pp2.bwf_order),
-			field_channel->signal_dzcdf( Pp2.dzcdf_step, Pp2.dzcdf_sigma, Pp2.dzcdf_smooth),
-			increment * current_pattern->samplerate),
-		 cpattern.diff);
+        assert (field_channel and current_pattern != patterns.end());
+
+        if ( field_channel != field_channel_saved )
+                field_channel_saved = field_channel;
+
+        pattern::CPatternTool<TFloat> cpattern
+                ({current_pattern->thing, current_pattern->samplerate},
+                 current_pattern->context_before, current_pattern->context_after,
+                 Pp2); // use this for the case when modiified current_pattern changes have not been committed
+        diff_line =
+                (cpattern.do_search(
+                        field_channel->signal_envelope( Pp2.env_scope).first,
+                        field_channel->signal_envelope( Pp2.env_scope).second,
+                        field_channel->signal_bandpass( Pp2.bwf_ffrom, Pp2.bwf_fupto, Pp2.bwf_order),
+                        field_channel->signal_dzcdf( Pp2.dzcdf_step, Pp2.dzcdf_sigma, Pp2.dzcdf_smooth),
+                        increment * current_pattern->samplerate),
+                 cpattern.diff);
 }
 
 
@@ -113,23 +113,23 @@ size_t
 SScoringFacility::SPatternsDialog::
 find_occurrences()
 {
-	if ( unlikely (current_pattern == patterns.end()) )
-		return 0;
-
-	occurrences.resize(0);
-	size_t inc = max((int)(increment * current_pattern->samplerate), 1);
-	for ( size_t i = 0; i < diff_line.size() - current_pattern->thing.size(); i += inc )
-		if ( diff_line[i].good_enough( criteria) ) {
-			occurrences.push_back(i);
-			i +=  // avoid overlapping occurrences *and* ensure we hit the stride
-				current_pattern->pattern_size_essential()/inc * inc;
-		}
-
-	restore_annotations();
-	occurrences_to_annotations();
-	_p.queue_redraw_all();
-
-	return occurrences.size();
+        if ( unlikely (current_pattern == patterns.end()) )
+                return 0;
+
+        occurrences.resize(0);
+        size_t inc = max((int)(increment * current_pattern->samplerate), 1);
+        for ( size_t i = 0; i < diff_line.size() - current_pattern->thing.size(); i += inc )
+                if ( diff_line[i].good_enough( criteria) ) {
+                        occurrences.push_back(i);
+                        i +=  // avoid overlapping occurrences *and* ensure we hit the stride
+                                current_pattern->pattern_size_essential()/inc * inc;
+                }
+
+        restore_annotations();
+        occurrences_to_annotations();
+        _p.queue_redraw_all();
+
+        return occurrences.size();
 }
 
 
@@ -137,28 +137,28 @@ void
 SScoringFacility::SPatternsDialog::
 occurrences_to_annotations( sigfile::SAnnotation::TType t)
 {
-	for ( size_t o = 0; o < occurrences.size(); ++o )
-		sigfile::mark_annotation(
-			field_channel->annotations,
-			((double)occurrences[o]) / field_channel->samplerate(),
-			((double)occurrences[o] + current_pattern->pattern_size_essential()) / field_channel->samplerate(),
-			snprintf_buf("%s (%zu)", current_pattern->name.c_str(), o+1),
-			t);
+        for ( size_t o = 0; o < occurrences.size(); ++o )
+                sigfile::mark_annotation(
+                        field_channel->annotations,
+                        ((double)occurrences[o]) / field_channel->samplerate(),
+                        ((double)occurrences[o] + current_pattern->pattern_size_essential()) / field_channel->samplerate(),
+                        snprintf_buf("%s (%zu)", current_pattern->name.c_str(), o+1),
+                        t);
 }
 
 void
 SScoringFacility::SPatternsDialog::
 save_annotations()
 {
-	saved_annotations = field_channel->annotations;
+        saved_annotations = field_channel->annotations;
 }
 
 void
 SScoringFacility::SPatternsDialog::
 restore_annotations()
 {
-	field_channel->annotations = saved_annotations;
-	saved_annotations.clear();
+        field_channel->annotations = saved_annotations;
+        saved_annotations.clear();
 }
 
 
@@ -168,58 +168,58 @@ void
 SScoringFacility::SPatternsDialog::
 setup_controls_for_find()
 {
-	bool	have_any = current_pattern != patterns.end();
+        bool        have_any = current_pattern != patterns.end();
 
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, have_any and TRUE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, have_any and TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, FALSE);
 
-	gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, have_any and TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, have_any and TRUE);
 
-	gtk_widget_set_visible( (GtkWidget*)swSFFDField, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)swSFFDField, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, FALSE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, TRUE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
 
-	gtk_label_set_markup( lSFFDFoundInfo, "");
+        gtk_label_set_markup( lSFFDFoundInfo, "");
 }
 
 void
 SScoringFacility::SPatternsDialog::
 setup_controls_for_wait()
 {
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, FALSE);
 
-	gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, TRUE);
 
-	gtk_widget_set_visible( (GtkWidget*)swSFFDField, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)swSFFDField, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, FALSE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, FALSE);
 }
 
 void
 SScoringFacility::SPatternsDialog::
 setup_controls_for_tune()
 {
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, FALSE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearchButton, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDSearching, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDAgainButton, TRUE);
 
-	gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, FALSE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDParameters, FALSE);
 
-	gtk_widget_set_visible( (GtkWidget*)swSFFDField, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)swSFFDField, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFFDCriteria, TRUE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)eSFFDPatternList, FALSE);
 
-	gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)iibSFFDMenu, TRUE);
 }
 
 
@@ -228,12 +228,12 @@ void
 SScoringFacility::SPatternsDialog::
 set_profile_manage_buttons_visibility()
 {
-	bool	have_any = current_pattern != patterns.end(),
-		is_transient = have_any && current_pattern->origin == pattern::TOrigin::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_any = current_pattern != patterns.end(),
+                is_transient = have_any && current_pattern->origin == pattern::TOrigin::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);
 }
 
 
@@ -241,12 +241,12 @@ void
 SScoringFacility::SPatternsDialog::
 preselect_channel( const int h) const
 {
-	if ( h < 0 ) {
-		gtk_combo_box_set_active( eSFFDChannel, -1);
-		return;
-	}
+        if ( h < 0 ) {
+                gtk_combo_box_set_active( eSFFDChannel, -1);
+                return;
+        }
 
-	gtk_combo_box_set_active( eSFFDChannel, h);
+        gtk_combo_box_set_active( eSFFDChannel, h);
 }
 
 
@@ -255,16 +255,16 @@ size_t
 SScoringFacility::SPatternsDialog::
 nearest_occurrence( const double x) const
 {
-	double shortest = INFINITY;
-	size_t found_at = -1;
-	for ( size_t o = 0; o < occurrences.size(); ++o ) {
-		double d = fabs((double)occurrences[o]/diff_line.size() - x/da_field_wd);
-		if ( d < shortest ) {
-			shortest = d;
-			found_at = o;
-		}
-	}
-	return found_at;
+        double shortest = INFINITY;
+        size_t found_at = -1;
+        for ( size_t o = 0; o < occurrences.size(); ++o ) {
+                double d = fabs((double)occurrences[o]/diff_line.size() - x/da_field_wd);
+                if ( d < shortest ) {
+                        shortest = d;
+                        found_at = o;
+                }
+        }
+        return found_at;
 }
 
 
@@ -274,36 +274,36 @@ void
 SScoringFacility::SPatternsDialog::
 update_field_check_menu_items()
 {
-	suppress_redraw = true;
-	gtk_check_menu_item_set_active( iSFFDFieldDrawMatchIndex, draw_match_index);
-
-	if ( not field_channel->schannel().is_fftable() ) {
-		field_profile_type = metrics::TType::raw;
-		gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, FALSE);
-	} else
-		gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, TRUE);
-
-	switch ( field_profile_type ) {
-	case metrics::TType::raw:
-		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeRaw, TRUE);
-		break;
-	case metrics::TType::psd:
-		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypePSD, TRUE);
-		break;
-	case metrics::TType::mc:
-		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeMC, TRUE);
-		break;
-	case metrics::TType::swu:
-		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeSWU, TRUE);
-		break;
-	}
-
-	suppress_redraw = false;
+        suppress_redraw = true;
+        gtk_check_menu_item_set_active( iSFFDFieldDrawMatchIndex, draw_match_index);
+
+        if ( not field_channel->schannel().is_fftable() ) {
+                field_profile_type = metrics::TType::raw;
+                gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, FALSE);
+        } else
+                gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, TRUE);
+
+        switch ( field_profile_type ) {
+        case metrics::TType::raw:
+                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeRaw, TRUE);
+                break;
+        case metrics::TType::psd:
+                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypePSD, TRUE);
+                break;
+        case metrics::TType::mc:
+                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeMC, TRUE);
+                break;
+        case metrics::TType::swu:
+                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)iSFFDFieldProfileTypeSWU, TRUE);
+                break;
+        }
+
+        suppress_redraw = false;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.hh b/upstream/src/aghermann/ui/sf/d/patterns.hh
index 9227acd..09e48d5 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.hh
+++ b/upstream/src/aghermann/ui/sf/d/patterns.hh
@@ -27,168 +27,168 @@ namespace ui {
 
 struct SPatternsDialogWidgets {
 
-	SPatternsDialogWidgets (SScoringFacility&); // need access to mAllChannels
+        SPatternsDialogWidgets (SScoringFacility&); // need access to mAllChannels
        ~SPatternsDialogWidgets ();
 
-	GtkBuilder *builder;
-
-	GtkListStore
-		*mSFFDPatterns,
-		*mSFFDChannels;
-	GtkDialog
-		*wSFFD;
-	GtkComboBox
-		*eSFFDChannel,
-		*eSFFDPatternList;
-	GtkScrolledWindow
-		*swSFFDThing,
-		*swSFFDField;
-	GtkTable
-		*cSFFDParameters,
-		*cSFFDCriteria,
-		*cSFFDSearchButton,
-		*cSFFDAgainButton;
-	GtkBox	*cSFFDSearching;
-	GtkDrawingArea
-		*daSFFDThing,
-		*daSFFDField;
-	GtkMenuBar
-		*iibSFFDMenu;
-	GtkMenu	*iiSFFDField,
-		*iiSFFDFieldProfileTypes;
-	GtkCheckMenuItem
-		*iSFFDFieldDrawMatchIndex;
-	GtkMenuItem
-		*iSFFDMarkPhasicEventSpindles,
-		*iSFFDMarkPhasicEventKComplexes,
-		*iSFFDMarkPlain;
-	GtkRadioMenuItem
-		*iSFFDFieldProfileTypeRaw,
-		*iSFFDFieldProfileTypePSD,
-		*iSFFDFieldProfileTypeMC,
-		*iSFFDFieldProfileTypeSWU;
-	GtkButton
-		*bSFFDSearch, *bSFFDAgain,
-		*bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
-	GtkSpinButton
-		*eSFFDEnvTightness,
-		*eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
-		*eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
-		*eSFFDParameterA, *eSFFDParameterB,
-		*eSFFDParameterC, *eSFFDParameterD,
-		*eSFFDIncrement;
-	GtkHBox
-		*cSFFDLabelBox;
-	GtkLabel
-		*lSFFDParametersBrief,
-		*lSFFDFoundInfo;
-	GtkDialog
-		*wSFFDPatternSave;
-	GtkEntry
-		*eSFFDPatternSaveName;
-	GtkToggleButton
-		*eSFFDPatternSaveOriginSubject,
-		*eSFFDPatternSaveOriginExperiment,
-		*eSFFDPatternSaveOriginUser;
-	GtkButton
-		*bSFFDPatternSaveOK;
-	gulong	eSFFDChannel_changed_cb_handler_id,
-		eSFFDPatternList_changed_cb_handler_id;
+        GtkBuilder *builder;
+
+        GtkListStore
+                *mSFFDPatterns,
+                *mSFFDChannels;
+        GtkDialog
+                *wSFFD;
+        GtkComboBox
+                *eSFFDChannel,
+                *eSFFDPatternList;
+        GtkScrolledWindow
+                *swSFFDThing,
+                *swSFFDField;
+        GtkTable
+                *cSFFDParameters,
+                *cSFFDCriteria,
+                *cSFFDSearchButton,
+                *cSFFDAgainButton;
+        GtkBox        *cSFFDSearching;
+        GtkDrawingArea
+                *daSFFDThing,
+                *daSFFDField;
+        GtkMenuBar
+                *iibSFFDMenu;
+        GtkMenu        *iiSFFDField,
+                *iiSFFDFieldProfileTypes;
+        GtkCheckMenuItem
+                *iSFFDFieldDrawMatchIndex;
+        GtkMenuItem
+                *iSFFDMarkPhasicEventSpindles,
+                *iSFFDMarkPhasicEventKComplexes,
+                *iSFFDMarkPlain;
+        GtkRadioMenuItem
+                *iSFFDFieldProfileTypeRaw,
+                *iSFFDFieldProfileTypePSD,
+                *iSFFDFieldProfileTypeMC,
+                *iSFFDFieldProfileTypeSWU;
+        GtkButton
+                *bSFFDSearch, *bSFFDAgain,
+                *bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
+        GtkSpinButton
+                *eSFFDEnvTightness,
+                *eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
+                *eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
+                *eSFFDParameterA, *eSFFDParameterB,
+                *eSFFDParameterC, *eSFFDParameterD,
+                *eSFFDIncrement;
+        GtkHBox
+                *cSFFDLabelBox;
+        GtkLabel
+                *lSFFDParametersBrief,
+                *lSFFDFoundInfo;
+        GtkDialog
+                *wSFFDPatternSave;
+        GtkEntry
+                *eSFFDPatternSaveName;
+        GtkToggleButton
+                *eSFFDPatternSaveOriginSubject,
+                *eSFFDPatternSaveOriginExperiment,
+                *eSFFDPatternSaveOriginUser;
+        GtkButton
+                *bSFFDPatternSaveOK;
+        gulong        eSFFDChannel_changed_cb_handler_id,
+                eSFFDPatternList_changed_cb_handler_id;
 };
 
 
 struct SScoringFacility::SPatternsDialog
   : public SPatternsDialogWidgets{
 
-	DELETE_DEFAULT_METHODS (SPatternsDialog);
+        DELETE_DEFAULT_METHODS (SPatternsDialog);
 
       // ctor, dtor
-	SPatternsDialog (SScoringFacility& parent);
+        SPatternsDialog (SScoringFacility& parent);
        ~SPatternsDialog ();
 
       // saved patterns
-	list<pattern::SPattern<TFloat>>
-		patterns;
-	list<pattern::SPattern<TFloat>>::iterator
-		current_pattern;
-	list<pattern::SPattern<TFloat>>::iterator
-	pattern_by_idx( size_t);
-
-	int import_from_selection( SScoringFacility::SChannel&);
-	void load_patterns();
-	void save_patterns();
-	void discard_current_pattern();
-	void populate_combo();
+        list<pattern::SPattern<TFloat>>
+                patterns;
+        list<pattern::SPattern<TFloat>>::iterator
+                current_pattern;
+        list<pattern::SPattern<TFloat>>::iterator
+        pattern_by_idx( size_t);
+
+        int import_from_selection( SScoringFacility::SChannel&);
+        void load_patterns();
+        void save_patterns();
+        void discard_current_pattern();
+        void populate_combo();
 
       // finding tool
-  	pattern::SPatternPPack<TFloat>
-		Pp2;
-	double	increment; // in seconds
+          pattern::SPatternPPack<TFloat>
+                Pp2;
+        double        increment; // in seconds
 
       // matches
-	pattern::CMatch<TFloat>
-		criteria;
-	vector<pattern::CMatch<TFloat>>
-		diff_line;
-	vector<size_t>
-		occurrences;
-	size_t	highlighted_occurrence;
-	void search();
-	size_t find_occurrences();
-	size_t nearest_occurrence( double) const;
-	int	now_tweaking; // limit draw similarity index to this item
+        pattern::CMatch<TFloat>
+                criteria;
+        vector<pattern::CMatch<TFloat>>
+                diff_line;
+        vector<size_t>
+                occurrences;
+        size_t        highlighted_occurrence;
+        void search();
+        size_t find_occurrences();
+        size_t nearest_occurrence( double) const;
+        int        now_tweaking; // limit draw similarity index to this item
 
       // field
-	SScoringFacility::SChannel
-		*field_channel,
-		*field_channel_saved;
-	list<sigfile::SAnnotation>
-		saved_annotations;
-	void occurrences_to_annotations( sigfile::SAnnotation::TType = sigfile::SAnnotation::TType::plain);
-	void save_annotations();
-	void restore_annotations();
-
-	metrics::TType
-		field_profile_type; // where appropriate; otherwise draw compressed raw
-	void update_field_check_menu_items();
+        SScoringFacility::SChannel
+                *field_channel,
+                *field_channel_saved;
+        list<sigfile::SAnnotation>
+                saved_annotations;
+        void occurrences_to_annotations( sigfile::SAnnotation::TType = sigfile::SAnnotation::TType::plain);
+        void save_annotations();
+        void restore_annotations();
+
+        metrics::TType
+                field_profile_type; // where appropriate; otherwise draw compressed raw
+        void update_field_check_menu_items();
 
       // draw
-	bool	suppress_w_v:1,
-		suppress_redraw:1,
-		draw_details:1,
-		draw_match_index:1;
-	void draw_thing( cairo_t*);
-	void draw_field( cairo_t*);
-	float	thing_display_scale,
-		field_display_scale;
+        bool        suppress_w_v:1,
+                suppress_redraw:1,
+                draw_details:1,
+                draw_match_index:1;
+        void draw_thing( cairo_t*);
+        void draw_field( cairo_t*);
+        float        thing_display_scale,
+                field_display_scale;
 
       // widgets
-	SUIVarCollection
-		W_V;
-	void atomic_up()
-		{
-			suppress_w_v = true;
-			W_V.up();
-			suppress_w_v = false;
-		}
-
-	void preselect_channel( int) const;
-
-	void setup_controls_for_find();
-	void setup_controls_for_wait();
-	void setup_controls_for_tune();
-	void set_profile_manage_buttons_visibility();
-
-	static const int
-		da_thing_ht = 200,
-		da_field_ht = 160;
-	int	da_thing_wd,
-		da_field_wd;
-	void set_thing_da_width( int);
-	void set_field_da_width( int);
-
-	agh::ui::SScoringFacility&
-		_p;
+        SUIVarCollection
+                W_V;
+        void atomic_up()
+                {
+                        suppress_w_v = true;
+                        W_V.up();
+                        suppress_w_v = false;
+                }
+
+        void preselect_channel( int) const;
+
+        void setup_controls_for_find();
+        void setup_controls_for_wait();
+        void setup_controls_for_tune();
+        void set_profile_manage_buttons_visibility();
+
+        static const int
+                da_thing_ht = 200,
+                da_field_ht = 160;
+        int        da_thing_wd,
+                da_field_wd;
+        void set_thing_da_width( int);
+        void set_field_da_width( int);
+
+        agh::ui::SScoringFacility&
+                _p;
 };
 
 
@@ -230,7 +230,7 @@ void iSFFD_any_field_profile_type_toggled_cb( GtkRadioMenuItem*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/patterns_cb.cc b/upstream/src/aghermann/ui/sf/d/patterns_cb.cc
index ea16dab..5888814 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns_cb.cc
@@ -22,28 +22,28 @@ extern "C" {
 
 gboolean
 daSFFDThing_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.draw_thing( cr);
+        FD.draw_thing( cr);
 
-	return TRUE;
+        return TRUE;
 }
 
 gboolean
 daSFFDField_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.draw_field( cr);
+        FD.draw_field( cr);
 
-	return TRUE;
+        return TRUE;
 }
 
 
@@ -51,184 +51,184 @@ daSFFDField_draw_cb(
 
 gboolean
 daSFFDThing_button_press_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	switch ( event->button ) {
-	case 2:
-		FD.thing_display_scale = FD.field_channel->signal_display_scale;
-	    break;
-	default:
-	    break;
-	}
+        switch ( event->button ) {
+        case 2:
+                FD.thing_display_scale = FD.field_channel->signal_display_scale;
+            break;
+        default:
+            break;
+        }
 
-	gtk_widget_queue_draw( wid);
+        gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 
 
 
 gboolean
 daSFFDThing_scroll_event_cb(
-	GtkWidget *wid,
-	GdkEventScroll *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	switch ( event->direction ) {
-	case GDK_SCROLL_UP:
-		if ( event->state & GDK_SHIFT_MASK )
-			FD.set_thing_da_width( FD.da_thing_wd + 10);
-		else
-			FD.thing_display_scale *= FD._p._p.scroll_factor;
-	    break;
-	case GDK_SCROLL_DOWN:
-		if ( event->state & GDK_SHIFT_MASK ) {
-			if ( FD.da_thing_wd > 20 )
-				FD.set_thing_da_width( FD.da_thing_wd - 10);
-		} else
-			FD.thing_display_scale /= FD._p._p.scroll_factor;
-	    break;
-	default:
-	    break;
-	}
-
-	gtk_widget_queue_draw( wid);
-
-	return TRUE;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        switch ( event->direction ) {
+        case GDK_SCROLL_UP:
+                if ( event->state & GDK_SHIFT_MASK )
+                        FD.set_thing_da_width( FD.da_thing_wd + 10);
+                else
+                        FD.thing_display_scale *= FD._p._p.scroll_factor;
+            break;
+        case GDK_SCROLL_DOWN:
+                if ( event->state & GDK_SHIFT_MASK ) {
+                        if ( FD.da_thing_wd > 20 )
+                                FD.set_thing_da_width( FD.da_thing_wd - 10);
+                } else
+                        FD.thing_display_scale /= FD._p._p.scroll_factor;
+            break;
+        default:
+            break;
+        }
+
+        gtk_widget_queue_draw( wid);
+
+        return TRUE;
 }
 
 
 
 gboolean
 daSFFDField_button_press_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	auto& SF = FD._p;
-
-	switch ( event->button ) {
-	case 1:
-		if ( event->y > FD.da_field_ht/2 ) {
-			if ( FD.highlighted_occurrence != (size_t)-1 )
-				SF.set_cur_vpage(
-					((double)FD.occurrences[FD.highlighted_occurrence] / FD.diff_line.size()) * SF.total_vpages());
-		} else
-			SF.set_cur_vpage(
-				((double)event->x/FD.da_field_wd * SF.total_vpages()));
-		gtk_widget_queue_draw( wid);
-	    break;
-	case 3:
-		FD.update_field_check_menu_items();
-		gtk_menu_popup(
-			FD.iiSFFDField,
-			NULL, NULL, NULL, NULL, 3, event->time);
-	    break;
-	}
-
-	return TRUE;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& SF = FD._p;
+
+        switch ( event->button ) {
+        case 1:
+                if ( event->y > FD.da_field_ht/2 ) {
+                        if ( FD.highlighted_occurrence != (size_t)-1 )
+                                SF.set_cur_vpage(
+                                        ((double)FD.occurrences[FD.highlighted_occurrence] / FD.diff_line.size()) * SF.total_vpages());
+                } else
+                        SF.set_cur_vpage(
+                                ((double)event->x/FD.da_field_wd * SF.total_vpages()));
+                gtk_widget_queue_draw( wid);
+            break;
+        case 3:
+                FD.update_field_check_menu_items();
+                gtk_menu_popup(
+                        FD.iiSFFDField,
+                        NULL, NULL, NULL, NULL, 3, event->time);
+            break;
+        }
+
+        return TRUE;
 }
 
 void
 iSFFDFieldDrawMatchIndex_toggled_cb(
-	GtkCheckMenuItem* mitem,
-	const gpointer userdata)
+        GtkCheckMenuItem* mitem,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	if ( FD.suppress_redraw )
-		return;
-	FD.draw_match_index = gtk_check_menu_item_get_active( mitem);
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        if ( FD.suppress_redraw )
+                return;
+        FD.draw_match_index = gtk_check_menu_item_get_active( mitem);
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
 }
 
 
 void
 iSFFD_any_field_profile_type_toggled_cb(
-	GtkRadioMenuItem* ritem,
-	const gpointer userdata)
+        GtkRadioMenuItem* ritem,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	if ( FD.suppress_redraw )
-		return;
-	if ( not gtk_check_menu_item_get_active( (GtkCheckMenuItem*)ritem) )
-		return; // let the item being turned on handle
-
-	if ( ritem == FD.iSFFDFieldProfileTypeRaw )
-		FD.field_profile_type = metrics::TType::raw;
-	else if ( ritem == FD.iSFFDFieldProfileTypePSD )
-		FD.field_profile_type = metrics::TType::psd;
-	else if ( ritem == FD.iSFFDFieldProfileTypeMC )
-		FD.field_profile_type = metrics::TType::mc;
-	else if ( ritem == FD.iSFFDFieldProfileTypeSWU )
-		FD.field_profile_type = metrics::TType::swu;
-
-	// autoscale
-	auto profile_with_corrected_type =
-		FD.field_channel->which_profile( FD.field_profile_type);
-	auto& profile = get<1>(profile_with_corrected_type);
-	FD.field_display_scale =
-		agh::alg::calibrate_display_scale(
-			profile,
-			profile.size(),
-			FD.da_field_ht/2);
-
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        if ( FD.suppress_redraw )
+                return;
+        if ( not gtk_check_menu_item_get_active( (GtkCheckMenuItem*)ritem) )
+                return; // let the item being turned on handle
+
+        if ( ritem == FD.iSFFDFieldProfileTypeRaw )
+                FD.field_profile_type = metrics::TType::raw;
+        else if ( ritem == FD.iSFFDFieldProfileTypePSD )
+                FD.field_profile_type = metrics::TType::psd;
+        else if ( ritem == FD.iSFFDFieldProfileTypeMC )
+                FD.field_profile_type = metrics::TType::mc;
+        else if ( ritem == FD.iSFFDFieldProfileTypeSWU )
+                FD.field_profile_type = metrics::TType::swu;
+
+        // autoscale
+        auto profile_with_corrected_type =
+                FD.field_channel->which_profile( FD.field_profile_type);
+        auto& profile = get<1>(profile_with_corrected_type);
+        FD.field_display_scale =
+                agh::alg::calibrate_display_scale(
+                        profile,
+                        profile.size(),
+                        FD.da_field_ht/2);
+
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
 }
 
 
 
 gboolean
 daSFFDField_scroll_event_cb(
-	GtkWidget *wid,
-	GdkEventScroll *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	switch ( event->direction ) {
-	case GDK_SCROLL_UP:
-		if ( event->state & GDK_SHIFT_MASK )
-			FD.set_field_da_width( FD.da_field_wd + 10);
-		else
-			FD.field_display_scale *= FD._p._p.scroll_factor;
-	    break;
-	case GDK_SCROLL_DOWN:
-		if ( event->state & GDK_SHIFT_MASK ) {
-			if ( FD.da_field_wd > 20 )
-				FD.set_field_da_width( FD.da_field_wd - 10);
-		} else
-			FD.field_display_scale /= FD._p._p.scroll_factor;
-	    break;
-	default:
-	    break;
-	}
-
-	gtk_widget_queue_draw( wid);
-
-	return TRUE;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        switch ( event->direction ) {
+        case GDK_SCROLL_UP:
+                if ( event->state & GDK_SHIFT_MASK )
+                        FD.set_field_da_width( FD.da_field_wd + 10);
+                else
+                        FD.field_display_scale *= FD._p._p.scroll_factor;
+            break;
+        case GDK_SCROLL_DOWN:
+                if ( event->state & GDK_SHIFT_MASK ) {
+                        if ( FD.da_field_wd > 20 )
+                                FD.set_field_da_width( FD.da_field_wd - 10);
+                } else
+                        FD.field_display_scale /= FD._p._p.scroll_factor;
+            break;
+        default:
+            break;
+        }
+
+        gtk_widget_queue_draw( wid);
+
+        return TRUE;
 }
 
 
 gboolean
 daSFFDField_motion_notify_event_cb(
-	GtkWidget *wid,
-	GdkEventMotion *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventMotion *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	auto prev_ho = FD.highlighted_occurrence;
-	if ( prev_ho != (FD.highlighted_occurrence = FD.nearest_occurrence( event->x)) )
-	     gtk_widget_queue_draw( wid);
+        auto prev_ho = FD.highlighted_occurrence;
+        if ( prev_ho != (FD.highlighted_occurrence = FD.nearest_occurrence( event->x)) )
+             gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 
 
@@ -238,101 +238,101 @@ daSFFDField_motion_notify_event_cb(
 
 void
 bSFFDSearch_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	auto& SF = FD._p;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& SF = FD._p;
 
-	SBusyBlock bb (FD.wSFFD);
+        SBusyBlock bb (FD.wSFFD);
 
-	FD.setup_controls_for_wait();
-	gtk_flush();
+        FD.setup_controls_for_wait();
+        gtk_flush();
 
-	FD.search();
-	FD.save_annotations();
+        FD.search();
+        FD.save_annotations();
 
-	FD.set_field_da_width( SF.total_pages() * SF.pagesize() / 3600 * SF._p.tl_pph);
+        FD.set_field_da_width( SF.total_pages() * SF.pagesize() / 3600 * SF._p.tl_pph);
 
-	FD.field_display_scale =
-		agh::alg::calibrate_display_scale(
-			get<1>(FD.field_channel->which_profile(FD.field_profile_type)),
-			SF.total_pages(),
-			FD.da_field_ht);
+        FD.field_display_scale =
+                agh::alg::calibrate_display_scale(
+                        get<1>(FD.field_channel->which_profile(FD.field_profile_type)),
+                        SF.total_pages(),
+                        FD.da_field_ht);
 
-	FD.setup_controls_for_tune();
-	gtk_label_set_markup(
-		FD.lSFFDParametersBrief,
-		snprintf_buf( "A: <b>%g</b>  "
-			      "B: <b>%g</b>/<b>%g</b>/<b>%d</b>  "
-			      "C: <b>%g</b>/<b>%g</b>/<b>%d</b>",
-			      FD.Pp2.env_scope,
-			      FD.Pp2.bwf_ffrom, FD.Pp2.bwf_fupto, FD.Pp2.bwf_order,
-			      FD.Pp2.dzcdf_step, FD.Pp2.dzcdf_sigma, FD.Pp2.dzcdf_smooth));
+        FD.setup_controls_for_tune();
+        gtk_label_set_markup(
+                FD.lSFFDParametersBrief,
+                snprintf_buf( "A: <b>%g</b>  "
+                              "B: <b>%g</b>/<b>%g</b>/<b>%d</b>  "
+                              "C: <b>%g</b>/<b>%g</b>/<b>%d</b>",
+                              FD.Pp2.env_scope,
+                              FD.Pp2.bwf_ffrom, FD.Pp2.bwf_fupto, FD.Pp2.bwf_order,
+                              FD.Pp2.dzcdf_step, FD.Pp2.dzcdf_sigma, FD.Pp2.dzcdf_smooth));
 
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
 
-	g_signal_emit_by_name( FD.eSFFDParameterA, "value-changed");
+        g_signal_emit_by_name( FD.eSFFDParameterA, "value-changed");
 }
 
 
 
 void
 bSFFDAgain_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.restore_annotations();
-	FD.occurrences.clear();
+        FD.restore_annotations();
+        FD.occurrences.clear();
 
-	FD.setup_controls_for_find();
+        FD.setup_controls_for_find();
 }
 
 void
 iSFFDMarkPhasicEventSpindles_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.restore_annotations();
-	FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_spindle);
-	FD.occurrences.clear();
-	FD._p.queue_redraw_all();
+        FD.restore_annotations();
+        FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_spindle);
+        FD.occurrences.clear();
+        FD._p.queue_redraw_all();
 
-	gtk_widget_hide( (GtkWidget*)FD.wSFFD);
+        gtk_widget_hide( (GtkWidget*)FD.wSFFD);
 }
 
 void
 iSFFDMarkPhasicEventKComplexes_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.restore_annotations();
-	FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_K_complex);
-	FD.occurrences.clear();
-	FD._p.queue_redraw_all();
+        FD.restore_annotations();
+        FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_K_complex);
+        FD.occurrences.clear();
+        FD._p.queue_redraw_all();
 
-	gtk_widget_hide( (GtkWidget*)FD.wSFFD);
+        gtk_widget_hide( (GtkWidget*)FD.wSFFD);
 }
 
 void
 iSFFDMarkPlain_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	// FD.restore_annotations();
-	// FD.occurrences_to_annotations( sigfile::SAnnotation::TType::plain);
-	FD.occurrences.clear();
-	// FD._p.queue_redraw_all();
+        // FD.restore_annotations();
+        // FD.occurrences_to_annotations( sigfile::SAnnotation::TType::plain);
+        FD.occurrences.clear();
+        // FD._p.queue_redraw_all();
 
-	gtk_widget_hide( (GtkWidget*)FD.wSFFD);
+        gtk_widget_hide( (GtkWidget*)FD.wSFFD);
 }
 
 
@@ -345,91 +345,91 @@ iSFFDMarkPlain_activate_cb(
 
 void
 eSFFD_any_pattern_value_changed_cb(
-	GtkSpinButton*,
-	const gpointer userdata)
+        GtkSpinButton*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	if ( FD.suppress_w_v )
-		return;
+        if ( FD.suppress_w_v )
+                return;
 
-	FD.W_V.down();
-	FD.setup_controls_for_find();
+        FD.W_V.down();
+        FD.setup_controls_for_find();
 
-	FD.set_profile_manage_buttons_visibility();
+        FD.set_profile_manage_buttons_visibility();
 
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDThing);
 }
 
 namespace {
 inline double
 timeval_elapsed( const struct timeval &x, const struct timeval &y)
 {
-	return y.tv_sec - x.tv_sec
-		+ 1e-6 * (y.tv_usec - x.tv_usec);
+        return y.tv_sec - x.tv_sec
+                + 1e-6 * (y.tv_usec - x.tv_usec);
 }
 }
 
 void
 eSFFD_any_criteria_value_changed_cb(
-	GtkSpinButton* button,
-	const gpointer userdata)
+        GtkSpinButton* button,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	if ( FD.suppress_w_v )
-		return;
-
-	if      ( button == FD.eSFFDParameterA )
-		FD.now_tweaking = 1;
-	else if ( button == FD.eSFFDParameterB )
-		FD.now_tweaking = 2;
-	else if ( button == FD.eSFFDParameterC )
-		FD.now_tweaking = 3;
-	else if ( button == FD.eSFFDParameterD )
-		FD.now_tweaking = 4;
-
-	static struct timeval last_criteria_change = {0, 0};
-	struct timeval currently;
-	gettimeofday( &currently, NULL);
-	if ( timeval_elapsed( last_criteria_change, currently) > .5 ) {
-		gettimeofday( &last_criteria_change, NULL);
-
-		FD.W_V.down();
-		FD.find_occurrences();
-
-		gtk_label_set_markup(
-			FD.lSFFDFoundInfo,
-			snprintf_buf(
-				"%zu match%s in <b>%s</b>",
-				FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es",
-				FD.field_channel->name()));
-
-		FD.set_profile_manage_buttons_visibility();
-
-		gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
-	}
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        if ( FD.suppress_w_v )
+                return;
+
+        if      ( button == FD.eSFFDParameterA )
+                FD.now_tweaking = 1;
+        else if ( button == FD.eSFFDParameterB )
+                FD.now_tweaking = 2;
+        else if ( button == FD.eSFFDParameterC )
+                FD.now_tweaking = 3;
+        else if ( button == FD.eSFFDParameterD )
+                FD.now_tweaking = 4;
+
+        static struct timeval last_criteria_change = {0, 0};
+        struct timeval currently;
+        gettimeofday( &currently, NULL);
+        if ( timeval_elapsed( last_criteria_change, currently) > .5 ) {
+                gettimeofday( &last_criteria_change, NULL);
+
+                FD.W_V.down();
+                FD.find_occurrences();
+
+                gtk_label_set_markup(
+                        FD.lSFFDFoundInfo,
+                        snprintf_buf(
+                                "%zu match%s in <b>%s</b>",
+                                FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es",
+                                FD.field_channel->name()));
+
+                FD.set_profile_manage_buttons_visibility();
+
+                gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
+        }
 }
 
 gboolean
 eSFFD_any_criteria_focus_in_event_cb(
-	GtkWidget *button,
-	GdkEvent*,
-	const gpointer userdata)
+        GtkWidget *button,
+        GdkEvent*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	if      ( button == (GtkWidget*)FD.eSFFDParameterA )
-		FD.now_tweaking = 1;
-	else if ( button == (GtkWidget*)FD.eSFFDParameterB )
-		FD.now_tweaking = 2;
-	else if ( button == (GtkWidget*)FD.eSFFDParameterC )
-		FD.now_tweaking = 3;
-	else if ( button == (GtkWidget*)FD.eSFFDParameterD )
-		FD.now_tweaking = 4;
-
-	gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
-
-	return FALSE;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        if      ( button == (GtkWidget*)FD.eSFFDParameterA )
+                FD.now_tweaking = 1;
+        else if ( button == (GtkWidget*)FD.eSFFDParameterB )
+                FD.now_tweaking = 2;
+        else if ( button == (GtkWidget*)FD.eSFFDParameterC )
+                FD.now_tweaking = 3;
+        else if ( button == (GtkWidget*)FD.eSFFDParameterD )
+                FD.now_tweaking = 4;
+
+        gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
+
+        return FALSE;
 }
 
 
@@ -438,76 +438,76 @@ eSFFD_any_criteria_focus_in_event_cb(
 
 void
 eSFFDChannel_changed_cb(
-	GtkComboBox *combo,
-	const gpointer userdata)
+        GtkComboBox *combo,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	auto& SF = FD._p;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& SF = FD._p;
 
-	gint h = gtk_combo_box_get_active( combo);
-	if ( h > 0 )
-		FD.field_channel = SF.using_channel = &SF[h];
+        gint h = gtk_combo_box_get_active( combo);
+        if ( h > 0 )
+                FD.field_channel = SF.using_channel = &SF[h];
 }
 
 
 void
 wSFFD_show_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
 
-	FD.setup_controls_for_find();
-	FD.populate_combo();
-	FD.set_profile_manage_buttons_visibility();
+        FD.setup_controls_for_find();
+        FD.populate_combo();
+        FD.set_profile_manage_buttons_visibility();
 
-	if ( not FD._p.using_channel ) // not invoked for a preselected signal via a menu
-		FD._p.using_channel = &FD._p.channels.front();
-	FD.field_channel = FD.field_channel_saved = FD._p.using_channel;
+        if ( not FD._p.using_channel ) // not invoked for a preselected signal via a menu
+                FD._p.using_channel = &FD._p.channels.front();
+        FD.field_channel = FD.field_channel_saved = FD._p.using_channel;
 
-	FD.preselect_channel( FD._p.using_channel_idx());
+        FD.preselect_channel( FD._p.using_channel_idx());
 }
 
 
 
 void
 wSFFD_hide_cb(
-	GtkWidget*,
-	gpointer userdata)
+        GtkWidget*,
+        gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-	auto& SF = FD._p;
-
-	if ( not FD.occurrences.empty() ) { // closing while dialog is in matching state
-		if ( GTK_RESPONSE_YES !=
-		     pop_question(
-			     SF.wSF,
-			     "<b>Pattern found and marked</b>",
-			     "Keep annotated occurrences?") )
-			FD.restore_annotations();
-		else {
-			SF._p.populate_mGlobalAnnotations();
-			SF.queue_redraw_all();
-		}
-	}
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+        auto& SF = FD._p;
+
+        if ( not FD.occurrences.empty() ) { // closing while dialog is in matching state
+                if ( GTK_RESPONSE_YES !=
+                     pop_question(
+                             SF.wSF,
+                             "<b>Pattern found and marked</b>",
+                             "Keep annotated occurrences?") )
+                        FD.restore_annotations();
+                else {
+                        SF._p.populate_mGlobalAnnotations();
+                        SF.queue_redraw_all();
+                }
+        }
 }
 
 
 
 gboolean
 wSFFD_configure_event_cb(
-	GtkWidget*,
-	GdkEventConfigure *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventConfigure *event,
+        const gpointer userdata)
 {
-	auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
-
-	if ( event->type == GDK_CONFIGURE ) {
-		int marijke = gtk_widget_get_allocated_width( (GtkWidget*)FD.swSFFDThing);
-		FD.set_thing_da_width( marijke);
-		FD.set_field_da_width( marijke);
-	}
-	return FALSE;
+        auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
+
+        if ( event->type == GDK_CONFIGURE ) {
+                int marijke = gtk_widget_get_allocated_width( (GtkWidget*)FD.swSFFDThing);
+                FD.set_thing_da_width( marijke);
+                FD.set_field_da_width( marijke);
+        }
+        return FALSE;
 }
 
 } // extern "C"
@@ -516,7 +516,7 @@ wSFFD_configure_event_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
index 707a087..afb2675 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
@@ -20,68 +20,68 @@ using namespace agh::ui;
 SPhasediffDialogWidgets::
 SPhasediffDialogWidgets (SScoringFacility& SF)
 {
-	builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-phasediff.glade", NULL) )
-		throw runtime_error( "Failed to load SF::phasediff glade resource");
-	gtk_builder_connect_signals( builder, NULL);
-
-	mSFPDChannels =
-		gtk_list_store_new( 1, G_TYPE_STRING);
-
-	if ( !(AGH_GBGETOBJ (GtkDialog,		wSFPD)) ||
-	     !(AGH_GBGETOBJ (GtkDrawingArea,	daSFPD)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,	eSFPDChannelA)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,	eSFPDChannelB)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFPDFreqFrom)) ||
-	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFPDBandwidth)) ||
-	     !(AGH_GBGETOBJ (GtkScaleButton,	eSFPDSmooth)) )
-		throw runtime_error ("Failed to construct SF widgets (11)");
-
-	// filter channels we don't have
-	for ( auto &H : SF.channels )
-		if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
-			GtkTreeIter iter;
-			gtk_list_store_append( mSFPDChannels, &iter);
-			gtk_list_store_set( mSFPDChannels, &iter,
-					    0, H.name(),
-					    -1);
-		}
-
-	gtk_combo_box_set_model_properly(
-		eSFPDChannelA, mSFPDChannels);
-	eSFPDChannelA_changed_cb_handler_id =
-		G_CONNECT_1 (eSFPDChannelA, changed);
-
-	gtk_combo_box_set_model_properly(
-		eSFPDChannelB, mSFPDChannels);
-	eSFPDChannelB_changed_cb_handler_id =
-		G_CONNECT_1 (eSFPDChannelB, changed);
-
-	G_CONNECT_1 (daSFPD, draw);
-	G_CONNECT_2 (daSFPD, scroll, event);
-	G_CONNECT_1 (eSFPDChannelA, changed);
-	G_CONNECT_1 (eSFPDChannelB, changed);
-	G_CONNECT_2 (eSFPDFreqFrom, value, changed);
-	G_CONNECT_2 (eSFPDBandwidth, value, changed);
-	G_CONNECT_2 (eSFPDSmooth, value, changed);
-	G_CONNECT_1 (wSFPD, show);
-	G_CONNECT_1 (wSFPD, hide);
+        builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/sf-phasediff.glade", NULL) )
+                throw runtime_error( "Failed to load SF::phasediff glade resource");
+        gtk_builder_connect_signals( builder, NULL);
+
+        mSFPDChannels =
+                gtk_list_store_new( 1, G_TYPE_STRING);
+
+        if ( !(AGH_GBGETOBJ (GtkDialog,                wSFPD)) ||
+             !(AGH_GBGETOBJ (GtkDrawingArea,        daSFPD)) ||
+             !(AGH_GBGETOBJ (GtkComboBox,        eSFPDChannelA)) ||
+             !(AGH_GBGETOBJ (GtkComboBox,        eSFPDChannelB)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFPDFreqFrom)) ||
+             !(AGH_GBGETOBJ (GtkSpinButton,        eSFPDBandwidth)) ||
+             !(AGH_GBGETOBJ (GtkScaleButton,        eSFPDSmooth)) )
+                throw runtime_error ("Failed to construct SF widgets (11)");
+
+        // filter channels we don't have
+        for ( auto &H : SF.channels )
+                if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+                        GtkTreeIter iter;
+                        gtk_list_store_append( mSFPDChannels, &iter);
+                        gtk_list_store_set( mSFPDChannels, &iter,
+                                            0, H.name(),
+                                            -1);
+                }
+
+        gtk_combo_box_set_model_properly(
+                eSFPDChannelA, mSFPDChannels);
+        eSFPDChannelA_changed_cb_handler_id =
+                G_CONNECT_1 (eSFPDChannelA, changed);
+
+        gtk_combo_box_set_model_properly(
+                eSFPDChannelB, mSFPDChannels);
+        eSFPDChannelB_changed_cb_handler_id =
+                G_CONNECT_1 (eSFPDChannelB, changed);
+
+        G_CONNECT_1 (daSFPD, draw);
+        G_CONNECT_2 (daSFPD, scroll, event);
+        G_CONNECT_1 (eSFPDChannelA, changed);
+        G_CONNECT_1 (eSFPDChannelB, changed);
+        G_CONNECT_2 (eSFPDFreqFrom, value, changed);
+        G_CONNECT_2 (eSFPDBandwidth, value, changed);
+        G_CONNECT_2 (eSFPDSmooth, value, changed);
+        G_CONNECT_1 (wSFPD, show);
+        G_CONNECT_1 (wSFPD, hide);
 }
 
 
 SPhasediffDialogWidgets::
 ~SPhasediffDialogWidgets ()
 {
-	gtk_widget_destroy( (GtkWidget*)wSFPD);
-	g_object_unref( (GObject*)builder);
-	g_object_unref( (GObject*)mSFPDChannels);
+        gtk_widget_destroy( (GtkWidget*)wSFPD);
+        g_object_unref( (GObject*)builder);
+        g_object_unref( (GObject*)mSFPDChannels);
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff.cc b/upstream/src/aghermann/ui/sf/d/phasediff.cc
index 37f0ed1..65bfb6e 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff.cc
+++ b/upstream/src/aghermann/ui/sf/d/phasediff.cc
@@ -21,25 +21,25 @@ using namespace agh::ui;
 SScoringFacility::SPhasediffDialog&
 SScoringFacility::phasediff_d()
 {
-	if ( not _phasediff_d )
-		_phasediff_d = new SScoringFacility::SPhasediffDialog(*this);
-	return *_phasediff_d;
+        if ( not _phasediff_d )
+                _phasediff_d = new SScoringFacility::SPhasediffDialog(*this);
+        return *_phasediff_d;
 }
 
 
 SScoringFacility::SPhasediffDialog::
 SPhasediffDialog (SScoringFacility& parent)
       : SPhasediffDialogWidgets (parent),
-	channel1 (nullptr),
-	channel2 (nullptr),
-	use_original_signal (false),
-	from (1.), upto (2.),
-	bwf_order (1),
-	scope (0),
-	display_scale (1.),
-	course (0), // have no total_pages() known yet
-	smooth_side (1),
-	_p (parent)
+        channel1 (nullptr),
+        channel2 (nullptr),
+        use_original_signal (false),
+        from (1.), upto (2.),
+        bwf_order (1),
+        scope (0),
+        display_scale (1.),
+        course (0), // have no total_pages() known yet
+        smooth_side (1),
+        _p (parent)
 {
 }
 
@@ -51,53 +51,53 @@ void
 SScoringFacility::SPhasediffDialog::
 update_course()
 {
-	if ( channel1->samplerate() != channel2->samplerate() )
-		return;
+        if ( channel1->samplerate() != channel2->samplerate() )
+                return;
 
       // set scope, now that we know the samplerate
-	scope = channel1->samplerate() * .5;
-
-	if ( course.size() == 0 )
-		course.resize( _p.total_pages());
-	for ( size_t p = 0; p < course.size()-1; ++p ) {
-		size_t	pa = _p.pagesize() * channel1->samplerate() *  p,
-			pz = _p.pagesize() * channel1->samplerate() * (p+1);
-		course[p] =
-			(channel1->artifacts.region_dirty_fraction(pa, pz) > .2 ||
-			 channel2->artifacts.region_dirty_fraction(pa, pz) > .2)
-			? NAN
-			: sigproc::phase_diff(
-				sigproc::SSignalRef<TFloat> {
-					use_original_signal ? channel1->signal_original : channel1->signal_filtered,
-					channel1 -> samplerate()
-				},
-				sigproc::SSignalRef<TFloat> {
-					use_original_signal ? channel2->signal_original : channel2->signal_filtered,
-					channel1 -> samplerate()
-				},
-				pa, pz,
-				from, upto,
-				bwf_order,
-				scope);
-	}
+        scope = channel1->samplerate() * .5;
+
+        if ( course.size() == 0 )
+                course.resize( _p.total_pages());
+        for ( size_t p = 0; p < course.size()-1; ++p ) {
+                size_t        pa = _p.pagesize() * channel1->samplerate() *  p,
+                        pz = _p.pagesize() * channel1->samplerate() * (p+1);
+                course[p] =
+                        (channel1->artifacts.region_dirty_fraction(pa, pz) > .2 ||
+                         channel2->artifacts.region_dirty_fraction(pa, pz) > .2)
+                        ? NAN
+                        : sigproc::phase_diff(
+                                sigproc::SSignalRef<TFloat> {
+                                        use_original_signal ? channel1->signal_original : channel1->signal_filtered,
+                                        channel1 -> samplerate()
+                                },
+                                sigproc::SSignalRef<TFloat> {
+                                        use_original_signal ? channel2->signal_original : channel2->signal_filtered,
+                                        channel1 -> samplerate()
+                                },
+                                pa, pz,
+                                from, upto,
+                                bwf_order,
+                                scope);
+        }
 }
 
 const SScoringFacility::SChannel*
 SScoringFacility::SPhasediffDialog::
 channel_from_cbox( GtkComboBox *cbox)
 {
-	GtkTreeIter iter;
-	if ( gtk_combo_box_get_active_iter( cbox, &iter) == FALSE )
-		return nullptr;
-
-	char *entry;
-	gtk_tree_model_get( gtk_combo_box_get_model( cbox), &iter,
-			    0, &entry,
-			    -1);
-	for ( auto &H : _p.channels )
-		if ( strcmp( entry, H.name()) == 0 )
-			return &H;
-	return nullptr;
+        GtkTreeIter iter;
+        if ( gtk_combo_box_get_active_iter( cbox, &iter) == FALSE )
+                return nullptr;
+
+        char *entry;
+        gtk_tree_model_get( gtk_combo_box_get_model( cbox), &iter,
+                            0, &entry,
+                            -1);
+        for ( auto &H : _p.channels )
+                if ( strcmp( entry, H.name()) == 0 )
+                        return &H;
+        return nullptr;
 }
 
 
@@ -105,23 +105,23 @@ void
 SScoringFacility::SPhasediffDialog::
 preselect_channel( GtkComboBox *cbox, const string& ch)
 {
-	GtkTreeModel *model = gtk_combo_box_get_model( cbox);
-	GtkTreeIter iter;
-	gboolean valid;
-	valid = gtk_tree_model_get_iter_first( model, &iter);
-	while ( valid ) {
-		char *entry;
-		gtk_tree_model_get( model, &iter,
-				    0, &entry,
-				    -1);
-		unique_ptr<void,void(*)(void*)> entry_deleter (entry, free);
-
-		if ( entry == ch ) {
-			gtk_combo_box_set_active_iter( cbox, &iter);
-			return;
-		}
-		valid = gtk_tree_model_iter_next( model, &iter);
-	}
+        GtkTreeModel *model = gtk_combo_box_get_model( cbox);
+        GtkTreeIter iter;
+        gboolean valid;
+        valid = gtk_tree_model_get_iter_first( model, &iter);
+        while ( valid ) {
+                char *entry;
+                gtk_tree_model_get( model, &iter,
+                                    0, &entry,
+                                    -1);
+                unique_ptr<void,void(*)(void*)> entry_deleter (entry, free);
+
+                if ( entry == ch ) {
+                        gtk_combo_box_set_active_iter( cbox, &iter);
+                        return;
+                }
+                valid = gtk_tree_model_iter_next( model, &iter);
+        }
 }
 
 
@@ -132,116 +132,116 @@ void
 SScoringFacility::SPhasediffDialog::
 draw( cairo_t* cr, const int wd, const int ht)
 {
-	auto& SF = _p;
-	auto& ED = SF._p;
+        auto& SF = _p;
+        auto& ED = SF._p;
 
-	ED.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgb( cr);
-	cairo_rectangle( cr, 0, 0, wd, ht);
-	cairo_fill( cr);
-	cairo_stroke( cr);
+        ED.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgb( cr);
+        cairo_rectangle( cr, 0, 0, wd, ht);
+        cairo_fill( cr);
+        cairo_stroke( cr);
 
-	if ( channel1 == channel2 ) {
-		cairo_put_banner( cr, wd, ht, "Same channel");
-		return;
-	}
+        if ( channel1 == channel2 ) {
+                cairo_put_banner( cr, wd, ht, "Same channel");
+                return;
+        }
 
-	if ( course.size() == 0 ) {
-		cairo_put_banner( cr, wd, ht, "Huh?");
-		return;
-	}
+        if ( course.size() == 0 ) {
+                cairo_put_banner( cr, wd, ht, "Huh?");
+                return;
+        }
 
-	if ( channel1->samplerate() != channel2->samplerate() ) {
-		cairo_put_banner( cr, wd, ht, "Incompatible channels (different samplerate)");
-		return;
-	}
+        if ( channel1->samplerate() != channel2->samplerate() ) {
+                cairo_put_banner( cr, wd, ht, "Incompatible channels (different samplerate)");
+                return;
+        }
 
       // psd course in selected freq range
-	{
-		auto	C1 = channel1->crecording.psd_profile.course( from, upto);
-//			C2 = channel2->crecording.psd_profile.course( from, upto) * display_scale + ht/2;
-
-		ED.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
-		auto	scale =
-			agh::alg::calibrate_display_scale( C1, C1.size(), ht/2.);
-		cairo_move_to( cr, 0, ht - C1[0]);
-		for ( size_t i = 1; i < C1.size(); ++i )
-			cairo_line_to( cr, ((double)i+.5) / C1.size() * wd, ht - C1[i] * scale);
-		cairo_line_to( cr, wd, ht);
-		cairo_line_to( cr, 0, ht);
-		cairo_line_to( cr, 0, C1[0]);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-	}
+        {
+                auto        C1 = channel1->crecording.psd_profile.course( from, upto);
+//                        C2 = channel2->crecording.psd_profile.course( from, upto) * display_scale + ht/2;
+
+                ED.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
+                auto        scale =
+                        agh::alg::calibrate_display_scale( C1, C1.size(), ht/2.);
+                cairo_move_to( cr, 0, ht - C1[0]);
+                for ( size_t i = 1; i < C1.size(); ++i )
+                        cairo_line_to( cr, ((double)i+.5) / C1.size() * wd, ht - C1[i] * scale);
+                cairo_line_to( cr, wd, ht);
+                cairo_line_to( cr, 0, ht);
+                cairo_line_to( cr, 0, C1[0]);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+        }
 
       // zeroline and hour ticks
-	{
-		ED.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgb( cr);
-		cairo_set_line_width( cr, 1);
-		cairo_move_to( cr, 0,  ht/2);
-		cairo_line_to( cr, wd, ht/2);
-		cairo_stroke( cr);
-
-		cairo_set_font_size( cr, 10);
-		float	hours4 = channel1->crecording.F().recording_time() / 3600. * 4;
-		for ( size_t i = 1; i < hours4; ++i ) {
-			unsigned tick_pos = (float)i / hours4 * wd;
-			cairo_move_to( cr, tick_pos, 0);
-			if ( i % 4 == 0 )
-				cairo_set_line_width( cr, 1.);
-			else if ( i % 2 == 0 )
-				cairo_set_line_width( cr, .5);
-			else
-				cairo_set_line_width( cr, .25);
-			cairo_line_to( cr, tick_pos, ht);
-			if ( i % 4 == 0 ) {
-				cairo_move_to( cr, tick_pos+5, 12);
-				cairo_show_text( cr, snprintf_buf( "%2zuh", i / 4));
-			}
-			cairo_stroke( cr);
-		}
-	}
+        {
+                ED.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgb( cr);
+                cairo_set_line_width( cr, 1);
+                cairo_move_to( cr, 0,  ht/2);
+                cairo_line_to( cr, wd, ht/2);
+                cairo_stroke( cr);
+
+                cairo_set_font_size( cr, 10);
+                float        hours4 = channel1->crecording.F().recording_time() / 3600. * 4;
+                for ( size_t i = 1; i < hours4; ++i ) {
+                        unsigned tick_pos = (float)i / hours4 * wd;
+                        cairo_move_to( cr, tick_pos, 0);
+                        if ( i % 4 == 0 )
+                                cairo_set_line_width( cr, 1.);
+                        else if ( i % 2 == 0 )
+                                cairo_set_line_width( cr, .5);
+                        else
+                                cairo_set_line_width( cr, .25);
+                        cairo_line_to( cr, tick_pos, ht);
+                        if ( i % 4 == 0 ) {
+                                cairo_move_to( cr, tick_pos+5, 12);
+                                cairo_show_text( cr, snprintf_buf( "%2zuh", i / 4));
+                        }
+                        cairo_stroke( cr);
+                }
+        }
 
       // course
-	{
-		auto tmp = course;
-		sigproc::smooth( tmp, smooth_side);
-
-		cairo_set_source_rgb( cr, 0., 0., 0.);
-		cairo_set_line_width( cr, .8);
-		for ( size_t p = 1; p < tmp.size()-1; ++p )
-			if ( isfinite(tmp[p-1]) && isfinite(tmp[p]) ) {
-				cairo_move_to( cr,
-					       (float)(p-1)/(tmp.size()-1) * wd, tmp[p-1] * 1000 * display_scale + ht/2);
-				cairo_line_to( cr,
-					       (float)(p  )/(tmp.size()-1) * wd, tmp[p  ] * 1000 * display_scale + ht/2);
-				cairo_stroke( cr);
-			}
-	}
+        {
+                auto tmp = course;
+                sigproc::smooth( tmp, smooth_side);
+
+                cairo_set_source_rgb( cr, 0., 0., 0.);
+                cairo_set_line_width( cr, .8);
+                for ( size_t p = 1; p < tmp.size()-1; ++p )
+                        if ( isfinite(tmp[p-1]) && isfinite(tmp[p]) ) {
+                                cairo_move_to( cr,
+                                               (float)(p-1)/(tmp.size()-1) * wd, tmp[p-1] * 1000 * display_scale + ht/2);
+                                cairo_line_to( cr,
+                                               (float)(p  )/(tmp.size()-1) * wd, tmp[p  ] * 1000 * display_scale + ht/2);
+                                cairo_stroke( cr);
+                        }
+        }
 
       // scale bar
-	{
-		cairo_set_source_rgb( cr, 0., 0., 0.);
-		cairo_set_line_width( cr, 1.5);
-		double dpuf =
-			agh::alg::sensible_scale_reduction_factor(
-				1e3 * display_scale, ht);
-		int x = 10;
-		cairo_move_to( cr, x, 5);
-		cairo_rel_line_to( cr, 0, dpuf * (1e3 * display_scale));
-		cairo_stroke( cr);
-
-		cairo_set_font_size( cr, 9);
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-		cairo_move_to( cr, x + 5, 10);
-		cairo_show_text( cr, snprintf_buf( "%g ms", dpuf));
-		cairo_stroke( cr);
-	}
+        {
+                cairo_set_source_rgb( cr, 0., 0., 0.);
+                cairo_set_line_width( cr, 1.5);
+                double dpuf =
+                        agh::alg::sensible_scale_reduction_factor(
+                                1e3 * display_scale, ht);
+                int x = 10;
+                cairo_move_to( cr, x, 5);
+                cairo_rel_line_to( cr, 0, dpuf * (1e3 * display_scale));
+                cairo_stroke( cr);
+
+                cairo_set_font_size( cr, 9);
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                cairo_move_to( cr, x + 5, 10);
+                cairo_show_text( cr, snprintf_buf( "%g ms", dpuf));
+                cairo_stroke( cr);
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff.hh b/upstream/src/aghermann/ui/sf/d/phasediff.hh
index eb2d685..6fa448a 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff.hh
+++ b/upstream/src/aghermann/ui/sf/d/phasediff.hh
@@ -25,64 +25,64 @@ namespace ui {
 
 struct SPhasediffDialogWidgets {
 
-	SPhasediffDialogWidgets (SScoringFacility&);
+        SPhasediffDialogWidgets (SScoringFacility&);
        ~SPhasediffDialogWidgets ();
 
-	GtkBuilder *builder;
-
-	GtkListStore
-		*mSFPDChannels;
-
-	// phasediff dialog
-	GtkDialog
-		*wSFPD;
-	GtkComboBox
-		*eSFPDChannelA, *eSFPDChannelB;
-	GtkDrawingArea
-		*daSFPD;
-	GtkSpinButton
-		*eSFPDFreqFrom,
-		*eSFPDBandwidth;
-	GtkScaleButton
-		*eSFPDSmooth;
-	gulong
-		eSFPDChannelA_changed_cb_handler_id,
-		eSFPDChannelB_changed_cb_handler_id;
+        GtkBuilder *builder;
+
+        GtkListStore
+                *mSFPDChannels;
+
+        // phasediff dialog
+        GtkDialog
+                *wSFPD;
+        GtkComboBox
+                *eSFPDChannelA, *eSFPDChannelB;
+        GtkDrawingArea
+                *daSFPD;
+        GtkSpinButton
+                *eSFPDFreqFrom,
+                *eSFPDBandwidth;
+        GtkScaleButton
+                *eSFPDSmooth;
+        gulong
+                eSFPDChannelA_changed_cb_handler_id,
+                eSFPDChannelB_changed_cb_handler_id;
 };
 
 struct SScoringFacility::SPhasediffDialog
   : public SPhasediffDialogWidgets {
 
-	DELETE_DEFAULT_METHODS (SPhasediffDialog);
+        DELETE_DEFAULT_METHODS (SPhasediffDialog);
 
-	SPhasediffDialog (SScoringFacility&);
+        SPhasediffDialog (SScoringFacility&);
 
-	const SScoringFacility::SChannel
-		*channel1,
-		*channel2;
-	bool	use_original_signal;
-	float	from,
-		upto;
+        const SScoringFacility::SChannel
+                *channel1,
+                *channel2;
+        bool        use_original_signal;
+        float        from,
+                upto;
 
-	unsigned
-		bwf_order,
-		scope;
-	float	display_scale;
+        unsigned
+                bwf_order,
+                scope;
+        float        display_scale;
 
-	valarray<TFloat>
-		course;
-	size_t	smooth_side;
-	void update_course();
+        valarray<TFloat>
+                course;
+        size_t        smooth_side;
+        void update_course();
 
-	const SScoringFacility::SChannel* channel_from_cbox( GtkComboBox *cbox);
-	void preselect_channel( GtkComboBox *cbox, const string& ch);
+        const SScoringFacility::SChannel* channel_from_cbox( GtkComboBox *cbox);
+        void preselect_channel( GtkComboBox *cbox, const string& ch);
 
-	void draw( cairo_t* cr, int wd, int ht);
+        void draw( cairo_t* cr, int wd, int ht);
 
-	bool suspend_draw;
+        bool suspend_draw;
 
-	SScoringFacility&
-		_p;
+        SScoringFacility&
+                _p;
 };
 
 }
@@ -107,7 +107,7 @@ void wSFPD_hide_cb( GtkWidget*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff_cb.cc b/upstream/src/aghermann/ui/sf/d/phasediff_cb.cc
index 5af4ecf..3b2e271 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff_cb.cc
+++ b/upstream/src/aghermann/ui/sf/d/phasediff_cb.cc
@@ -21,44 +21,44 @@ extern "C" {
 
 gboolean
 daSFPD_draw_cb(
-	GtkWidget *wid,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget *wid,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	if ( PD.suspend_draw )
-		return TRUE;
+        if ( PD.suspend_draw )
+                return TRUE;
 
-	PD.draw( cr,
-		 gtk_widget_get_allocated_width( wid),
-		 gtk_widget_get_allocated_height( wid));
+        PD.draw( cr,
+                 gtk_widget_get_allocated_width( wid),
+                 gtk_widget_get_allocated_height( wid));
 
-	return TRUE;
+        return TRUE;
 }
 
 
 gboolean
 daSFPD_scroll_event_cb(
-	GtkWidget *wid,
-	GdkEventScroll *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	switch ( event->direction ) {
-	case GDK_SCROLL_UP:
-		PD.display_scale *= PD._p._p.scroll_factor;
-		break;
-	case GDK_SCROLL_DOWN:
-		PD.display_scale /= PD._p._p.scroll_factor;
-	default:
-		break;
-	}
+        switch ( event->direction ) {
+        case GDK_SCROLL_UP:
+                PD.display_scale *= PD._p._p.scroll_factor;
+                break;
+        case GDK_SCROLL_DOWN:
+                PD.display_scale /= PD._p._p.scroll_factor;
+        default:
+                break;
+        }
 
-	gtk_widget_queue_draw( wid);
+        gtk_widget_queue_draw( wid);
 
-	return TRUE;
+        return TRUE;
 }
 
 
@@ -66,34 +66,34 @@ daSFPD_scroll_event_cb(
 
 void
 eSFPDChannelA_changed_cb(
-	GtkComboBox *cbox,
-	const gpointer userdata)
+        GtkComboBox *cbox,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	if ( PD.suspend_draw )
-		return;
+        if ( PD.suspend_draw )
+                return;
 
-	PD.channel1 = PD.channel_from_cbox( cbox);
+        PD.channel1 = PD.channel_from_cbox( cbox);
 
-	PD.update_course();
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        PD.update_course();
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 void
 eSFPDChannelB_changed_cb(
-	GtkComboBox *cbox,
-	const gpointer userdata)
+        GtkComboBox *cbox,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	if ( PD.suspend_draw )
-		return;
+        if ( PD.suspend_draw )
+                return;
 
-	PD.channel2 = PD.channel_from_cbox( cbox);
+        PD.channel2 = PD.channel_from_cbox( cbox);
 
-	PD.update_course();
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        PD.update_course();
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 
@@ -101,99 +101,99 @@ eSFPDChannelB_changed_cb(
 
 void
 eSFPDFreqFrom_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	if ( PD.suspend_draw )
-		return;
+        if ( PD.suspend_draw )
+                return;
 
-	PD.from = gtk_spin_button_get_value( spinbutton);
-	PD.upto = PD.from + gtk_spin_button_get_value( PD.eSFPDBandwidth);
+        PD.from = gtk_spin_button_get_value( spinbutton);
+        PD.upto = PD.from + gtk_spin_button_get_value( PD.eSFPDBandwidth);
 
-	PD.update_course();
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        PD.update_course();
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 void
 eSFPDBandwidth_value_changed_cb(
-	GtkSpinButton *spinbutton,
-	const gpointer userdata)
+        GtkSpinButton *spinbutton,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	if ( PD.suspend_draw )
-		return;
+        if ( PD.suspend_draw )
+                return;
 
-	PD.upto = PD.from + gtk_spin_button_get_value( spinbutton);
+        PD.upto = PD.from + gtk_spin_button_get_value( spinbutton);
 
-	PD.update_course();
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        PD.update_course();
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 
 
 void
 eSFPDSmooth_value_changed_cb(
-	GtkScaleButton *b,
-	const gdouble v,
-	const gpointer userdata)
+        GtkScaleButton *b,
+        const gdouble v,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	PD.smooth_side = v;
-	gtk_button_set_label(
-		(GtkButton*)b,
-		snprintf_buf( "Smooth: %zu", (size_t)v));
-	if ( PD.suspend_draw )
-		return;
+        PD.smooth_side = v;
+        gtk_button_set_label(
+                (GtkButton*)b,
+                snprintf_buf( "Smooth: %zu", (size_t)v));
+        if ( PD.suspend_draw )
+                return;
 
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 
 
 void
 wSFPD_show_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
-	auto& SF = PD._p;
-
-	PD.suspend_draw = true;
-	if ( gtk_combo_box_get_active( PD.eSFPDChannelA) == -1 ||
-	     gtk_combo_box_get_active( PD.eSFPDChannelB) == -1 ) {
-		PD.channel1 = &*SF.channels.begin();
-		PD.channel2 = &*next(SF.channels.begin());
-		PD.preselect_channel( PD.eSFPDChannelA, PD.channel1->name());
-		PD.preselect_channel( PD.eSFPDChannelB, PD.channel2->name());
-	} else {
-		// they have been nicely set before, havent't they
-		// PD.channel1 = PD.channel_from_cbox( eSFPDChannelA);
-		// PD.channel2 = PD.channel_from_cbox( eSFPDChannelB);
-	}
-
-	gtk_spin_button_set_value( PD.eSFPDFreqFrom, PD.from);
-	gtk_spin_button_set_value( PD.eSFPDBandwidth, PD.upto - PD.from);
-	gtk_button_set_label(
-		(GtkButton*)PD.eSFPDSmooth,
-		snprintf_buf( "Smooth: %zu", PD.smooth_side));
-
-	PD.update_course();
-	PD.suspend_draw = false;
-	gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
+        auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        auto& SF = PD._p;
+
+        PD.suspend_draw = true;
+        if ( gtk_combo_box_get_active( PD.eSFPDChannelA) == -1 ||
+             gtk_combo_box_get_active( PD.eSFPDChannelB) == -1 ) {
+                PD.channel1 = &*SF.channels.begin();
+                PD.channel2 = &*next(SF.channels.begin());
+                PD.preselect_channel( PD.eSFPDChannelA, PD.channel1->name());
+                PD.preselect_channel( PD.eSFPDChannelB, PD.channel2->name());
+        } else {
+                // they have been nicely set before, havent't they
+                // PD.channel1 = PD.channel_from_cbox( eSFPDChannelA);
+                // PD.channel2 = PD.channel_from_cbox( eSFPDChannelB);
+        }
+
+        gtk_spin_button_set_value( PD.eSFPDFreqFrom, PD.from);
+        gtk_spin_button_set_value( PD.eSFPDBandwidth, PD.upto - PD.from);
+        gtk_button_set_label(
+                (GtkButton*)PD.eSFPDSmooth,
+                snprintf_buf( "Smooth: %zu", PD.smooth_side));
+
+        PD.update_course();
+        PD.suspend_draw = false;
+        gtk_widget_queue_draw( (GtkWidget*)PD.daSFPD);
 }
 
 void
 wSFPD_hide_cb(
-	GtkWidget*,
-	const gpointer)
+        GtkWidget*,
+        const gpointer)
 {
-	// auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+        // auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	
+        
 }
 
 } // extern "C"
@@ -201,7 +201,7 @@ wSFPD_hide_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/d/rk1968.hh b/upstream/src/aghermann/ui/sf/d/rk1968.hh
index 87d6f39..3497e4d 100644
--- a/upstream/src/aghermann/ui/sf/d/rk1968.hh
+++ b/upstream/src/aghermann/ui/sf/d/rk1968.hh
@@ -25,169 +25,169 @@ namespace aghui {
 
 struct SRK1968DialogWidgets {
 
-	SRK1968DialogWidgets (SScoringFacility&); // need access to mAllChannels
+        SRK1968DialogWidgets (SScoringFacility&); // need access to mAllChannels
        ~SRK1968DialogWidgets ();
 
-	GtkBuilder *builder;
-
-	
-	GtkListStore
-		*mSFFDPatterns,
-		*mSFFDChannels;
-	GtkDialog
-		*wSFFD;
-	GtkComboBox
-		*eSFFDChannel,
-		*eSFFDPatternList;
-	GtkScrolledWindow
-		*swSFFDThing,
-		*swSFFDField;
-	GtkTable
-		*cSFFDParameters,
-		*cSFFDCriteria,
-		*cSFFDSearchButton,
-		*cSFFDAgainButton;
-	GtkBox	*cSFFDSearching;
-	GtkDrawingArea
-		*daSFFDThing,
-		*daSFFDField;
-	GtkMenuBar
-		*iibSFFDMenu;
-	GtkMenu	*iiSFFDField,
-		*iiSFFDFieldProfileTypes;
-	GtkCheckMenuItem
-		*iSFFDFieldDrawMatchIndex;
-	GtkMenuItem
-		*iSFFDMarkPhasicEventSpindles,
-		*iSFFDMarkPhasicEventKComplexes,
-		*iSFFDMarkPlain;
-	GtkRadioMenuItem
-		*iSFFDFieldProfileTypeRaw,
-		*iSFFDFieldProfileTypePSD,
-		*iSFFDFieldProfileTypeMC,
-		*iSFFDFieldProfileTypeSWU;
-	GtkButton
-		*bSFFDSearch, *bSFFDAgain,
-		*bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
-	GtkSpinButton
-		*eSFFDEnvTightness,
-		*eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
-		*eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
-		*eSFFDParameterA, *eSFFDParameterB,
-		*eSFFDParameterC, *eSFFDParameterD,
-		*eSFFDIncrement;
-	GtkHBox
-		*cSFFDLabelBox;
-	GtkLabel
-		*lSFFDParametersBrief,
-		*lSFFDFoundInfo;
-	GtkDialog
-		*wSFFDPatternSave;
-	GtkEntry
-		*eSFFDPatternSaveName;
-	GtkToggleButton
-		*eSFFDPatternSaveOriginSubject,
-		*eSFFDPatternSaveOriginExperiment,
-		*eSFFDPatternSaveOriginUser;
-	GtkButton
-		*bSFFDPatternSaveOK;
-	gulong	eSFFDChannel_changed_cb_handler_id,
-		eSFFDPatternList_changed_cb_handler_id;
+        GtkBuilder *builder;
+
+        
+        GtkListStore
+                *mSFFDPatterns,
+                *mSFFDChannels;
+        GtkDialog
+                *wSFFD;
+        GtkComboBox
+                *eSFFDChannel,
+                *eSFFDPatternList;
+        GtkScrolledWindow
+                *swSFFDThing,
+                *swSFFDField;
+        GtkTable
+                *cSFFDParameters,
+                *cSFFDCriteria,
+                *cSFFDSearchButton,
+                *cSFFDAgainButton;
+        GtkBox        *cSFFDSearching;
+        GtkDrawingArea
+                *daSFFDThing,
+                *daSFFDField;
+        GtkMenuBar
+                *iibSFFDMenu;
+        GtkMenu        *iiSFFDField,
+                *iiSFFDFieldProfileTypes;
+        GtkCheckMenuItem
+                *iSFFDFieldDrawMatchIndex;
+        GtkMenuItem
+                *iSFFDMarkPhasicEventSpindles,
+                *iSFFDMarkPhasicEventKComplexes,
+                *iSFFDMarkPlain;
+        GtkRadioMenuItem
+                *iSFFDFieldProfileTypeRaw,
+                *iSFFDFieldProfileTypePSD,
+                *iSFFDFieldProfileTypeMC,
+                *iSFFDFieldProfileTypeSWU;
+        GtkButton
+                *bSFFDSearch, *bSFFDAgain,
+                *bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
+        GtkSpinButton
+                *eSFFDEnvTightness,
+                *eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
+                *eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
+                *eSFFDParameterA, *eSFFDParameterB,
+                *eSFFDParameterC, *eSFFDParameterD,
+                *eSFFDIncrement;
+        GtkHBox
+                *cSFFDLabelBox;
+        GtkLabel
+                *lSFFDParametersBrief,
+                *lSFFDFoundInfo;
+        GtkDialog
+                *wSFFDPatternSave;
+        GtkEntry
+                *eSFFDPatternSaveName;
+        GtkToggleButton
+                *eSFFDPatternSaveOriginSubject,
+                *eSFFDPatternSaveOriginExperiment,
+                *eSFFDPatternSaveOriginUser;
+        GtkButton
+                *bSFFDPatternSaveOK;
+        gulong        eSFFDChannel_changed_cb_handler_id,
+                eSFFDPatternList_changed_cb_handler_id;
 };
 
 
 struct SScoringFacility::SPatternsDialog
   : public SPatternsDialogWidgets{
 
-	DELETE_DEFAULT_METHODS (SPatternsDialog);
+        DELETE_DEFAULT_METHODS (SPatternsDialog);
 
       // ctor, dtor
-	SPatternsDialog (SScoringFacility& parent);
+        SPatternsDialog (SScoringFacility& parent);
        ~SPatternsDialog ();
 
       // saved patterns
-	list<pattern::SPattern<TFloat>>
-		patterns;
-	list<pattern::SPattern<TFloat>>::iterator
-		current_pattern;
-	list<pattern::SPattern<TFloat>>::iterator
-	pattern_by_idx( size_t);
-
-	int import_from_selection( SScoringFacility::SChannel&);
-	void load_patterns();
-	void save_patterns();
-	void discard_current_pattern();
-	void populate_combo();
+        list<pattern::SPattern<TFloat>>
+                patterns;
+        list<pattern::SPattern<TFloat>>::iterator
+                current_pattern;
+        list<pattern::SPattern<TFloat>>::iterator
+        pattern_by_idx( size_t);
+
+        int import_from_selection( SScoringFacility::SChannel&);
+        void load_patterns();
+        void save_patterns();
+        void discard_current_pattern();
+        void populate_combo();
 
       // finding tool
-  	pattern::SPatternPPack<TFloat>
-		Pp2;
-	double	increment; // in seconds
+          pattern::SPatternPPack<TFloat>
+                Pp2;
+        double        increment; // in seconds
 
       // matches
-	pattern::CMatch<TFloat>
-		criteria;
-	vector<pattern::CMatch<TFloat>>
-		diff_line;
-	vector<size_t>
-		occurrences;
-	size_t	highlighted_occurrence;
-	void search();
-	size_t find_occurrences();
-	size_t nearest_occurrence( double) const;
-	int	now_tweaking; // limit draw similarity index to this item
+        pattern::CMatch<TFloat>
+                criteria;
+        vector<pattern::CMatch<TFloat>>
+                diff_line;
+        vector<size_t>
+                occurrences;
+        size_t        highlighted_occurrence;
+        void search();
+        size_t find_occurrences();
+        size_t nearest_occurrence( double) const;
+        int        now_tweaking; // limit draw similarity index to this item
 
       // field
-	SScoringFacility::SChannel
-		*field_channel,
-		*field_channel_saved;
-	list<sigfile::SAnnotation>
-		saved_annotations;
-	void occurrences_to_annotations( sigfile::SAnnotation::TType = sigfile::SAnnotation::TType::plain);
-	void save_annotations();
-	void restore_annotations();
-
-	metrics::TType
-		field_profile_type; // where appropriate; otherwise draw compressed raw
-	void update_field_check_menu_items();
+        SScoringFacility::SChannel
+                *field_channel,
+                *field_channel_saved;
+        list<sigfile::SAnnotation>
+                saved_annotations;
+        void occurrences_to_annotations( sigfile::SAnnotation::TType = sigfile::SAnnotation::TType::plain);
+        void save_annotations();
+        void restore_annotations();
+
+        metrics::TType
+                field_profile_type; // where appropriate; otherwise draw compressed raw
+        void update_field_check_menu_items();
 
       // draw
-	bool	suppress_w_v:1,
-		suppress_redraw:1,
-		draw_details:1,
-		draw_match_index:1;
-	void draw_thing( cairo_t*);
-	void draw_field( cairo_t*);
-	float	thing_display_scale,
-		field_display_scale;
+        bool        suppress_w_v:1,
+                suppress_redraw:1,
+                draw_details:1,
+                draw_match_index:1;
+        void draw_thing( cairo_t*);
+        void draw_field( cairo_t*);
+        float        thing_display_scale,
+                field_display_scale;
 
       // widgets
-	SUIVarCollection
-		W_V;
-	void atomic_up()
-		{
-			suppress_w_v = true;
-			W_V.up();
-			suppress_w_v = false;
-		}
-
-	void preselect_channel( int) const;
-
-	void setup_controls_for_find();
-	void setup_controls_for_wait();
-	void setup_controls_for_tune();
-	void set_profile_manage_buttons_visibility();
-
-	static const int
-		da_thing_ht = 200,
-		da_field_ht = 160;
-	int	da_thing_wd,
-		da_field_wd;
-	void set_thing_da_width( int);
-	void set_field_da_width( int);
-
-	aghui::SScoringFacility&
-		_p;
+        SUIVarCollection
+                W_V;
+        void atomic_up()
+                {
+                        suppress_w_v = true;
+                        W_V.up();
+                        suppress_w_v = false;
+                }
+
+        void preselect_channel( int) const;
+
+        void setup_controls_for_find();
+        void setup_controls_for_wait();
+        void setup_controls_for_tune();
+        void set_profile_manage_buttons_visibility();
+
+        static const int
+                da_thing_ht = 200,
+                da_field_ht = 160;
+        int        da_thing_wd,
+                da_field_wd;
+        void set_thing_da_width( int);
+        void set_field_da_width( int);
+
+        aghui::SScoringFacility&
+                _p;
 };
 
 
@@ -228,6 +228,6 @@ void iSFFD_any_field_profile_type_toggled_cb( GtkRadioMenuItem*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/hypnogram.cc b/upstream/src/aghermann/ui/sf/hypnogram.cc
index c898e6c..a03c85f 100644
--- a/upstream/src/aghermann/ui/sf/hypnogram.cc
+++ b/upstream/src/aghermann/ui/sf/hypnogram.cc
@@ -23,7 +23,7 @@ using namespace agh::ui;
 namespace {
 
 unsigned short __score_hypn_depth[8] = {
-	0, 20, 23, 30, 33, 5, 10, 1
+        0, 20, 23, 30, 33, 5, 10, 1
 };
 
 }
@@ -34,88 +34,88 @@ SScoringFacility::
 draw_hypnogram( cairo_t *cr)
 {
       // bg
-	_p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgb( cr);
-	cairo_rectangle( cr, 0., 0., da_wd, HypnogramHeight);
-	cairo_fill( cr);
-	cairo_stroke( cr);
-
-	if ( alt_hypnogram ) {
-		for ( size_t i = 0; i < total_pages(); ++i ) {
-			auto s = sigfile::SPage::char2score( hypnogram[i]);
-			if ( s != sigfile::SPage::TScore::none ) {
-				_p.CwB[SExpDesignUI::score2colour(s)].set_source_rgba( cr, .4);
-				cairo_rectangle( cr,
-						 (float)i/total_pages() * da_wd, 0,
-						 1./total_pages() * da_wd, da_ht);
-				cairo_fill( cr);
-				cairo_stroke( cr);
-			}
-		}
-	} else {
-		_p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgba_contrasting( cr, .4);
-		cairo_set_line_width( cr, .4);
-		for ( size_t i = 1; i < (size_t)sigfile::SPage::TScore::TScore_total; ++i ) {
-			cairo_move_to( cr, 0,     __score_hypn_depth[i]);
-			cairo_line_to( cr, da_wd, __score_hypn_depth[i]);
-		}
-		cairo_stroke( cr);
-
-	      // scores
-		_p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgba_contrasting( cr, 1.);
-		cairo_set_line_width( cr, 3.);
-		// these lines can be discontinuous
-		for ( size_t i = 0; i < total_pages(); ++i ) {
-			char c = hypnogram[i];
-			if ( c != sigfile::SPage::score_code( sigfile::SPage::TScore::none) ) {
-				int y = __score_hypn_depth[ (size_t)sigfile::SPage::char2score(c) ];
-				cairo_move_to( cr, (float)i/total_pages() * da_wd, y);
-				cairo_rel_line_to( cr, 1./total_pages() * da_wd, 0);
-			}
-		}
-		cairo_stroke( cr);
-	}
+        _p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgb( cr);
+        cairo_rectangle( cr, 0., 0., da_wd, HypnogramHeight);
+        cairo_fill( cr);
+        cairo_stroke( cr);
+
+        if ( alt_hypnogram ) {
+                for ( size_t i = 0; i < total_pages(); ++i ) {
+                        auto s = sigfile::SPage::char2score( hypnogram[i]);
+                        if ( s != sigfile::SPage::TScore::none ) {
+                                _p.CwB[SExpDesignUI::score2colour(s)].set_source_rgba( cr, .4);
+                                cairo_rectangle( cr,
+                                                 (float)i/total_pages() * da_wd, 0,
+                                                 1./total_pages() * da_wd, da_ht);
+                                cairo_fill( cr);
+                                cairo_stroke( cr);
+                        }
+                }
+        } else {
+                _p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgba_contrasting( cr, .4);
+                cairo_set_line_width( cr, .4);
+                for ( size_t i = 1; i < (size_t)sigfile::SPage::TScore::TScore_total; ++i ) {
+                        cairo_move_to( cr, 0,     __score_hypn_depth[i]);
+                        cairo_line_to( cr, da_wd, __score_hypn_depth[i]);
+                }
+                cairo_stroke( cr);
+
+              // scores
+                _p.CwB[SExpDesignUI::TColour::sf_hypnogram].set_source_rgba_contrasting( cr, 1.);
+                cairo_set_line_width( cr, 3.);
+                // these lines can be discontinuous
+                for ( size_t i = 0; i < total_pages(); ++i ) {
+                        char c = hypnogram[i];
+                        if ( c != sigfile::SPage::score_code( sigfile::SPage::TScore::none) ) {
+                                int y = __score_hypn_depth[ (size_t)sigfile::SPage::char2score(c) ];
+                                cairo_move_to( cr, (float)i/total_pages() * da_wd, y);
+                                cairo_rel_line_to( cr, 1./total_pages() * da_wd, 0);
+                        }
+                }
+                cairo_stroke( cr);
+        }
 
       // extra: annotations
-	{
-		_p.CwB[SExpDesignUI::TColour::sf_annotations].set_source_rgba( cr, .9);
-		cairo_set_line_width( cr, 18.);
-
-		auto total_seconds = total_pages() * pagesize();
-		for ( auto &H : channels ) {
-			for ( auto &A : H.annotations ) {
-				cairo_move_to( cr, A.span.a / total_seconds * da_wd, 4);
-				cairo_line_to( cr, A.span.z / total_seconds * da_wd, 4);
-			}
-		}
-		cairo_stroke( cr);
-
-		_p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr, .9);
-		for ( auto &SA : common_annotations ) {
-			auto& A = *SA.second;
-			cairo_move_to( cr, A.span.a / total_seconds * da_wd - 1, 4); // extend by one pixel to prevent
-			cairo_line_to( cr, A.span.z / total_seconds * da_wd + 1, 4); // zero-length annotations to vanish
-		}
-
-		cairo_stroke( cr);
-	}
+        {
+                _p.CwB[SExpDesignUI::TColour::sf_annotations].set_source_rgba( cr, .9);
+                cairo_set_line_width( cr, 18.);
+
+                auto total_seconds = total_pages() * pagesize();
+                for ( auto &H : channels ) {
+                        for ( auto &A : H.annotations ) {
+                                cairo_move_to( cr, A.span.a / total_seconds * da_wd, 4);
+                                cairo_line_to( cr, A.span.z / total_seconds * da_wd, 4);
+                        }
+                }
+                cairo_stroke( cr);
+
+                _p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr, .9);
+                for ( auto &SA : common_annotations ) {
+                        auto& A = *SA.second;
+                        cairo_move_to( cr, A.span.a / total_seconds * da_wd - 1, 4); // extend by one pixel to prevent
+                        cairo_line_to( cr, A.span.z / total_seconds * da_wd + 1, 4); // zero-length annotations to vanish
+                }
+
+                cairo_stroke( cr);
+        }
 
       // extra: artifacts
-	{
-		_p.CwB[SExpDesignUI::TColour::sf_artifact].set_source_rgba( cr);
-		cairo_set_line_width( cr, 12.);
-
-		auto total_seconds = total_pages() * pagesize();
-		for ( auto &H : channels ) {
-			for ( auto &A : H.artifacts() ) {
-				cairo_move_to( cr, A.a / total_seconds * da_wd - 1, 12);
-				cairo_line_to( cr, A.z / total_seconds * da_wd + 1, 12);
-			}
-		}
-		cairo_stroke( cr);
-	}
+        {
+                _p.CwB[SExpDesignUI::TColour::sf_artifact].set_source_rgba( cr);
+                cairo_set_line_width( cr, 12.);
+
+                auto total_seconds = total_pages() * pagesize();
+                for ( auto &H : channels ) {
+                        for ( auto &A : H.artifacts() ) {
+                                cairo_move_to( cr, A.a / total_seconds * da_wd - 1, 12);
+                                cairo_line_to( cr, A.z / total_seconds * da_wd + 1, 12);
+                        }
+                }
+                cairo_stroke( cr);
+        }
 
       // hour ticks
-	_draw_hour_ticks( cr, 0, HypnogramHeight);
+        _draw_hour_ticks( cr, 0, HypnogramHeight);
 }
 
 
@@ -128,41 +128,41 @@ void
 SScoringFacility::
 do_dialog_import_hypnogram()
 {
-	GtkWidget *f_chooser =
-		gtk_file_chooser_dialog_new(
-			"Import Scores",
-			NULL,
-			GTK_FILE_CHOOSER_ACTION_OPEN,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-			NULL);
-	if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
-		gchar *fname = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
-		// count lines first
-		ifstream f (fname);
-		string t;
-		size_t c = 0;
-		while ( not getline(f, t).eof() )
-			++c;
-		size_t our_pages = sepisode().sources.front().pages();
-		if ( c != our_pages && // allow for last page scored but discarded in CHypnogram as incomplete
-		     c != our_pages+1 )
-			pop_ok_message(
-				wSF,
-				"Page count in current hypnogram (%zu,"
-				" even allowing for one incomplete extra) is not equal"
-				" to the number of lines in <i>%s</i> (%zu).\n\n"
-				"Please trim the file contents and try again.",
-				fname, c, our_pages);
-		else {
-			for ( auto &F : sepisode().sources )
-				F.load_canonical( fname, _p.ext_score_codes);
-			get_hypnogram();
-			calculate_scored_percent();
-			queue_redraw_all();
-		}
-	}
-	gtk_widget_destroy( f_chooser);
+        GtkWidget *f_chooser =
+                gtk_file_chooser_dialog_new(
+                        "Import Scores",
+                        NULL,
+                        GTK_FILE_CHOOSER_ACTION_OPEN,
+                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                        NULL);
+        if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
+                gchar *fname = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
+                // count lines first
+                ifstream f (fname);
+                string t;
+                size_t c = 0;
+                while ( not getline(f, t).eof() )
+                        ++c;
+                size_t our_pages = sepisode().sources.front().pages();
+                if ( c != our_pages && // allow for last page scored but discarded in CHypnogram as incomplete
+                     c != our_pages+1 )
+                        pop_ok_message(
+                                wSF,
+                                "Page count in current hypnogram (%zu,"
+                                " even allowing for one incomplete extra) is not equal"
+                                " to the number of lines in <i>%s</i> (%zu).\n\n"
+                                "Please trim the file contents and try again.",
+                                fname, c, our_pages);
+                else {
+                        for ( auto &F : sepisode().sources )
+                                F.load_canonical( fname, _p.ext_score_codes);
+                        get_hypnogram();
+                        calculate_scored_percent();
+                        queue_redraw_all();
+                }
+        }
+        gtk_widget_destroy( f_chooser);
 }
 
 
@@ -170,20 +170,20 @@ void
 SScoringFacility::
 do_dialog_export_hypnogram() const
 {
-	GtkWidget *f_chooser =
-		gtk_file_chooser_dialog_new(
-			"Export Scores",
-			NULL,
-			GTK_FILE_CHOOSER_ACTION_SAVE,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-			NULL);
-	if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
-		gchar *fname = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
-		// put_hypnogram();  // side-effect being, implicit flash of SScoringFacility::sepisode.sources // do this elsewhere
-		sepisode().sources.front().save_canonical( fname);
-	}
-	gtk_widget_destroy( f_chooser);
+        GtkWidget *f_chooser =
+                gtk_file_chooser_dialog_new(
+                        "Export Scores",
+                        NULL,
+                        GTK_FILE_CHOOSER_ACTION_SAVE,
+                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                        NULL);
+        if ( gtk_dialog_run( (GtkDialog*)f_chooser) == GTK_RESPONSE_ACCEPT ) {
+                gchar *fname = gtk_file_chooser_get_filename( (GtkFileChooser*)f_chooser);
+                // put_hypnogram();  // side-effect being, implicit flash of SScoringFacility::sepisode.sources // do this elsewhere
+                sepisode().sources.front().save_canonical( fname);
+        }
+        gtk_widget_destroy( f_chooser);
 }
 
 
@@ -192,19 +192,19 @@ void
 SScoringFacility::
 do_clear_hypnogram()
 {
-	hypnogram.assign(
-		hypnogram.size(),
-		sigfile::SPage::score_code( sigfile::SPage::TScore::none));
-	put_hypnogram();  // side-effect being, implicit flash of SScoringFacility::sepisode.sources
-	calculate_scored_percent();
-	queue_redraw_all();
+        hypnogram.assign(
+                hypnogram.size(),
+                sigfile::SPage::score_code( sigfile::SPage::TScore::none));
+        put_hypnogram();  // side-effect being, implicit flash of SScoringFacility::sepisode.sources
+        calculate_scored_percent();
+        queue_redraw_all();
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/hypnogram_cb.cc b/upstream/src/aghermann/ui/sf/hypnogram_cb.cc
index 2f41210..26ebfab 100644
--- a/upstream/src/aghermann/ui/sf/hypnogram_cb.cc
+++ b/upstream/src/aghermann/ui/sf/hypnogram_cb.cc
@@ -20,15 +20,15 @@ extern "C" {
 
 gboolean
 daSFHypnogram_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.draw_hypnogram( cr);
+        SF.draw_hypnogram( cr);
 
-	return TRUE;
+        return TRUE;
 }
 
 
@@ -36,122 +36,122 @@ daSFHypnogram_draw_cb(
 
 gboolean
 daSFHypnogram_button_press_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	switch ( event->button ) {
-	case 1:
-		SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
-		SF.hypnogram_button_down = true;
-		SF.queue_redraw_all();
-	    break;
-	case 2:
-		SF.alt_hypnogram = !SF.alt_hypnogram;
-		gtk_widget_queue_draw( wid);
-	    break;
-	case 3:
-		gtk_menu_popup(
-			SF.iiSFScore,
-			NULL, NULL, NULL, NULL, 3, event->time);
-	    break;
-	}
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+
+        switch ( event->button ) {
+        case 1:
+                SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
+                SF.hypnogram_button_down = true;
+                SF.queue_redraw_all();
+            break;
+        case 2:
+                SF.alt_hypnogram = !SF.alt_hypnogram;
+                gtk_widget_queue_draw( wid);
+            break;
+        case 3:
+                gtk_menu_popup(
+                        SF.iiSFScore,
+                        NULL, NULL, NULL, NULL, 3, event->time);
+            break;
+        }
+        return TRUE;
 }
 
 gboolean
 daSFHypnogram_button_release_event_cb(
-	GtkWidget*,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	switch ( event->button ) {
-	case 1:
-		SF.set_cur_vpage(
-			agh::alg::value_within( event->x / SF.da_wd, 0., 1.) * SF.total_vpages());
-		SF.hypnogram_button_down = false;
-		SF.queue_redraw_all();
-	    break;
-	}
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+
+        switch ( event->button ) {
+        case 1:
+                SF.set_cur_vpage(
+                        agh::alg::value_within( event->x / SF.da_wd, 0., 1.) * SF.total_vpages());
+                SF.hypnogram_button_down = false;
+                SF.queue_redraw_all();
+            break;
+        }
+        return TRUE;
 }
 
 
 
 gboolean
 daSFHypnogram_motion_notify_event_cb(
-	GtkWidget*,
-	GdkEventMotion *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventMotion *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.hypnogram_button_down ) {
-		SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
-		gdk_event_request_motions( event);
-		SF.queue_redraw_all();
-	}
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.hypnogram_button_down ) {
+                SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
+                gdk_event_request_motions( event);
+                SF.queue_redraw_all();
+        }
+        return TRUE;
 }
 
 
 void
 iSFScoreAssist_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	if ( agh::rk1968::CScoreAssistant().score( SF.sepisode()) == 0 ) {
-		SF.get_hypnogram();
-		SF.calculate_scored_percent();
-		//SF.repaint_score_stats();
-		SF.queue_redraw_all();
-	}
+        auto& SF = *(SScoringFacility*)userdata;
+
+        if ( agh::rk1968::CScoreAssistant().score( SF.sepisode()) == 0 ) {
+                SF.get_hypnogram();
+                SF.calculate_scored_percent();
+                //SF.repaint_score_stats();
+                SF.queue_redraw_all();
+        }
 }
 
 
 
 void
 iSFScoreImport_activate_cb(
-	GtkMenuItem*,
-	gpointer userdata)
+        GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_dialog_import_hypnogram();
+        SF.do_dialog_import_hypnogram();
 }
 
 void
 iSFScoreExport_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_dialog_export_hypnogram();
+        SF.do_dialog_export_hypnogram();
 }
 
 
 
 void
 iSFScoreClear_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_clear_hypnogram();
+        SF.do_clear_hypnogram();
 }
 
 } // extern "C"
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/ica.cc b/upstream/src/aghermann/ui/sf/ica.cc
index dade7ad..f0344e7 100644
--- a/upstream/src/aghermann/ui/sf/ica.cc
+++ b/upstream/src/aghermann/ui/sf/ica.cc
@@ -22,116 +22,116 @@ using namespace std;
 using namespace agh::ui;
 
 const char
-	*SScoringFacility::ica_unmapped_menu_item_label = "(not mapped)";
+        *SScoringFacility::ica_unmapped_menu_item_label = "(not mapped)";
 
 int
 SScoringFacility::
 setup_ica()
 {
-	if ( ica )
-		delete ica;
+        if ( ica )
+                delete ica;
 
       // check for previous ICA runs
-	{
-		list<string> affected_sources;
-		for ( auto &H : channels )
-			affected_sources.push_back( H.crecording.F().filename());
-		affected_sources.unique();
-		for ( auto &fname : affected_sources ) {
-			if ( access( (fname + ".orig").c_str(), F_OK) == -1 ) {
-				; // good
-			} else {
-				if ( GTK_RESPONSE_NO ==
-				     pop_question(
-					     wSF,
-					     "<b>You have already run ICA on these channels</b>",
-					     "A backup file <i>\"%s.orig\"</i> exists, and\n"
-					     "will be overwritten if you proceed now.\n\n"
-					     "Sure you want to do it again?",
-					     fname.c_str()) )
-					return 1;
-			}
-		}
-	}
-
-	vector<TICASetupFun> src;
-	size_t	checking_sr = 0,
-		checking_total_samples = (size_t)-1;
-	for ( auto &H : channels ) {
-		size_t	this_sr = H.crecording.F().samplerate(H.h()),
-			this_ts = H.crecording.total_samples();
-		if ( checking_sr and this_sr != checking_sr ) {
-			pop_ok_message(
-				wSF,
-				"<b>Variable sample rates not supported</b>",
-				"Sorry, ICA cannot yet be performed on channels with different sample rates.");
-			return 1;
-		} else
-			checking_sr = this_sr;
-		if ( checking_total_samples != (size_t)-1 and checking_total_samples != this_ts ) {
-			pop_ok_message( wSF,
-					"Unequal channel sizes",
-					"This is something that's never supposed to happen.");
-			return 1;
-		} else
-			checking_total_samples = this_ts;
-
-		src.emplace_back(
-			bind (&sigfile::CSource::get_signal_original, &H.crecording.F(), H.h()));
-	}
-	ica = new ica::CFastICA (src, channels.front().crecording.total_samples());
+        {
+                list<string> affected_sources;
+                for ( auto &H : channels )
+                        affected_sources.push_back( H.crecording.F().filename());
+                affected_sources.unique();
+                for ( auto &fname : affected_sources ) {
+                        if ( access( (fname + ".orig").c_str(), F_OK) == -1 ) {
+                                ; // good
+                        } else {
+                                if ( GTK_RESPONSE_NO ==
+                                     pop_question(
+                                             wSF,
+                                             "<b>You have already run ICA on these channels</b>",
+                                             "A backup file <i>\"%s.orig\"</i> exists, and\n"
+                                             "will be overwritten if you proceed now.\n\n"
+                                             "Sure you want to do it again?",
+                                             fname.c_str()) )
+                                        return 1;
+                        }
+                }
+        }
+
+        vector<TICASetupFun> src;
+        size_t        checking_sr = 0,
+                checking_total_samples = (size_t)-1;
+        for ( auto &H : channels ) {
+                size_t        this_sr = H.crecording.F().samplerate(H.h()),
+                        this_ts = H.crecording.total_samples();
+                if ( checking_sr and this_sr != checking_sr ) {
+                        pop_ok_message(
+                                wSF,
+                                "<b>Variable sample rates not supported</b>",
+                                "Sorry, ICA cannot yet be performed on channels with different sample rates.");
+                        return 1;
+                } else
+                        checking_sr = this_sr;
+                if ( checking_total_samples != (size_t)-1 and checking_total_samples != this_ts ) {
+                        pop_ok_message( wSF,
+                                        "Unequal channel sizes",
+                                        "This is something that's never supposed to happen.");
+                        return 1;
+                } else
+                        checking_total_samples = this_ts;
+
+                src.emplace_back(
+                        bind (&sigfile::CSource::get_signal_original, &H.crecording.F(), H.h()));
+        }
+        ica = new ica::CFastICA (src, channels.front().crecording.total_samples());
 
       // initialize
-	// has no independent default
-	gtk_spin_button_set_value( eSFICANofICs, channels.size());
-	gtk_adjustment_set_upper( jSFICANofICs, channels.size());
-	gtk_spin_button_set_value( eSFICAEigVecFirst, 1);
-	gtk_spin_button_set_value( eSFICAEigVecLast, channels.size());
-
-	g_signal_emit_by_name( eSFICAApproach,		"changed");
-	g_signal_emit_by_name( eSFICANonlinearity,	"changed");
-	g_signal_emit_by_name( eSFICAFineTune,		"toggled");
-	g_signal_emit_by_name( eSFICAStabilizationMode,	"toggled");
-	g_signal_emit_by_name( eSFICAa1,		"value-changed");
-	g_signal_emit_by_name( eSFICAa2,		"value-changed");
-	g_signal_emit_by_name( eSFICAmu,		"value-changed");
-	g_signal_emit_by_name( eSFICAepsilon,		"value-changed");
-	g_signal_emit_by_name( eSFICASampleSizePercent,	"value-changed");
-	g_signal_emit_by_name( eSFICAMaxIterations,	"value-changed");
-	g_signal_emit_by_name( eSFICARemixMode,		"changed");
-
-	// populate mSFICAPage
-	gtk_container_foreach( (GtkContainer*)iiSFICAPage, (GtkCallback)gtk_widget_destroy, NULL);
-	GSList *group = nullptr;
-	for ( auto &H : channels ) {
-		auto item = (GtkWidget*)gtk_radio_menu_item_new_with_label( group, H.name());
-		group = gtk_radio_menu_item_get_group( (GtkRadioMenuItem*)item);
-		g_object_set( (GObject*)item,
-			      "visible", TRUE,
-			      NULL);
-		g_signal_connect( (GObject*)item,
-				  "activate", (GCallback)iSFICAPageMapIC_activate_cb,
-				  this);
-		gtk_container_add( (GtkContainer*)iiSFICAPage, item);
-	}
-	GtkWidget *another;
-	// add separator and a "(clean)" item
-	gtk_container_add( (GtkContainer*)iiSFICAPage,
-			   another = gtk_separator_menu_item_new());
-	g_object_set( (GObject*)another, "visible", TRUE, NULL);
-
-	gtk_container_add( (GtkContainer*)iiSFICAPage,
-			   another = gtk_radio_menu_item_new_with_label( group, ica_unmapped_menu_item_label));
-	g_object_set( (GObject*)another, "visible", TRUE, NULL);
-	g_signal_connect( (GObject*)another,
-			  "activate", (GCallback)iSFICAPageMapIC_activate_cb,
-			  this);
-
-	suppress_redraw = true;
-	gtk_toggle_button_set_active( bSFICAPreview, FALSE);
-	suppress_redraw = false;
-
-	return 0;
+        // has no independent default
+        gtk_spin_button_set_value( eSFICANofICs, channels.size());
+        gtk_adjustment_set_upper( jSFICANofICs, channels.size());
+        gtk_spin_button_set_value( eSFICAEigVecFirst, 1);
+        gtk_spin_button_set_value( eSFICAEigVecLast, channels.size());
+
+        g_signal_emit_by_name( eSFICAApproach,                "changed");
+        g_signal_emit_by_name( eSFICANonlinearity,        "changed");
+        g_signal_emit_by_name( eSFICAFineTune,                "toggled");
+        g_signal_emit_by_name( eSFICAStabilizationMode,        "toggled");
+        g_signal_emit_by_name( eSFICAa1,                "value-changed");
+        g_signal_emit_by_name( eSFICAa2,                "value-changed");
+        g_signal_emit_by_name( eSFICAmu,                "value-changed");
+        g_signal_emit_by_name( eSFICAepsilon,                "value-changed");
+        g_signal_emit_by_name( eSFICASampleSizePercent,        "value-changed");
+        g_signal_emit_by_name( eSFICAMaxIterations,        "value-changed");
+        g_signal_emit_by_name( eSFICARemixMode,                "changed");
+
+        // populate mSFICAPage
+        gtk_container_foreach( (GtkContainer*)iiSFICAPage, (GtkCallback)gtk_widget_destroy, NULL);
+        GSList *group = nullptr;
+        for ( auto &H : channels ) {
+                auto item = (GtkWidget*)gtk_radio_menu_item_new_with_label( group, H.name());
+                group = gtk_radio_menu_item_get_group( (GtkRadioMenuItem*)item);
+                g_object_set( (GObject*)item,
+                              "visible", TRUE,
+                              NULL);
+                g_signal_connect( (GObject*)item,
+                                  "activate", (GCallback)iSFICAPageMapIC_activate_cb,
+                                  this);
+                gtk_container_add( (GtkContainer*)iiSFICAPage, item);
+        }
+        GtkWidget *another;
+        // add separator and a "(clean)" item
+        gtk_container_add( (GtkContainer*)iiSFICAPage,
+                           another = gtk_separator_menu_item_new());
+        g_object_set( (GObject*)another, "visible", TRUE, NULL);
+
+        gtk_container_add( (GtkContainer*)iiSFICAPage,
+                           another = gtk_radio_menu_item_new_with_label( group, ica_unmapped_menu_item_label));
+        g_object_set( (GObject*)another, "visible", TRUE, NULL);
+        g_signal_connect( (GObject*)another,
+                          "activate", (GCallback)iSFICAPageMapIC_activate_cb,
+                          this);
+
+        suppress_redraw = true;
+        gtk_toggle_button_set_active( bSFICAPreview, FALSE);
+        suppress_redraw = false;
+
+        return 0;
 }
 
 
@@ -139,19 +139,19 @@ int
 SScoringFacility::
 run_ica()
 {
-	if ( ica == nullptr )
-		return 1;
+        if ( ica == nullptr )
+                return 1;
 
-	SBusyBlock bb (wSF);
+        SBusyBlock bb (wSF);
 
-	ica_components = itpp::mat (0, 0); // free up couple of hundred megs
-	ica->obj() . separate();
-	ica_components = ica->obj() . get_independent_components();
+        ica_components = itpp::mat (0, 0); // free up couple of hundred megs
+        ica->obj() . separate();
+        ica_components = ica->obj() . get_independent_components();
 
-	ica_map.clear();
-	ica_map.resize(ica_components.rows(), {-1});
+        ica_map.clear();
+        ica_map.resize(ica_components.rows(), {-1});
 
-	return 0;
+        return 0;
 }
 
 
@@ -159,92 +159,92 @@ int
 SScoringFacility::
 remix_ics()
 {
-	if ( ica == nullptr )
-		return 1;
-
-	SBusyBlock bb (wSF);
-
-	switch ( remix_mode ) {
-	case TICARemixMode::map:
-	{
-		size_t r = 0;
-		for ( r = 0; r < ica_map.size(); ++r ) {
-			int map_to = ica_map[r].m;
-			if ( map_to != -1 )
-				channel_by_idx(map_to).signal_reconstituted =
-					itpp::to_va<TFloat, double>(
-						ica_components, r);
-		}
-	}
-	break;
-	case TICARemixMode::punch:
-	{
-		// get unmixing matrix
-		itpp::mat
-			mixmat = ica->obj() . get_separating_matrix(),
-			ximmat;
-		itpp::inv( mixmat, ximmat);
-
-		// reconstitute projections of good ICs
-		size_t r = ica_map.size();
-		while ( r-- )
-			if ( ica_map[r].m != -1 ) {
-				ica_components.del_row(r);
-				ximmat.del_col(r);
-			}
-		itpp::mat reconst = ximmat * ica_components;
-		r = 0;
-		for ( auto &H : channels ) {
-			H.signal_reconstituted.resize( H.signal_filtered.size());
-			H.signal_reconstituted = itpp::to_va<TFloat, double>( reconst, r++);
-		}
-	}
-	break;
-	case TICARemixMode::zero:
-	{
-		// get unmixing matrix
-		itpp::mat
-			mixmat = ica->obj() . get_separating_matrix(),
-			ximmat;
-		itpp::inv( mixmat, ximmat);
-
-		// reconstitute projections of good ICs
-		size_t r = 0;
-		for ( r = 0; r < ica_map.size(); ++r )
-			if ( ica_map[r].m != -1 ) {
-				for ( int c = 0; c < ica_components.cols(); ++c )
-					ica_components(r, c) = 0.;
-			}
-		itpp::mat reconst = ximmat * ica_components;
-		r = 0;
-		for ( auto &H : channels ) {
-			H.signal_reconstituted.resize( H.signal_filtered.size());
-			H.signal_reconstituted = itpp::to_va<TFloat, double>( reconst, r++);
-		}
-	}
-	break;
-	}
-
-	return 0;
+        if ( ica == nullptr )
+                return 1;
+
+        SBusyBlock bb (wSF);
+
+        switch ( remix_mode ) {
+        case TICARemixMode::map:
+        {
+                size_t r = 0;
+                for ( r = 0; r < ica_map.size(); ++r ) {
+                        int map_to = ica_map[r].m;
+                        if ( map_to != -1 )
+                                channel_by_idx(map_to).signal_reconstituted =
+                                        itpp::to_va<TFloat, double>(
+                                                ica_components, r);
+                }
+        }
+        break;
+        case TICARemixMode::punch:
+        {
+                // get unmixing matrix
+                itpp::mat
+                        mixmat = ica->obj() . get_separating_matrix(),
+                        ximmat;
+                itpp::inv( mixmat, ximmat);
+
+                // reconstitute projections of good ICs
+                size_t r = ica_map.size();
+                while ( r-- )
+                        if ( ica_map[r].m != -1 ) {
+                                ica_components.del_row(r);
+                                ximmat.del_col(r);
+                        }
+                itpp::mat reconst = ximmat * ica_components;
+                r = 0;
+                for ( auto &H : channels ) {
+                        H.signal_reconstituted.resize( H.signal_filtered.size());
+                        H.signal_reconstituted = itpp::to_va<TFloat, double>( reconst, r++);
+                }
+        }
+        break;
+        case TICARemixMode::zero:
+        {
+                // get unmixing matrix
+                itpp::mat
+                        mixmat = ica->obj() . get_separating_matrix(),
+                        ximmat;
+                itpp::inv( mixmat, ximmat);
+
+                // reconstitute projections of good ICs
+                size_t r = 0;
+                for ( r = 0; r < ica_map.size(); ++r )
+                        if ( ica_map[r].m != -1 ) {
+                                for ( int c = 0; c < ica_components.cols(); ++c )
+                                        ica_components(r, c) = 0.;
+                        }
+                itpp::mat reconst = ximmat * ica_components;
+                r = 0;
+                for ( auto &H : channels ) {
+                        H.signal_reconstituted.resize( H.signal_filtered.size());
+                        H.signal_reconstituted = itpp::to_va<TFloat, double>( reconst, r++);
+                }
+        }
+        break;
+        }
+
+        return 0;
 }
 
 int
 SScoringFacility::
 restore_ics()
 {
-	if ( ica == nullptr )
-		return 1;
-
-	switch ( remix_mode ) {
-	case TICARemixMode::map:
-	    break;
-	case TICARemixMode::zero:
-	case TICARemixMode::punch:
-		ica_components = ica->obj() . get_independent_components();
-	    break;
-	}
-
-	return 0;
+        if ( ica == nullptr )
+                return 1;
+
+        switch ( remix_mode ) {
+        case TICARemixMode::map:
+            break;
+        case TICARemixMode::zero:
+        case TICARemixMode::punch:
+                ica_components = ica->obj() . get_independent_components();
+            break;
+        }
+
+        return 0;
 }
 
 
@@ -254,44 +254,44 @@ int
 SScoringFacility::
 apply_remix( const bool do_backup)
 {
-	if ( ica == nullptr )
-		return 1;
-
-	delete ica;
-	ica = nullptr;
-
-	// move the original edf file aside
-	if ( do_backup ) {
-		list<string> affected_sources;
-		for ( auto &H : channels )
-			affected_sources.push_back( H.crecording.F().filename());
-		affected_sources.unique();
-		for ( auto &fname : affected_sources ) {
-			snprintf_buf( "cp -f '%s' '%s.orig'", fname.c_str(), fname.c_str());
-			if ( system(global::buf) )
-				fprintf( stderr, "SScoringFacility::apply_remix(): Command '%s' failed", global::buf);
-		}
-	}
-	// put signal
-	for ( auto &H : channels ) {
-		if ( not H.apply_reconstituted )
-			continue;
-		if ( H.signal_reconstituted.size() > 0 )
-			H.crecording.F().put_signal(
-				H.h(),
-				H.signal_reconstituted);
-		H.signal_reconstituted = valarray<TFloat> (0);
-		H.get_signal_original();
-		H.get_signal_filtered();
-		if ( H.schannel().type() ==  sigfile::SChannel::TType::eeg ) {
-			H.get_psd_course();
-			H.get_psd_in_bands();
-			H.get_mc_course();
-			H.get_spectrum();
-		}
-	}
-
-	return 0;
+        if ( ica == nullptr )
+                return 1;
+
+        delete ica;
+        ica = nullptr;
+
+        // move the original edf file aside
+        if ( do_backup ) {
+                list<string> affected_sources;
+                for ( auto &H : channels )
+                        affected_sources.push_back( H.crecording.F().filename());
+                affected_sources.unique();
+                for ( auto &fname : affected_sources ) {
+                        snprintf_buf( "cp -f '%s' '%s.orig'", fname.c_str(), fname.c_str());
+                        if ( system(global::buf) )
+                                fprintf( stderr, "SScoringFacility::apply_remix(): Command '%s' failed", global::buf);
+                }
+        }
+        // put signal
+        for ( auto &H : channels ) {
+                if ( not H.apply_reconstituted )
+                        continue;
+                if ( H.signal_reconstituted.size() > 0 )
+                        H.crecording.F().put_signal(
+                                H.h(),
+                                H.signal_reconstituted);
+                H.signal_reconstituted = valarray<TFloat> (0);
+                H.get_signal_original();
+                H.get_signal_filtered();
+                if ( H.schannel().type() ==  sigfile::SChannel::TType::eeg ) {
+                        H.get_psd_course();
+                        H.get_psd_in_bands();
+                        H.get_mc_course();
+                        H.get_spectrum();
+                }
+        }
+
+        return 0;
 }
 
 
@@ -302,25 +302,25 @@ __attribute__ ((pure))
 SScoringFacility::
 ic_near( const double y) const
 {
-	int nearest = INT_MAX, thisd;
-	int nearest_h = 0;
-	int gap = da_ht/ica_components.rows();
-	int thisy = gap/2;
-	for ( int h = 0; h < ica_components.rows(); ++h ) {
-		thisd = y - thisy;
-		if ( thisd < 0 ) {
-			if ( -thisd < nearest )
-				return h;
-			else
-				return nearest_h;
-		}
-		if ( thisd < nearest ) {
-			nearest = thisd;
-			nearest_h = h;
-		}
-		thisy += gap;
-	}
-	return nearest_h;
+        int nearest = INT_MAX, thisd;
+        int nearest_h = 0;
+        int gap = da_ht/ica_components.rows();
+        int thisy = gap/2;
+        for ( int h = 0; h < ica_components.rows(); ++h ) {
+                thisd = y - thisy;
+                if ( thisd < 0 ) {
+                        if ( -thisd < nearest )
+                                return h;
+                        else
+                                return nearest_h;
+                }
+                if ( thisd < nearest ) {
+                        nearest = thisd;
+                        nearest_h = h;
+                }
+                thisy += gap;
+        }
+        return nearest_h;
 }
 
 int
@@ -328,19 +328,19 @@ __attribute__ ((pure))
 SScoringFacility::
 ic_of( const SChannel* ch) const
 {
-	int h = 0;
-	for ( auto &H : channels ) {
-		if ( &H == ch )
-			return h;
-		++h;
-	}
-	throw out_of_range ("SScoringFacility::ic_of(): bad channel");
+        int h = 0;
+        for ( auto &H : channels ) {
+                if ( &H == ch )
+                        return h;
+                ++h;
+        }
+        throw out_of_range ("SScoringFacility::ic_of(): bad channel");
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/ica_cb.cc b/upstream/src/aghermann/ui/sf/ica_cb.cc
index 1824a46..1cece9a 100644
--- a/upstream/src/aghermann/ui/sf/ica_cb.cc
+++ b/upstream/src/aghermann/ui/sf/ica_cb.cc
@@ -22,158 +22,158 @@ extern "C" {
 
 void
 eSFICANonlinearity_changed_cb(
-	GtkComboBox* w,
-	const gpointer u)
+        GtkComboBox* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	static int vv[] = {
-		FICA_NONLIN_POW3,
-		FICA_NONLIN_TANH,
-		FICA_NONLIN_GAUSS,
-		FICA_NONLIN_SKEW
-	};
-	int select = gtk_combo_box_get_active( w);
-	SF.ica->obj().set_non_linearity( vv[select]);
-
-	gtk_widget_set_sensitive( (GtkWidget*)SF.eSFICAa1, vv[select] == FICA_NONLIN_TANH);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.eSFICAa2, vv[select] == FICA_NONLIN_GAUSS);
+        auto& SF = *(SScoringFacility*)u;
+        static int vv[] = {
+                FICA_NONLIN_POW3,
+                FICA_NONLIN_TANH,
+                FICA_NONLIN_GAUSS,
+                FICA_NONLIN_SKEW
+        };
+        int select = gtk_combo_box_get_active( w);
+        SF.ica->obj().set_non_linearity( vv[select]);
+
+        gtk_widget_set_sensitive( (GtkWidget*)SF.eSFICAa1, vv[select] == FICA_NONLIN_TANH);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.eSFICAa2, vv[select] == FICA_NONLIN_GAUSS);
 }
 
 void
 eSFICAApproach_changed_cb(
-	GtkComboBox* w,
-	const gpointer u)
+        GtkComboBox* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	static int vv[] = {
-		FICA_APPROACH_SYMM,
-		FICA_APPROACH_DEFL,
-	};
-	SF.ica->obj().set_approach( vv[gtk_combo_box_get_active( w)]);
+        auto& SF = *(SScoringFacility*)u;
+        static int vv[] = {
+                FICA_APPROACH_SYMM,
+                FICA_APPROACH_DEFL,
+        };
+        SF.ica->obj().set_approach( vv[gtk_combo_box_get_active( w)]);
 }
 
 void
 eSFICAFineTune_toggled_cb(
-	GtkCheckButton* w,
-	const gpointer u)
+        GtkCheckButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_fine_tune( (bool)gtk_toggle_button_get_active( (GtkToggleButton*)w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_fine_tune( (bool)gtk_toggle_button_get_active( (GtkToggleButton*)w));
 }
 
 void
 eSFICAStabilizationMode_toggled_cb(
-	GtkCheckButton* w,
-	const gpointer u)
+        GtkCheckButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_stabilization( (bool)gtk_toggle_button_get_active( (GtkToggleButton*)w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_stabilization( (bool)gtk_toggle_button_get_active( (GtkToggleButton*)w));
 }
 
 void
 eSFICAa1_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_a1( gtk_spin_button_get_value( w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_a1( gtk_spin_button_get_value( w));
 }
 
 void
 eSFICAa2_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_a2( gtk_spin_button_get_value( w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_a2( gtk_spin_button_get_value( w));
 }
 
 void
 eSFICAmu_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_mu( gtk_spin_button_get_value( w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_mu( gtk_spin_button_get_value( w));
 }
 
 void
 eSFICAepsilon_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_epsilon( gtk_spin_button_get_value( w));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_epsilon( gtk_spin_button_get_value( w));
 }
 
 void
 eSFICASampleSizePercent_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_sample_size( gtk_spin_button_get_value( w)/100);
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_sample_size( gtk_spin_button_get_value( w)/100);
 }
 
 void
 eSFICANofICs_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	int n = (int)roundf( gtk_spin_button_get_value( w));
-	SF.ica->obj().set_nrof_independent_components( n);
+        auto& SF = *(SScoringFacility*)u;
+        int n = (int)roundf( gtk_spin_button_get_value( w));
+        SF.ica->obj().set_nrof_independent_components( n);
 
-	gtk_adjustment_set_upper( SF.jSFICAEigVecFirst, n);
-	gtk_adjustment_set_upper( SF.jSFICAEigVecLast, n);
+        gtk_adjustment_set_upper( SF.jSFICAEigVecFirst, n);
+        gtk_adjustment_set_upper( SF.jSFICAEigVecLast, n);
 }
 
 void
 eSFICAEigVecFirst_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	int n = (int)roundf( gtk_spin_button_get_value( w));
-	SF.ica->obj().set_first_eig( n);
-	gtk_adjustment_set_lower( SF.jSFICAEigVecLast, n);
+        auto& SF = *(SScoringFacility*)u;
+        int n = (int)roundf( gtk_spin_button_get_value( w));
+        SF.ica->obj().set_first_eig( n);
+        gtk_adjustment_set_lower( SF.jSFICAEigVecLast, n);
 }
 
 void
 eSFICAEigVecLast_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	int n = (int)roundf( gtk_spin_button_get_value( w));
-	SF.ica->obj().set_last_eig( n);
-	gtk_adjustment_set_upper( SF.jSFICAEigVecFirst, n);
+        auto& SF = *(SScoringFacility*)u;
+        int n = (int)roundf( gtk_spin_button_get_value( w));
+        SF.ica->obj().set_last_eig( n);
+        gtk_adjustment_set_upper( SF.jSFICAEigVecFirst, n);
 }
 
 void
 eSFICAMaxIterations_value_changed_cb(
-	GtkSpinButton* w,
-	const gpointer u)
+        GtkSpinButton* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	SF.ica->obj().set_max_num_iterations( (int)roundf( gtk_spin_button_get_value( w)));
+        auto& SF = *(SScoringFacility*)u;
+        SF.ica->obj().set_max_num_iterations( (int)roundf( gtk_spin_button_get_value( w)));
 }
 
 void
 eSFICARemixMode_changed_cb(
-	GtkComboBox* w,
-	const gpointer u)
+        GtkComboBox* w,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	static SScoringFacility::TICARemixMode vv[] = {
-		SScoringFacility::TICARemixMode::punch,
-		SScoringFacility::TICARemixMode::map,
-		SScoringFacility::TICARemixMode::zero,
-	};
-	SF.remix_mode = vv[gtk_combo_box_get_active( w)];
-	SF.ica_map.assign( SF.ica_map.size(), SScoringFacility::SICMapOptions {-1});
-
-	SF.queue_redraw_all();
+        auto& SF = *(SScoringFacility*)u;
+        static SScoringFacility::TICARemixMode vv[] = {
+                SScoringFacility::TICARemixMode::punch,
+                SScoringFacility::TICARemixMode::map,
+                SScoringFacility::TICARemixMode::zero,
+        };
+        SF.remix_mode = vv[gtk_combo_box_get_active( w)];
+        SF.ica_map.assign( SF.ica_map.size(), SScoringFacility::SICMapOptions {-1});
+
+        SF.queue_redraw_all();
 }
 
 
@@ -181,132 +181,132 @@ eSFICARemixMode_changed_cb(
 
 void
 bSFICATry_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
+        GtkButton*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.mode = SScoringFacility::TMode::separating; // strictly to have draw_montage display a banner
+        SF.mode = SScoringFacility::TMode::separating; // strictly to have draw_montage display a banner
 
-	SF.queue_redraw_all();
-	SBusyBlock bb (SF.wSF);
+        SF.queue_redraw_all();
+        SBusyBlock bb (SF.wSF);
 
-	SF.run_ica();
+        SF.run_ica();
 
-	SF.mode = SScoringFacility::TMode::showing_ics;
-	gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, TRUE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, TRUE);
+        SF.mode = SScoringFacility::TMode::showing_ics;
+        gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, TRUE);
 
-	SF.queue_redraw_all();
+        SF.queue_redraw_all();
 }
 
 void
 bSFICAPreview_toggled_cb(
-	GtkToggleButton *button,
-	const gpointer userdata)
+        GtkToggleButton *button,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-
-	if ( gtk_toggle_button_get_active( button) ) {
-		SF.remix_ics();
-		SF.mode = SScoringFacility::TMode::showing_remixed;
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, TRUE);
-	} else {
-		SF.restore_ics();
-		SF.mode = SScoringFacility::TMode::showing_ics;
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
-	}
-
-	SF.queue_redraw_all();
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+
+        if ( gtk_toggle_button_get_active( button) ) {
+                SF.remix_ics();
+                SF.mode = SScoringFacility::TMode::showing_remixed;
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, FALSE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, TRUE);
+        } else {
+                SF.restore_ics();
+                SF.mode = SScoringFacility::TMode::showing_ics;
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
+        }
+
+        SF.queue_redraw_all();
 }
 
 namespace {
 void
 mat2text_buffer( GtkTextBuffer *buffer, const itpp::mat& mx)
 {
-	gtk_text_buffer_set_text( buffer, "", -1);
-	for ( int r = 0; r < mx.rows(); ++r ) {
-		for ( int c = 0; c < mx.cols(); ++c )
-			gtk_text_buffer_insert_at_cursor(
-				buffer,
-				snprintf_buf( "\t% #6.3f", mx(r, c)),
-				-1);
-		if ( r + 1 < mx.rows() )
-			gtk_text_buffer_insert_at_cursor( buffer, "\n", -1);
-	}
+        gtk_text_buffer_set_text( buffer, "", -1);
+        for ( int r = 0; r < mx.rows(); ++r ) {
+                for ( int c = 0; c < mx.cols(); ++c )
+                        gtk_text_buffer_insert_at_cursor(
+                                buffer,
+                                snprintf_buf( "\t% #6.3f", mx(r, c)),
+                                -1);
+                if ( r + 1 < mx.rows() )
+                        gtk_text_buffer_insert_at_cursor( buffer, "\n", -1);
+        }
 }
 
 } // namespace
 void
 bSFICAShowMatrix_toggled_cb(
-	GtkToggleButton *button,
-	const gpointer userdata)
+        GtkToggleButton *button,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	mat2text_buffer(
-		gtk_text_view_get_buffer( SF.tSFICAMatrix),
-		SF.ica->obj().get_separating_matrix());
+        mat2text_buffer(
+                gtk_text_view_get_buffer( SF.tSFICAMatrix),
+                SF.ica->obj().get_separating_matrix());
 
-	if ( gtk_toggle_button_get_active( button) )
-		gtk_widget_show_all( (GtkWidget*)SF.wSFICAMatrix);
-	else
-		gtk_widget_hide( (GtkWidget*)SF.wSFICAMatrix);
+        if ( gtk_toggle_button_get_active( button) )
+                gtk_widget_show_all( (GtkWidget*)SF.wSFICAMatrix);
+        else
+                gtk_widget_hide( (GtkWidget*)SF.wSFICAMatrix);
 }
 
 void
 wSFICAMatrix_hide_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	gtk_toggle_button_set_active( SF.bSFICAShowMatrix, FALSE);
+        auto& SF = *(SScoringFacility*)userdata;
+        gtk_toggle_button_set_active( SF.bSFICAShowMatrix, FALSE);
 }
 
 
 void
 bSFICAApply_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.apply_remix( true);
+        SF.apply_remix( true);
 
-	SF.mode = SScoringFacility::TMode::scoring;
-	gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
-	SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
+        SF.mode = SScoringFacility::TMode::scoring;
+        gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
+        SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
 
-	SF.queue_redraw_all();
+        SF.queue_redraw_all();
 }
 
 void
 bSFICACancel_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	// cleanup
-	delete SF.ica;
-	SF.ica = NULL;
-	SF.ica_components = itpp::mat (0, 0);
+        // cleanup
+        delete SF.ica;
+        SF.ica = NULL;
+        SF.ica_components = itpp::mat (0, 0);
 
-	SF.mode = SScoringFacility::TMode::scoring;
-	gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
-	SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
+        SF.mode = SScoringFacility::TMode::scoring;
+        gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
+        gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
+        SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
 
-	SF.queue_redraw_all();
+        SF.queue_redraw_all();
 }
 
 
@@ -316,7 +316,7 @@ bSFICACancel_clicked_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/mainmenu_cb.cc b/upstream/src/aghermann/ui/sf/mainmenu_cb.cc
index b03e63a..e948083 100644
--- a/upstream/src/aghermann/ui/sf/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/sf/mainmenu_cb.cc
@@ -21,147 +21,147 @@ extern "C" {
 
 void
 iSFMontageMenu_activate_cb(
-	const GtkMenuItem*,
-	gpointer userdata)
+        const GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.update_main_menu_items();
+        SF.update_main_menu_items();
 }
 
 
 
 void
 iSFMontageDrawOriginalSignal_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
 
-	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
 
-	for ( auto& H : SF.channels ) {
-		H.draw_original_signal = indeed;
-		if ( not H.draw_original_signal and not H.draw_filtered_signal )
-			H.draw_filtered_signal = true;
-	}
+        for ( auto& H : SF.channels ) {
+                H.draw_original_signal = indeed;
+                if ( not H.draw_original_signal and not H.draw_filtered_signal )
+                        H.draw_filtered_signal = true;
+        }
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 
-	SF.update_main_menu_items();
+        SF.update_main_menu_items();
 }
 
 
 void
 iSFMontageDrawProcessedSignal_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
 
-	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
 
-	for ( auto& H : SF.channels ) {
-		H.draw_filtered_signal = indeed;
-		if ( not H.draw_original_signal and not H.draw_filtered_signal )
-			H.draw_original_signal = true;
-	}
+        for ( auto& H : SF.channels ) {
+                H.draw_filtered_signal = indeed;
+                if ( not H.draw_original_signal and not H.draw_filtered_signal )
+                        H.draw_original_signal = true;
+        }
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 
-	SF.update_main_menu_items();
+        SF.update_main_menu_items();
 }
 
 
 void
 iSFMontageDrawFast_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
 
-	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
 
-	for ( auto& H : SF.channels )
-		H.resample_signal = indeed;
+        for ( auto& H : SF.channels )
+                H.resample_signal = indeed;
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 
-	SF.update_main_menu_items();
+        SF.update_main_menu_items();
 }
 
 
 void
 iSFMontageDrawZeroLine_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
 
-	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
 
-	for ( auto& H : SF.channels )
-		H.draw_zeroline = indeed;
+        for ( auto& H : SF.channels )
+                H.draw_zeroline = indeed;
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 
-	SF.update_main_menu_items();
+        SF.update_main_menu_items();
 }
 
 
 
 void
 iSFMontagePatterns_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.patterns_d().setup_controls_for_find();
-	gtk_widget_show( (GtkWidget*)SF.patterns_d().wSFFD);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.patterns_d().setup_controls_for_find();
+        gtk_widget_show( (GtkWidget*)SF.patterns_d().wSFFD);
 }
 
 
 
 void
 iSFMontagePhaseDiff_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	gtk_widget_show( (GtkWidget*)SF.phasediff_d().wSFPD);
+        auto& SF = *(SScoringFacility*)userdata;
+        gtk_widget_show( (GtkWidget*)SF.phasediff_d().wSFPD);
 }
 
 
 void
 iSFMontageICA_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.setup_ica() == 0 ) {
-		SF.mode = SScoringFacility::TMode::showing_ics;
-		gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, TRUE);
-
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
-
-		gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, FALSE);
-		SF.set_tooltip( SScoringFacility::TTipIdx::ica_mode);
-		SF.queue_redraw_all();
-	} else
-		gdk_window_beep( gtk_widget_get_window( (GtkWidget*)SF.wSF));
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.setup_ica() == 0 ) {
+                SF.mode = SScoringFacility::TMode::showing_ics;
+                gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, FALSE);
+                gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, TRUE);
+
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, FALSE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, FALSE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
+
+                gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, FALSE);
+                gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, FALSE);
+                SF.set_tooltip( SScoringFacility::TTipIdx::ica_mode);
+                SF.queue_redraw_all();
+        } else
+                gdk_window_beep( gtk_widget_get_window( (GtkWidget*)SF.wSF));
 }
 
 
@@ -172,41 +172,41 @@ iSFMontageICA_activate_cb(
 
 void
 iSFMontageScoreAssist_activate_cb(
-	const GtkMenuItem*,
-	gpointer userdata)
+        const GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	
+        auto& SF = *(SScoringFacility*)userdata;
+        
 }
 
 void
 iSFMontageScoreImport_activate_cb(
-	const GtkMenuItem*,
-	gpointer userdata)
+        const GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_dialog_import_hypnogram();
+        SF.do_dialog_import_hypnogram();
 }
 
 void
 iSFMontageScoreExport_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	const auto& SF = *(SScoringFacility*)userdata;
+        const auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_dialog_export_hypnogram();
+        SF.do_dialog_export_hypnogram();
 }
 
 void
 iSFMontageScoreClear_activate_cb(
-	const GtkMenuItem*,
-	gpointer userdata)
+        const GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF.do_clear_hypnogram();
+        SF.do_clear_hypnogram();
 }
 
 
@@ -215,38 +215,38 @@ iSFMontageScoreClear_activate_cb(
 
 void
 iSFMontageClose_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF._p.close_this_SF_now = &SF;
-	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
+        SF._p.close_this_SF_now = &SF;
+        g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
 }
 
 
 void
 iSFMontageCloseAndNext_activate_cb(
-	const GtkMenuItem*,
-	const gpointer userdata)
+        const GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& ED = SF._p; // keep same parent
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& ED = SF._p; // keep same parent
 
-	ED.using_subject->create_cprofile();
-	gtk_widget_queue_draw( (GtkWidget*)ED.using_subject->da);
+        ED.using_subject->create_cprofile();
+        gtk_widget_queue_draw( (GtkWidget*)ED.using_subject->da);
 
-	SBusyBlock bb (SF.wSF);
-	// guaranteed to have next(E)
+        SBusyBlock bb (SF.wSF);
+        // guaranteed to have next(E)
 
-	SF._p.close_this_SF_now = &SF;
-	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
+        SF._p.close_this_SF_now = &SF;
+        g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
 
-	auto& J = SF.csubject();
-	new SScoringFacility(
-		J, SF.session().c_str(),
-		next( J.measurements[SF.session()].episode_iter_by_name(SF.sepisode().name())) -> name(),
-		ED); // ED records SScoringFacility::this alright
+        auto& J = SF.csubject();
+        new SScoringFacility(
+                J, SF.session().c_str(),
+                next( J.measurements[SF.session()].episode_iter_by_name(SF.sepisode().name())) -> name(),
+                ED); // ED records SScoringFacility::this alright
 }
 
 
@@ -258,20 +258,20 @@ namespace {
 
 size_t position_for_channel = -1;
 void channel_menu_position( GtkMenu*,
-			    gint *x,
-			    gint *y,
-			    gboolean*, //push_in,
-			    const gpointer userdata)
+                            gint *x,
+                            gint *y,
+                            gboolean*, //push_in,
+                            const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	int mwx, mwy, rwx, rwy;
-	gtk_window_get_position( SF.wSF, &mwx, &mwy);
-	gdk_window_get_position( gtk_widget_get_window( (GtkWidget*)SF.daSFMontage), &rwx, &rwy);
-	if ( position_for_channel < SF.channels.size() ) {
-		*x = mwx + rwx + EVENT_X;
-		*y = mwy + rwx + SF[position_for_channel].zeroy-20;
-	} else
-		*x = *y = 0;
+        auto& SF = *(SScoringFacility*)userdata;
+        int mwx, mwy, rwx, rwy;
+        gtk_window_get_position( SF.wSF, &mwx, &mwy);
+        gdk_window_get_position( gtk_widget_get_window( (GtkWidget*)SF.daSFMontage), &rwx, &rwy);
+        if ( position_for_channel < SF.channels.size() ) {
+                *x = mwx + rwx + EVENT_X;
+                *y = mwy + rwx + SF[position_for_channel].zeroy-20;
+        } else
+                *x = *y = 0;
 }
 
 }
@@ -279,36 +279,36 @@ void channel_menu_position( GtkMenu*,
 gboolean
 wSF_key_press_event_cb( GtkWidget*, const GdkEventKey *event, const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	if ( event->type == GDK_KEY_RELEASE or
-	     !(event->state & GDK_MOD1_MASK) )
-		return FALSE;
+        if ( event->type == GDK_KEY_RELEASE or
+             !(event->state & GDK_MOD1_MASK) )
+                return FALSE;
 
 #define KEKE(N) \
-	position_for_channel = N-1;					\
-	if ( position_for_channel < SF.channels.size() ) {		\
-		SF.using_channel = &SF[position_for_channel];		\
-		SF.using_channel->update_channel_menu_items( EVENT_X);	\
-		gtk_menu_popup( SF.iiSFPage, NULL, NULL, channel_menu_position, userdata, 3, event->time); \
-	} else								\
-		gdk_beep();						\
-	return TRUE;
-
-	switch ( event->keyval ) {
-	case GDK_KEY_1: KEKE(1);
-	case GDK_KEY_2: KEKE(2);
-	case GDK_KEY_3: KEKE(3);
-	case GDK_KEY_4: KEKE(4);
-	case GDK_KEY_5: KEKE(5);
-	case GDK_KEY_6: KEKE(6);
-	case GDK_KEY_7: KEKE(7);
-	case GDK_KEY_8: KEKE(8);
-	case GDK_KEY_9: KEKE(9);
-	case GDK_KEY_0: KEKE(10);
-	}
+        position_for_channel = N-1;                                        \
+        if ( position_for_channel < SF.channels.size() ) {                \
+                SF.using_channel = &SF[position_for_channel];                \
+                SF.using_channel->update_channel_menu_items( EVENT_X);        \
+                gtk_menu_popup( SF.iiSFPage, NULL, NULL, channel_menu_position, userdata, 3, event->time); \
+        } else                                                                \
+                gdk_beep();                                                \
+        return TRUE;
+
+        switch ( event->keyval ) {
+        case GDK_KEY_1: KEKE(1);
+        case GDK_KEY_2: KEKE(2);
+        case GDK_KEY_3: KEKE(3);
+        case GDK_KEY_4: KEKE(4);
+        case GDK_KEY_5: KEKE(5);
+        case GDK_KEY_6: KEKE(6);
+        case GDK_KEY_7: KEKE(7);
+        case GDK_KEY_8: KEKE(8);
+        case GDK_KEY_9: KEKE(9);
+        case GDK_KEY_0: KEKE(10);
+        }
 #undef KEKE
-	return FALSE;
+        return FALSE;
 }
 
 
@@ -316,7 +316,7 @@ wSF_key_press_event_cb( GtkWidget*, const GdkEventKey *event, const gpointer use
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/montage-overlays.cc b/upstream/src/aghermann/ui/sf/montage-overlays.cc
index 6f22670..efa1519 100644
--- a/upstream/src/aghermann/ui/sf/montage-overlays.cc
+++ b/upstream/src/aghermann/ui/sf/montage-overlays.cc
@@ -23,333 +23,333 @@ using namespace agh::ui;
 void
 SScoringFacility::SChannel::
 draw_overlays( cairo_t* cr,
-	       const int, const float zeroy) const
+               const int, const float zeroy) const
 {
-	if ( _p.mode != TMode::scoring )
-		return;
+        if ( _p.mode != TMode::scoring )
+                return;
 
-	float	pbot = zeroy + _p.interchannel_gap / 2.2,
-		ptop = zeroy - _p.interchannel_gap / 2.2;
-	bool	overlay = false;
+        float        pbot = zeroy + _p.interchannel_gap / 2.2,
+                ptop = zeroy - _p.interchannel_gap / 2.2;
+        bool        overlay = false;
 
        // PSD profile
-	if ( draw_psd and schannel().type() == sigfile::SChannel::TType::eeg ) {
-		overlay = true;
-
-		cairo_set_line_width( cr, 1.);
-		cairo_set_font_size( cr, 10);
-		guint i;
-
-		if ( draw_psd_bands ) {
-			for ( size_t b = metrics::TBand::delta; b <= psd.uppermost_band; ++b ) {
-				auto& P = psd.course_in_bands[b];
-				_p._p.CwB[SExpDesignUI::band2colour((metrics::TBand)b)].set_source_rgba( cr, .5);
-				double zero = 0.5 / P.size() * _p.da_wd;
-				cairo_move_to( cr, zero,
-					       - P[0] * psd.display_scale + pbot);
-				for ( i = 1; i < P.size(); ++i )
-					cairo_line_to( cr, ((double)i+0.5) / P.size() * _p.da_wd,
-						       - P[i] * psd.display_scale + pbot);
-				if ( b == psd.focused_band ) {
-					cairo_line_to( cr, _p.da_wd, pbot);
-					cairo_line_to( cr,     zero, pbot);
-					cairo_fill( cr);
-				}
-				cairo_stroke( cr);
-
-				if ( b == psd.focused_band ) {
-					cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-					snprintf_buf(
-						"%s %g–%g",
-						_p._p.ED->FreqBandNames[(unsigned)b],
-						_p._p.ED->freq_bands[(unsigned)b][0],
-						_p._p.ED->freq_bands[(unsigned)b][1]);
-				} else {
-					cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-					snprintf_buf( "%s", _p._p.ED->FreqBandNames[(unsigned)b]);
-				}
-				cairo_move_to( cr, _p.da_wd - 170,
-					       ptop + psd.uppermost_band*12 - 12*(unsigned)b + 12);
-				cairo_show_text( cr, global::buf);
-				cairo_stroke( cr);
-			}
-		} else {
-			_p._p.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
-			double zero = 0.5 / psd.course.size() * _p.da_wd;
-			cairo_move_to( cr, zero,
-				       psd.course[0]);
-			for ( i = 0; i < psd.course.size(); ++i )
-				cairo_line_to( cr, ((double)i+.5) / psd.course.size() * _p.da_wd,
-					       - psd.course[i] * psd.display_scale + pbot);
-			cairo_line_to( cr, _p.da_wd, pbot);
-			cairo_line_to( cr,     zero, pbot);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-
-			cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			cairo_move_to( cr, _p.da_wd - 170, pbot - 15);
-			cairo_show_text( cr, snprintf_buf( "%g–%g Hz", psd.from, psd.upto));
-			cairo_stroke( cr);
-		}
-
-	      // scale
-		{
-			cairo_set_source_rgb( cr, 0., 0., 0.);
-			cairo_set_line_width( cr, 1.5);
-			double dpuf =
-				agh::alg::sensible_scale_reduction_factor(
-					1e6 * psd.display_scale, _p.interchannel_gap/2);
-			int x = 30;
-			cairo_move_to( cr, x, pbot - 5);
-			cairo_rel_line_to( cr, 0, -dpuf * (1e6 * psd.display_scale));
-			cairo_stroke( cr);
-
-			cairo_set_font_size( cr, 9);
-			cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			cairo_move_to( cr, x + 5, pbot - 20);
-			cairo_show_text( cr, snprintf_buf( "%g uV2", dpuf));
-			cairo_stroke( cr);
-		}
-
-		if ( draw_spectrum and _p.pagesize_is_right()
-		     and _p.cur_page() < crecording.full_pages() ) {
-			guint	gx = 120,
-				gy = ptop + 25,
-				gh = min( 60.f, pbot - ptop - 5),
-				gw  = 80;
-			size_t	m;
-
-			cairo_set_source_rgba( cr, 1., 1., 1., .8);
-			cairo_rectangle( cr, gx-15, gy-5, gw+15+5, gh+5+5);
-			cairo_fill( cr);
-
-			// grid lines
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr, .1);
-			cairo_set_line_width( cr, .3);
-			for ( size_t i = 1; i < last_spectrum_bin; ++i ) {
-				cairo_move_to( cr, gx + (float)i/last_spectrum_bin * gw, gy);
-				cairo_rel_line_to( cr, 0, gh);
-			}
-			cairo_stroke( cr);
-
-			// spectrum
-			_p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr, .8);
-			cairo_set_line_width( cr, 2);
-			float factor = psd.display_scale / crecording.psd_profile.Pp.binsize;
-			cairo_move_to( cr,
-				       gx, gy + gh - (2 + spectrum[0] * factor));
-			for ( m = 1; m < last_spectrum_bin; ++m ) {
-				cairo_line_to( cr,
-					       gx + (float)m / last_spectrum_bin * gw,
-					       gy + gh - spectrum[m] * factor);
-			}
-			cairo_stroke( cr);
-
-			// axes
-			_p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr, .5);
-			cairo_set_line_width( cr, .5);
-			cairo_move_to( cr, gx, gy);
-			cairo_rel_line_to( cr, 0, gh);
-			cairo_rel_line_to( cr, gw, 0);
-
-			// y ticks
-			m = 0;
-			while ( (++m * 1e6) < gh / factor ) {
-				cairo_move_to( cr, gx-3,  gy + gh - (2 + (float)m*1e6 * factor));
-				cairo_rel_line_to( cr, 3, 0);
-			}
-			cairo_stroke( cr);
-
-			// labels
-			cairo_text_extents_t extents;
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
-			cairo_set_font_size( cr, 8);
-
-			snprintf_buf(
-				"%g Hz",
-				last_spectrum_bin * crecording.psd_profile.Pp.binsize);
-//				draw_spectrum_absolute ? 'A' : 'R');
-			cairo_text_extents( cr, global::buf, &extents);
-			cairo_move_to( cr,
-				       gx + gw - extents.width - 5,
-				       gy + 4);
-			cairo_show_text( cr, global::buf);
-			cairo_stroke( cr);
-		}
-	}
-
-	if ( draw_mc and schannel().type() == sigfile::SChannel::TType::eeg ) {
-		overlay = true;
-
-		cairo_set_line_width( cr, 1.);
-		cairo_set_font_size( cr, 10);
-		guint i;
-
-		_p._p.CwB[SExpDesignUI::TColour::sf_profile_mc].set_source_rgba( cr, .5);
-		double zero = 0.5 / mc.course.size() * _p.da_wd;
-		cairo_move_to( cr, zero,
-			       mc.course[0]);
-		for ( i = 0; i < mc.course.size(); ++i )
-			cairo_line_to( cr, ((double)i+.5) / mc.course.size() * _p.da_wd,
-				       - mc.course[i] * mc.display_scale + pbot);
-		cairo_line_to( cr, _p.da_wd, pbot);
-		cairo_line_to( cr,     zero, pbot);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-		cairo_move_to( cr, _p.da_wd - 70, pbot - 30);
-		cairo_show_text( cr, snprintf_buf( "f0:%g", mc.f0));
-		cairo_stroke( cr);
-
-	      // scale
-		{
-			cairo_set_source_rgb( cr, 0., 0., 0.);
-			cairo_set_line_width( cr, 1.5);
-			double dpuf =
-				agh::alg::sensible_scale_reduction_factor(
-					mc.display_scale, _p.interchannel_gap/2);
-			int x = 80;
-			cairo_move_to( cr, x, pbot - 5);
-			cairo_rel_line_to( cr, 0, -dpuf * mc.display_scale);
-			cairo_stroke( cr);
-
-			cairo_set_font_size( cr, 9);
-			//cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			cairo_move_to( cr, x + 5, pbot - 20);
-			cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
-			cairo_stroke( cr);
-		}
-
-	}
-
-	if ( draw_swu and schannel().type() == sigfile::SChannel::TType::eeg ) {
-		overlay = true;
-
-		cairo_set_line_width( cr, 1.);
-		cairo_set_font_size( cr, 10);
-		guint i;
-
-		_p._p.CwB[SExpDesignUI::TColour::sf_profile_swu].set_source_rgba( cr, .5);
-		double zero = 0.5 / swu.course.size() * _p.da_wd;
-		cairo_move_to( cr, zero,
-			       swu.course[0]);
-		for ( i = 0; i < swu.course.size(); ++i )
-			cairo_line_to( cr, ((double)i+.5) / swu.course.size() * _p.da_wd,
-				       - swu.course[i] * swu.display_scale + pbot);
-		cairo_line_to( cr, _p.da_wd, pbot);
-		cairo_line_to( cr,     zero, pbot);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-
-	      // scale
-		{
-			cairo_set_source_rgb( cr, 0., 0., 0.);
-			cairo_set_line_width( cr, 1.5);
-			double dpuf =
-				agh::alg::sensible_scale_reduction_factor(
-					swu.display_scale, _p.interchannel_gap/2);
-			int x = 140;
-			cairo_move_to( cr, x, pbot - 5);
-			cairo_rel_line_to( cr, 0, -dpuf * swu.display_scale);
-			cairo_stroke( cr);
-
-			cairo_set_font_size( cr, 9);
-			//cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			cairo_move_to( cr, x + 5, pbot - 20);
-			cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
-			cairo_stroke( cr);
-		}
-
-	}
+        if ( draw_psd and schannel().type() == sigfile::SChannel::TType::eeg ) {
+                overlay = true;
+
+                cairo_set_line_width( cr, 1.);
+                cairo_set_font_size( cr, 10);
+                guint i;
+
+                if ( draw_psd_bands ) {
+                        for ( size_t b = metrics::TBand::delta; b <= psd.uppermost_band; ++b ) {
+                                auto& P = psd.course_in_bands[b];
+                                _p._p.CwB[SExpDesignUI::band2colour((metrics::TBand)b)].set_source_rgba( cr, .5);
+                                double zero = 0.5 / P.size() * _p.da_wd;
+                                cairo_move_to( cr, zero,
+                                               - P[0] * psd.display_scale + pbot);
+                                for ( i = 1; i < P.size(); ++i )
+                                        cairo_line_to( cr, ((double)i+0.5) / P.size() * _p.da_wd,
+                                                       - P[i] * psd.display_scale + pbot);
+                                if ( b == psd.focused_band ) {
+                                        cairo_line_to( cr, _p.da_wd, pbot);
+                                        cairo_line_to( cr,     zero, pbot);
+                                        cairo_fill( cr);
+                                }
+                                cairo_stroke( cr);
+
+                                if ( b == psd.focused_band ) {
+                                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                                        snprintf_buf(
+                                                "%s %g–%g",
+                                                _p._p.ED->FreqBandNames[(unsigned)b],
+                                                _p._p.ED->freq_bands[(unsigned)b][0],
+                                                _p._p.ED->freq_bands[(unsigned)b][1]);
+                                } else {
+                                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+                                        snprintf_buf( "%s", _p._p.ED->FreqBandNames[(unsigned)b]);
+                                }
+                                cairo_move_to( cr, _p.da_wd - 170,
+                                               ptop + psd.uppermost_band*12 - 12*(unsigned)b + 12);
+                                cairo_show_text( cr, global::buf);
+                                cairo_stroke( cr);
+                        }
+                } else {
+                        _p._p.CwB[SExpDesignUI::TColour::sf_profile_psd].set_source_rgba( cr, .5);
+                        double zero = 0.5 / psd.course.size() * _p.da_wd;
+                        cairo_move_to( cr, zero,
+                                       psd.course[0]);
+                        for ( i = 0; i < psd.course.size(); ++i )
+                                cairo_line_to( cr, ((double)i+.5) / psd.course.size() * _p.da_wd,
+                                               - psd.course[i] * psd.display_scale + pbot);
+                        cairo_line_to( cr, _p.da_wd, pbot);
+                        cairo_line_to( cr,     zero, pbot);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+
+                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        cairo_move_to( cr, _p.da_wd - 170, pbot - 15);
+                        cairo_show_text( cr, snprintf_buf( "%g–%g Hz", psd.from, psd.upto));
+                        cairo_stroke( cr);
+                }
+
+              // scale
+                {
+                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                        cairo_set_line_width( cr, 1.5);
+                        double dpuf =
+                                agh::alg::sensible_scale_reduction_factor(
+                                        1e6 * psd.display_scale, _p.interchannel_gap/2);
+                        int x = 30;
+                        cairo_move_to( cr, x, pbot - 5);
+                        cairo_rel_line_to( cr, 0, -dpuf * (1e6 * psd.display_scale));
+                        cairo_stroke( cr);
+
+                        cairo_set_font_size( cr, 9);
+                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        cairo_move_to( cr, x + 5, pbot - 20);
+                        cairo_show_text( cr, snprintf_buf( "%g uV2", dpuf));
+                        cairo_stroke( cr);
+                }
+
+                if ( draw_spectrum and _p.pagesize_is_right()
+                     and _p.cur_page() < crecording.full_pages() ) {
+                        guint        gx = 120,
+                                gy = ptop + 25,
+                                gh = min( 60.f, pbot - ptop - 5),
+                                gw  = 80;
+                        size_t        m;
+
+                        cairo_set_source_rgba( cr, 1., 1., 1., .8);
+                        cairo_rectangle( cr, gx-15, gy-5, gw+15+5, gh+5+5);
+                        cairo_fill( cr);
+
+                        // grid lines
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr, .1);
+                        cairo_set_line_width( cr, .3);
+                        for ( size_t i = 1; i < last_spectrum_bin; ++i ) {
+                                cairo_move_to( cr, gx + (float)i/last_spectrum_bin * gw, gy);
+                                cairo_rel_line_to( cr, 0, gh);
+                        }
+                        cairo_stroke( cr);
+
+                        // spectrum
+                        _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr, .8);
+                        cairo_set_line_width( cr, 2);
+                        float factor = psd.display_scale / crecording.psd_profile.Pp.binsize;
+                        cairo_move_to( cr,
+                                       gx, gy + gh - (2 + spectrum[0] * factor));
+                        for ( m = 1; m < last_spectrum_bin; ++m ) {
+                                cairo_line_to( cr,
+                                               gx + (float)m / last_spectrum_bin * gw,
+                                               gy + gh - spectrum[m] * factor);
+                        }
+                        cairo_stroke( cr);
+
+                        // axes
+                        _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr, .5);
+                        cairo_set_line_width( cr, .5);
+                        cairo_move_to( cr, gx, gy);
+                        cairo_rel_line_to( cr, 0, gh);
+                        cairo_rel_line_to( cr, gw, 0);
+
+                        // y ticks
+                        m = 0;
+                        while ( (++m * 1e6) < gh / factor ) {
+                                cairo_move_to( cr, gx-3,  gy + gh - (2 + (float)m*1e6 * factor));
+                                cairo_rel_line_to( cr, 3, 0);
+                        }
+                        cairo_stroke( cr);
+
+                        // labels
+                        cairo_text_extents_t extents;
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
+                        cairo_set_font_size( cr, 8);
+
+                        snprintf_buf(
+                                "%g Hz",
+                                last_spectrum_bin * crecording.psd_profile.Pp.binsize);
+//                                draw_spectrum_absolute ? 'A' : 'R');
+                        cairo_text_extents( cr, global::buf, &extents);
+                        cairo_move_to( cr,
+                                       gx + gw - extents.width - 5,
+                                       gy + 4);
+                        cairo_show_text( cr, global::buf);
+                        cairo_stroke( cr);
+                }
+        }
+
+        if ( draw_mc and schannel().type() == sigfile::SChannel::TType::eeg ) {
+                overlay = true;
+
+                cairo_set_line_width( cr, 1.);
+                cairo_set_font_size( cr, 10);
+                guint i;
+
+                _p._p.CwB[SExpDesignUI::TColour::sf_profile_mc].set_source_rgba( cr, .5);
+                double zero = 0.5 / mc.course.size() * _p.da_wd;
+                cairo_move_to( cr, zero,
+                               mc.course[0]);
+                for ( i = 0; i < mc.course.size(); ++i )
+                        cairo_line_to( cr, ((double)i+.5) / mc.course.size() * _p.da_wd,
+                                       - mc.course[i] * mc.display_scale + pbot);
+                cairo_line_to( cr, _p.da_wd, pbot);
+                cairo_line_to( cr,     zero, pbot);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                cairo_move_to( cr, _p.da_wd - 70, pbot - 30);
+                cairo_show_text( cr, snprintf_buf( "f0:%g", mc.f0));
+                cairo_stroke( cr);
+
+              // scale
+                {
+                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                        cairo_set_line_width( cr, 1.5);
+                        double dpuf =
+                                agh::alg::sensible_scale_reduction_factor(
+                                        mc.display_scale, _p.interchannel_gap/2);
+                        int x = 80;
+                        cairo_move_to( cr, x, pbot - 5);
+                        cairo_rel_line_to( cr, 0, -dpuf * mc.display_scale);
+                        cairo_stroke( cr);
+
+                        cairo_set_font_size( cr, 9);
+                        //cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        cairo_move_to( cr, x + 5, pbot - 20);
+                        cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
+                        cairo_stroke( cr);
+                }
+
+        }
+
+        if ( draw_swu and schannel().type() == sigfile::SChannel::TType::eeg ) {
+                overlay = true;
+
+                cairo_set_line_width( cr, 1.);
+                cairo_set_font_size( cr, 10);
+                guint i;
+
+                _p._p.CwB[SExpDesignUI::TColour::sf_profile_swu].set_source_rgba( cr, .5);
+                double zero = 0.5 / swu.course.size() * _p.da_wd;
+                cairo_move_to( cr, zero,
+                               swu.course[0]);
+                for ( i = 0; i < swu.course.size(); ++i )
+                        cairo_line_to( cr, ((double)i+.5) / swu.course.size() * _p.da_wd,
+                                       - swu.course[i] * swu.display_scale + pbot);
+                cairo_line_to( cr, _p.da_wd, pbot);
+                cairo_line_to( cr,     zero, pbot);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+
+              // scale
+                {
+                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                        cairo_set_line_width( cr, 1.5);
+                        double dpuf =
+                                agh::alg::sensible_scale_reduction_factor(
+                                        swu.display_scale, _p.interchannel_gap/2);
+                        int x = 140;
+                        cairo_move_to( cr, x, pbot - 5);
+                        cairo_rel_line_to( cr, 0, -dpuf * swu.display_scale);
+                        cairo_stroke( cr);
+
+                        cairo_set_font_size( cr, 9);
+                        //cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        cairo_move_to( cr, x + 5, pbot - 20);
+                        cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
+                        cairo_stroke( cr);
+                }
+
+        }
 
       // phasic events
-	if ( draw_phasic_spindle ) {
-		_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].set_source_rgba( cr);
-		cairo_set_line_width( cr, 1);
-		for ( auto& A : annotations )
-			if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle ) {
-				auto x = (double)(A.span.z + A.span.a)/2 / samplerate()
-					/ ((double)_p.total_pages() * _p.pagesize());
-				cairo_move_to( cr, x * _p.da_wd - 2,  pbot - 8);
-				cairo_rel_line_to( cr,  2, -5);
-				cairo_rel_line_to( cr,  2,  5);
-				cairo_rel_line_to( cr, -2,  5);
-				cairo_rel_line_to( cr, -2, -5);
-				cairo_close_path( cr);
-				cairo_fill( cr);
-				cairo_stroke( cr);
-			}
-	}
-	if ( draw_phasic_Kcomplex ) {
-		_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].set_source_rgba( cr);
-		cairo_set_line_width( cr, 8);
-		for ( auto& A : annotations )
-			if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex ) {
-				auto x = (float)(A.span.z + A.span.a)/2 / samplerate()
-					/ ((float)_p.total_pages() * _p.pagesize());
-				cairo_move_to( cr, x * _p.da_wd - 1, pbot - ptop - 8);
-				cairo_rel_line_to( cr, 2, 0);
-				cairo_stroke( cr);
-			}
-	}
+        if ( draw_phasic_spindle ) {
+                _p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].set_source_rgba( cr);
+                cairo_set_line_width( cr, 1);
+                for ( auto& A : annotations )
+                        if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle ) {
+                                auto x = (double)(A.span.z + A.span.a)/2 / samplerate()
+                                        / ((double)_p.total_pages() * _p.pagesize());
+                                cairo_move_to( cr, x * _p.da_wd - 2,  pbot - 8);
+                                cairo_rel_line_to( cr,  2, -5);
+                                cairo_rel_line_to( cr,  2,  5);
+                                cairo_rel_line_to( cr, -2,  5);
+                                cairo_rel_line_to( cr, -2, -5);
+                                cairo_close_path( cr);
+                                cairo_fill( cr);
+                                cairo_stroke( cr);
+                        }
+        }
+        if ( draw_phasic_Kcomplex ) {
+                _p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].set_source_rgba( cr);
+                cairo_set_line_width( cr, 8);
+                for ( auto& A : annotations )
+                        if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex ) {
+                                auto x = (float)(A.span.z + A.span.a)/2 / samplerate()
+                                        / ((float)_p.total_pages() * _p.pagesize());
+                                cairo_move_to( cr, x * _p.da_wd - 1, pbot - ptop - 8);
+                                cairo_rel_line_to( cr, 2, 0);
+                                cairo_stroke( cr);
+                        }
+        }
 
       // EMG profile
-	if ( draw_emg and
-	     schannel().type() == sigfile::SChannel::TType::emg ) {
-		overlay = true;
-
-		cairo_pattern_t *cp = cairo_pattern_create_linear( 0., pbot-EMGProfileHeight, 0., pbot);
-		_p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, 0., 1.);
-		_p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, .5, 0.6);
-		_p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, 1., 1.);
-		cairo_set_source( cr, cp);
-
-		cairo_set_line_width( cr, .3);
-		cairo_draw_envelope(
-			cr,
-			raw_profile, 0, raw_profile.size(),
-			_p.da_wd, 0., pbot - EMGProfileHeight/2, signal_display_scale/2.); // half-signal scale, looks ok?
-		cairo_stroke( cr);
-		cairo_pattern_destroy( cp);
-	}
-
-	if ( overlay )
-		_p._draw_hour_ticks( cr, zeroy, pbot);
+        if ( draw_emg and
+             schannel().type() == sigfile::SChannel::TType::emg ) {
+                overlay = true;
+
+                cairo_pattern_t *cp = cairo_pattern_create_linear( 0., pbot-EMGProfileHeight, 0., pbot);
+                _p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, 0., 1.);
+                _p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, .5, 0.6);
+                _p._p.CwB[SExpDesignUI::TColour::sf_emg].pattern_add_color_stop_rgba( cp, 1., 1.);
+                cairo_set_source( cr, cp);
+
+                cairo_set_line_width( cr, .3);
+                cairo_draw_envelope(
+                        cr,
+                        raw_profile, 0, raw_profile.size(),
+                        _p.da_wd, 0., pbot - EMGProfileHeight/2, signal_display_scale/2.); // half-signal scale, looks ok?
+                cairo_stroke( cr);
+                cairo_pattern_destroy( cp);
+        }
+
+        if ( overlay )
+                _p._draw_hour_ticks( cr, zeroy, pbot);
 
       // crosshair (is drawn once in SScoringFacility::draw_montage), voltage at
-	if ( _p.draw_crosshair and
-	     _p.crosshair_at_time >= 0. and
-	     _p.crosshair_at_time * samplerate() < n_samples() ) {
-		cairo_set_font_size( cr, 10);
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-		_p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgb( cr);
-		if ( this == &_p.channels.front() )
-			snprintf_buf(
-				"%4.2f (%5.2fs)",
-				(draw_filtered_signal ? signal_filtered : signal_original)
-				[ (size_t)(_p.crosshair_at_time * samplerate()) ],
-				_p.crosshair_at_time - _p.cur_xvpage_start() - _p.skirting_run_per1 * _p.vpagesize());
-		else
-			snprintf_buf(
-				"%4.2f",
-				(draw_filtered_signal ? signal_filtered : signal_original)
-				[ (size_t)(_p.crosshair_at_time * samplerate()) ]);
-
-		cairo_move_to( cr, _p.crosshair_at+2, ptop + 22);
-		cairo_show_text( cr, global::buf);
-		cairo_stroke( cr);
-	}
+        if ( _p.draw_crosshair and
+             _p.crosshair_at_time >= 0. and
+             _p.crosshair_at_time * samplerate() < n_samples() ) {
+                cairo_set_font_size( cr, 10);
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                _p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgb( cr);
+                if ( this == &_p.channels.front() )
+                        snprintf_buf(
+                                "%4.2f (%5.2fs)",
+                                (draw_filtered_signal ? signal_filtered : signal_original)
+                                [ (size_t)(_p.crosshair_at_time * samplerate()) ],
+                                _p.crosshair_at_time - _p.cur_xvpage_start() - _p.skirting_run_per1 * _p.vpagesize());
+                else
+                        snprintf_buf(
+                                "%4.2f",
+                                (draw_filtered_signal ? signal_filtered : signal_original)
+                                [ (size_t)(_p.crosshair_at_time * samplerate()) ]);
+
+                cairo_move_to( cr, _p.crosshair_at+2, ptop + 22);
+                cairo_show_text( cr, global::buf);
+                cairo_stroke( cr);
+        }
 
       // samples per pixel
-	if ( resample_signal ) {
-		_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
-		cairo_set_font_size( cr, 8);
-		cairo_move_to( cr, _p.da_wd-40, ptop + 11);
-		cairo_show_text( cr, snprintf_buf( "%4.2f spp", spp()));
-		cairo_stroke( cr);
-	}
+        if ( resample_signal ) {
+                _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
+                cairo_set_font_size( cr, 8);
+                cairo_move_to( cr, _p.da_wd-40, ptop + 11);
+                cairo_show_text( cr, snprintf_buf( "%4.2f spp", spp()));
+                cairo_stroke( cr);
+        }
 }
 
 
@@ -360,39 +360,39 @@ draw_overlays( cairo_t* cr,
 void
 SScoringFacility::
 _draw_hour_ticks( cairo_t *cr,
-		  const int htop, const int hbot,
-		  const bool with_cursor)
+                  const int htop, const int hbot,
+                  const bool with_cursor)
 {
-	cairo_set_line_width( cr, 1);
-	cairo_set_font_size( cr, 10);
-	float	hours4 = (float)total_pages() * pagesize() / 3600 * 4;
-	for ( size_t i = 1; i < hours4; ++i ) {
-		guint tick_pos = (float)i / hours4 * da_wd;
-		_p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
-		cairo_move_to( cr, tick_pos, hbot);
-		cairo_rel_line_to( cr, 0, -((i%4 == 0) ? 20 : (i%2 == 0) ? 12 : 5));
-		if ( i % 4 == 0 ) {
-			_p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
-			cairo_move_to( cr, tick_pos+5, hbot - 2);
-			cairo_show_text( cr, snprintf_buf( "%2zuh", i/4));
-		}
-	}
-	cairo_stroke( cr);
-
-	if ( with_cursor ) {
-		_p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
-		cairo_rectangle( cr,
-				 (double)cur_vpage() / total_vpages() * da_wd, htop,
-				 max( .5, 1. / total_vpages() * da_wd), hbot - htop);
-		cairo_fill( cr);
-		cairo_stroke( cr);
-	}
+        cairo_set_line_width( cr, 1);
+        cairo_set_font_size( cr, 10);
+        float        hours4 = (float)total_pages() * pagesize() / 3600 * 4;
+        for ( size_t i = 1; i < hours4; ++i ) {
+                guint tick_pos = (float)i / hours4 * da_wd;
+                _p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
+                cairo_move_to( cr, tick_pos, hbot);
+                cairo_rel_line_to( cr, 0, -((i%4 == 0) ? 20 : (i%2 == 0) ? 12 : 5));
+                if ( i % 4 == 0 ) {
+                        _p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
+                        cairo_move_to( cr, tick_pos+5, hbot - 2);
+                        cairo_show_text( cr, snprintf_buf( "%2zuh", i/4));
+                }
+        }
+        cairo_stroke( cr);
+
+        if ( with_cursor ) {
+                _p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
+                cairo_rectangle( cr,
+                                 (double)cur_vpage() / total_vpages() * da_wd, htop,
+                                 max( .5, 1. / total_vpages() * da_wd), hbot - htop);
+                cairo_fill( cr);
+                cairo_stroke( cr);
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/montage.cc b/upstream/src/aghermann/ui/sf/montage.cc
index 492ca7b..bc452fc 100644
--- a/upstream/src/aghermann/ui/sf/montage.cc
+++ b/upstream/src/aghermann/ui/sf/montage.cc
@@ -23,7 +23,7 @@ using namespace agh::ui;
 namespace {
 
 unsigned short PageTicks[] = {
-	8, 10, 10, 5, 5, 6, 12, 24, 30
+        8, 10, 10, 5, 5, 6, 12, 24, 30
 };
 
 }
@@ -32,18 +32,18 @@ unsigned short PageTicks[] = {
 void
 SScoringFacility::SChannel::
 draw_signal( const valarray<TFloat>& signal,
-	     size_t width, int vdisp, cairo_t *cr) const
+             size_t width, int vdisp, cairo_t *cr) const
 {
-	ssize_t	start  = _p.cur_vpage_start()  * samplerate(), // signed please
-		end    = _p.cur_vpage_end()    * samplerate(),
-		run    = end - start,
-		half_pad = run * _p.skirting_run_per1;
-	cairo_draw_signal(
-		cr, signal,
-		start - half_pad,
-		end + half_pad,
-		width, 0, vdisp, signal_display_scale,
-		resample_signal ? max(1u, (unsigned)spp()) : 1);
+        ssize_t        start  = _p.cur_vpage_start()  * samplerate(), // signed please
+                end    = _p.cur_vpage_end()    * samplerate(),
+                run    = end - start,
+                half_pad = run * _p.skirting_run_per1;
+        cairo_draw_signal(
+                cr, signal,
+                start - half_pad,
+                end + half_pad,
+                width, 0, vdisp, signal_display_scale,
+                resample_signal ? max(1u, (unsigned)spp()) : 1);
 }
 
 
@@ -53,7 +53,7 @@ void
 SScoringFacility::
 estimate_montage_height()
 {
-	da_ht = channels.size() * interchannel_gap;
+        da_ht = channels.size() * interchannel_gap;
 }
 
 
@@ -61,12 +61,12 @@ estimate_montage_height()
 
 
 struct SChHolder {
-	SScoringFacility::SChannel* ch;
-	SChHolder( SScoringFacility::SChannel& ini) : ch (&ini) {}
-	bool operator<( const SChHolder& rv) const
-		{
-			return ch->zeroy < rv.ch->zeroy;
-		}
+        SScoringFacility::SChannel* ch;
+        SChHolder( SScoringFacility::SChannel& ini) : ch (&ini) {}
+        bool operator<( const SChHolder& rv) const
+                {
+                        return ch->zeroy < rv.ch->zeroy;
+                }
 };
 
 
@@ -75,28 +75,28 @@ sigfile::SAnnotation*
 SScoringFacility::
 interactively_choose_annotation() const
 {
-	// do some on-the-fly construcion
-	gtk_combo_box_set_model( eSFAnnotationSelectorWhich, NULL);
-	gtk_list_store_clear( mSFAnnotationsAtCursor);
-	GtkTreeIter iter;
-	for ( auto &A : over_annotations ) {
-		gtk_list_store_append( mSFAnnotationsAtCursor, &iter);
-		gtk_list_store_set( mSFAnnotationsAtCursor, &iter,
-				    0, A->label.c_str(),
-				    -1);
-	}
-	gtk_combo_box_set_model( eSFAnnotationSelectorWhich, (GtkTreeModel*)mSFAnnotationsAtCursor);
-
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( wSFAnnotationSelector) ) {
-		const char *selected_label = gtk_combo_box_get_active_id( eSFAnnotationSelectorWhich);
-		if ( selected_label == nullptr )
-			return nullptr;
-		for ( auto &A : over_annotations )
-			if ( A->label == selected_label )
-				return A;
-	}
-	return nullptr;
+        // do some on-the-fly construcion
+        gtk_combo_box_set_model( eSFAnnotationSelectorWhich, NULL);
+        gtk_list_store_clear( mSFAnnotationsAtCursor);
+        GtkTreeIter iter;
+        for ( auto &A : over_annotations ) {
+                gtk_list_store_append( mSFAnnotationsAtCursor, &iter);
+                gtk_list_store_set( mSFAnnotationsAtCursor, &iter,
+                                    0, A->label.c_str(),
+                                    -1);
+        }
+        gtk_combo_box_set_model( eSFAnnotationSelectorWhich, (GtkTreeModel*)mSFAnnotationsAtCursor);
+
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( wSFAnnotationSelector) ) {
+                const char *selected_label = gtk_combo_box_get_active_id( eSFAnnotationSelectorWhich);
+                if ( selected_label == nullptr )
+                        return nullptr;
+                for ( auto &A : over_annotations )
+                        if ( A->label == selected_label )
+                                return A;
+        }
+        return nullptr;
 }
 
 
@@ -107,54 +107,54 @@ int
 SScoringFacility::
 find_free_space()
 {
-	vector<SChHolder> thomas;
-	for ( SChannel& ch : channels )
-		if ( not ch.hidden )
-			thomas.push_back( {ch});
-	sort( thomas.begin(), thomas.end());
-
-	int	mean_gap,
-		widest_gap = 0,
-		widest_after = 0;
-	int sum = 0;
-	for ( auto ch = channels.begin(); ch != prev(channels.end()); ++ch ) {
-		int gap = next(ch)->zeroy - ch->zeroy;
-		sum += gap;
-		if ( gap > widest_gap ) {
-			widest_after = ch->zeroy;
-			widest_gap = gap;
-		}
-	}
-	mean_gap = sum / thomas.size()-1;
-	if ( widest_gap > mean_gap * 1.5 )
-		return widest_after + widest_gap / 2;
-	else {
-		gtk_widget_set_size_request( (GtkWidget*)daSFMontage,
-					     -1, thomas.back().ch->zeroy + 42*2);
-		return thomas.back().ch->zeroy + mean_gap;
-	}
+        vector<SChHolder> thomas;
+        for ( SChannel& ch : channels )
+                if ( not ch.hidden )
+                        thomas.push_back( {ch});
+        sort( thomas.begin(), thomas.end());
+
+        int        mean_gap,
+                widest_gap = 0,
+                widest_after = 0;
+        int sum = 0;
+        for ( auto ch = channels.begin(); ch != prev(channels.end()); ++ch ) {
+                int gap = next(ch)->zeroy - ch->zeroy;
+                sum += gap;
+                if ( gap > widest_gap ) {
+                        widest_after = ch->zeroy;
+                        widest_gap = gap;
+                }
+        }
+        mean_gap = sum / thomas.size()-1;
+        if ( widest_gap > mean_gap * 1.5 )
+                return widest_after + widest_gap / 2;
+        else {
+                gtk_widget_set_size_request( (GtkWidget*)daSFMontage,
+                                             -1, thomas.back().ch->zeroy + 42*2);
+                return thomas.back().ch->zeroy + mean_gap;
+        }
 }
 
 void
 SScoringFacility::
 space_evenly()
 {
-	vector<SChHolder> thomas;
-	for ( auto& H : channels )
-		if ( not H.hidden )
-			thomas.push_back( H);
-	if ( thomas.size() < 2 )
-		return;
-
-	interchannel_gap = da_ht / thomas.size();
-
-	sort( thomas.begin(), thomas.end());
-	size_t i = 0;
-	for ( auto& T : thomas )
-		T.ch->zeroy = interchannel_gap/2 + interchannel_gap * i++;
-
-	// gtk_widget_set_size_request( (GtkWidget*)daSFMontage,
-	// 			     -1, thomas.back().ch->zeroy + mean_gap/2);
+        vector<SChHolder> thomas;
+        for ( auto& H : channels )
+                if ( not H.hidden )
+                        thomas.push_back( H);
+        if ( thomas.size() < 2 )
+                return;
+
+        interchannel_gap = da_ht / thomas.size();
+
+        sort( thomas.begin(), thomas.end());
+        size_t i = 0;
+        for ( auto& T : thomas )
+                T.ch->zeroy = interchannel_gap/2 + interchannel_gap * i++;
+
+        // gtk_widget_set_size_request( (GtkWidget*)daSFMontage,
+        //                              -1, thomas.back().ch->zeroy + mean_gap/2);
 }
 
 
@@ -162,18 +162,18 @@ void
 SScoringFacility::
 expand_by_factor( const double fac)
 {
-	for ( auto &H : channels ) {
-		H.signal_display_scale *= fac;
-		H.psd.display_scale *= fac;
-		H.mc.display_scale *= fac;
-		H.zeroy *= fac;
-	}
-	interchannel_gap *= fac;
-	da_ht *= fac;
-
-	gtk_widget_set_size_request(
-		(GtkWidget*)daSFMontage,
-		-1, da_ht);
+        for ( auto &H : channels ) {
+                H.signal_display_scale *= fac;
+                H.psd.display_scale *= fac;
+                H.mc.display_scale *= fac;
+                H.zeroy *= fac;
+        }
+        interchannel_gap *= fac;
+        da_ht *= fac;
+
+        gtk_widget_set_size_request(
+                (GtkWidget*)daSFMontage,
+                -1, da_ht);
 }
 
 
@@ -186,26 +186,26 @@ expand_by_factor( const double fac)
 void
 SScoringFacility::SChannel::
 draw_for_montage( const string& fname,
-		  const int width, const int height) // to a file
+                  const int width, const int height) // to a file
 {
-	cairo_surface_t *cs = cairo_svg_surface_create( fname.c_str(), width, height);
-	cairo_t *cr = cairo_create( cs);
+        cairo_surface_t *cs = cairo_svg_surface_create( fname.c_str(), width, height);
+        cairo_t *cr = cairo_create( cs);
 
-	draw_page( cr, width, height/2, false); // or maybe *with* selection?
-	draw_overlays( cr, width, height/2);
+        draw_page( cr, width, height/2, false); // or maybe *with* selection?
+        draw_overlays( cr, width, height/2);
 
-	cairo_destroy( cr);
-	cairo_surface_destroy( cs);
+        cairo_destroy( cr);
+        cairo_surface_destroy( cs);
 }
 
 void
 SScoringFacility::SChannel::
 draw_for_montage( cairo_t* cr)
 {
-	if ( !hidden ) {
-		draw_page( cr, _p.da_wd, zeroy, true);
-		draw_overlays( cr, _p.da_wd, zeroy);
-	}
+        if ( !hidden ) {
+                draw_page( cr, _p.da_wd, zeroy, true);
+                draw_overlays( cr, _p.da_wd, zeroy);
+        }
 }
 
 
@@ -213,425 +213,425 @@ draw_for_montage( cairo_t* cr)
 void
 SScoringFacility::SChannel::
 draw_page( cairo_t *cr,
-	   const int wd, const float y0,
-	   bool draw_marquee) const
+           const int wd, const float y0,
+           bool draw_marquee) const
 {
-	int	ptop = y0 - _p.interchannel_gap/2,
-		pbot = ptop + _p.interchannel_gap;
+        int        ptop = y0 - _p.interchannel_gap/2,
+                pbot = ptop + _p.interchannel_gap;
 
       // zeroline
-	if ( draw_zeroline ) {
-		cairo_set_line_width( cr, fine_line());
-		_p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
-		cairo_move_to( cr, 0, y0);
-		cairo_rel_line_to( cr, wd, 0);
-		cairo_stroke( cr);
-	}
+        if ( draw_zeroline ) {
+                cairo_set_line_width( cr, fine_line());
+                _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
+                cairo_move_to( cr, 0, y0);
+                cairo_rel_line_to( cr, wd, 0);
+                cairo_stroke( cr);
+        }
 
       // marquee, goes first, not to obscure waveforms
-	if ( _p.mode != SScoringFacility::TMode::shuffling_channels
-	     and draw_marquee // possibly undesired (such as when drawing for unfazer (what unfazer?))
-	     && agh::alg::overlap(
-		     selection_start_time, selection_end_time,
-		     _p.cur_xvpage_start(), _p.cur_xvpage_end()) ) {
-
-		double	pre = _p.skirting_run_per1 * _p.vpagesize(),
-			ma = (selection_start_time - _p.cur_xvpage_start()) / _p.xvpagesize() * wd,
-			me = (selection_end_time   - _p.cur_xvpage_start()) / _p.xvpagesize() * wd;
-		{
-			cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
-			_p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, 0., .6);
-			_p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, .2, .3);
-			_p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, .8, .4);
-			_p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, 1., .6);
-			cairo_set_source( cr, cp);
-			cairo_rectangle( cr,
-					 ma, ptop, me - ma, _p.interchannel_gap);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-			cairo_pattern_destroy( cp);
-		}
-
-	      // start timestamp
-		cairo_set_font_size( cr, 10);
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-		_p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
-
-		cairo_text_extents_t extents;
-		snprintf_buf(
-			"%5.2fs",
-			selection_start_time - _p.cur_xvpage_start() - pre);
-		cairo_text_extents( cr, global::buf, &extents);
-		double ido = ma - 3 - extents.width;
-		if ( ido < extents.width+3 )
-			cairo_move_to( cr, ma+3, ptop + 30);
-		else
-			cairo_move_to( cr, ido, ptop + 12);
-		cairo_show_text( cr, global::buf);
-		cairo_stroke( cr);
-
-		if ( (draw_selection_envelope || draw_selection_course || draw_selection_dzcdf) &&
-		     selection_end_time - selection_start_time > .5 ) {
-		      // signal properties
-			const valarray<TFloat>
-				selection {(draw_filtered_signal
-					    ? signal_filtered
-					    : signal_original)[ slice (selection_start,
-								       selection_end - selection_start,
-								       1) ]};
-			if ( draw_selection_envelope ) {
-				valarray<TFloat>
-					env_u, env_l;
-				if ( sigproc::envelope(
-					     {selection, samplerate()},
-					     pattern_params.env_scope,
-					     1./samplerate(),
-					     &env_l, &env_u) > 2 ) {
-
-					cairo_set_source_rgba( cr, 1, 1, 1, .6);
-					cairo_set_line_width( cr, 1);
-					cairo_draw_signal(
-						cr, env_u, 0, env_u.size(),
-						me-ma, ma, y0, signal_display_scale);
-					cairo_draw_signal(
-						cr, env_l, 0, env_l.size(),
-						me-ma, ma, y0, signal_display_scale,
-						1,
-						TDrawSignalDirection::backward,
-						TDrawSignalPathOption::yes);
-					cairo_close_path( cr);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-				}
-			}
-			if ( draw_selection_course ) {
-				valarray<TFloat>
-					course
-						= exstrom::band_pass(
-							selection, samplerate(),
-							pattern_params.bwf_ffrom,
-							pattern_params.bwf_fupto,
-							pattern_params.bwf_order, true);
-
-				cairo_set_source_rgba( cr, 0.3, 0.3, 0.3, .5);
-				cairo_set_line_width( cr, 3.);
-				cairo_draw_signal(
-					cr, course, 0, course.size(),
-					me-ma, ma, y0, signal_display_scale);
-				cairo_stroke( cr);
-			}
-			if ( draw_selection_dzcdf ) {
-				if ( samplerate() > 10 &&
-				     pattern_params.dzcdf_step * 10 < selection_end_time - selection_start_time ) {
-					valarray<TFloat>
-						dzcdf = sigproc::dzcdf(
-							sigproc::SSignalRef<TFloat> {selection, samplerate()},
-							pattern_params.dzcdf_step,
-							pattern_params.dzcdf_sigma,
-							pattern_params.dzcdf_smooth);
-					float	dzcdf_display_scale = (pbot-ptop)/2. / dzcdf.max();
-
-					cairo_set_source_rgba( cr, 0.3, 0.3, 0.99, .8);
-					cairo_set_line_width( cr, 1.);
-					cairo_draw_signal(
-						cr, dzcdf, 0, dzcdf.size(),
-						me-ma, ma, y0, dzcdf_display_scale);
-					cairo_stroke( cr);
-				}
-			}
-		}
-
-	      // labels
-		if ( selection_end_time - selection_start_time > .25 ) {  // don't mark end if selection is too short
-			_p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
-			snprintf_buf(
-				"%5.2fs",
-				selection_end_time - _p.cur_xvpage_start() - pre);
-			cairo_text_extents( cr, global::buf, &extents);
-			ido = me + extents.width+3;
-			if ( ido > wd )
-				cairo_move_to( cr, me - 3 - extents.width, ptop + 30);
-			else
-				cairo_move_to( cr, me + 3, ptop + 12);
-			cairo_show_text( cr, global::buf);
-
-			snprintf_buf(
-				"< %4.2fs >", // "←%4.2fs→",
-				selection_end_time - selection_start_time);
-			cairo_text_extents( cr, global::buf, &extents);
-			cairo_move_to( cr, ma+(me-ma)/2 - extents.width/2,
-				       ptop + (extents.width < me-ma ? 12 : 30));
-			cairo_show_text( cr, global::buf);
-
-			// MC metrics
-			if ( schannel().type() == sigfile::SChannel::TType::eeg &&
-			     selection_end_time - selection_start_time > 2. ) {
-
-				cairo_set_font_size( cr, 10);
-				cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-				snprintf_buf(
-					"%4.2f (%3.1f / %3.1f)",
-					selection_SS / selection_SU, selection_SS, selection_SU);
-				cairo_text_extents( cr, global::buf, &extents);
-				cairo_move_to( cr, ma+(me-ma)/2 - extents.width/2,
-					       pbot - (extents.width < me-ma ? 12 : 30));
-				cairo_show_text( cr, global::buf);
-			}
-			cairo_stroke( cr);
-		}
-	}
+        if ( _p.mode != SScoringFacility::TMode::shuffling_channels
+             and draw_marquee // possibly undesired (such as when drawing for unfazer (what unfazer?))
+             && agh::alg::overlap(
+                     selection_start_time, selection_end_time,
+                     _p.cur_xvpage_start(), _p.cur_xvpage_end()) ) {
+
+                double        pre = _p.skirting_run_per1 * _p.vpagesize(),
+                        ma = (selection_start_time - _p.cur_xvpage_start()) / _p.xvpagesize() * wd,
+                        me = (selection_end_time   - _p.cur_xvpage_start()) / _p.xvpagesize() * wd;
+                {
+                        cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
+                        _p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, 0., .6);
+                        _p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, .2, .3);
+                        _p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, .8, .4);
+                        _p._p.CwB[SExpDesignUI::TColour::sf_selection].pattern_add_color_stop_rgba( cp, 1., .6);
+                        cairo_set_source( cr, cp);
+                        cairo_rectangle( cr,
+                                         ma, ptop, me - ma, _p.interchannel_gap);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+                        cairo_pattern_destroy( cp);
+                }
+
+              // start timestamp
+                cairo_set_font_size( cr, 10);
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+                _p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
+
+                cairo_text_extents_t extents;
+                snprintf_buf(
+                        "%5.2fs",
+                        selection_start_time - _p.cur_xvpage_start() - pre);
+                cairo_text_extents( cr, global::buf, &extents);
+                double ido = ma - 3 - extents.width;
+                if ( ido < extents.width+3 )
+                        cairo_move_to( cr, ma+3, ptop + 30);
+                else
+                        cairo_move_to( cr, ido, ptop + 12);
+                cairo_show_text( cr, global::buf);
+                cairo_stroke( cr);
+
+                if ( (draw_selection_envelope || draw_selection_course || draw_selection_dzcdf) &&
+                     selection_end_time - selection_start_time > .5 ) {
+                      // signal properties
+                        const valarray<TFloat>
+                                selection {(draw_filtered_signal
+                                            ? signal_filtered
+                                            : signal_original)[ slice (selection_start,
+                                                                       selection_end - selection_start,
+                                                                       1) ]};
+                        if ( draw_selection_envelope ) {
+                                valarray<TFloat>
+                                        env_u, env_l;
+                                if ( sigproc::envelope(
+                                             {selection, samplerate()},
+                                             pattern_params.env_scope,
+                                             1./samplerate(),
+                                             &env_l, &env_u) > 2 ) {
+
+                                        cairo_set_source_rgba( cr, 1, 1, 1, .6);
+                                        cairo_set_line_width( cr, 1);
+                                        cairo_draw_signal(
+                                                cr, env_u, 0, env_u.size(),
+                                                me-ma, ma, y0, signal_display_scale);
+                                        cairo_draw_signal(
+                                                cr, env_l, 0, env_l.size(),
+                                                me-ma, ma, y0, signal_display_scale,
+                                                1,
+                                                TDrawSignalDirection::backward,
+                                                TDrawSignalPathOption::yes);
+                                        cairo_close_path( cr);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                }
+                        }
+                        if ( draw_selection_course ) {
+                                valarray<TFloat>
+                                        course
+                                                = exstrom::band_pass(
+                                                        selection, samplerate(),
+                                                        pattern_params.bwf_ffrom,
+                                                        pattern_params.bwf_fupto,
+                                                        pattern_params.bwf_order, true);
+
+                                cairo_set_source_rgba( cr, 0.3, 0.3, 0.3, .5);
+                                cairo_set_line_width( cr, 3.);
+                                cairo_draw_signal(
+                                        cr, course, 0, course.size(),
+                                        me-ma, ma, y0, signal_display_scale);
+                                cairo_stroke( cr);
+                        }
+                        if ( draw_selection_dzcdf ) {
+                                if ( samplerate() > 10 &&
+                                     pattern_params.dzcdf_step * 10 < selection_end_time - selection_start_time ) {
+                                        valarray<TFloat>
+                                                dzcdf = sigproc::dzcdf(
+                                                        sigproc::SSignalRef<TFloat> {selection, samplerate()},
+                                                        pattern_params.dzcdf_step,
+                                                        pattern_params.dzcdf_sigma,
+                                                        pattern_params.dzcdf_smooth);
+                                        float        dzcdf_display_scale = (pbot-ptop)/2. / dzcdf.max();
+
+                                        cairo_set_source_rgba( cr, 0.3, 0.3, 0.99, .8);
+                                        cairo_set_line_width( cr, 1.);
+                                        cairo_draw_signal(
+                                                cr, dzcdf, 0, dzcdf.size(),
+                                                me-ma, ma, y0, dzcdf_display_scale);
+                                        cairo_stroke( cr);
+                                }
+                        }
+                }
+
+              // labels
+                if ( selection_end_time - selection_start_time > .25 ) {  // don't mark end if selection is too short
+                        _p._p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
+                        snprintf_buf(
+                                "%5.2fs",
+                                selection_end_time - _p.cur_xvpage_start() - pre);
+                        cairo_text_extents( cr, global::buf, &extents);
+                        ido = me + extents.width+3;
+                        if ( ido > wd )
+                                cairo_move_to( cr, me - 3 - extents.width, ptop + 30);
+                        else
+                                cairo_move_to( cr, me + 3, ptop + 12);
+                        cairo_show_text( cr, global::buf);
+
+                        snprintf_buf(
+                                "< %4.2fs >", // "←%4.2fs→",
+                                selection_end_time - selection_start_time);
+                        cairo_text_extents( cr, global::buf, &extents);
+                        cairo_move_to( cr, ma+(me-ma)/2 - extents.width/2,
+                                       ptop + (extents.width < me-ma ? 12 : 30));
+                        cairo_show_text( cr, global::buf);
+
+                        // MC metrics
+                        if ( schannel().type() == sigfile::SChannel::TType::eeg &&
+                             selection_end_time - selection_start_time > 2. ) {
+
+                                cairo_set_font_size( cr, 10);
+                                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                                snprintf_buf(
+                                        "%4.2f (%3.1f / %3.1f)",
+                                        selection_SS / selection_SU, selection_SS, selection_SU);
+                                cairo_text_extents( cr, global::buf, &extents);
+                                cairo_move_to( cr, ma+(me-ma)/2 - extents.width/2,
+                                               pbot - (extents.width < me-ma ? 12 : 30));
+                                cairo_show_text( cr, global::buf);
+                        }
+                        cairo_stroke( cr);
+                }
+        }
 
       // waveform: signal_filtered
-	bool	need_filtered = (have_low_pass() or have_high_pass() or have_notch_filter()) or (not artifacts().empty()),
-		one_signal_drawn = false;
-	if ( draw_filtered_signal and need_filtered ) {
-		cairo_set_line_width( cr, fine_line());
-		cairo_set_source_rgb( cr, 0., 0., 0.); // bg is uniformly light shades
-
-		draw_signal_filtered( wd, y0, cr);
-		cairo_stroke( cr);
-
-		if ( _p.mode == SScoringFacility::TMode::scoring ) {
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
-			cairo_move_to( cr, wd-88, y0 - 15);
-			cairo_set_font_size( cr, 10);
-			cairo_show_text( cr, "filt");
-			one_signal_drawn = true;
-			cairo_stroke( cr);
-		}
-	}
+        bool        need_filtered = (have_low_pass() or have_high_pass() or have_notch_filter()) or (not artifacts().empty()),
+                one_signal_drawn = false;
+        if ( draw_filtered_signal and need_filtered ) {
+                cairo_set_line_width( cr, fine_line());
+                cairo_set_source_rgb( cr, 0., 0., 0.); // bg is uniformly light shades
+
+                draw_signal_filtered( wd, y0, cr);
+                cairo_stroke( cr);
+
+                if ( _p.mode == SScoringFacility::TMode::scoring ) {
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
+                        cairo_move_to( cr, wd-88, y0 - 15);
+                        cairo_set_font_size( cr, 10);
+                        cairo_show_text( cr, "filt");
+                        one_signal_drawn = true;
+                        cairo_stroke( cr);
+                }
+        }
 
       // waveform: signal_original
-	if ( draw_original_signal or not one_signal_drawn ) {
-		if ( one_signal_drawn ) {  // attenuate the other signal
-			cairo_set_line_width( cr, fine_line() * .6);
-			cairo_set_source_rgba( cr, 0., 0.3, 0., .4);
-		} else {
-			cairo_set_line_width( cr, fine_line());
-			cairo_set_source_rgb( cr, 0., 0., 0.);
-		}
-		draw_signal_original( wd, y0, cr);
-		cairo_stroke( cr);
-
-		if ( _p.mode == SScoringFacility::TMode::scoring ) {
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
-			cairo_move_to( cr, wd-88, y0 - 25);
-			cairo_set_font_size( cr, 10);
-			cairo_show_text( cr, "orig");
-			cairo_stroke( cr);
-		}
-	}
+        if ( draw_original_signal or not one_signal_drawn ) {
+                if ( one_signal_drawn ) {  // attenuate the other signal
+                        cairo_set_line_width( cr, fine_line() * .6);
+                        cairo_set_source_rgba( cr, 0., 0.3, 0., .4);
+                } else {
+                        cairo_set_line_width( cr, fine_line());
+                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                }
+                draw_signal_original( wd, y0, cr);
+                cairo_stroke( cr);
+
+                if ( _p.mode == SScoringFacility::TMode::scoring ) {
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
+                        cairo_move_to( cr, wd-88, y0 - 25);
+                        cairo_set_font_size( cr, 10);
+                        cairo_show_text( cr, "orig");
+                        cairo_stroke( cr);
+                }
+        }
 
       // waveform: signal_reconstituted
-	if ( _p.mode == SScoringFacility::TMode::showing_remixed &&
-	     signal_reconstituted.size() != 0 ) {
-		if ( apply_reconstituted ) {
-			cairo_set_line_width( cr, fine_line() * 1.3);
-			cairo_set_source_rgba( cr, .7, 0., .6, 1); // red
-		} else {
-			cairo_set_line_width( cr, fine_line() * 1.3 * 2);
-			cairo_set_source_rgba( cr, 1., .2, 0., .4);
-		}
-
-		draw_signal_reconstituted( wd, y0, cr);
-		cairo_stroke( cr);
-
-		if ( apply_reconstituted ) {
-			cairo_move_to( cr, 120, y0 + 35);
-			cairo_set_source_rgba( cr, 1., 0., 0., .4);
-			cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-			cairo_set_font_size( cr, 28);
-			cairo_show_text( cr, "APPLY");
-			cairo_stroke( cr);
-		}
-	}
-
-	double	half_pad = _p.pagesize() * _p.skirting_run_per1;
-
-	double	cvpa = _p.cur_xvpage_start(),
-		cvpe = _p.cur_xvpage_end(),
-		evpz = cvpe - cvpa;
+        if ( _p.mode == SScoringFacility::TMode::showing_remixed &&
+             signal_reconstituted.size() != 0 ) {
+                if ( apply_reconstituted ) {
+                        cairo_set_line_width( cr, fine_line() * 1.3);
+                        cairo_set_source_rgba( cr, .7, 0., .6, 1); // red
+                } else {
+                        cairo_set_line_width( cr, fine_line() * 1.3 * 2);
+                        cairo_set_source_rgba( cr, 1., .2, 0., .4);
+                }
+
+                draw_signal_reconstituted( wd, y0, cr);
+                cairo_stroke( cr);
+
+                if ( apply_reconstituted ) {
+                        cairo_move_to( cr, 120, y0 + 35);
+                        cairo_set_source_rgba( cr, 1., 0., 0., .4);
+                        cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+                        cairo_set_font_size( cr, 28);
+                        cairo_show_text( cr, "APPLY");
+                        cairo_stroke( cr);
+                }
+        }
+
+        double        half_pad = _p.pagesize() * _p.skirting_run_per1;
+
+        double        cvpa = _p.cur_xvpage_start(),
+                cvpe = _p.cur_xvpage_end(),
+                evpz = cvpe - cvpa;
       // artifacts (changed bg)
-	{
-		auto& Aa = crecording.F().artifacts(crecording.h());
-		if ( not Aa.obj.empty() ) {
-			_p._p.CwB[SExpDesignUI::TColour::sf_artifact].set_source_rgba(
-				cr, .4); // do some gradients perhaps?
-			for ( auto &A : Aa() ) {
-				if ( agh::alg::overlap(
-					     A.a, A.z,
-					     cvpa, cvpe) ) {
-					double	aa = A.a - cvpa,
-						ae = A.z - cvpa;
-					if ( aa < 0.   ) aa = 0.;
-					if ( ae > evpz ) ae = evpz;
-					cairo_rectangle(
-						cr,
-						fmod(aa, evpz) / evpz * wd, ptop + _p.interchannel_gap * 1./3,
-						(ae - aa)      / evpz * wd,        _p.interchannel_gap * 1./3);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-				} else if ( A.a > cvpe )  // no more artifacts up to and on current page
-					break;
-			}
-			_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
-			cairo_move_to( cr, wd-70, y0 + 15);
-			cairo_set_font_size( cr, 8);
-			cairo_show_text( cr, snprintf_buf( "%4.2f %% dirty", percent_dirty));
-			cairo_stroke( cr);
-		}
-	}
+        {
+                auto& Aa = crecording.F().artifacts(crecording.h());
+                if ( not Aa.obj.empty() ) {
+                        _p._p.CwB[SExpDesignUI::TColour::sf_artifact].set_source_rgba(
+                                cr, .4); // do some gradients perhaps?
+                        for ( auto &A : Aa() ) {
+                                if ( agh::alg::overlap(
+                                             A.a, A.z,
+                                             cvpa, cvpe) ) {
+                                        double        aa = A.a - cvpa,
+                                                ae = A.z - cvpa;
+                                        if ( aa < 0.   ) aa = 0.;
+                                        if ( ae > evpz ) ae = evpz;
+                                        cairo_rectangle(
+                                                cr,
+                                                fmod(aa, evpz) / evpz * wd, ptop + _p.interchannel_gap * 1./3,
+                                                (ae - aa)      / evpz * wd,        _p.interchannel_gap * 1./3);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                } else if ( A.a > cvpe )  // no more artifacts up to and on current page
+                                        break;
+                        }
+                        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
+                        cairo_move_to( cr, wd-70, y0 + 15);
+                        cairo_set_font_size( cr, 8);
+                        cairo_show_text( cr, snprintf_buf( "%4.2f %% dirty", percent_dirty));
+                        cairo_stroke( cr);
+                }
+        }
 
       // annotations
-	if ( _p.mode == SScoringFacility::TMode::scoring
-	     and not annotations.empty() ) {
-		double last_label_end = 0;
-		int overlap_count = 0;
-
-		cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
-		cairo_set_font_size( cr, 11);
-		cairo_text_extents_t extents;
-
-		for ( auto &A : annotations ) {
-			if ( agh::alg::overlap( A.span.a, A.span.z, cvpa, cvpe) ) {
-				double	aa = A.span.a - cvpa,
-					ae = A.span.z - cvpa;
-				agh::alg::ensure_within( aa, -half_pad, -half_pad + evpz);
-				agh::alg::ensure_within( ae, -half_pad, -half_pad + evpz);
-
-				auto	wa = fmod(aa, evpz) / evpz * wd,
-					ww = (ae - aa) / evpz * wd;
-
-				if ( A.type == sigfile::SAnnotation::TType::plain ) {
-					cairo_text_extents( cr, A.label.c_str(), &extents);
-					int disp = ptop +
-						((last_label_end > wa)
-						 ? ++overlap_count * 12
-						 : (overlap_count = 0));
-					last_label_end = max( wa + extents.width + 3, last_label_end);
-
-					cairo_pattern_t *cp = cairo_pattern_create_linear( 0., disp, 0., pbot);
-					_p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, 0., 1.);
-					_p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, .1, 0.3);
-					_p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, 1., 0.);
-					cairo_set_source( cr, cp);
-
-					cairo_rectangle( cr, wa, disp, ww, pbot-ptop);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-					cairo_pattern_destroy( cp);
-
-					cairo_set_source_rgb( cr, 0., 0., 0.);
-					cairo_move_to( cr, fmod(aa, evpz) / evpz * wd, disp + 12);
-					cairo_show_text( cr, A.label.c_str());
-					cairo_stroke( cr);
-
-				} else if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle
-					    and draw_phasic_spindle ) {
-					cairo_pattern_t *cp = cairo_pattern_create_linear( wa, 0., wa + ww, 0.);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, 0., 0.);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, .5, 0.3);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, 1., 0.);
-					cairo_set_source( cr, cp);
-
-					cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-					cairo_pattern_destroy( cp);
-
-				} else if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex
-					    and draw_phasic_Kcomplex ) {
-					cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, 0., 0.);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, .5, 0.4);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, 1., 0.);
-					cairo_set_source( cr, cp);
-
-					cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-					cairo_pattern_destroy( cp);
-
-				} else if ( A.type == sigfile::SAnnotation::TType::eyeblink
-					    and draw_phasic_eyeblink ) {
-					cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, 0., 0.);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, .5, 0.4);
-					_p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, 1., 0.);
-					cairo_set_source( cr, cp);
-
-					cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
-					cairo_fill( cr);
-					cairo_stroke( cr);
-					cairo_pattern_destroy( cp);
-				}
-
-			} else if ( (int)A.span.a > cvpe )  // no more artifacts up to and on current page
-				break;
-		}
-	}
+        if ( _p.mode == SScoringFacility::TMode::scoring
+             and not annotations.empty() ) {
+                double last_label_end = 0;
+                int overlap_count = 0;
+
+                cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
+                cairo_set_font_size( cr, 11);
+                cairo_text_extents_t extents;
+
+                for ( auto &A : annotations ) {
+                        if ( agh::alg::overlap( A.span.a, A.span.z, cvpa, cvpe) ) {
+                                double        aa = A.span.a - cvpa,
+                                        ae = A.span.z - cvpa;
+                                agh::alg::ensure_within( aa, -half_pad, -half_pad + evpz);
+                                agh::alg::ensure_within( ae, -half_pad, -half_pad + evpz);
+
+                                auto        wa = fmod(aa, evpz) / evpz * wd,
+                                        ww = (ae - aa) / evpz * wd;
+
+                                if ( A.type == sigfile::SAnnotation::TType::plain ) {
+                                        cairo_text_extents( cr, A.label.c_str(), &extents);
+                                        int disp = ptop +
+                                                ((last_label_end > wa)
+                                                 ? ++overlap_count * 12
+                                                 : (overlap_count = 0));
+                                        last_label_end = max( wa + extents.width + 3, last_label_end);
+
+                                        cairo_pattern_t *cp = cairo_pattern_create_linear( 0., disp, 0., pbot);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, 0., 1.);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, .1, 0.3);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, 1., 0.);
+                                        cairo_set_source( cr, cp);
+
+                                        cairo_rectangle( cr, wa, disp, ww, pbot-ptop);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                        cairo_pattern_destroy( cp);
+
+                                        cairo_set_source_rgb( cr, 0., 0., 0.);
+                                        cairo_move_to( cr, fmod(aa, evpz) / evpz * wd, disp + 12);
+                                        cairo_show_text( cr, A.label.c_str());
+                                        cairo_stroke( cr);
+
+                                } else if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle
+                                            and draw_phasic_spindle ) {
+                                        cairo_pattern_t *cp = cairo_pattern_create_linear( wa, 0., wa + ww, 0.);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, 0., 0.);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, .5, 0.3);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, 1., 0.);
+                                        cairo_set_source( cr, cp);
+
+                                        cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                        cairo_pattern_destroy( cp);
+
+                                } else if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex
+                                            and draw_phasic_Kcomplex ) {
+                                        cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, 0., 0.);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, .5, 0.4);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, 1., 0.);
+                                        cairo_set_source( cr, cp);
+
+                                        cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                        cairo_pattern_destroy( cp);
+
+                                } else if ( A.type == sigfile::SAnnotation::TType::eyeblink
+                                            and draw_phasic_eyeblink ) {
+                                        cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, 0., 0.);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, .5, 0.4);
+                                        _p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, 1., 0.);
+                                        cairo_set_source( cr, cp);
+
+                                        cairo_rectangle( cr, wa, ptop, ww, pbot-ptop);
+                                        cairo_fill( cr);
+                                        cairo_stroke( cr);
+                                        cairo_pattern_destroy( cp);
+                                }
+
+                        } else if ( (int)A.span.a > cvpe )  // no more artifacts up to and on current page
+                                break;
+                }
+        }
 
       // labels of all kinds
       // channel id
-	{
-		int x = 15, y = y0 - 16;
+        {
+                int x = 15, y = y0 - 16;
 
-		snprintf_buf( "[%s] %s", schannel().type_s(), schannel().name());
-		cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
-		cairo_set_font_size( cr, 14);
+                snprintf_buf( "[%s] %s", schannel().type_s(), schannel().name());
+                cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
+                cairo_set_font_size( cr, 14);
 
-		cairo_set_source_rgba( cr, 1., 1., 1., 0.6);
-		cairo_move_to( cr, x+1, y+1);
-		cairo_show_text( cr, global::buf);
-		cairo_stroke( cr);
+                cairo_set_source_rgba( cr, 1., 1., 1., 0.6);
+                cairo_move_to( cr, x+1, y+1);
+                cairo_show_text( cr, global::buf);
+                cairo_stroke( cr);
 
-		cairo_set_source_rgba( cr, 0., 0., 0., 0.7);
-		cairo_move_to( cr, x, y);
-		cairo_show_text( cr, global::buf);
-		cairo_stroke( cr);
-	}
+                cairo_set_source_rgba( cr, 0., 0., 0., 0.7);
+                cairo_move_to( cr, x, y);
+                cairo_show_text( cr, global::buf);
+                cairo_stroke( cr);
+        }
 
-	_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
+        _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
 
        // uV scale
-	{
-		cairo_set_font_size( cr, 10);
-		cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-
-		cairo_set_source_rgb( cr, 0., 0., 0.);
-		cairo_set_line_width( cr, 1.5);
-		double dpuf =
-			alg::sensible_scale_reduction_factor(
-				1 * signal_display_scale, _p.interchannel_gap * .75);
-		int x = 10;
-		cairo_move_to( cr, x, ptop + 5);
-		cairo_rel_line_to( cr, 0, dpuf * signal_display_scale);
-		cairo_stroke( cr);
-
-		cairo_set_font_size( cr, 9);
-		cairo_move_to( cr, x + 5, ptop + 20);
-		cairo_show_text( cr, snprintf_buf( "%g mV", dpuf));
-		cairo_stroke( cr);
-	}
+        {
+                cairo_set_font_size( cr, 10);
+                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+
+                cairo_set_source_rgb( cr, 0., 0., 0.);
+                cairo_set_line_width( cr, 1.5);
+                double dpuf =
+                        alg::sensible_scale_reduction_factor(
+                                1 * signal_display_scale, _p.interchannel_gap * .75);
+                int x = 10;
+                cairo_move_to( cr, x, ptop + 5);
+                cairo_rel_line_to( cr, 0, dpuf * signal_display_scale);
+                cairo_stroke( cr);
+
+                cairo_set_font_size( cr, 9);
+                cairo_move_to( cr, x + 5, ptop + 20);
+                cairo_show_text( cr, snprintf_buf( "%g mV", dpuf));
+                cairo_stroke( cr);
+        }
 
        // applied filters legend
-	{
-		cairo_set_font_size( cr, 9);
-		if ( have_low_pass() ) {
-			cairo_move_to( cr, wd-100, y0 + 15);
-			cairo_show_text( cr, snprintf_buf( "LP: %6.2f/%u", filters.low_pass_cutoff, filters.low_pass_order));
-		}
-		if ( have_high_pass() ) {
-			cairo_move_to( cr, wd-100, y0 + 24);
-			cairo_show_text( cr, snprintf_buf( "HP: %6.2f/%u", filters.high_pass_cutoff, filters.high_pass_order));
-		}
-		if ( have_notch_filter() ) {
-			static const char *nfs[] = { "", "50 Hz", "60 Hz" };
-			cairo_move_to( cr, wd-100, y0 + 33);
-			cairo_show_text( cr, snprintf_buf( "-v-: %s", nfs[(int)filters.notch_filter]));
-		}
-		cairo_stroke( cr);
-	}
+        {
+                cairo_set_font_size( cr, 9);
+                if ( have_low_pass() ) {
+                        cairo_move_to( cr, wd-100, y0 + 15);
+                        cairo_show_text( cr, snprintf_buf( "LP: %6.2f/%u", filters.low_pass_cutoff, filters.low_pass_order));
+                }
+                if ( have_high_pass() ) {
+                        cairo_move_to( cr, wd-100, y0 + 24);
+                        cairo_show_text( cr, snprintf_buf( "HP: %6.2f/%u", filters.high_pass_cutoff, filters.high_pass_order));
+                }
+                if ( have_notch_filter() ) {
+                        static const char *nfs[] = { "", "50 Hz", "60 Hz" };
+                        cairo_move_to( cr, wd-100, y0 + 33);
+                        cairo_show_text( cr, snprintf_buf( "-v-: %s", nfs[(int)filters.notch_filter]));
+                }
+                cairo_stroke( cr);
+        }
 }
 
 
@@ -639,11 +639,11 @@ void
 SScoringFacility::
 draw_montage( const string& fname) // to a file
 {
-	cairo_surface_t *cs = cairo_svg_surface_create( fname.c_str(), da_wd, da_ht);
-	cairo_t *cr = cairo_create( cs);
-	draw_montage( cr);
-	cairo_destroy( cr);
-	cairo_surface_destroy( cs);
+        cairo_surface_t *cs = cairo_svg_surface_create( fname.c_str(), da_wd, da_ht);
+        cairo_t *cr = cairo_create( cs);
+        draw_montage( cr);
+        cairo_destroy( cr);
+        cairo_surface_destroy( cs);
 }
 
 
@@ -653,69 +653,69 @@ void
 SScoringFacility::
 _draw_matrix_to_montage( cairo_t *cr, const itpp::Mat<T>& mat)
 {
-	int gap = da_ht/mat.rows();
-	int our_y = gap/2;
+        int gap = da_ht/mat.rows();
+        int our_y = gap/2;
 
       // labels, per mode and mark
-	cairo_set_line_width( cr, 16);
-	cairo_set_source_rgba( cr, .7, .2, .1, .2);
-	for ( int r = 0; r < mat.rows(); ++r ) {
-		if ( ica_map[r].m == -1 )
-			switch ( remix_mode ) {
-			case TICARemixMode::map:
-				cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
-				cairo_set_font_size( cr, 20);
-				cairo_move_to( cr, 30, our_y-10);
-				cairo_set_source_rgba( cr, .2, .6, .2, .45);
-				cairo_show_text( cr, "(not mapped)");
-			    break;
-			default:
-			    break;
-			}
-		else
-			switch ( remix_mode ) {
-			case TICARemixMode::map:
-				cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-				cairo_set_font_size( cr, 28);
-				cairo_move_to( cr, 30, our_y-10);
-				cairo_set_source_rgba( cr, .3, .1, .2, .65);
-				cairo_show_text( cr, channel_by_idx(ica_map[r].m).name());
-			    break;
-			default:
-				cairo_move_to( cr, da_wd * .06, our_y - gap/2.5);
-				cairo_line_to( cr, da_wd * .94, our_y + gap/2.5);
-				cairo_move_to( cr, da_wd * .06, our_y + gap/2.5);
-				cairo_line_to( cr, da_wd * .94, our_y - gap/2.5);
-			    break;
-			}
-		cairo_stroke( cr);
-		our_y += gap;
-	}
+        cairo_set_line_width( cr, 16);
+        cairo_set_source_rgba( cr, .7, .2, .1, .2);
+        for ( int r = 0; r < mat.rows(); ++r ) {
+                if ( ica_map[r].m == -1 )
+                        switch ( remix_mode ) {
+                        case TICARemixMode::map:
+                                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
+                                cairo_set_font_size( cr, 20);
+                                cairo_move_to( cr, 30, our_y-10);
+                                cairo_set_source_rgba( cr, .2, .6, .2, .45);
+                                cairo_show_text( cr, "(not mapped)");
+                            break;
+                        default:
+                            break;
+                        }
+                else
+                        switch ( remix_mode ) {
+                        case TICARemixMode::map:
+                                cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+                                cairo_set_font_size( cr, 28);
+                                cairo_move_to( cr, 30, our_y-10);
+                                cairo_set_source_rgba( cr, .3, .1, .2, .65);
+                                cairo_show_text( cr, channel_by_idx(ica_map[r].m).name());
+                            break;
+                        default:
+                                cairo_move_to( cr, da_wd * .06, our_y - gap/2.5);
+                                cairo_line_to( cr, da_wd * .94, our_y + gap/2.5);
+                                cairo_move_to( cr, da_wd * .06, our_y + gap/2.5);
+                                cairo_line_to( cr, da_wd * .94, our_y - gap/2.5);
+                            break;
+                        }
+                cairo_stroke( cr);
+                our_y += gap;
+        }
 
       // waveform
-	auto sr = channels.front().samplerate();  // ica wouldn't start if samplerates were different between any two channels
-	auto our_display_scale = channels.front().signal_display_scale;
-
-	cairo_set_line_width( cr, .6);
-	our_y = gap/2;
-	for ( int r = 0; r < mat.rows(); ++r ) {
-		if ( ica_map[r].m != -1 )
-			cairo_set_source_rgba( cr, 0, 0, 0, .6);
-		else
-			cairo_set_source_rgba( cr, 0., 0., .3, 1.);
-		size_t  start = cur_vpage_start() * sr,
-			end   = cur_vpage_end()   * sr,
-			run   = end - start,
-			half_pad = run * skirting_run_per1;
-
-		cairo_draw_signal(
-			cr, mat, r,
-			start - half_pad,
-			end + half_pad,
-			da_wd, 0, our_y, our_display_scale);
-		cairo_stroke( cr);
-		our_y += gap;
-	}
+        auto sr = channels.front().samplerate();  // ica wouldn't start if samplerates were different between any two channels
+        auto our_display_scale = channels.front().signal_display_scale;
+
+        cairo_set_line_width( cr, .6);
+        our_y = gap/2;
+        for ( int r = 0; r < mat.rows(); ++r ) {
+                if ( ica_map[r].m != -1 )
+                        cairo_set_source_rgba( cr, 0, 0, 0, .6);
+                else
+                        cairo_set_source_rgba( cr, 0., 0., .3, 1.);
+                size_t  start = cur_vpage_start() * sr,
+                        end   = cur_vpage_end()   * sr,
+                        run   = end - start,
+                        half_pad = run * skirting_run_per1;
+
+                cairo_draw_signal(
+                        cr, mat, r,
+                        start - half_pad,
+                        end + half_pad,
+                        da_wd, 0, our_y, our_display_scale);
+                cairo_stroke( cr);
+                our_y += gap;
+        }
 }
 
 
@@ -723,142 +723,142 @@ void
 SScoringFacility::
 draw_montage( cairo_t* cr)
 {
-	double	true_frac = 1. - 1. / (1. + 2*skirting_run_per1),
-		half_pad = pagesize() * skirting_run_per1;
-	size_t	ef = da_wd * (1. - true_frac);  // w + 10% = d
-
-	using namespace sigfile;
-	switch ( mode ) {
-	case TMode::showing_ics:
-		if ( ica_components.size() == 0 ) {
-			cairo_put_banner(
-				cr, da_wd, da_ht,
-				"Now set up ICA parameters, then press [Compute ICs]");
-		} else
-			_draw_matrix_to_montage( cr, ica_components);
-			// draw ignoring channels' zeroy
-	    break;
-	case TMode::separating:
-		cairo_put_banner(
-			cr, da_wd, da_ht,
-			"Separating...");
-	    break;
-	case TMode::scoring:
+        double        true_frac = 1. - 1. / (1. + 2*skirting_run_per1),
+                half_pad = pagesize() * skirting_run_per1;
+        size_t        ef = da_wd * (1. - true_frac);  // w + 10% = d
+
+        using namespace sigfile;
+        switch ( mode ) {
+        case TMode::showing_ics:
+                if ( ica_components.size() == 0 ) {
+                        cairo_put_banner(
+                                cr, da_wd, da_ht,
+                                "Now set up ICA parameters, then press [Compute ICs]");
+                } else
+                        _draw_matrix_to_montage( cr, ica_components);
+                        // draw ignoring channels' zeroy
+            break;
+        case TMode::separating:
+                cairo_put_banner(
+                        cr, da_wd, da_ht,
+                        "Separating...");
+            break;
+        case TMode::scoring:
       // background, is now common to all channels
-	{
-		double	ppart = (double)pagesize()/vpagesize();
-		int	cp = cur_page();
-		for ( int pp = cp-1; ; ++pp ) {
-			double ppoff = ((double)pp * pagesize() - cur_vpage_start()) / vpagesize();
-			if ( ppoff > 1.5 )
-				break;
-
-			SPage::TScore this_page_score = (pp < 0) ? SPage::TScore::none : SPage::char2score( hypnogram[pp]);
-			_p.CwB[SExpDesignUI::score2colour(this_page_score)].set_source_rgba( cr, .2);
-			cairo_rectangle( cr, half_pad + ppoff * ef,
-					 0., ef * ppart, da_ht);
-			cairo_fill( cr);
-			cairo_stroke( cr);
-
-			cairo_set_font_size( cr, 30);
-			cairo_set_source_rgba( cr, 0., 0., 0., .1);
-			cairo_move_to( cr, half_pad + ppoff * ef + ppart/2, da_ht-10);
-			cairo_show_text( cr, SPage::score_name( this_page_score));
-			cairo_stroke( cr);
-		}
-	}
+        {
+                double        ppart = (double)pagesize()/vpagesize();
+                int        cp = cur_page();
+                for ( int pp = cp-1; ; ++pp ) {
+                        double ppoff = ((double)pp * pagesize() - cur_vpage_start()) / vpagesize();
+                        if ( ppoff > 1.5 )
+                                break;
+
+                        SPage::TScore this_page_score = (pp < 0) ? SPage::TScore::none : SPage::char2score( hypnogram[pp]);
+                        _p.CwB[SExpDesignUI::score2colour(this_page_score)].set_source_rgba( cr, .2);
+                        cairo_rectangle( cr, half_pad + ppoff * ef,
+                                         0., ef * ppart, da_ht);
+                        cairo_fill( cr);
+                        cairo_stroke( cr);
+
+                        cairo_set_font_size( cr, 30);
+                        cairo_set_source_rgba( cr, 0., 0., 0., .1);
+                        cairo_move_to( cr, half_pad + ppoff * ef + ppart/2, da_ht-10);
+                        cairo_show_text( cr, SPage::score_name( this_page_score));
+                        cairo_stroke( cr);
+                }
+        }
       // recording-wide annotations
-	if ( not common_annotations.empty() ) {
-		cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
-		cairo_set_font_size( cr, 10);
-		cairo_text_extents_t extents;
-
-		double last_label_end = 0.;
-		int overlap_count = 0;
-
-		double	cvpa = cur_xvpage_start(),
-			cvpe = cur_xvpage_end(),
-			evpz = cvpe - cvpa;
-
-		for ( auto &SA : common_annotations ) {
-			//auto &S = *SA.first;
-			auto &A = *SA.second;
-			if ( agh::alg::overlap( A.span.a, A.span.z, cvpa, cvpe) ) {
-				double	aa = A.span.a - cvpa,
-					ae = A.span.z - cvpa;
-				agh::alg::ensure_within( aa, -half_pad, -half_pad + evpz);
-				agh::alg::ensure_within( ae, -half_pad, -half_pad + evpz);
-
-				auto	wa = fmod(aa, evpz) / evpz * da_wd,
-					ww = (ae - aa) / evpz * da_wd;
-
-				cairo_text_extents( cr, A.label.c_str(), &extents);
-
-				int disp = 0 +
-					(last_label_end > wa)
-					? ++overlap_count * 12
-					: (overlap_count = 0);
-				last_label_end = max( wa + extents.width + 3, last_label_end);
-
-				_p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr, .9);
-				cairo_set_line_width( cr, 2.5);
-				cairo_rectangle( cr, wa, 0, ww, da_ht);
-				cairo_stroke( cr);
-
-				_p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr);
-				cairo_rectangle( cr, wa, 0, ww, da_ht);
-				cairo_fill( cr);
-				cairo_stroke( cr);
-
-				cairo_set_source_rgb( cr, 0., 0., 0.);
-				cairo_move_to( cr, wa, da_ht - 12 - disp);
-				cairo_show_text( cr, A.label.c_str());
-				cairo_stroke( cr);
-			}
-		}
-	}
-	case TMode::showing_remixed:
-	default:
-	      // draw individual signal pages (let SChannel::draw_page_static draw the appropriate signal)
-		for ( auto &H : channels )
-			H.draw_for_montage( cr);
-	    break;
-	}
+        if ( not common_annotations.empty() ) {
+                cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
+                cairo_set_font_size( cr, 10);
+                cairo_text_extents_t extents;
+
+                double last_label_end = 0.;
+                int overlap_count = 0;
+
+                double        cvpa = cur_xvpage_start(),
+                        cvpe = cur_xvpage_end(),
+                        evpz = cvpe - cvpa;
+
+                for ( auto &SA : common_annotations ) {
+                        //auto &S = *SA.first;
+                        auto &A = *SA.second;
+                        if ( agh::alg::overlap( A.span.a, A.span.z, cvpa, cvpe) ) {
+                                double        aa = A.span.a - cvpa,
+                                        ae = A.span.z - cvpa;
+                                agh::alg::ensure_within( aa, -half_pad, -half_pad + evpz);
+                                agh::alg::ensure_within( ae, -half_pad, -half_pad + evpz);
+
+                                auto        wa = fmod(aa, evpz) / evpz * da_wd,
+                                        ww = (ae - aa) / evpz * da_wd;
+
+                                cairo_text_extents( cr, A.label.c_str(), &extents);
+
+                                int disp = 0 +
+                                        (last_label_end > wa)
+                                        ? ++overlap_count * 12
+                                        : (overlap_count = 0);
+                                last_label_end = max( wa + extents.width + 3, last_label_end);
+
+                                _p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr, .9);
+                                cairo_set_line_width( cr, 2.5);
+                                cairo_rectangle( cr, wa, 0, ww, da_ht);
+                                cairo_stroke( cr);
+
+                                _p.CwB[SExpDesignUI::TColour::sf_embedded_annotations].set_source_rgba( cr);
+                                cairo_rectangle( cr, wa, 0, ww, da_ht);
+                                cairo_fill( cr);
+                                cairo_stroke( cr);
+
+                                cairo_set_source_rgb( cr, 0., 0., 0.);
+                                cairo_move_to( cr, wa, da_ht - 12 - disp);
+                                cairo_show_text( cr, A.label.c_str());
+                                cairo_stroke( cr);
+                        }
+                }
+        }
+        case TMode::showing_remixed:
+        default:
+              // draw individual signal pages (let SChannel::draw_page_static draw the appropriate signal)
+                for ( auto &H : channels )
+                        H.draw_for_montage( cr);
+            break;
+        }
 
       // ticks
-	{
-		cairo_set_font_size( cr, 9);
-		cairo_set_line_width( cr, .2);
-		for ( size_t i = 0; i <= PageTicks[pagesize_item]; ++i ) {
-			_p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
-			double tick_pos = (double)i * vpagesize() / PageTicks[pagesize_item];
-			cairo_move_to( cr, half_pad + i * ef / PageTicks[pagesize_item], 0);
-			cairo_rel_line_to( cr, 0, da_ht);
-
-			_p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
-			cairo_move_to( cr, half_pad + i * ef / PageTicks[pagesize_item] + 5, da_ht-2);
-			snprintf_buf_ts_s( tick_pos);
-			cairo_show_text( cr, global::buf);
-		}
-		cairo_stroke( cr);
-	}
-
-	// save/restore cairo contexts please
+        {
+                cairo_set_font_size( cr, 9);
+                cairo_set_line_width( cr, .2);
+                for ( size_t i = 0; i <= PageTicks[pagesize_item]; ++i ) {
+                        _p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
+                        double tick_pos = (double)i * vpagesize() / PageTicks[pagesize_item];
+                        cairo_move_to( cr, half_pad + i * ef / PageTicks[pagesize_item], 0);
+                        cairo_rel_line_to( cr, 0, da_ht);
+
+                        _p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
+                        cairo_move_to( cr, half_pad + i * ef / PageTicks[pagesize_item] + 5, da_ht-2);
+                        snprintf_buf_ts_s( tick_pos);
+                        cairo_show_text( cr, global::buf);
+                }
+                cairo_stroke( cr);
+        }
+
+        // save/restore cairo contexts please
 
       // crosshair line
-	if ( draw_crosshair ) {
-		_p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
-		cairo_set_line_width( cr, .2);
-		cairo_move_to( cr, crosshair_at, 0);
-		cairo_rel_line_to( cr, 0, da_ht);
-		cairo_stroke( cr);
-	}
+        if ( draw_crosshair ) {
+                _p.CwB[SExpDesignUI::TColour::sf_cursor].set_source_rgba( cr);
+                cairo_set_line_width( cr, .2);
+                cairo_move_to( cr, crosshair_at, 0);
+                cairo_rel_line_to( cr, 0, da_ht);
+                cairo_stroke( cr);
+        }
 }
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/montage_cb.cc b/upstream/src/aghermann/ui/sf/montage_cb.cc
index 8b25b91..922a0cc 100644
--- a/upstream/src/aghermann/ui/sf/montage_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage_cb.cc
@@ -29,16 +29,16 @@ extern "C" {
 
 gboolean
 daSFMontage_configure_event_cb(
-	GtkWidget*,
-	GdkEventConfigure *event,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventConfigure *event,
+        const gpointer userdata)
 {
-	 if ( event->type == GDK_CONFIGURE ) {
-		 auto& SF = *(SScoringFacility*)userdata;
-		 SF.da_wd = event->width;
-		 // don't care about height: it's our own calculation
-	 }
-	 return FALSE;
+         if ( event->type == GDK_CONFIGURE ) {
+                 auto& SF = *(SScoringFacility*)userdata;
+                 SF.da_wd = event->width;
+                 // don't care about height: it's our own calculation
+         }
+         return FALSE;
 }
 
 
@@ -48,13 +48,13 @@ daSFMontage_configure_event_cb(
 
 gboolean
 daSFMontage_draw_cb(
-	GtkWidget*,
-	cairo_t *cr,
-	const gpointer userdata)
+        GtkWidget*,
+        cairo_t *cr,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.draw_montage( cr);
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.draw_montage( cr);
+        return TRUE;
 }
 
 
@@ -62,157 +62,157 @@ namespace {
 void
 radio_item_setter( GtkWidget *i, const gpointer u)
 {
-	const char *label = gtk_menu_item_get_label( (GtkMenuItem*)i);
-	if ( strcmp(label, (const char*)u) == 0 )
-		gtk_check_menu_item_set_active( (GtkCheckMenuItem*)i, TRUE);
+        const char *label = gtk_menu_item_get_label( (GtkMenuItem*)i);
+        if ( strcmp(label, (const char*)u) == 0 )
+                gtk_check_menu_item_set_active( (GtkCheckMenuItem*)i, TRUE);
 }
 } // namespace
 
 
 gboolean
 daSFMontage_button_press_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	if ( SF.mode == SScoringFacility::TMode::showing_ics ) {
-		if ( SF.ica_components.size() == 0 )
-			return TRUE;
-
-		SF.using_ic = SF.ic_near( event->y);
-
-		if ( event->button == 1 &&
-		     (SF.remix_mode == SScoringFacility::TICARemixMode::punch ||
-		      SF.remix_mode == SScoringFacility::TICARemixMode::zero) ) {
-			SF.ica_map[SF.using_ic].m =
-				(SF.ica_map[SF.using_ic].m == -1) ? 0 : -1;
-			gtk_widget_queue_draw( wid);
-		} else if ( SF.remix_mode == SScoringFacility::TICARemixMode::map ) {
-			const char *mapped =
-				(SF.ica_map[SF.using_ic].m != -1)
-				? SF.channel_by_idx( SF.ica_map[SF.using_ic].m) . name()
-				: SScoringFacility::ica_unmapped_menu_item_label;
-			SF.suppress_redraw = true;
-			gtk_container_foreach(
-				(GtkContainer*)SF.iiSFICAPage,
-				radio_item_setter, (gpointer)mapped);
-			SF.suppress_redraw = false;
-			gtk_menu_popup( SF.iiSFICAPage,
-					NULL, NULL, NULL, NULL, 3, event->time);
-		}
-		return TRUE;
-	}
-
-	if ( SF.mode == SScoringFacility::TMode::showing_remixed ) {
-		if ( SF.ica_components.size() == 0 )
-			return TRUE;
-
-		SF.using_channel = SF.channel_near( event->y);
-		//SF.using_ic = SF.ic_of( SF.using_channel);
-
-		if ( event->button == 1 ) {
-			SF.using_channel->apply_reconstituted =
-				!SF.using_channel->apply_reconstituted;
-			gtk_widget_queue_draw( wid);
-		}
-		return TRUE;
-	}
-
-	if ( SF.mode == SScoringFacility::TMode::shuffling_channels ) {
-		SF.mode = SScoringFacility::TMode::scoring;
-		return TRUE;
-	}
-
-	auto Ch = SF.using_channel = SF.channel_near( event->y);
-
-	if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
-	     (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy ) {
-		switch ( event->button ) {
-		case 1:
-			if ( event->state & GDK_MODIFIER_MASK )
-				;
-			else
-				SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
-			// will eventually call set_cur_vpage(), which will do redraw
-		    break;
-		case 2:
-			Ch->draw_psd_bands = !Ch->draw_psd_bands;
-			gtk_widget_queue_draw( wid);
-		    break;
-		case 3:
-			Ch->update_power_menu_items();
-			gtk_menu_popup( SF.iiSFPower,
-					NULL, NULL, NULL, NULL, 3, event->time);
-		    break;
-		}
-
-	} else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
-		    Ch->draw_emg && event->y > Ch->zeroy ) {
-		switch ( event->button ) {
-		case 1:
-			SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
-		    break;
-		default:
-		    break;
-		}
-
-	} else {
-		double cpos = SF.time_at_click( event->x);
-		bool in_selection =
-			agh::alg::overlap(
-				Ch->selection_start_time, Ch->selection_end_time,
-				cpos, cpos);
-
-		switch ( event->button ) {
-		case 2:
-			Ch->signal_display_scale =
-				agh::alg::calibrate_display_scale(
-					Ch->draw_filtered_signal ? Ch->signal_filtered : Ch->signal_original,
-					SF.vpagesize() * Ch->samplerate() * min (Ch->crecording.total_pages(), (size_t)10),
-					SF.interchannel_gap / 2);
-			if ( event->state & GDK_CONTROL_MASK )
-				for ( auto& H : SF.channels )
-					H.signal_display_scale = Ch->signal_display_scale;
-
-			gtk_widget_queue_draw( wid);
-		    break;
-
-		case 3:
-			if ( (event->state & GDK_MOD1_MASK && SF.n_hidden > 0) ||
-			     !(SF.n_hidden < (int)SF.channels.size()) )
-				gtk_menu_popup( SF.iiSFPageHidden,
-						NULL, NULL, NULL, NULL, 3, event->time);
-			else {
-				Ch->update_channel_menu_items( event->x);
-				Ch->update_power_menu_items();
-				gtk_menu_popup(
-					in_selection ? SF.iiSFPageSelection : SF.iiSFPage,
-					NULL, NULL, NULL, NULL, 3, event->time);
-			}
-		    break;
-
-		case 1:
-			if ( event->state & GDK_MOD1_MASK ) {
-				if ( in_selection ) {
-					SF.moving_selection_handle_offset =
-						cpos - Ch->selection_start_time;
-					SF.mode = SScoringFacility::TMode::moving_selection;
-				} else {
-					SF.event_y_when_shuffling = event->y;
-					SF.zeroy_before_shuffling = Ch->zeroy;
-					SF.mode = SScoringFacility::TMode::shuffling_channels;
-				}
-			} else {
-				SF.mode = SScoringFacility::TMode::marking;
-				Ch->marquee_mstart = Ch->marquee_mend = event->x;
-			}
-			gtk_widget_queue_draw( wid);
-		    break;
-		}
-	}
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+
+        if ( SF.mode == SScoringFacility::TMode::showing_ics ) {
+                if ( SF.ica_components.size() == 0 )
+                        return TRUE;
+
+                SF.using_ic = SF.ic_near( event->y);
+
+                if ( event->button == 1 &&
+                     (SF.remix_mode == SScoringFacility::TICARemixMode::punch ||
+                      SF.remix_mode == SScoringFacility::TICARemixMode::zero) ) {
+                        SF.ica_map[SF.using_ic].m =
+                                (SF.ica_map[SF.using_ic].m == -1) ? 0 : -1;
+                        gtk_widget_queue_draw( wid);
+                } else if ( SF.remix_mode == SScoringFacility::TICARemixMode::map ) {
+                        const char *mapped =
+                                (SF.ica_map[SF.using_ic].m != -1)
+                                ? SF.channel_by_idx( SF.ica_map[SF.using_ic].m) . name()
+                                : SScoringFacility::ica_unmapped_menu_item_label;
+                        SF.suppress_redraw = true;
+                        gtk_container_foreach(
+                                (GtkContainer*)SF.iiSFICAPage,
+                                radio_item_setter, (gpointer)mapped);
+                        SF.suppress_redraw = false;
+                        gtk_menu_popup( SF.iiSFICAPage,
+                                        NULL, NULL, NULL, NULL, 3, event->time);
+                }
+                return TRUE;
+        }
+
+        if ( SF.mode == SScoringFacility::TMode::showing_remixed ) {
+                if ( SF.ica_components.size() == 0 )
+                        return TRUE;
+
+                SF.using_channel = SF.channel_near( event->y);
+                //SF.using_ic = SF.ic_of( SF.using_channel);
+
+                if ( event->button == 1 ) {
+                        SF.using_channel->apply_reconstituted =
+                                !SF.using_channel->apply_reconstituted;
+                        gtk_widget_queue_draw( wid);
+                }
+                return TRUE;
+        }
+
+        if ( SF.mode == SScoringFacility::TMode::shuffling_channels ) {
+                SF.mode = SScoringFacility::TMode::scoring;
+                return TRUE;
+        }
+
+        auto Ch = SF.using_channel = SF.channel_near( event->y);
+
+        if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
+             (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy ) {
+                switch ( event->button ) {
+                case 1:
+                        if ( event->state & GDK_MODIFIER_MASK )
+                                ;
+                        else
+                                SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
+                        // will eventually call set_cur_vpage(), which will do redraw
+                    break;
+                case 2:
+                        Ch->draw_psd_bands = !Ch->draw_psd_bands;
+                        gtk_widget_queue_draw( wid);
+                    break;
+                case 3:
+                        Ch->update_power_menu_items();
+                        gtk_menu_popup( SF.iiSFPower,
+                                        NULL, NULL, NULL, NULL, 3, event->time);
+                    break;
+                }
+
+        } else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
+                    Ch->draw_emg && event->y > Ch->zeroy ) {
+                switch ( event->button ) {
+                case 1:
+                        SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
+                    break;
+                default:
+                    break;
+                }
+
+        } else {
+                double cpos = SF.time_at_click( event->x);
+                bool in_selection =
+                        agh::alg::overlap(
+                                Ch->selection_start_time, Ch->selection_end_time,
+                                cpos, cpos);
+
+                switch ( event->button ) {
+                case 2:
+                        Ch->signal_display_scale =
+                                agh::alg::calibrate_display_scale(
+                                        Ch->draw_filtered_signal ? Ch->signal_filtered : Ch->signal_original,
+                                        SF.vpagesize() * Ch->samplerate() * min (Ch->crecording.total_pages(), (size_t)10),
+                                        SF.interchannel_gap / 2);
+                        if ( event->state & GDK_CONTROL_MASK )
+                                for ( auto& H : SF.channels )
+                                        H.signal_display_scale = Ch->signal_display_scale;
+
+                        gtk_widget_queue_draw( wid);
+                    break;
+
+                case 3:
+                        if ( (event->state & GDK_MOD1_MASK && SF.n_hidden > 0) ||
+                             !(SF.n_hidden < (int)SF.channels.size()) )
+                                gtk_menu_popup( SF.iiSFPageHidden,
+                                                NULL, NULL, NULL, NULL, 3, event->time);
+                        else {
+                                Ch->update_channel_menu_items( event->x);
+                                Ch->update_power_menu_items();
+                                gtk_menu_popup(
+                                        in_selection ? SF.iiSFPageSelection : SF.iiSFPage,
+                                        NULL, NULL, NULL, NULL, 3, event->time);
+                        }
+                    break;
+
+                case 1:
+                        if ( event->state & GDK_MOD1_MASK ) {
+                                if ( in_selection ) {
+                                        SF.moving_selection_handle_offset =
+                                                cpos - Ch->selection_start_time;
+                                        SF.mode = SScoringFacility::TMode::moving_selection;
+                                } else {
+                                        SF.event_y_when_shuffling = event->y;
+                                        SF.zeroy_before_shuffling = Ch->zeroy;
+                                        SF.mode = SScoringFacility::TMode::shuffling_channels;
+                                }
+                        } else {
+                                SF.mode = SScoringFacility::TMode::marking;
+                                Ch->marquee_mstart = Ch->marquee_mend = event->x;
+                        }
+                        gtk_widget_queue_draw( wid);
+                    break;
+                }
+        }
+        return TRUE;
 }
 
 
@@ -221,168 +221,168 @@ namespace {
 inline double
 timeval_elapsed( const struct timeval &x, const struct timeval &y)
 {
-	return y.tv_sec - x.tv_sec
-		+ 1e-6 * (y.tv_usec - x.tv_usec);
+        return y.tv_sec - x.tv_sec
+                + 1e-6 * (y.tv_usec - x.tv_usec);
 }
 }
 
 gboolean
 daSFMontage_motion_notify_event_cb(
-	GtkWidget *wid,
-	GdkEventMotion *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventMotion *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.mode == SScoringFacility::TMode::showing_ics )
-		return TRUE;
-
-	static struct timeval last_page_flip = {0, 0};
-	if ( last_page_flip.tv_sec == 0 )
-		gettimeofday( &last_page_flip, NULL);
-
-	switch ( SF.mode ) {
-
-	case SScoringFacility::TMode::shuffling_channels:
-	{
-		SF.using_channel->zeroy = SF.zeroy_before_shuffling + (event->y - SF.event_y_when_shuffling);
-		gtk_widget_queue_draw( wid);
-	}
-	break;
-
-	case SScoringFacility::TMode::marking:
-	{
-		if ( SF.channel_near( event->y) != SF.using_channel ) // user has dragged too much vertically
-			return TRUE;
-		SF.using_channel->marquee_mend = event->x;
-
-		struct timeval currently;
-		gettimeofday( &currently, NULL);
-		if ( (int)event->x > SF.da_wd && SF.cur_vpage() < SF.total_vpages()-1 ) {
-			if ( timeval_elapsed( last_page_flip, currently) > .4 ) {
-				// x (1+2a) = y
-				SF.using_channel->marquee_mstart -= SF.da_wd / (1. + 2*SF.skirting_run_per1);
-				SF.set_cur_vpage( SF.cur_vpage()+1);
-				gettimeofday( &last_page_flip, NULL);
-			}
-		} else if ( (int)event->x < 0 && SF.cur_vpage() > 0 ) {
-			if ( timeval_elapsed( last_page_flip, currently) > .4 ) {
-				SF.using_channel->marquee_mstart += SF.da_wd / (1. + 2*SF.skirting_run_per1);
-				SF.set_cur_vpage( SF.cur_vpage()-1);
-				gettimeofday( &last_page_flip, NULL);
-			}
-		}
-
-		SF.using_channel->marquee_to_selection(); // to be sure, also do it on button_release
-		if ( event->state & GDK_SHIFT_MASK )
-			for( auto &H : SF.channels )
-				if ( &H != SF.using_channel ) {
-					H.marquee_mstart = SF.using_channel->marquee_mstart;
-					H.marquee_mend = event->x;
-					H.marquee_to_selection();
-				}
-		gtk_widget_queue_draw( wid);
-	}
-	break;
-
-	case SScoringFacility::TMode::moving_selection:
-	{
-		auto	new_start_time = SF.time_at_click( event->x) - SF.moving_selection_handle_offset,
-			new_end_time = new_start_time + (SF.using_channel->selection_end_time - SF.using_channel->selection_start_time);
-		auto& H = *SF.using_channel;
-		// reposition marquee
-		H.marquee_mstart =
-			(new_start_time - SF.cur_xvpage_start()) / SF.xvpagesize() * SF.da_wd;
-		H.marquee_mend =
-			(new_end_time - SF.cur_xvpage_start()) / SF.xvpagesize() * SF.da_wd;
-
-		H.marquee_to_selection(); // to be sure, also do it on button_release
-		H.put_selection( H.selection_start, H.selection_end);
-
-		gtk_widget_queue_draw( wid);
-	}
-	break;
-
-	default:
-	break;
-	}
-
-	if ( SF.draw_crosshair ) {
-		SF.crosshair_at = event->x;
-		SF.crosshair_at_time = SF.time_at_click( event->x);
-		gtk_widget_queue_draw( wid);
-	}
-
-	if ( SF.mode == SScoringFacility::TMode::scoring ) {
-		gtk_label_set_text(
-			SF.lSFOverChannel,
-			SF.channel_near( event->y) -> name());
-	} else
-		gtk_label_set_text( SF.lSFOverChannel, "");
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.mode == SScoringFacility::TMode::showing_ics )
+                return TRUE;
+
+        static struct timeval last_page_flip = {0, 0};
+        if ( last_page_flip.tv_sec == 0 )
+                gettimeofday( &last_page_flip, NULL);
+
+        switch ( SF.mode ) {
+
+        case SScoringFacility::TMode::shuffling_channels:
+        {
+                SF.using_channel->zeroy = SF.zeroy_before_shuffling + (event->y - SF.event_y_when_shuffling);
+                gtk_widget_queue_draw( wid);
+        }
+        break;
+
+        case SScoringFacility::TMode::marking:
+        {
+                if ( SF.channel_near( event->y) != SF.using_channel ) // user has dragged too much vertically
+                        return TRUE;
+                SF.using_channel->marquee_mend = event->x;
+
+                struct timeval currently;
+                gettimeofday( &currently, NULL);
+                if ( (int)event->x > SF.da_wd && SF.cur_vpage() < SF.total_vpages()-1 ) {
+                        if ( timeval_elapsed( last_page_flip, currently) > .4 ) {
+                                // x (1+2a) = y
+                                SF.using_channel->marquee_mstart -= SF.da_wd / (1. + 2*SF.skirting_run_per1);
+                                SF.set_cur_vpage( SF.cur_vpage()+1);
+                                gettimeofday( &last_page_flip, NULL);
+                        }
+                } else if ( (int)event->x < 0 && SF.cur_vpage() > 0 ) {
+                        if ( timeval_elapsed( last_page_flip, currently) > .4 ) {
+                                SF.using_channel->marquee_mstart += SF.da_wd / (1. + 2*SF.skirting_run_per1);
+                                SF.set_cur_vpage( SF.cur_vpage()-1);
+                                gettimeofday( &last_page_flip, NULL);
+                        }
+                }
+
+                SF.using_channel->marquee_to_selection(); // to be sure, also do it on button_release
+                if ( event->state & GDK_SHIFT_MASK )
+                        for( auto &H : SF.channels )
+                                if ( &H != SF.using_channel ) {
+                                        H.marquee_mstart = SF.using_channel->marquee_mstart;
+                                        H.marquee_mend = event->x;
+                                        H.marquee_to_selection();
+                                }
+                gtk_widget_queue_draw( wid);
+        }
+        break;
+
+        case SScoringFacility::TMode::moving_selection:
+        {
+                auto        new_start_time = SF.time_at_click( event->x) - SF.moving_selection_handle_offset,
+                        new_end_time = new_start_time + (SF.using_channel->selection_end_time - SF.using_channel->selection_start_time);
+                auto& H = *SF.using_channel;
+                // reposition marquee
+                H.marquee_mstart =
+                        (new_start_time - SF.cur_xvpage_start()) / SF.xvpagesize() * SF.da_wd;
+                H.marquee_mend =
+                        (new_end_time - SF.cur_xvpage_start()) / SF.xvpagesize() * SF.da_wd;
+
+                H.marquee_to_selection(); // to be sure, also do it on button_release
+                H.put_selection( H.selection_start, H.selection_end);
+
+                gtk_widget_queue_draw( wid);
+        }
+        break;
+
+        default:
+        break;
+        }
+
+        if ( SF.draw_crosshair ) {
+                SF.crosshair_at = event->x;
+                SF.crosshair_at_time = SF.time_at_click( event->x);
+                gtk_widget_queue_draw( wid);
+        }
+
+        if ( SF.mode == SScoringFacility::TMode::scoring ) {
+                gtk_label_set_text(
+                        SF.lSFOverChannel,
+                        SF.channel_near( event->y) -> name());
+        } else
+                gtk_label_set_text( SF.lSFOverChannel, "");
 
       // current pos
-	SF.draw_current_pos( event->x);
+        SF.draw_current_pos( event->x);
 
-	return TRUE;
+        return TRUE;
 }
 
 
 gboolean
 daSFMontage_leave_notify_event_cb(
-	GtkWidget*,
-	GdkEventMotion*,
-	const gpointer userdata)
+        GtkWidget*,
+        GdkEventMotion*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	gtk_label_set_text( SF.lSFOverChannel, "");
-	SF.draw_current_pos( NAN);
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+        gtk_label_set_text( SF.lSFOverChannel, "");
+        SF.draw_current_pos( NAN);
+        return TRUE;
 }
 
 
 gboolean
 daSFMontage_button_release_event_cb(
-	GtkWidget *wid,
-	GdkEventButton *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventButton *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.mode == SScoringFacility::TMode::showing_ics ||
-	     SF.mode == SScoringFacility::TMode::showing_remixed )
-		return TRUE;
-
-	auto Ch = SF.using_channel;
-
-	if ( SF.channel_near( event->y) != SF.using_channel ) // user has dragged too much vertically
-		 return TRUE;
-
-	switch ( event->button ) {
-	case 1:
-		if ( SF.mode == SScoringFacility::TMode::marking ) {
-			SF.mode = SScoringFacility::TMode::scoring;
-			Ch->put_selection( Ch->selection_start, Ch->selection_end);
-			Ch->selectively_enable_selection_menu_items();
-			Ch->update_channel_menu_items( event->x);
-			if ( fabs(SF.using_channel->marquee_mstart - SF.using_channel->marquee_mend) > 5 ) {
-				gtk_menu_popup( SF.iiSFPageSelection,
-						NULL, NULL, NULL, NULL, 3, event->time);
-			}
-			gtk_widget_queue_draw( wid);
-
-		} else if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
-			    (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy )
-			SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
-
-		else {
-			SF.using_channel->marquee_to_selection();
-			SF.mode = SScoringFacility::TMode::scoring;
-			gtk_widget_queue_draw( wid);
-		}
-	    break;
-	case 3:
-	    break;
-	}
-
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.mode == SScoringFacility::TMode::showing_ics ||
+             SF.mode == SScoringFacility::TMode::showing_remixed )
+                return TRUE;
+
+        auto Ch = SF.using_channel;
+
+        if ( SF.channel_near( event->y) != SF.using_channel ) // user has dragged too much vertically
+                 return TRUE;
+
+        switch ( event->button ) {
+        case 1:
+                if ( SF.mode == SScoringFacility::TMode::marking ) {
+                        SF.mode = SScoringFacility::TMode::scoring;
+                        Ch->put_selection( Ch->selection_start, Ch->selection_end);
+                        Ch->selectively_enable_selection_menu_items();
+                        Ch->update_channel_menu_items( event->x);
+                        if ( fabs(SF.using_channel->marquee_mstart - SF.using_channel->marquee_mend) > 5 ) {
+                                gtk_menu_popup( SF.iiSFPageSelection,
+                                                NULL, NULL, NULL, NULL, 3, event->time);
+                        }
+                        gtk_widget_queue_draw( wid);
+
+                } else if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
+                            (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy )
+                        SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
+
+                else {
+                        SF.using_channel->marquee_to_selection();
+                        SF.mode = SScoringFacility::TMode::scoring;
+                        gtk_widget_queue_draw( wid);
+                }
+            break;
+        case 3:
+            break;
+        }
+
+        return TRUE;
 }
 
 
@@ -391,136 +391,136 @@ daSFMontage_button_release_event_cb(
 
 gboolean
 daSFMontage_scroll_event_cb(
-	GtkWidget *wid,
-	GdkEventScroll *event,
-	const gpointer userdata)
+        GtkWidget *wid,
+        GdkEventScroll *event,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto Ch = SF.using_channel = SF.channel_near( event->y);
-
-	if ( (event->state & GDK_MOD1_MASK) and
-	     not (event->state & GDK_SHIFT_MASK) ) {
-		switch ( event->direction ) {
-		case GDK_SCROLL_UP:
-			if ( SF.da_ht > (int)(SF.channels.size() - SF.n_hidden) * 20 ) {
-				SF.expand_by_factor( (double)(SF.da_ht - 10)/ SF.da_ht);
-				gtk_widget_queue_draw( wid);
-			}
-		    break;
-		case GDK_SCROLL_DOWN:
-			SF.expand_by_factor( (double)(SF.da_ht + 10) / SF.da_ht);
-			gtk_widget_queue_draw( wid);
-		    break;
-		default:
-		    break;
-		}
-
-	} else if ( event->y > Ch->zeroy ) {
-		if ( event->state & GDK_SHIFT_MASK && Ch->draw_psd ) {
-			switch ( event->direction ) {
-			case GDK_SCROLL_DOWN:
-				if ( Ch->draw_psd_bands ) {
-					if ( Ch->psd.focused_band > metrics::TBand::delta ) {
-						--Ch->psd.focused_band;
-						if ( Ch->autoscale_profile )
-							Ch->update_profile_display_scales();
-						gtk_widget_queue_draw( wid);
-					}
-				} else
-					if ( Ch->psd.from > 0 ) {
-						Ch->psd.from -= .5;
-						Ch->psd.upto -= .5;
-						Ch->get_psd_course();
-						if ( Ch->autoscale_profile )
-							Ch->update_profile_display_scales();
-						gtk_widget_queue_draw( wid);
-					}
-				break;
-			case GDK_SCROLL_UP:
-				if ( Ch->draw_psd_bands ) {
-					if ( Ch->psd.focused_band < Ch->psd.uppermost_band ) {
-						++Ch->psd.focused_band;
-						if ( Ch->autoscale_profile )
-							Ch->update_profile_display_scales();
-						gtk_widget_queue_draw( wid);
-					}
-				} else {
-					auto& R = Ch->crecording;
-					if ( Ch->psd.upto < R.psd_profile.Pp.binsize * R.psd_profile.bins() ) {
-						Ch->psd.from += .5;
-						Ch->psd.upto += .5;
-						Ch->get_psd_course();
-						if ( Ch->autoscale_profile )
-							Ch->update_profile_display_scales();
-						gtk_widget_queue_draw( wid);
-					}
-				}
-				break;
-			case GDK_SCROLL_LEFT:
-			case GDK_SCROLL_RIGHT:
-			default:
-				break;
-			}
-		} else {
-			switch ( event->direction ) {
-			case GDK_SCROLL_DOWN:
-				if ( Ch->draw_psd )
-					Ch->psd.display_scale /= SF._p.scroll_factor;
-				if ( Ch->draw_swu )
-					Ch->swu.display_scale /= SF._p.scroll_factor;
-				if ( Ch->draw_mc )
-					Ch->mc.display_scale  /= SF._p.scroll_factor;
-			    break;
-			case GDK_SCROLL_UP:
-				if ( Ch->draw_psd )
-					Ch->psd.display_scale *= SF._p.scroll_factor;
-				if ( Ch->draw_swu )
-					Ch->swu.display_scale *= SF._p.scroll_factor;
-				if ( Ch->draw_mc )
-					Ch->mc.display_scale  *= SF._p.scroll_factor;
-			    break;
-			case GDK_SCROLL_LEFT:
-				if ( SF.cur_vpage() > 0 )
-					SF.set_cur_vpage( SF.cur_vpage() - 1);
-			case GDK_SCROLL_RIGHT:
-				if ( SF.cur_vpage() < SF.total_vpages() )
-					SF.set_cur_vpage( SF.cur_vpage() + 1);
-			    break;
-			default:
-			    break;
-			}
-			if ( event->state & GDK_CONTROL_MASK )
-				for ( auto& H : SF.channels ) {
-					if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
-					     H.schannel().type() == sigfile::SChannel::TType::eeg ) {
-						H.psd.display_scale = Ch->psd.display_scale;
-						H.mc.display_scale  = Ch->mc.display_scale;
-						H.swu.display_scale = Ch->swu.display_scale;
-					} else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
-					     H.schannel().type() == sigfile::SChannel::TType::emg )
-						H.signal_display_scale = Ch->signal_display_scale;
-				}
-			gtk_widget_queue_draw( wid);
-		}
-	} else {
-		switch ( event->direction ) {
-		case GDK_SCROLL_DOWN:
-			Ch->signal_display_scale /= SF._p.scroll_factor;
-			break;
-		case GDK_SCROLL_UP:
-			Ch->signal_display_scale *= SF._p.scroll_factor;
-			break;
-		default:
-			break;
-		}
-
-		if ( event->state & GDK_CONTROL_MASK )
-			for ( auto& H : SF.channels )
-				H.signal_display_scale = Ch->signal_display_scale;
-		gtk_widget_queue_draw( wid);
-	}
-
-	return TRUE;
+        auto& SF = *(SScoringFacility*)userdata;
+        auto Ch = SF.using_channel = SF.channel_near( event->y);
+
+        if ( (event->state & GDK_MOD1_MASK) and
+             not (event->state & GDK_SHIFT_MASK) ) {
+                switch ( event->direction ) {
+                case GDK_SCROLL_UP:
+                        if ( SF.da_ht > (int)(SF.channels.size() - SF.n_hidden) * 20 ) {
+                                SF.expand_by_factor( (double)(SF.da_ht - 10)/ SF.da_ht);
+                                gtk_widget_queue_draw( wid);
+                        }
+                    break;
+                case GDK_SCROLL_DOWN:
+                        SF.expand_by_factor( (double)(SF.da_ht + 10) / SF.da_ht);
+                        gtk_widget_queue_draw( wid);
+                    break;
+                default:
+                    break;
+                }
+
+        } else if ( event->y > Ch->zeroy ) {
+                if ( event->state & GDK_SHIFT_MASK && Ch->draw_psd ) {
+                        switch ( event->direction ) {
+                        case GDK_SCROLL_DOWN:
+                                if ( Ch->draw_psd_bands ) {
+                                        if ( Ch->psd.focused_band > metrics::TBand::delta ) {
+                                                --Ch->psd.focused_band;
+                                                if ( Ch->autoscale_profile )
+                                                        Ch->update_profile_display_scales();
+                                                gtk_widget_queue_draw( wid);
+                                        }
+                                } else
+                                        if ( Ch->psd.from > 0 ) {
+                                                Ch->psd.from -= .5;
+                                                Ch->psd.upto -= .5;
+                                                Ch->get_psd_course();
+                                                if ( Ch->autoscale_profile )
+                                                        Ch->update_profile_display_scales();
+                                                gtk_widget_queue_draw( wid);
+                                        }
+                                break;
+                        case GDK_SCROLL_UP:
+                                if ( Ch->draw_psd_bands ) {
+                                        if ( Ch->psd.focused_band < Ch->psd.uppermost_band ) {
+                                                ++Ch->psd.focused_band;
+                                                if ( Ch->autoscale_profile )
+                                                        Ch->update_profile_display_scales();
+                                                gtk_widget_queue_draw( wid);
+                                        }
+                                } else {
+                                        auto& R = Ch->crecording;
+                                        if ( Ch->psd.upto < R.psd_profile.Pp.binsize * R.psd_profile.bins() ) {
+                                                Ch->psd.from += .5;
+                                                Ch->psd.upto += .5;
+                                                Ch->get_psd_course();
+                                                if ( Ch->autoscale_profile )
+                                                        Ch->update_profile_display_scales();
+                                                gtk_widget_queue_draw( wid);
+                                        }
+                                }
+                                break;
+                        case GDK_SCROLL_LEFT:
+                        case GDK_SCROLL_RIGHT:
+                        default:
+                                break;
+                        }
+                } else {
+                        switch ( event->direction ) {
+                        case GDK_SCROLL_DOWN:
+                                if ( Ch->draw_psd )
+                                        Ch->psd.display_scale /= SF._p.scroll_factor;
+                                if ( Ch->draw_swu )
+                                        Ch->swu.display_scale /= SF._p.scroll_factor;
+                                if ( Ch->draw_mc )
+                                        Ch->mc.display_scale  /= SF._p.scroll_factor;
+                            break;
+                        case GDK_SCROLL_UP:
+                                if ( Ch->draw_psd )
+                                        Ch->psd.display_scale *= SF._p.scroll_factor;
+                                if ( Ch->draw_swu )
+                                        Ch->swu.display_scale *= SF._p.scroll_factor;
+                                if ( Ch->draw_mc )
+                                        Ch->mc.display_scale  *= SF._p.scroll_factor;
+                            break;
+                        case GDK_SCROLL_LEFT:
+                                if ( SF.cur_vpage() > 0 )
+                                        SF.set_cur_vpage( SF.cur_vpage() - 1);
+                        case GDK_SCROLL_RIGHT:
+                                if ( SF.cur_vpage() < SF.total_vpages() )
+                                        SF.set_cur_vpage( SF.cur_vpage() + 1);
+                            break;
+                        default:
+                            break;
+                        }
+                        if ( event->state & GDK_CONTROL_MASK )
+                                for ( auto& H : SF.channels ) {
+                                        if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
+                                             H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+                                                H.psd.display_scale = Ch->psd.display_scale;
+                                                H.mc.display_scale  = Ch->mc.display_scale;
+                                                H.swu.display_scale = Ch->swu.display_scale;
+                                        } else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
+                                             H.schannel().type() == sigfile::SChannel::TType::emg )
+                                                H.signal_display_scale = Ch->signal_display_scale;
+                                }
+                        gtk_widget_queue_draw( wid);
+                }
+        } else {
+                switch ( event->direction ) {
+                case GDK_SCROLL_DOWN:
+                        Ch->signal_display_scale /= SF._p.scroll_factor;
+                        break;
+                case GDK_SCROLL_UP:
+                        Ch->signal_display_scale *= SF._p.scroll_factor;
+                        break;
+                default:
+                        break;
+                }
+
+                if ( event->state & GDK_CONTROL_MASK )
+                        for ( auto& H : SF.channels )
+                                H.signal_display_scale = Ch->signal_display_scale;
+                gtk_widget_queue_draw( wid);
+        }
+
+        return TRUE;
 }
 
 
@@ -533,339 +533,339 @@ daSFMontage_scroll_event_cb(
 
 void
 iSFPageShowOriginal_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_original_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	// prevent both being switched off
-	if ( !SF.using_channel->draw_original_signal && !SF.using_channel->draw_filtered_signal )
-		gtk_check_menu_item_set_active( SF.iSFPageShowProcessed,
-						(gboolean)(SF.using_channel->draw_filtered_signal = true));
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_original_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        // prevent both being switched off
+        if ( !SF.using_channel->draw_original_signal && !SF.using_channel->draw_filtered_signal )
+                gtk_check_menu_item_set_active( SF.iSFPageShowProcessed,
+                                                (gboolean)(SF.using_channel->draw_filtered_signal = true));
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageShowProcessed_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_filtered_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	if ( !SF.using_channel->draw_filtered_signal && !SF.using_channel->draw_original_signal )
-		gtk_check_menu_item_set_active( SF.iSFPageShowOriginal,
-						(gboolean)(SF.using_channel->draw_original_signal = true));
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_filtered_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        if ( !SF.using_channel->draw_filtered_signal && !SF.using_channel->draw_original_signal )
+                gtk_check_menu_item_set_active( SF.iSFPageShowOriginal,
+                                                (gboolean)(SF.using_channel->draw_original_signal = true));
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageUseResample_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->resample_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->resample_signal = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageDrawZeroline_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_zeroline = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_zeroline = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageHide_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.using_channel->hidden = true;
-	// add an item to iSFPageHidden
-	auto item = (GtkWidget*)(SF.using_channel->menu_item_when_hidden =
-				 (GtkMenuItem*)gtk_menu_item_new_with_label( SF.using_channel->name()));
-	g_object_set( (GObject*)item,
-		      "visible", TRUE,
-		      NULL);
-	g_signal_connect( (GObject*)item,
-			  "activate", (GCallback)iSFPageShowHidden_activate_cb,
-			  &SF);
-	gtk_container_add( (GtkContainer*)SF.iiSFPageHidden,
-			   item);
-	++SF.n_hidden;
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.using_channel->hidden = true;
+        // add an item to iSFPageHidden
+        auto item = (GtkWidget*)(SF.using_channel->menu_item_when_hidden =
+                                 (GtkMenuItem*)gtk_menu_item_new_with_label( SF.using_channel->name()));
+        g_object_set( (GObject*)item,
+                      "visible", TRUE,
+                      NULL);
+        g_signal_connect( (GObject*)item,
+                          "activate", (GCallback)iSFPageShowHidden_activate_cb,
+                          &SF);
+        gtk_container_add( (GtkContainer*)SF.iiSFPageHidden,
+                           item);
+        ++SF.n_hidden;
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageShowHidden_activate_cb(
-	GtkMenuItem *menuitem,
-	const gpointer userdata)
+        GtkMenuItem *menuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto Ch = &SF[gtk_menu_item_get_label(menuitem)];
-	Ch->hidden = false;
-
-	SF.using_channel = Ch;
-	gdk_window_get_device_position(
-		gtk_widget_get_window( (GtkWidget*)SF.daSFMontage),
-		global::client_pointer,
-		NULL, (int*)&Ch->zeroy, NULL); //SF.find_free_space();
-	SF.zeroy_before_shuffling = Ch->zeroy;
-	SF.event_y_when_shuffling = (double)Ch->zeroy;
-	SF.mode = SScoringFacility::TMode::shuffling_channels;
-
-	gtk_widget_destroy( (GtkWidget*)Ch->menu_item_when_hidden);
-	Ch->menu_item_when_hidden = NULL;
-
-	--SF.n_hidden;
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        auto Ch = &SF[gtk_menu_item_get_label(menuitem)];
+        Ch->hidden = false;
+
+        SF.using_channel = Ch;
+        gdk_window_get_device_position(
+                gtk_widget_get_window( (GtkWidget*)SF.daSFMontage),
+                global::client_pointer,
+                NULL, (int*)&Ch->zeroy, NULL); //SF.find_free_space();
+        SF.zeroy_before_shuffling = Ch->zeroy;
+        SF.event_y_when_shuffling = (double)Ch->zeroy;
+        SF.mode = SScoringFacility::TMode::shuffling_channels;
+
+        gtk_widget_destroy( (GtkWidget*)Ch->menu_item_when_hidden);
+        Ch->menu_item_when_hidden = NULL;
+
+        --SF.n_hidden;
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageSpaceEvenly_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.space_evenly();
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.space_evenly();
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageLocateSelection_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.using_channel->selection_start == SF.using_channel->selection_end ) {
-		SF.sb_message( "There is no selection in this channel");
-	} else
-		SF.set_cur_vpage(
-			SF.using_channel->selection_start_time / SF.vpagesize());
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.using_channel->selection_start == SF.using_channel->selection_end ) {
+                SF.sb_message( "There is no selection in this channel");
+        } else
+                SF.set_cur_vpage(
+                        SF.using_channel->selection_start_time / SF.vpagesize());
 }
 
 
 void
 iSFPageDrawPSDProfile_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_psd = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_psd = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawPSDSpectrum_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_spectrum = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_spectrum = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawMCProfile_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_mc = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_mc = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawSWUProfile_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_swu = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_swu = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawEMGProfile_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_emg = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_emg = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawPhasicSpindles_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_phasic_spindle = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_phasic_spindle = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawPhasicKComplexes_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_phasic_Kcomplex = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_phasic_Kcomplex = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageDrawPhasicEyeBlinks_toggled_cb(
-	GtkCheckMenuItem *checkmenuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_phasic_eyeblink = (bool)gtk_check_menu_item_get_active( checkmenuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_phasic_eyeblink = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageFilter_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& FD =  SF.filters_d();
-	auto& H  = *SF.using_channel;
-	FD.P = H.filters;
-	FD.W_V.up();
-
-	gtk_label_set_markup(
-		FD.lSFFilterCaption,
-		snprintf_buf(
-			"<big>Filters for channel <b>%s</b></big>",
-			SF.using_channel->name()));
-
-	if ( gtk_dialog_run( FD.wSFFilters) == GTK_RESPONSE_OK ) {
-		FD.W_V.down();
-		H.filters = FD.P;
-		H.get_signal_filtered();
-
-		if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
-			H.get_psd_course();
-			H.get_psd_in_bands();
-			H.get_spectrum( SF.cur_page());
-			H.get_mc_course();
-		}
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-
-		if ( strcmp( SF.using_channel->name(), SF._p.AghH()) == 0 )
-			SF.redraw_ssubject_timeline();
-	}
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& FD =  SF.filters_d();
+        auto& H  = *SF.using_channel;
+        FD.P = H.filters;
+        FD.W_V.up();
+
+        gtk_label_set_markup(
+                FD.lSFFilterCaption,
+                snprintf_buf(
+                        "<big>Filters for channel <b>%s</b></big>",
+                        SF.using_channel->name()));
+
+        if ( gtk_dialog_run( FD.wSFFilters) == GTK_RESPONSE_OK ) {
+                FD.W_V.down();
+                H.filters = FD.P;
+                H.get_signal_filtered();
+
+                if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+                        H.get_psd_course();
+                        H.get_psd_in_bands();
+                        H.get_spectrum( SF.cur_page());
+                        H.get_mc_course();
+                }
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+
+                if ( strcmp( SF.using_channel->name(), SF._p.AghH()) == 0 )
+                        SF.redraw_ssubject_timeline();
+        }
 }
 
 
 void
 iSFPageArtifactsDetect_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& AD = SF.artifacts_d();
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& AD = SF.artifacts_d();
 
-	gtk_widget_show( (GtkWidget*)AD.wSFAD);
+        gtk_widget_show( (GtkWidget*)AD.wSFAD);
 }
 
 void
 iSFPageArtifactsMarkFlat_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& AS = SF.artifacts_simple_d();
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( (GtkDialog*)AS.wSFADS) ) {
-		AS.W_V.down();
-
-		auto marked = SF.using_channel->mark_flat_regions_as_artifacts( AS.min_size, AS.pad);
-
-		SF.sb_message(
-			snprintf_buf(
-				"Detected %.2g sec of flat regions, adding %.2g sec to already marked",
-				marked.first, marked.second));
-
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
-	}
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& AS = SF.artifacts_simple_d();
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( (GtkDialog*)AS.wSFADS) ) {
+                AS.W_V.down();
+
+                auto marked = SF.using_channel->mark_flat_regions_as_artifacts( AS.min_size, AS.pad);
+
+                SF.sb_message(
+                        snprintf_buf(
+                                "Detected %.2g sec of flat regions, adding %.2g sec to already marked",
+                                marked.first, marked.second));
+
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        }
 }
 
 
 
 void
 iSFPageArtifactsClear_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	char* chnamee = g_markup_escape_text( SF.using_channel->name(), -1);
+        char* chnamee = g_markup_escape_text( SF.using_channel->name(), -1);
 
-	if ( SF.using_channel->artifacts().empty() ) {
-		pop_ok_message( SF.wSF, "No artifacts to clear", "Channel <b>%s</b> is already clean.", chnamee);
+        if ( SF.using_channel->artifacts().empty() ) {
+                pop_ok_message( SF.wSF, "No artifacts to clear", "Channel <b>%s</b> is already clean.", chnamee);
 
-	} else
-		if ( GTK_RESPONSE_YES ==
-		     pop_question(
-			     SF.wSF,
-			     "<b>All marked artifacts will be lost</b>",
-			     "Sure to clean all artifacts in channel <b>%s</b>?",
-			     chnamee) ) {
+        } else
+                if ( GTK_RESPONSE_YES ==
+                     pop_question(
+                             SF.wSF,
+                             "<b>All marked artifacts will be lost</b>",
+                             "Sure to clean all artifacts in channel <b>%s</b>?",
+                             chnamee) ) {
 
-			SF.using_channel->artifacts().clear();
-			SF.using_channel->get_signal_filtered();
+                        SF.using_channel->artifacts().clear();
+                        SF.using_channel->get_signal_filtered();
 
-			if ( SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) {
-				SF.using_channel->get_psd_course();
-				SF.using_channel->get_psd_in_bands();
-				SF.using_channel->get_spectrum();
+                        if ( SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) {
+                                SF.using_channel->get_psd_course();
+                                SF.using_channel->get_psd_in_bands();
+                                SF.using_channel->get_spectrum();
 
-				SF.redraw_ssubject_timeline();
-			}
+                                SF.redraw_ssubject_timeline();
+                        }
 
-			gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-			gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
-		}
+                        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+                        gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+                }
 
-	g_free( chnamee);
+        g_free( chnamee);
 }
 
 
@@ -873,75 +873,75 @@ iSFPageArtifactsClear_activate_cb(
 
 void
 iSFPageSaveChannelAsSVG_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& ED = SF._p;
-	string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
-	string fname = str::sasprintf(
-		"%s/%s/%s-p%zu@%zu.svg",
-		j_dir.c_str(), ED.AghD(), ED.AghT(), SF.cur_vpage(), SF.vpagesize());
-
-	SF.using_channel->draw_for_montage( fname, SF.da_wd, SF.interchannel_gap);
-	ED.sb_message(
-		str::sasprintf(
-			"Wrote \"%s\"",
-			agh::str::homedir2tilda(fname).c_str()));
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& ED = SF._p;
+        string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
+        string fname = str::sasprintf(
+                "%s/%s/%s-p%zu@%zu.svg",
+                j_dir.c_str(), ED.AghD(), ED.AghT(), SF.cur_vpage(), SF.vpagesize());
+
+        SF.using_channel->draw_for_montage( fname, SF.da_wd, SF.interchannel_gap);
+        ED.sb_message(
+                str::sasprintf(
+                        "Wrote \"%s\"",
+                        agh::str::homedir2tilda(fname).c_str()));
 }
 
 
 void
 iSFPageSaveMontageAsSVG_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& ED = SF._p;
-	string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
-	string fname = str::sasprintf(
-			"%s/%s/montage-p%zu@%zu.svg",
-			j_dir.c_str(), ED.AghD(), SF.cur_vpage(), SF.vpagesize());
-
-	SF.draw_montage( fname);
-	ED.sb_message(
-		str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& ED = SF._p;
+        string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
+        string fname = str::sasprintf(
+                        "%s/%s/montage-p%zu@%zu.svg",
+                        j_dir.c_str(), ED.AghD(), SF.cur_vpage(), SF.vpagesize());
+
+        SF.draw_montage( fname);
+        ED.sb_message(
+                str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
 }
 
 
 void
 iSFPageExportSignal_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& r = SF.using_channel->crecording;
-	string fname_base = r.F().filename();
-	r.F().export_filtered(
-		SF.using_channel->h(),
-		str::sasprintf( "%s-filt.tsv", fname_base.c_str()));
-	r.F().export_original(
-		SF.using_channel->h(),
-		str::sasprintf( "%s-filt.tsv", fname_base.c_str()));
-	SF.sb_message(
-		str::sasprintf( "Wrote \"%s-{filt,orig}.tsv\"", fname_base.c_str()));
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& r = SF.using_channel->crecording;
+        string fname_base = r.F().filename();
+        r.F().export_filtered(
+                SF.using_channel->h(),
+                str::sasprintf( "%s-filt.tsv", fname_base.c_str()));
+        r.F().export_original(
+                SF.using_channel->h(),
+                str::sasprintf( "%s-filt.tsv", fname_base.c_str()));
+        SF.sb_message(
+                str::sasprintf( "Wrote \"%s-{filt,orig}.tsv\"", fname_base.c_str()));
 }
 
 
 
 void
 iSFPageUseThisScale_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto sane_signal_display_scale = SF.using_channel->signal_display_scale;
-	for_each( SF.channels.begin(), SF.channels.end(),
-		  [&] ( SScoringFacility::SChannel& H)
-		  {
-			  H.signal_display_scale = sane_signal_display_scale;
-		  });
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        auto sane_signal_display_scale = SF.using_channel->signal_display_scale;
+        for_each( SF.channels.begin(), SF.channels.end(),
+                  [&] ( SScoringFacility::SChannel& H)
+                  {
+                          H.signal_display_scale = sane_signal_display_scale;
+                  });
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
@@ -950,144 +950,144 @@ iSFPageUseThisScale_activate_cb(
 
 void
 iSFPageAnnotationDelete_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.over_annotations.size() == 1 ) {
-		if ( GTK_RESPONSE_YES
-		     == pop_question( SF.wSF,
-				      "<b>Deleting annotation</b>",
-				      "Sure you want to delete annotation\n <b>%s</b>?",
-				      SF.over_annotations.front()->label.c_str()) )
-			SF.using_channel->annotations.remove(
-				*SF.over_annotations.front());
-	} else {
-		if ( GTK_RESPONSE_YES
-		     == pop_question( SF.wSF,
-				      "<b>Deleting annotations</b>",
-				      "Sure you want to delete <b>%zu annotations</b>?",
-				      SF.over_annotations.size()) )
-			for ( auto &rm : SF.over_annotations )
-				SF.using_channel->annotations.remove( *rm);
-	}
-	SF._p.populate_mGlobalAnnotations();
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.over_annotations.size() == 1 ) {
+                if ( GTK_RESPONSE_YES
+                     == pop_question( SF.wSF,
+                                      "<b>Deleting annotation</b>",
+                                      "Sure you want to delete annotation\n <b>%s</b>?",
+                                      SF.over_annotations.front()->label.c_str()) )
+                        SF.using_channel->annotations.remove(
+                                *SF.over_annotations.front());
+        } else {
+                if ( GTK_RESPONSE_YES
+                     == pop_question( SF.wSF,
+                                      "<b>Deleting annotations</b>",
+                                      "Sure you want to delete <b>%zu annotations</b>?",
+                                      SF.over_annotations.size()) )
+                        for ( auto &rm : SF.over_annotations )
+                                SF.using_channel->annotations.remove( *rm);
+        }
+        SF._p.populate_mGlobalAnnotations();
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 void
 iSFPageAnnotationEdit_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	sigfile::SAnnotation *which =
-		(SF.over_annotations.size() == 1)
-		? SF.over_annotations.front()
-		: SF.interactively_choose_annotation();
-	if ( not which )
-		return;
-
-	gtk_entry_set_text( SF.eSFAnnotationLabel, which->label.c_str());
-	switch ( which->type ) {
-	case sigfile::SAnnotation::TType::phasic_event_spindle:
-		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle, TRUE);
-		break;
-	case sigfile::SAnnotation::TType::phasic_event_K_complex:
-		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex, TRUE);
-		break;
-	case sigfile::SAnnotation::TType::eyeblink:
-		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink, TRUE);
-		break;
-	case sigfile::SAnnotation::TType::plain:
-	default:
-		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypePlain, TRUE);
-		break;
-	}
-
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( SF.wSFAnnotationLabel) ) {
-		const char* new_label = gtk_entry_get_text( SF.eSFAnnotationLabel);
-		auto new_type =
-			gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
-			? sigfile::SAnnotation::TType::phasic_event_spindle
-			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
-			? sigfile::SAnnotation::TType::phasic_event_K_complex
-			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
-			? sigfile::SAnnotation::TType::eyeblink
-			: sigfile::SAnnotation::TType::plain;
-
-		if ( strlen(new_label) > 0 ) {
-			which->label = new_label;
-			which->type = new_type;
-			SF._p.populate_mGlobalAnnotations();
-			gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-		}
-	}
+        auto& SF = *(SScoringFacility*)userdata;
+        sigfile::SAnnotation *which =
+                (SF.over_annotations.size() == 1)
+                ? SF.over_annotations.front()
+                : SF.interactively_choose_annotation();
+        if ( not which )
+                return;
+
+        gtk_entry_set_text( SF.eSFAnnotationLabel, which->label.c_str());
+        switch ( which->type ) {
+        case sigfile::SAnnotation::TType::phasic_event_spindle:
+                gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle, TRUE);
+                break;
+        case sigfile::SAnnotation::TType::phasic_event_K_complex:
+                gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex, TRUE);
+                break;
+        case sigfile::SAnnotation::TType::eyeblink:
+                gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink, TRUE);
+                break;
+        case sigfile::SAnnotation::TType::plain:
+        default:
+                gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypePlain, TRUE);
+                break;
+        }
+
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( SF.wSFAnnotationLabel) ) {
+                const char* new_label = gtk_entry_get_text( SF.eSFAnnotationLabel);
+                auto new_type =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
+                        ? sigfile::SAnnotation::TType::phasic_event_spindle
+                        : gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
+                        ? sigfile::SAnnotation::TType::phasic_event_K_complex
+                        : gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
+                        ? sigfile::SAnnotation::TType::eyeblink
+                        : sigfile::SAnnotation::TType::plain;
+
+                if ( strlen(new_label) > 0 ) {
+                        which->label = new_label;
+                        which->type = new_type;
+                        SF._p.populate_mGlobalAnnotations();
+                        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+                }
+        }
 }
 
 
 void
 iSFPageAnnotationClearAll_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	char* chnamee = g_markup_escape_text( SF.using_channel->name(), -1);
-	if ( GTK_RESPONSE_YES
-	     == pop_question(
-		     SF.wSF,
-		     "<b>Deleting annotations</b>",
-		     "Sure you want to delete all annotations in channel <b>%s</b>?",
-		     chnamee) ) {
-
-		SF.using_channel->annotations.clear();
-
-		SF._p.populate_mGlobalAnnotations();
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	}
-	g_free( chnamee);
+        auto& SF = *(SScoringFacility*)userdata;
+
+        char* chnamee = g_markup_escape_text( SF.using_channel->name(), -1);
+        if ( GTK_RESPONSE_YES
+             == pop_question(
+                     SF.wSF,
+                     "<b>Deleting annotations</b>",
+                     "Sure you want to delete all annotations in channel <b>%s</b>?",
+                     chnamee) ) {
+
+                SF.using_channel->annotations.clear();
+
+                SF._p.populate_mGlobalAnnotations();
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        }
+        g_free( chnamee);
 }
 
 
 void
 iSFPageAnnotationGotoNext_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	if ( SF.cur_vpage() == SF.total_vpages()-1 )
-		return;
-	size_t p = SF.cur_vpage();
-	while ( ++p < SF.total_vpages() )
-		if ( SF.page_has_annotations( p, *SF.using_channel)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more annotations after this");
+        auto& SF = *(SScoringFacility*)userdata;
+
+        if ( SF.cur_vpage() == SF.total_vpages()-1 )
+                return;
+        size_t p = SF.cur_vpage();
+        while ( ++p < SF.total_vpages() )
+                if ( SF.page_has_annotations( p, *SF.using_channel)) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( p);
+                        return;
+                }
+        SF.sb_message( "No more annotations after this");
 }
 
 void
 iSFPageAnnotationGotoPrev_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	if ( SF.cur_vpage() == 0 )
-		return;
-	size_t p = SF.cur_vpage();
-	while ( --p != (size_t)-1 )
-		if ( SF.page_has_annotations( p, *SF.using_channel)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more annotations before this");
+        auto& SF = *(SScoringFacility*)userdata;
+
+        if ( SF.cur_vpage() == 0 )
+                return;
+        size_t p = SF.cur_vpage();
+        while ( --p != (size_t)-1 )
+                if ( SF.page_has_annotations( p, *SF.using_channel)) {
+                        SF.sb_clear();
+                        SF.set_cur_vpage( p);
+                        return;
+                }
+        SF.sb_message( "No more annotations before this");
 }
 
 
@@ -1097,147 +1097,147 @@ iSFPageAnnotationGotoPrev_activate_cb(
 
 void
 iSFICAPageMapIC_activate_cb(
-	GtkRadioMenuItem* i,
-	const gpointer u)
+        GtkRadioMenuItem* i,
+        const gpointer u)
 {
-	auto& SF = *(SScoringFacility*)u;
-	if ( SF.suppress_redraw )
-		return;
-	const char *label = gtk_menu_item_get_label( (GtkMenuItem*)i);
+        auto& SF = *(SScoringFacility*)u;
+        if ( SF.suppress_redraw )
+                return;
+        const char *label = gtk_menu_item_get_label( (GtkMenuItem*)i);
 
       // find target h
-	int target = -1;
-	int h = 0;
-	for ( auto H = SF.channels.begin(); H != SF.channels.end(); ++H, ++h )
-		if ( strcmp( H->name(), label) == 0 ) {
-			target = h;
-			break;
-		}
-	SF.ica_map[SF.using_ic].m = target;
+        int target = -1;
+        int h = 0;
+        for ( auto H = SF.channels.begin(); H != SF.channels.end(); ++H, ++h )
+                if ( strcmp( H->name(), label) == 0 ) {
+                        target = h;
+                        break;
+                }
+        SF.ica_map[SF.using_ic].m = target;
 
       // remove any previous mapping of the same target
-	h = 0;
-	for ( h = 0; h < (int)SF.ica_map.size(); ++h )
-		if ( SF.ica_map[h].m == target && h != SF.using_ic )
-			SF.ica_map[h].m = -1;
+        h = 0;
+        for ( h = 0; h < (int)SF.ica_map.size(); ++h )
+                if ( SF.ica_map[h].m == target && h != SF.using_ic )
+                        SF.ica_map[h].m = -1;
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
 // page selection
 void
 iSFPageSelectionMarkArtifact_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& H = SF.using_channel;
-	SBusyBlock bb (SF.wSF);
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& H = SF.using_channel;
+        SBusyBlock bb (SF.wSF);
 
-	H->mark_region_as_artifact( true);
+        H->mark_region_as_artifact( true);
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
 
 void
 iSFPageSelectionClearArtifact_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& H = SF.using_channel;
-	SBusyBlock bb (SF.wSF);
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& H = SF.using_channel;
+        SBusyBlock bb (SF.wSF);
 
-	H->mark_region_as_artifact( false);
+        H->mark_region_as_artifact( false);
 
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
 
 void
 iSFPageSelectionFindPattern_activate_cb(
-	GtkMenuItem*,
-	gpointer userdata)
+        GtkMenuItem*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& H = SF.using_channel;
-	H->mark_region_as_pattern();
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& H = SF.using_channel;
+        H->mark_region_as_pattern();
 }
 
 void
 iSFPageSelectionAnnotate_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	gtk_entry_set_text( SF.eSFAnnotationLabel, "");
+        gtk_entry_set_text( SF.eSFAnnotationLabel, "");
 
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( (GtkDialog*)SF.wSFAnnotationLabel) ) {
-		auto new_ann = gtk_entry_get_text( SF.eSFAnnotationLabel);
+        if ( GTK_RESPONSE_OK ==
+             gtk_dialog_run( (GtkDialog*)SF.wSFAnnotationLabel) ) {
+                auto new_ann = gtk_entry_get_text( SF.eSFAnnotationLabel);
 
-		using sigfile::SAnnotation;
-		auto type =
-			gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
-			? SAnnotation::TType::phasic_event_spindle
-			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
-			? SAnnotation::TType::phasic_event_K_complex
-			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
-			? SAnnotation::TType::eyeblink
-			: SAnnotation::TType::plain;
+                using sigfile::SAnnotation;
+                auto type =
+                        gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
+                        ? SAnnotation::TType::phasic_event_spindle
+                        : gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
+                        ? SAnnotation::TType::phasic_event_K_complex
+                        : gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
+                        ? SAnnotation::TType::eyeblink
+                        : SAnnotation::TType::plain;
 
-		if ( strlen( new_ann) == 0 && type == SAnnotation::TType::plain ) {
-			pop_ok_message( SF.wSF, "Give a plain annotation a name", "and try again.");
-			return;
-		}
+                if ( strlen( new_ann) == 0 && type == SAnnotation::TType::plain ) {
+                        pop_ok_message( SF.wSF, "Give a plain annotation a name", "and try again.");
+                        return;
+                }
 
-		SF.using_channel->mark_region_as_annotation( new_ann, type);
+                SF.using_channel->mark_region_as_annotation( new_ann, type);
 
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 
-		SF._p.populate_mGlobalAnnotations();
-	}
+                SF._p.populate_mGlobalAnnotations();
+        }
 }
 
 
 void
 iSFPageSelectionDrawCourse_toggled_cb(
-	GtkCheckMenuItem *cb,
-	const gpointer userdata)
+        GtkCheckMenuItem *cb,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.using_channel->draw_selection_course = gtk_check_menu_item_get_active( cb);
-	if ( SF.suppress_redraw )
-		return;
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.using_channel->draw_selection_course = gtk_check_menu_item_get_active( cb);
+        if ( SF.suppress_redraw )
+                return;
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageSelectionDrawEnvelope_toggled_cb(
-	GtkCheckMenuItem *cb,
-	const gpointer userdata)
+        GtkCheckMenuItem *cb,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.using_channel->draw_selection_envelope = gtk_check_menu_item_get_active( cb);
-	if ( SF.suppress_redraw )
-		return;
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.using_channel->draw_selection_envelope = gtk_check_menu_item_get_active( cb);
+        if ( SF.suppress_redraw )
+                return;
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPageSelectionDrawDzxdf_toggled_cb(
-	GtkCheckMenuItem *cb,
-	const gpointer userdata)
+        GtkCheckMenuItem *cb,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.using_channel->draw_selection_dzcdf = gtk_check_menu_item_get_active( cb);
-	if ( SF.suppress_redraw )
-		return;
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        SF.using_channel->draw_selection_dzcdf = gtk_check_menu_item_get_active( cb);
+        if ( SF.suppress_redraw )
+                return;
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 
@@ -1246,136 +1246,136 @@ iSFPageSelectionDrawDzxdf_toggled_cb(
 
 void
 iSFPowerExportRange_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& R = SF.using_channel->crecording;
-
-	if ( SF.using_channel->draw_psd ) {
-		string fname = str::sasprintf(
-			"%s-psd_%g-%g.tsv",
-			R.psd_profile.fname_base().c_str(), SF.using_channel->psd.from, SF.using_channel->psd.upto);
-		R.psd_profile.export_tsv(
-			SF.using_channel->psd.from, SF.using_channel->psd.upto,
-			fname);
-		SF.sb_message( str::sasprintf( "Wrote \"%s\"", str::homedir2tilda(fname).c_str()));
-	}
-	// if ( SF.using_channel->draw_swu ) {
-	// 	fname_base = R.swu_profile.fname_base();
-	// 	snprintf_buf( "%s-swu_%g-%g.tsv",
-	// 		      fname_base.c_str(), SF.using_channel->swu.from, SF.using_channel->swu.upto);
-	// 	R.swu_profile.export_tsv(
-	// 		SF.using_channel->swu.from, SF.using_channel->swu.upto,
-	// 		global::buf);
-	// 	fname_base = global::buf; // recycle
-	// }
-	// if ( SF.using_channel->draw_mc ) {
-	// 	fname_base = R.mc_profile.fname_base();
-	// 	snprintf_buf( "%s-mc_%g-%g.tsv",
-	// 		      fname_base.c_str(),
-	// 		      R.freq_from + R.bandwidth*(SF.using_channel->mc.bin),
-	// 		      R.freq_from + R.bandwidth*(SF.using_channel->mc.bin+1));
-	// 	R.mc_profile.export_tsv(
-	// 		SF.using_channel->mc.bin,
-	// 		global::buf);
-	// 	fname_base = global::buf;
-	// }
+        auto& SF = *(SScoringFacility*)userdata;
+        auto& R = SF.using_channel->crecording;
+
+        if ( SF.using_channel->draw_psd ) {
+                string fname = str::sasprintf(
+                        "%s-psd_%g-%g.tsv",
+                        R.psd_profile.fname_base().c_str(), SF.using_channel->psd.from, SF.using_channel->psd.upto);
+                R.psd_profile.export_tsv(
+                        SF.using_channel->psd.from, SF.using_channel->psd.upto,
+                        fname);
+                SF.sb_message( str::sasprintf( "Wrote \"%s\"", str::homedir2tilda(fname).c_str()));
+        }
+        // if ( SF.using_channel->draw_swu ) {
+        //         fname_base = R.swu_profile.fname_base();
+        //         snprintf_buf( "%s-swu_%g-%g.tsv",
+        //                       fname_base.c_str(), SF.using_channel->swu.from, SF.using_channel->swu.upto);
+        //         R.swu_profile.export_tsv(
+        //                 SF.using_channel->swu.from, SF.using_channel->swu.upto,
+        //                 global::buf);
+        //         fname_base = global::buf; // recycle
+        // }
+        // if ( SF.using_channel->draw_mc ) {
+        //         fname_base = R.mc_profile.fname_base();
+        //         snprintf_buf( "%s-mc_%g-%g.tsv",
+        //                       fname_base.c_str(),
+        //                       R.freq_from + R.bandwidth*(SF.using_channel->mc.bin),
+        //                       R.freq_from + R.bandwidth*(SF.using_channel->mc.bin+1));
+        //         R.mc_profile.export_tsv(
+        //                 SF.using_channel->mc.bin,
+        //                 global::buf);
+        //         fname_base = global::buf;
+        // }
 }
 
 void
 iSFPowerExportAll_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	const auto& SF = *(SScoringFacility*)userdata;
-	auto& R = SF.using_channel->crecording;
-
-	string fname_base;
-	if ( SF.using_channel->draw_psd ) {
-		string fname = str::sasprintf(
-			"%s-psd.tsv",
-			SF.using_channel->crecording.psd_profile.fname_base().c_str());
-		R.psd_profile.export_tsv( fname);
-		SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
-	}
-	if ( SF.using_channel->draw_swu ) {
-		string fname = str::sasprintf(
-			"%s-swu.tsv",
-			SF.using_channel->crecording.swu_profile.fname_base().c_str());
-		R.swu_profile.export_tsv( fname);
-		SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
-	}
-	if ( SF.using_channel->draw_mc ) {
-		string fname = str::sasprintf(
-			"%s-psd.tsv",
-			SF.using_channel->crecording.psd_profile.fname_base().c_str());
-		R.psd_profile.export_tsv( fname);
-		SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
-	}
+        const auto& SF = *(SScoringFacility*)userdata;
+        auto& R = SF.using_channel->crecording;
+
+        string fname_base;
+        if ( SF.using_channel->draw_psd ) {
+                string fname = str::sasprintf(
+                        "%s-psd.tsv",
+                        SF.using_channel->crecording.psd_profile.fname_base().c_str());
+                R.psd_profile.export_tsv( fname);
+                SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
+        }
+        if ( SF.using_channel->draw_swu ) {
+                string fname = str::sasprintf(
+                        "%s-swu.tsv",
+                        SF.using_channel->crecording.swu_profile.fname_base().c_str());
+                R.swu_profile.export_tsv( fname);
+                SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
+        }
+        if ( SF.using_channel->draw_mc ) {
+                string fname = str::sasprintf(
+                        "%s-psd.tsv",
+                        SF.using_channel->crecording.psd_profile.fname_base().c_str());
+                R.psd_profile.export_tsv( fname);
+                SF.sb_message( str::sasprintf( "Wrote \"%s\"", agh::str::homedir2tilda(fname).c_str()));
+        }
 }
 
 void
 iSFPowerSmooth_toggled_cb(
-	GtkCheckMenuItem *menuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *menuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	if ( likely (SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) ) {
-		SF.using_channel->resample_power = (bool)gtk_check_menu_item_get_active( menuitem);
-		SF.using_channel->get_psd_course();
-		SF.using_channel->get_psd_in_bands();
-		SF.using_channel->get_swu_course();
-		SF.using_channel->get_mc_course();
-		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
-	}
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        if ( likely (SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) ) {
+                SF.using_channel->resample_power = (bool)gtk_check_menu_item_get_active( menuitem);
+                SF.using_channel->get_psd_course();
+                SF.using_channel->get_psd_in_bands();
+                SF.using_channel->get_swu_course();
+                SF.using_channel->get_mc_course();
+                gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        }
 }
 
 void
 iSFPowerDrawBands_toggled_cb(
-	GtkCheckMenuItem *menuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *menuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	SF.using_channel->draw_psd_bands = (bool)gtk_check_menu_item_get_active( menuitem);
-	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_psd_bands = (bool)gtk_check_menu_item_get_active( menuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
 void
 iSFPowerUseThisScale_activate_cb(
-	GtkMenuItem*,
-	const gpointer userdata)
+        GtkMenuItem*,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-
-	auto	sane_psd_display_scale = SF.using_channel->psd.display_scale,
-		sane_swu_display_scale = SF.using_channel->swu.display_scale,
-		sane_mc_display_scale  = SF.using_channel->mc.display_scale;
-	for ( auto& H : SF.channels ) {
-		H.psd.display_scale = sane_psd_display_scale;
-		H.swu.display_scale = sane_swu_display_scale;
-		H.mc.display_scale  = sane_mc_display_scale;
-	}
-	SF.queue_redraw_all();
+        auto& SF = *(SScoringFacility*)userdata;
+
+        auto        sane_psd_display_scale = SF.using_channel->psd.display_scale,
+                sane_swu_display_scale = SF.using_channel->swu.display_scale,
+                sane_mc_display_scale  = SF.using_channel->mc.display_scale;
+        for ( auto& H : SF.channels ) {
+                H.psd.display_scale = sane_psd_display_scale;
+                H.swu.display_scale = sane_swu_display_scale;
+                H.mc.display_scale  = sane_mc_display_scale;
+        }
+        SF.queue_redraw_all();
 }
 
 void
 iSFPowerAutoscale_toggled_cb(
-	GtkCheckMenuItem *menuitem,
-	const gpointer userdata)
+        GtkCheckMenuItem *menuitem,
+        const gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_redraw )
-		return;
-	auto& H = *SF.using_channel;
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        auto& H = *SF.using_channel;
 
-	H.autoscale_profile = (bool)gtk_check_menu_item_get_active( menuitem);
+        H.autoscale_profile = (bool)gtk_check_menu_item_get_active( menuitem);
 
-	SF.queue_redraw_all();
+        SF.queue_redraw_all();
 }
 
 
@@ -1383,7 +1383,7 @@ iSFPowerAutoscale_toggled_cb(
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/sf.cc b/upstream/src/aghermann/ui/sf/sf.cc
index ae08c4a..4d3c59a 100644
--- a/upstream/src/aghermann/ui/sf/sf.cc
+++ b/upstream/src/aghermann/ui/sf/sf.cc
@@ -27,16 +27,16 @@
 using namespace std;
 using namespace agh::ui;
 
-size_t	SScoringFacility::IntersignalSpace = 120,
-	SScoringFacility::HypnogramHeight  =  40,
-	SScoringFacility::EMGProfileHeight =  30;
+size_t        SScoringFacility::IntersignalSpace = 120,
+        SScoringFacility::HypnogramHeight  =  40,
+        SScoringFacility::EMGProfileHeight =  30;
 
 
 // class SScoringFacility
 
 const array<unsigned, 9>
-	SScoringFacility::DisplayPageSizeValues = {
-	{4, 5, 10, 15, 20, 30, 60, 60*3, 60*5}
+        SScoringFacility::DisplayPageSizeValues = {
+        {4, 5, 10, 15, 20, 30, 60, 60*3, 60*5}
 };
 
 size_t
@@ -44,10 +44,10 @@ __attribute__ ((pure))
 SScoringFacility::
 figure_display_pagesize_item( const size_t seconds)
 {
-	size_t i = 0;
-	while ( i < DisplayPageSizeValues.size()-1 && DisplayPageSizeValues[i] < seconds )
-		++i;
-	return i;
+        size_t i = 0;
+        while ( i < DisplayPageSizeValues.size()-1 && DisplayPageSizeValues[i] < seconds )
+                ++i;
+        return i;
 }
 
 
@@ -55,297 +55,297 @@ using agh::confval::SValidator;
 
 SScoringFacility::
 SScoringFacility (agh::CSubject& J,
-		  const string& D, const string& E,
-		  SExpDesignUI& parent)
+                  const string& D, const string& E,
+                  SExpDesignUI& parent)
       : _p (parent),
-	_csubject (J),
-	_session (D),
-	_sepisode (J.measurements.at(D)[E]),
-	hypnogram_button_down (false),
-	artifacts_dialog_shown (false),
-	mode (TMode::scoring),
-	crosshair_at (10),
-	show_cur_pos_time_relative (false),
-	draw_crosshair (false),
-	alt_hypnogram (true),
-	pagesize_item (figure_display_pagesize_item( parent.pagesize())),
-	_cur_page (0),
-	_cur_vpage (0),
-	skirting_run_per1 (.04),
-	ica (nullptr),
-	interchannel_gap (IntersignalSpace),
-	n_hidden (0),
-	config_keys_b ({
-		SValidator<bool>("show_cur_pos_time_relative",	&show_cur_pos_time_relative),
-		SValidator<bool>("draw.crosshair",		&draw_crosshair),
-		SValidator<bool>("draw.alt_hypnogram",		&alt_hypnogram),
-	}),
-	config_keys_d ({
-		SValidator<int>("cur_vpage",			(int*)&_cur_vpage,	SValidator<int>::SVFRangeIn (0, INT_MAX)),
-		SValidator<int>("pagesize_item",		(int*)&pagesize_item,	SValidator<int>::SVFRangeIn (0, DisplayPageSizeValues.size()-1)),
-	}),
-	config_keys_g ({
-		SValidator<float>("montage.interchannel_gap",	&interchannel_gap,	SValidator<float>::SVFRangeIn (0., 400.)),
-		SValidator<float>("montage.height",		&da_ht,			SValidator<float>::SVFRangeIn (10., 4000.)),
-	}),
-	_patterns_d (nullptr),
-	_filters_d (nullptr),
-	_phasediff_d (nullptr),
-	_artifacts_d (nullptr),
-	_artifacts_simple_d (nullptr),
-	using_channel (nullptr),
-	da_wd (800), // gets properly set in a configure_event cb
-	da_ht (NAN) // bad value, to be estimated unless previously saved
+        _csubject (J),
+        _session (D),
+        _sepisode (J.measurements.at(D)[E]),
+        hypnogram_button_down (false),
+        artifacts_dialog_shown (false),
+        mode (TMode::scoring),
+        crosshair_at (10),
+        show_cur_pos_time_relative (false),
+        draw_crosshair (false),
+        alt_hypnogram (true),
+        pagesize_item (figure_display_pagesize_item( parent.pagesize())),
+        _cur_page (0),
+        _cur_vpage (0),
+        skirting_run_per1 (.04),
+        ica (nullptr),
+        interchannel_gap (IntersignalSpace),
+        n_hidden (0),
+        config_keys_b ({
+                SValidator<bool>("show_cur_pos_time_relative",        &show_cur_pos_time_relative),
+                SValidator<bool>("draw.crosshair",                &draw_crosshair),
+                SValidator<bool>("draw.alt_hypnogram",                &alt_hypnogram),
+        }),
+        config_keys_d ({
+                SValidator<int>("cur_vpage",                        (int*)&_cur_vpage,        SValidator<int>::SVFRangeIn (0, INT_MAX)),
+                SValidator<int>("pagesize_item",                (int*)&pagesize_item,        SValidator<int>::SVFRangeIn (0, DisplayPageSizeValues.size()-1)),
+        }),
+        config_keys_g ({
+                SValidator<float>("montage.interchannel_gap",        &interchannel_gap,        SValidator<float>::SVFRangeIn (0., 400.)),
+                SValidator<float>("montage.height",                &da_ht,                        SValidator<float>::SVFRangeIn (10., 4000.)),
+        }),
+        _patterns_d (nullptr),
+        _filters_d (nullptr),
+        _phasediff_d (nullptr),
+        _artifacts_d (nullptr),
+        _artifacts_simple_d (nullptr),
+        using_channel (nullptr),
+        da_wd (800), // gets properly set in a configure_event cb
+        da_ht (NAN) // bad value, to be estimated unless previously saved
 {
-	SBusyBlock bb (_p.wMainWindow);
+        SBusyBlock bb (_p.wMainWindow);
 
       // complete widget construction
       // histogram -> scores
-	get_hypnogram();
-	calculate_scored_percent();
+        get_hypnogram();
+        calculate_scored_percent();
 
       // add channels, EEGs first, then EOG, EMG, then the rest
-	{
-		size_t	y = interchannel_gap / 2.;
-		int	seq = 1;
-		for ( auto &H : _sepisode.recordings )
-			if ( H.second.signal_type() == sigfile::SChannel::TType::eeg ) {
-				_p.sb_message( snprintf_buf( "Reading and processing EEG channel %s ...", H.first.c_str()));
-				channels.emplace_back( H.second, *this, y, seq++);
-				y += interchannel_gap;
-			}
-		for ( auto &H : _sepisode.recordings )
-			if ( H.second.signal_type() == sigfile::SChannel::TType::eog ) {
-				_p.sb_message( snprintf_buf( "Reading and processing EOG channel %s ...", H.first.c_str()));
-				channels.emplace_back( H.second, *this, y, seq++);
-				y += interchannel_gap;
-			}
-		for ( auto &H : _sepisode.recordings )
-			if ( H.second.signal_type() == sigfile::SChannel::TType::emg ) {
-				_p.sb_message( snprintf_buf( "Reading and processing EMG channel %s ...", H.first.c_str()));
-				channels.emplace_back( H.second, *this, y, seq++);
-				y += interchannel_gap;
-			}
-		for ( auto &H : _sepisode.recordings ) {
-			auto type = H.second.signal_type();
-			if ( type != sigfile::SChannel::TType::eeg &&
-			     type != sigfile::SChannel::TType::eog &&
-			     type != sigfile::SChannel::TType::emg &&
-			     type != sigfile::SChannel::TType::embedded_annotation ) {
-				_p.sb_message( snprintf_buf( "Reading and processing channel %s ...", H.first.c_str()));
-				channels.emplace_back( H.second, *this, y, seq++);
-				y += interchannel_gap;
-			}
-		}
-	}
-	if ( channels.empty() )
-		throw invalid_argument( string ("No channels found for combination (") + J.id + ", " + D + ", " + E + ")");
+        {
+                size_t        y = interchannel_gap / 2.;
+                int        seq = 1;
+                for ( auto &H : _sepisode.recordings )
+                        if ( H.second.signal_type() == sigfile::SChannel::TType::eeg ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EEG channel %s ...", H.first.c_str()));
+                                channels.emplace_back( H.second, *this, y, seq++);
+                                y += interchannel_gap;
+                        }
+                for ( auto &H : _sepisode.recordings )
+                        if ( H.second.signal_type() == sigfile::SChannel::TType::eog ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EOG channel %s ...", H.first.c_str()));
+                                channels.emplace_back( H.second, *this, y, seq++);
+                                y += interchannel_gap;
+                        }
+                for ( auto &H : _sepisode.recordings )
+                        if ( H.second.signal_type() == sigfile::SChannel::TType::emg ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EMG channel %s ...", H.first.c_str()));
+                                channels.emplace_back( H.second, *this, y, seq++);
+                                y += interchannel_gap;
+                        }
+                for ( auto &H : _sepisode.recordings ) {
+                        auto type = H.second.signal_type();
+                        if ( type != sigfile::SChannel::TType::eeg &&
+                             type != sigfile::SChannel::TType::eog &&
+                             type != sigfile::SChannel::TType::emg &&
+                             type != sigfile::SChannel::TType::embedded_annotation ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing channel %s ...", H.first.c_str()));
+                                channels.emplace_back( H.second, *this, y, seq++);
+                                y += interchannel_gap;
+                        }
+                }
+        }
+        if ( channels.empty() )
+                throw invalid_argument( string ("No channels found for combination (") + J.id + ", " + D + ", " + E + ")");
 
       // collect common annotations
-	for ( auto& H : channels )
-		for ( auto& A : H.crecording.F().annotations() )
-			if ( not any_of( common_annotations.begin(), common_annotations.end(),
-					 [&A]( const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a1)
-					 { return *a1.second == A; }) )
-				common_annotations.push_back( {&H.crecording.F(), &A}); // bitch&
-	common_annotations.sort(
-	      []( const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a1,
-		  const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a2)
-	      { return *a1.second < *a2.second; });
+        for ( auto& H : channels )
+                for ( auto& A : H.crecording.F().annotations() )
+                        if ( not any_of( common_annotations.begin(), common_annotations.end(),
+                                         [&A]( const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a1)
+                                         { return *a1.second == A; }) )
+                                common_annotations.push_back( {&H.crecording.F(), &A}); // bitch&
+        common_annotations.sort(
+              []( const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a1,
+                  const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a2)
+              { return *a1.second < *a2.second; });
 
       // count n_eeg_channels
-	n_eeg_channels =
-		count_if( channels.begin(), channels.end(),
-			  [] (const SChannel& h)
-			  { return h.schannel().type() == sigfile::SChannel::TType::eeg; });
+        n_eeg_channels =
+                count_if( channels.begin(), channels.end(),
+                          [] (const SChannel& h)
+                          { return h.schannel().type() == sigfile::SChannel::TType::eeg; });
 
       // load montage, recalibrate display scales as necessary
-	load_montage();
-	if ( !isfinite(da_ht) )
-		estimate_montage_height();
-
-	for ( auto &h : channels ) {
-		if ( not isfinite(h.signal_display_scale) )
-			h.signal_display_scale =
-				agh::alg::calibrate_display_scale(
-					h.signal_filtered,
-					vpagesize() * h.samplerate() * min (h.crecording.total_pages(), (size_t)10),
-					interchannel_gap / 2);
-		agh::alg::ensure_within( h.signal_display_scale, 1e-6, 1e6);
-
-		if ( h.schannel().type() == sigfile::SChannel::TType::eeg ) {
-		      // calibrate profile display scales
-			if ( not isfinite(h.psd.display_scale) )
-				h.psd.display_scale =
-					agh::alg::calibrate_display_scale(
-						h.psd.course_in_bands[metrics::TBand::delta],
-						h.psd.course.size(),
-						interchannel_gap / 4);
-			agh::alg::ensure_within( h.psd.display_scale, 1e-9, 1e9);
-
-			if ( not isfinite(h.mc.display_scale) )
-				h.mc.display_scale =
-					agh::alg::calibrate_display_scale(
-						h.mc.course,
-						h.mc.course.size(),
-						interchannel_gap / 4);
-			agh::alg::ensure_within( h.mc.display_scale, 1e-9, 1e9);
-
-			if ( not isfinite(h.swu.display_scale) )
-				h.swu.display_scale =
-					agh::alg::calibrate_display_scale(
-						h.swu.course,
-						h.swu.course.size(),
-						interchannel_gap / 4);
-			agh::alg::ensure_within( h.swu.display_scale, 1e-9, 1e9);
-		}
-
-		h._put_selection();
-	}
+        load_montage();
+        if ( !isfinite(da_ht) )
+                estimate_montage_height();
+
+        for ( auto &h : channels ) {
+                if ( not isfinite(h.signal_display_scale) )
+                        h.signal_display_scale =
+                                agh::alg::calibrate_display_scale(
+                                        h.signal_filtered,
+                                        vpagesize() * h.samplerate() * min (h.crecording.total_pages(), (size_t)10),
+                                        interchannel_gap / 2);
+                agh::alg::ensure_within( h.signal_display_scale, 1e-6, 1e6);
+
+                if ( h.schannel().type() == sigfile::SChannel::TType::eeg ) {
+                      // calibrate profile display scales
+                        if ( not isfinite(h.psd.display_scale) )
+                                h.psd.display_scale =
+                                        agh::alg::calibrate_display_scale(
+                                                h.psd.course_in_bands[metrics::TBand::delta],
+                                                h.psd.course.size(),
+                                                interchannel_gap / 4);
+                        agh::alg::ensure_within( h.psd.display_scale, 1e-9, 1e9);
+
+                        if ( not isfinite(h.mc.display_scale) )
+                                h.mc.display_scale =
+                                        agh::alg::calibrate_display_scale(
+                                                h.mc.course,
+                                                h.mc.course.size(),
+                                                interchannel_gap / 4);
+                        agh::alg::ensure_within( h.mc.display_scale, 1e-9, 1e9);
+
+                        if ( not isfinite(h.swu.display_scale) )
+                                h.swu.display_scale =
+                                        agh::alg::calibrate_display_scale(
+                                                h.swu.course,
+                                                h.swu.course.size(),
+                                                interchannel_gap / 4);
+                        agh::alg::ensure_within( h.swu.display_scale, 1e-9, 1e9);
+                }
+
+                h._put_selection();
+        }
 
       // set up other controls
-	// suppress flicker
-	suppress_redraw = true;
-
-	// set window title
-	gtk_window_set_title(
-		(GtkWindow*)wSF,
-		snprintf_buf( "Scoring: %s’s %s in %s", J.name.c_str(), E.c_str(), D.c_str()));
-
-	// align empty area next to EMG profile with spectrum panes vertically
-	// g_object_set( (GObject*)cSFSleepStageStats,
-	// 	      "width-request", settings::WidgetSize_SFSpectrumWidth,
-	// 	      NULL);
-	g_object_set( (GObject*)daSFHypnogram,
-		      "height-request", HypnogramHeight,
-		      NULL);
-	g_object_set( (GObject*)daSFMontage,
-		      "height-request", (int)da_ht,
-		      NULL);
-
-	// set tooltip
-	set_tooltip( TTipIdx::scoring_mode);
-
-	// grey out phasediff button if there are fewer than 2 EEG channels
-	gtk_widget_set_sensitive(
-		(GtkWidget*)iSFMontagePhaseDiff,
-		(n_eeg_channels >= 2));
-
-	// desensitize iSFAcceptAndTakeNext unless there are more episodes
-	gtk_widget_set_sensitive(
-		(GtkWidget*)iSFMontageCloseAndNext,
-		J.measurements.at(D).episodes.back().name() != E);
-	// (de)sensitize various toolbar toggle buttons
-	gtk_toggle_button_set_active(
-		bSFDrawCrosshair,
-		(gboolean)draw_crosshair);
-
-	// add items to iSFPageHidden
-	for ( auto &H : channels )
-		if ( H.hidden ) {
-			++n_hidden;
-			auto item = (GtkWidget*)(H.menu_item_when_hidden =
-						 (GtkMenuItem*)gtk_menu_item_new_with_label( H.name()));
-			g_object_set(
-				(GObject*)item,
-				"visible", TRUE,
-				NULL);
-			g_signal_connect(
-				(GObject*)item,
-				"activate", (GCallback)iSFPageShowHidden_activate_cb,
-				this);
-			gtk_container_add(
-				(GtkContainer*)iiSFPageHidden,
-				item);
-		}
-	// if there's too many visible, suggest to hide some
-	if ( channels.size() > 10 && n_hidden == 0 )
-		pop_ok_message(
-			wSF, "<b>Montage seems overcrowded</b>",
-			"The recording you are about to view has %zu channels.\n"
-			"You can hide some using appropriate channel context menus.", channels.size() - n_hidden);
-
-	{
-		int bar_height;
-		gtk_widget_get_size_request( (GtkWidget*)cSFControlBar, NULL, &bar_height);
-		int optimal_win_height = min(
-			(int)(HypnogramHeight + bar_height + da_ht + 100),
-			(int)(gdk_screen_get_height( gdk_screen_get_default()) * .95));
-		gtk_window_set_default_size(
-			wSF,
-			gdk_screen_get_width( gdk_screen_get_default()) * .90,
-			optimal_win_height);
-	}
-
-	// set current page and page size
-	set_cur_vpage( _cur_vpage, true);
-	set_vpagesize_item( pagesize_item, true); // will do set_cur_vpage one more time, but ok
-
-	suppress_redraw = false;
-	gtk_widget_show_all( (GtkWidget*)wSF);
-
-	// display proper control bar (has to be done on a shown widget)
-	gtk_widget_set_visible( (GtkWidget*)cSFScoringModeContainer, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)cSFICAModeContainer, FALSE);
-
-	queue_redraw_all();
+        // suppress flicker
+        suppress_redraw = true;
+
+        // set window title
+        gtk_window_set_title(
+                (GtkWindow*)wSF,
+                snprintf_buf( "Scoring: %s’s %s in %s", J.name.c_str(), E.c_str(), D.c_str()));
+
+        // align empty area next to EMG profile with spectrum panes vertically
+        // g_object_set( (GObject*)cSFSleepStageStats,
+        //               "width-request", settings::WidgetSize_SFSpectrumWidth,
+        //               NULL);
+        g_object_set( (GObject*)daSFHypnogram,
+                      "height-request", HypnogramHeight,
+                      NULL);
+        g_object_set( (GObject*)daSFMontage,
+                      "height-request", (int)da_ht,
+                      NULL);
+
+        // set tooltip
+        set_tooltip( TTipIdx::scoring_mode);
+
+        // grey out phasediff button if there are fewer than 2 EEG channels
+        gtk_widget_set_sensitive(
+                (GtkWidget*)iSFMontagePhaseDiff,
+                (n_eeg_channels >= 2));
+
+        // desensitize iSFAcceptAndTakeNext unless there are more episodes
+        gtk_widget_set_sensitive(
+                (GtkWidget*)iSFMontageCloseAndNext,
+                J.measurements.at(D).episodes.back().name() != E);
+        // (de)sensitize various toolbar toggle buttons
+        gtk_toggle_button_set_active(
+                bSFDrawCrosshair,
+                (gboolean)draw_crosshair);
+
+        // add items to iSFPageHidden
+        for ( auto &H : channels )
+                if ( H.hidden ) {
+                        ++n_hidden;
+                        auto item = (GtkWidget*)(H.menu_item_when_hidden =
+                                                 (GtkMenuItem*)gtk_menu_item_new_with_label( H.name()));
+                        g_object_set(
+                                (GObject*)item,
+                                "visible", TRUE,
+                                NULL);
+                        g_signal_connect(
+                                (GObject*)item,
+                                "activate", (GCallback)iSFPageShowHidden_activate_cb,
+                                this);
+                        gtk_container_add(
+                                (GtkContainer*)iiSFPageHidden,
+                                item);
+                }
+        // if there's too many visible, suggest to hide some
+        if ( channels.size() > 10 && n_hidden == 0 )
+                pop_ok_message(
+                        wSF, "<b>Montage seems overcrowded</b>",
+                        "The recording you are about to view has %zu channels.\n"
+                        "You can hide some using appropriate channel context menus.", channels.size() - n_hidden);
+
+        {
+                int bar_height;
+                gtk_widget_get_size_request( (GtkWidget*)cSFControlBar, NULL, &bar_height);
+                int optimal_win_height = min(
+                        (int)(HypnogramHeight + bar_height + da_ht + 100),
+                        (int)(gdk_screen_get_height( gdk_screen_get_default()) * .95));
+                gtk_window_set_default_size(
+                        wSF,
+                        gdk_screen_get_width( gdk_screen_get_default()) * .90,
+                        optimal_win_height);
+        }
+
+        // set current page and page size
+        set_cur_vpage( _cur_vpage, true);
+        set_vpagesize_item( pagesize_item, true); // will do set_cur_vpage one more time, but ok
+
+        suppress_redraw = false;
+        gtk_widget_show_all( (GtkWidget*)wSF);
+
+        // display proper control bar (has to be done on a shown widget)
+        gtk_widget_set_visible( (GtkWidget*)cSFScoringModeContainer, TRUE);
+        gtk_widget_set_visible( (GtkWidget*)cSFICAModeContainer, FALSE);
+
+        queue_redraw_all();
 
       // advise parent we are open
-	_p.open_scoring_facilities.push_front( this);
-	for ( auto x : {(GtkWidget*)_p.iExpRefresh,
-			(GtkWidget*)_p.iExpClose,
-			(GtkWidget*)_p.tSettings} )
-		gtk_widget_set_visible( x, FALSE);
-
-	// tell main window we are done (so it can start another instance of scoring facility)
-	_p.sb_clear();
+        _p.open_scoring_facilities.push_front( this);
+        for ( auto x : {(GtkWidget*)_p.iExpRefresh,
+                        (GtkWidget*)_p.iExpClose,
+                        (GtkWidget*)_p.tSettings} )
+                gtk_widget_set_visible( x, FALSE);
+
+        // tell main window we are done (so it can start another instance of scoring facility)
+        _p.sb_clear();
 }
 
 
 SScoringFacility::
 ~SScoringFacility ()
 {
-	// put scores
-	put_hypnogram();
-
-	// save montage
-	save_montage();
-
-	// cause repopulate
-	redraw_ssubject_timeline();
-
-	_p.open_scoring_facilities.remove( this);
-	bool enable_expd_destructive_controls =
-		_p.open_scoring_facilities.empty();
-	for ( auto x : {(GtkWidget*)_p.iExpRefresh,
-			(GtkWidget*)_p.iExpClose,
-			(GtkWidget*)_p.tSettings} )
-		gtk_widget_set_visible(
-			(GtkWidget*)x,
-			enable_expd_destructive_controls);
-
-	if ( ica )
-		delete ica;
-
-	if ( _artifacts_d )
-		delete _artifacts_d;
-	if ( _patterns_d )
-		delete _patterns_d;
-	if ( _phasediff_d )
-		delete _phasediff_d;
-	if ( _filters_d )
-		delete _filters_d;
+        // put scores
+        put_hypnogram();
+
+        // save montage
+        save_montage();
+
+        // cause repopulate
+        redraw_ssubject_timeline();
+
+        _p.open_scoring_facilities.remove( this);
+        bool enable_expd_destructive_controls =
+                _p.open_scoring_facilities.empty();
+        for ( auto x : {(GtkWidget*)_p.iExpRefresh,
+                        (GtkWidget*)_p.iExpClose,
+                        (GtkWidget*)_p.tSettings} )
+                gtk_widget_set_visible(
+                        (GtkWidget*)x,
+                        enable_expd_destructive_controls);
+
+        if ( ica )
+                delete ica;
+
+        if ( _artifacts_d )
+                delete _artifacts_d;
+        if ( _patterns_d )
+                delete _patterns_d;
+        if ( _phasediff_d )
+                delete _phasediff_d;
+        if ( _filters_d )
+                delete _filters_d;
 }
 
 void
 SScoringFacility::
 redraw_ssubject_timeline() const
 {
-	auto j = _p.subject_presentation_by_csubject( _csubject);
-	if ( j ) {
-		j->create_cprofile();
-		gtk_widget_queue_draw( (GtkWidget*)j->da);
-	}
+        auto j = _p.subject_presentation_by_csubject( _csubject);
+        if ( j ) {
+                j->create_cprofile();
+                gtk_widget_queue_draw( (GtkWidget*)j->da);
+        }
 }
 
 
@@ -354,20 +354,20 @@ SScoringFacility::SChannel&
 SScoringFacility::
 operator[]( const string& ch)
 {
-	auto iter = find( channels.begin(), channels.end(), ch);
-	if ( unlikely (iter == channels.end()) )
-		throw invalid_argument( string ("SScoringFacility::operator[]: bad channel: ") + ch);
-	return *iter;
+        auto iter = find( channels.begin(), channels.end(), ch);
+        if ( unlikely (iter == channels.end()) )
+                throw invalid_argument( string ("SScoringFacility::operator[]: bad channel: ") + ch);
+        return *iter;
 }
 
 SScoringFacility::SChannel&
 SScoringFacility::
 channel_by_idx( size_t i)
 {
-	for ( auto &H : channels )
-		if ( i-- == 0 )
-			return H;
-	throw invalid_argument( string ("SScoringFacility::operator[]: bad channel idx: ") + to_string(i));
+        for ( auto &H : channels )
+                if ( i-- == 0 )
+                        return H;
+        throw invalid_argument( string ("SScoringFacility::operator[]: bad channel idx: ") + to_string(i));
 }
 
 
@@ -376,22 +376,22 @@ __attribute__ ((pure))
 SScoringFacility::
 channel_near( const int y)
 {
-	int nearest = INT_MAX, thisy;
-	auto nearest_h = &channels.front();
-	for ( auto &H : channels ) {
-		if ( H.hidden )
-			continue;
-		thisy = (y > H.zeroy) ? y - H.zeroy : H.zeroy - y;
-			// if ( thisy < nearest )
-			// 	return &const_cast<SChannel&>(H);
-			// else
-			// 	return nearest_h;
-		if ( thisy < nearest ) {
-			nearest = thisy;
-			nearest_h = &H;
-		}
-	}
-	return nearest_h;
+        int nearest = INT_MAX, thisy;
+        auto nearest_h = &channels.front();
+        for ( auto &H : channels ) {
+                if ( H.hidden )
+                        continue;
+                thisy = (y > H.zeroy) ? y - H.zeroy : H.zeroy - y;
+                        // if ( thisy < nearest )
+                        //         return &const_cast<SChannel&>(H);
+                        // else
+                        //         return nearest_h;
+                if ( thisy < nearest ) {
+                        nearest = thisy;
+                        nearest_h = &H;
+                }
+        }
+        return nearest_h;
 }
 
 
@@ -402,9 +402,9 @@ void
 SScoringFacility::
 update_all_channels_profile_display_scale()
 {
-	for ( auto& H : channels )
-		if ( H.schannel().is_fftable() )
-			H.update_profile_display_scales();
+        for ( auto& H : channels )
+                if ( H.schannel().is_fftable() )
+                        H.update_profile_display_scales();
 }
 
 
@@ -413,21 +413,21 @@ void
 SScoringFacility::
 get_hypnogram()
 {
-	// just get from the first source,
-	// trust other sources are no different
-	auto &F = _sepisode.sources.front();
-	hypnogram.resize( F.sigfile::CHypnogram::pages());
-	for ( size_t p = 0; p < F.pages(); ++p )
-		hypnogram[p] = F[p].score_code();
+        // just get from the first source,
+        // trust other sources are no different
+        auto &F = _sepisode.sources.front();
+        hypnogram.resize( F.sigfile::CHypnogram::pages());
+        for ( size_t p = 0; p < F.pages(); ++p )
+                hypnogram[p] = F[p].score_code();
 }
 void
 SScoringFacility::
 put_hypnogram()
 {
-	// but put to all
-	for( auto &F : _sepisode.sources )
-		for ( size_t p = 0; p < F.sigfile::CHypnogram::pages(); ++p )
-			F[p].mark( hypnogram[p]);
+        // but put to all
+        for( auto &F : _sepisode.sources )
+                for ( size_t p = 0; p < F.sigfile::CHypnogram::pages(); ++p )
+                        F[p].mark( hypnogram[p]);
 }
 
 
@@ -437,27 +437,27 @@ void
 SScoringFacility::
 calculate_scored_percent()
 {
-	using namespace sigfile;
-	scored_percent_nrem =
-		(float)count_if( hypnogram.begin(), hypnogram.end(),
-				 [] ( const char& c)
-				 {
-					 return
-					    c == SPage::score_code(SPage::TScore::nrem1)
-					 || c == SPage::score_code(SPage::TScore::nrem2)
-					 || c == SPage::score_code(SPage::TScore::nrem3)
-					 || c == SPage::score_code(SPage::TScore::nrem4);
-				 }) / hypnogram.size() * 100;
-	scored_percent_rem =
-		(float)count( hypnogram.begin(), hypnogram.end(),
-			      SPage::score_code(SPage::TScore::rem)) / hypnogram.size() * 100;
-	scored_percent_wake =
-		(float)count( hypnogram.begin(), hypnogram.end(),
-			      SPage::score_code(SPage::TScore::wake)) / hypnogram.size() * 100;
-
-	scored_percent =
-		100. - (float)count( hypnogram.begin(), hypnogram.end(),
-				     SPage::score_code(SPage::TScore::none)) / hypnogram.size() * 100;
+        using namespace sigfile;
+        scored_percent_nrem =
+                (float)count_if( hypnogram.begin(), hypnogram.end(),
+                                 [] ( const char& c)
+                                 {
+                                         return
+                                            c == SPage::score_code(SPage::TScore::nrem1)
+                                         || c == SPage::score_code(SPage::TScore::nrem2)
+                                         || c == SPage::score_code(SPage::TScore::nrem3)
+                                         || c == SPage::score_code(SPage::TScore::nrem4);
+                                 }) / hypnogram.size() * 100;
+        scored_percent_rem =
+                (float)count( hypnogram.begin(), hypnogram.end(),
+                              SPage::score_code(SPage::TScore::rem)) / hypnogram.size() * 100;
+        scored_percent_wake =
+                (float)count( hypnogram.begin(), hypnogram.end(),
+                              SPage::score_code(SPage::TScore::wake)) / hypnogram.size() * 100;
+
+        scored_percent =
+                100. - (float)count( hypnogram.begin(), hypnogram.end(),
+                                     SPage::score_code(SPage::TScore::none)) / hypnogram.size() * 100;
 }
 
 
@@ -466,52 +466,52 @@ void
 SScoringFacility::
 set_cur_vpage( size_t p, const bool touch_self)
 {
-	if ( _cur_vpage == p && !touch_self )
-		return;
+        if ( _cur_vpage == p && !touch_self )
+                return;
 
-	agh::alg::ensure_within( p, (size_t)0, total_vpages()-1);
-	_cur_vpage = p;
+        agh::alg::ensure_within( p, (size_t)0, total_vpages()-1);
+        _cur_vpage = p;
 
-	if ( ap2p(p) != _cur_page ) { // vpage changed but page is same
-		_cur_page = ap2p(p);
-		for ( auto& H : channels )
-			if ( H.schannel().type() == sigfile::SChannel::TType::eeg && H.draw_spectrum )
-				H.get_spectrum( _cur_page);
+        if ( ap2p(p) != _cur_page ) { // vpage changed but page is same
+                _cur_page = ap2p(p);
+                for ( auto& H : channels )
+                        if ( H.schannel().type() == sigfile::SChannel::TType::eeg && H.draw_spectrum )
+                                H.get_spectrum( _cur_page);
 
-		gtk_widget_set_sensitive( (GtkWidget*)bSFForward, _cur_vpage < total_vpages()-1);
-		gtk_widget_set_sensitive( (GtkWidget*)bSFBack, _cur_vpage > 0);
-	}
+                gtk_widget_set_sensitive( (GtkWidget*)bSFForward, _cur_vpage < total_vpages()-1);
+                gtk_widget_set_sensitive( (GtkWidget*)bSFBack, _cur_vpage > 0);
+        }
 
-	if ( touch_self )
-		gtk_spin_button_set_value( eSFCurrentPage, _cur_vpage+1);
+        if ( touch_self )
+                gtk_spin_button_set_value( eSFCurrentPage, _cur_vpage+1);
 
-	draw_current_pos( 0.);
+        draw_current_pos( 0.);
 }
 
 void
 SScoringFacility::
 set_vpagesize_item( int item, const bool touch_self)
 {
-	if ( pagesize_item == item && !touch_self )
-		return;
+        if ( pagesize_item == item && !touch_self )
+                return;
 
-	agh::alg::ensure_within( item, 0, (int)DisplayPageSizeValues.size()-1 );
-	pagesize_item = item;
-	gtk_adjustment_set_upper( jSFPageNo, total_vpages());
+        agh::alg::ensure_within( item, 0, (int)DisplayPageSizeValues.size()-1 );
+        pagesize_item = item;
+        gtk_adjustment_set_upper( jSFPageNo, total_vpages());
 
-	set_cur_vpage( p2ap(_cur_page), true);
+        set_cur_vpage( p2ap(_cur_page), true);
 
-	gboolean sensitive_indeed = pagesize_is_right();
-	for ( auto& B : {bSFScoreClear, bSFScoreNREM1, bSFScoreNREM2, bSFScoreNREM3, bSFScoreNREM4, bSFScoreREM, bSFScoreWake,
-				bSFGotoPrevUnscored, bSFGotoNextUnscored} )
-		gtk_widget_set_sensitive( (GtkWidget*)(B), sensitive_indeed);
+        gboolean sensitive_indeed = pagesize_is_right();
+        for ( auto& B : {bSFScoreClear, bSFScoreNREM1, bSFScoreNREM2, bSFScoreNREM3, bSFScoreNREM4, bSFScoreREM, bSFScoreWake,
+                                bSFGotoPrevUnscored, bSFGotoNextUnscored} )
+                gtk_widget_set_sensitive( (GtkWidget*)(B), sensitive_indeed);
 
-	gtk_label_set_markup( lSFTotalPages, snprintf_buf( "of %zu", total_vpages()));
+        gtk_label_set_markup( lSFTotalPages, snprintf_buf( "of %zu", total_vpages()));
 
-	if ( touch_self )
-		gtk_combo_box_set_active( eSFPageSize, pagesize_item);
+        if ( touch_self )
+                gtk_combo_box_set_active( eSFPageSize, pagesize_item);
 
-	draw_current_pos( 0.);
+        draw_current_pos( 0.);
 }
 
 
@@ -520,46 +520,46 @@ void
 SScoringFacility::
 do_score_forward( const char score_ch)
 {
-	hypnogram[_cur_page] = score_ch;
-	calculate_scored_percent();
-	draw_score_stats();
-	set_cur_vpage( _cur_page+1);
+        hypnogram[_cur_page] = score_ch;
+        calculate_scored_percent();
+        draw_score_stats();
+        set_cur_vpage( _cur_page+1);
 }
 
 void
 SScoringFacility::
 do_score_back( const char score_ch)
 {
-	hypnogram[_cur_page] = score_ch;
-	calculate_scored_percent();
-	draw_score_stats();
-	set_cur_vpage( _cur_page-1);
+        hypnogram[_cur_page] = score_ch;
+        calculate_scored_percent();
+        draw_score_stats();
+        set_cur_vpage( _cur_page-1);
 }
 
 size_t
 SScoringFacility::SChannel::
 marquee_to_selection()
 {
-	if ( marquee_mstart < marquee_mend) {
-		marquee_start = marquee_mstart;
-		marquee_end = marquee_mend;
-	} else {
-		marquee_start = marquee_mend;
-		marquee_end = marquee_mstart;
-	}
-
-	selection_start = sample_at_click( marquee_start);
-	selection_end   = sample_at_click( marquee_end);
-
-	if ( selection_start > n_samples() )
-		selection_start = selection_end = 0;
-	else if ( selection_end > n_samples() )
-		selection_end = n_samples();
-
-	selection_start_time = (double)selection_start / samplerate();
-	selection_end_time   = (double)selection_end / samplerate();
-
-	return (selection_end - selection_start);
+        if ( marquee_mstart < marquee_mend) {
+                marquee_start = marquee_mstart;
+                marquee_end = marquee_mend;
+        } else {
+                marquee_start = marquee_mend;
+                marquee_end = marquee_mstart;
+        }
+
+        selection_start = sample_at_click( marquee_start);
+        selection_end   = sample_at_click( marquee_end);
+
+        if ( selection_start > n_samples() )
+                selection_start = selection_end = 0;
+        else if ( selection_end > n_samples() )
+                selection_end = n_samples();
+
+        selection_start_time = (double)selection_start / samplerate();
+        selection_end_time   = (double)selection_end / samplerate();
+
+        return (selection_end - selection_start);
 }
 
 
@@ -568,15 +568,15 @@ bool
 SScoringFacility::
 page_has_artifacts( const size_t p, const bool search_all) const
 {
-	for ( auto &H : channels )
-		if ( ! search_all && H.hidden )
-			continue;
-		else {
-			if ( ((agh::alg::SSpan<double> ((double)p, (double)p+1)) * (double)vpagesize())
-			     . dirty( H.artifacts()) > 0. )
-				return true;
-		}
-	return false;
+        for ( auto &H : channels )
+                if ( ! search_all && H.hidden )
+                        continue;
+                else {
+                        if ( ((agh::alg::SSpan<double> ((double)p, (double)p+1)) * (double)vpagesize())
+                             . dirty( H.artifacts()) > 0. )
+                                return true;
+                }
+        return false;
 }
 
 
@@ -584,15 +584,15 @@ bool
 SScoringFacility::
 page_has_annotations( const size_t p, const SChannel& H) const
 {
-	int	half_pad_samples = skirting_run_per1 * vpagesize() * H.samplerate();
-	int	cvpa =  p    * pagesize() * H.samplerate() - half_pad_samples,
-		cvpe = (p+1) * pagesize() * H.samplerate() + half_pad_samples;
-	for ( auto &A : H.annotations )
-		if ( agh::alg::overlap( (int)A.span.a, (int)A.span.z, cvpa, cvpe) )
-			return true;
-		else if ( (int)A.span.a > cvpe )  // no more up to and on current page
-			return false;
-	return false;
+        int        half_pad_samples = skirting_run_per1 * vpagesize() * H.samplerate();
+        int        cvpa =  p    * pagesize() * H.samplerate() - half_pad_samples,
+                cvpe = (p+1) * pagesize() * H.samplerate() + half_pad_samples;
+        for ( auto &A : H.annotations )
+                if ( agh::alg::overlap( (int)A.span.a, (int)A.span.z, cvpa, cvpe) )
+                        return true;
+                else if ( (int)A.span.a > cvpe )  // no more up to and on current page
+                        return false;
+        return false;
 }
 
 
@@ -601,18 +601,18 @@ void
 SScoringFacility::
 draw_score_stats() const
 {
-	gtk_label_set_markup(
-		lSFPercentScored,
-		snprintf_buf( "<b>%3.1f</b> %% scored", scored_percent));
-	gtk_label_set_markup(
-		lScoreStatsNREMPercent,
-		snprintf_buf( "<small>%3.1f</small> %%", scored_percent_nrem));
-	gtk_label_set_markup(
-		lScoreStatsREMPercent,
-		snprintf_buf( "<small>%3.1f</small> %%", scored_percent_rem));
-	gtk_label_set_markup(
-		lScoreStatsWakePercent,
-		snprintf_buf( "<small>%3.1f</small> %%", scored_percent_wake));
+        gtk_label_set_markup(
+                lSFPercentScored,
+                snprintf_buf( "<b>%3.1f</b> %% scored", scored_percent));
+        gtk_label_set_markup(
+                lScoreStatsNREMPercent,
+                snprintf_buf( "<small>%3.1f</small> %%", scored_percent_nrem));
+        gtk_label_set_markup(
+                lScoreStatsREMPercent,
+                snprintf_buf( "<small>%3.1f</small> %%", scored_percent_rem));
+        gtk_label_set_markup(
+                lScoreStatsWakePercent,
+                snprintf_buf( "<small>%3.1f</small> %%", scored_percent_wake));
 }
 
 
@@ -620,30 +620,30 @@ void
 SScoringFacility::
 draw_current_pos( const double x) const
 {
-	static const time_t epoch_clockhour = 3 * 60 * 60;
-	if ( isfinite(x) ) {
-		double	clickt = time_at_click( x);
-		if ( likely (clickt > 0.) ) {
-			time_t time_at_cur_pos =
-				(time_t)(clickt + (show_cur_pos_time_relative ? -epoch_clockhour : start_time()));
-			struct tm *ltime = localtime( &time_at_cur_pos);
-			char tmp[10];
-			strftime( tmp, 9, "%H:%M:%S", ltime);
-			snprintf_buf(
-				"%s.%02d",
-				tmp, (int)((clickt - floor(clickt)) * 100));
-		} else
-			snprintf_buf( "--:--:--");
-	} else {
-		time_t time_at_cur_pos = cur_vpage_start()
-			+ (time_t)(show_cur_pos_time_relative ? -epoch_clockhour : start_time());
-		struct tm *ltime = localtime( &time_at_cur_pos);
-		char tmp[10];
-		strftime( tmp, 9, "%H:%M:%S", ltime);
-		snprintf_buf( "%s", tmp);
-	}
-
-	gtk_button_set_label( eSFCurrentPos, global::buf);
+        static const time_t epoch_clockhour = 3 * 60 * 60;
+        if ( isfinite(x) ) {
+                double        clickt = time_at_click( x);
+                if ( likely (clickt > 0.) ) {
+                        time_t time_at_cur_pos =
+                                (time_t)(clickt + (show_cur_pos_time_relative ? -epoch_clockhour : start_time()));
+                        struct tm *ltime = localtime( &time_at_cur_pos);
+                        char tmp[10];
+                        strftime( tmp, 9, "%H:%M:%S", ltime);
+                        snprintf_buf(
+                                "%s.%02d",
+                                tmp, (int)((clickt - floor(clickt)) * 100));
+                } else
+                        snprintf_buf( "--:--:--");
+        } else {
+                time_t time_at_cur_pos = cur_vpage_start()
+                        + (time_t)(show_cur_pos_time_relative ? -epoch_clockhour : start_time());
+                struct tm *ltime = localtime( &time_at_cur_pos);
+                char tmp[10];
+                strftime( tmp, 9, "%H:%M:%S", ltime);
+                snprintf_buf( "%s", tmp);
+        }
+
+        gtk_button_set_label( eSFCurrentPos, global::buf);
 }
 
 
@@ -651,11 +651,11 @@ void
 SScoringFacility::
 queue_redraw_all() const
 {
-	if ( suppress_redraw )
-		return;
-	draw_score_stats();
-	gtk_widget_queue_draw( (GtkWidget*)daSFMontage);
-	gtk_widget_queue_draw( (GtkWidget*)daSFHypnogram);
+        if ( suppress_redraw )
+                return;
+        draw_score_stats();
+        gtk_widget_queue_draw( (GtkWidget*)daSFMontage);
+        gtk_widget_queue_draw( (GtkWidget*)daSFHypnogram);
 }
 
 
@@ -671,43 +671,43 @@ void
 SScoringFacility::
 load_montage()
 {
-	libconfig::Config conf;
-	string montage_file =
-		agh::fs::make_fname_base(
-			channels.front().crecording.F().filename(),
-			sigfile::supported_sigfile_extensions,
-			agh::fs::TMakeFnameOption::hidden) + ".montage";
-	try {
-		conf.readFile (montage_file.c_str());
-	} catch (libconfig::ParseException ex) {
-		fprintf( stderr, "Failed parsing montage file %s:%d: %s\n",
-			 montage_file.c_str(),
-			 ex.getLine(), ex.getError());
-		return;
-	} catch (libconfig::FileIOException ex) {
-		return;
-	}
-	agh::confval::get( config_keys_b, conf);
-	agh::confval::get( config_keys_d, conf);
-
-	for ( auto &h : channels ) {
-		agh::confval::get( h.config_keys_b, conf);
-		agh::confval::get( h.config_keys_d, conf);
-		agh::confval::get( h.config_keys_g, conf);
-
-	      // postprocess a little
-		h.selection_start = h.selection_start_time * h.samplerate();
-		h.selection_end = h.selection_end_time * h.samplerate();
-
-	      // make sure these won't cause any confusion later
-		if ( h.schannel().type() == sigfile::SChannel::TType::eeg )
-			h.draw_emg = false;
-		if ( h.schannel().type() == sigfile::SChannel::TType::emg )
-			h.draw_psd = h.draw_swu = h.draw_mc = false;
-	}
+        libconfig::Config conf;
+        string montage_file =
+                agh::fs::make_fname_base(
+                        channels.front().crecording.F().filename(),
+                        sigfile::supported_sigfile_extensions,
+                        agh::fs::TMakeFnameOption::hidden) + ".montage";
+        try {
+                conf.readFile (montage_file.c_str());
+        } catch (libconfig::ParseException ex) {
+                fprintf( stderr, "Failed parsing montage file %s:%d: %s\n",
+                         montage_file.c_str(),
+                         ex.getLine(), ex.getError());
+                return;
+        } catch (libconfig::FileIOException ex) {
+                return;
+        }
+        agh::confval::get( config_keys_b, conf);
+        agh::confval::get( config_keys_d, conf);
+
+        for ( auto &h : channels ) {
+                agh::confval::get( h.config_keys_b, conf);
+                agh::confval::get( h.config_keys_d, conf);
+                agh::confval::get( h.config_keys_g, conf);
+
+              // postprocess a little
+                h.selection_start = h.selection_start_time * h.samplerate();
+                h.selection_end = h.selection_end_time * h.samplerate();
+
+              // make sure these won't cause any confusion later
+                if ( h.schannel().type() == sigfile::SChannel::TType::eeg )
+                        h.draw_emg = false;
+                if ( h.schannel().type() == sigfile::SChannel::TType::emg )
+                        h.draw_psd = h.draw_swu = h.draw_mc = false;
+        }
 
       // any additional checks
-	;
+        ;
 }
 
 
@@ -716,25 +716,25 @@ void
 SScoringFacility::
 save_montage()
 {
-	libconfig::Config conf;
-	agh::confval::put( config_keys_b, conf);
-	agh::confval::put( config_keys_d, conf);
-
-	for ( auto &h : channels ) {
-		agh::confval::put( h.config_keys_b, conf);
-		agh::confval::put( h.config_keys_d, conf);
-		agh::confval::put( h.config_keys_g, conf);
-	}
-	try {
-		conf.writeFile (
-			(agh::fs::make_fname_base(
-				channels.front().crecording.F().filename(),
-				sigfile::supported_sigfile_extensions,
-				agh::fs::TMakeFnameOption::hidden)
-			 + ".montage").c_str() );
-	} catch (...) {
-		;
-	}
+        libconfig::Config conf;
+        agh::confval::put( config_keys_b, conf);
+        agh::confval::put( config_keys_d, conf);
+
+        for ( auto &h : channels ) {
+                agh::confval::put( h.config_keys_b, conf);
+                agh::confval::put( h.config_keys_d, conf);
+                agh::confval::put( h.config_keys_g, conf);
+        }
+        try {
+                conf.writeFile (
+                        (agh::fs::make_fname_base(
+                                channels.front().crecording.F().filename(),
+                                sigfile::supported_sigfile_extensions,
+                                agh::fs::TMakeFnameOption::hidden)
+                         + ".montage").c_str() );
+        } catch (...) {
+                ;
+        }
 }
 
 
@@ -743,48 +743,48 @@ void
 SScoringFacility::
 sb_message( const string& msg) const
 {
-	gtk_statusbar_pop(  sbSF, sbSFContextIdGeneral);
-	gtk_statusbar_push( sbSF, sbSFContextIdGeneral, msg.c_str());
+        gtk_statusbar_pop(  sbSF, sbSFContextIdGeneral);
+        gtk_statusbar_push( sbSF, sbSFContextIdGeneral, msg.c_str());
 }
 
 void
 SScoringFacility::
 sb_clear() const
 {
-	gtk_statusbar_pop(  sbSF, sbSFContextIdGeneral);
+        gtk_statusbar_pop(  sbSF, sbSFContextIdGeneral);
 }
 
 
 
 const char* const
-	SScoringFacility::tooltips[2] = {
-	"<b>Page views:</b>\n"
-	"  Wheel:	adjust display scale;\n"
-	"  Ctrl+Wheel:	change scale for\n"
-	"		all channels;\n"
-	"  Click2:	reset display scale;\n"
-	"  Move1:	mark selection;\n"
-	"  Alt+Move1:	move channel around\n"
-	"		in montage;\n"
-	" Alt+Wheel:	change montage height;\n"
-	" <i>on profile:</i>\n"
-	"  Click1:	position cursor;\n"
-	"  Click2:	bands/discrete 1Hz bins.\n"
-	"  Shift+Wheel:	cycle focused PSD band\n"
-	"		/ in-/decrement bin;\n"
-	"  Wheel:	in-/decrement scale;\n"
-	"  Ctrl+Wheel:	in-/decrement scale for all.\n"
-	"  Alt+1..9:	context menu for channels 1..9\n"
-	"\n"
-	"<b>Hypnogram:</b>\n"
-	"  Click1:	position cursor;\n"
-	"  Click2:	alt view;\n"
-	"  Click3:	context menu.",
-
-	"<b>ICA:</b>\n"
-	"  Wheel:	adjust display scale;\n"
-	"  Click1:	\"apply\" toggle;\n"
-	"  Click3:	IC map context menu.\n",
+        SScoringFacility::tooltips[2] = {
+        "<b>Page views:</b>\n"
+        "  Wheel:        adjust display scale;\n"
+        "  Ctrl+Wheel:        change scale for\n"
+        "                all channels;\n"
+        "  Click2:        reset display scale;\n"
+        "  Move1:        mark selection;\n"
+        "  Alt+Move1:        move channel around\n"
+        "                in montage;\n"
+        " Alt+Wheel:        change montage height;\n"
+        " <i>on profile:</i>\n"
+        "  Click1:        position cursor;\n"
+        "  Click2:        bands/discrete 1Hz bins.\n"
+        "  Shift+Wheel:        cycle focused PSD band\n"
+        "                / in-/decrement bin;\n"
+        "  Wheel:        in-/decrement scale;\n"
+        "  Ctrl+Wheel:        in-/decrement scale for all.\n"
+        "  Alt+1..9:        context menu for channels 1..9\n"
+        "\n"
+        "<b>Hypnogram:</b>\n"
+        "  Click1:        position cursor;\n"
+        "  Click2:        alt view;\n"
+        "  Click3:        context menu.",
+
+        "<b>ICA:</b>\n"
+        "  Wheel:        adjust display scale;\n"
+        "  Click1:        \"apply\" toggle;\n"
+        "  Click3:        IC map context menu.\n",
 };
 
 
@@ -792,7 +792,7 @@ void
 SScoringFacility::
 set_tooltip( TTipIdx i) const
 {
-	gtk_widget_set_tooltip_markup( (GtkWidget*)lSFHint, tooltips[i]);
+        gtk_widget_set_tooltip_markup( (GtkWidget*)lSFHint, tooltips[i]);
 }
 
 
@@ -801,47 +801,47 @@ void
 SScoringFacility::
 update_main_menu_items()
 {
-	bool	all_draw_original[2] = {true, true},
-		all_draw_filtered[2] = {true, true},
-		all_draw_fast    [2] = {true, true},
-		all_draw_zeroline[2] = {true, true};
-
-	for ( const auto& H : channels ) {
-		all_draw_original[0] = all_draw_original[0] &&  H.draw_original_signal,
-		all_draw_filtered[0] = all_draw_filtered[0] &&  H.draw_filtered_signal,
-		all_draw_fast    [0] = all_draw_fast    [0] &&  H.resample_signal,
-		all_draw_zeroline[0] = all_draw_zeroline[0] &&  H.draw_zeroline;
-
-		all_draw_original[1] = all_draw_original[1] && !H.draw_original_signal,
-		all_draw_filtered[1] = all_draw_filtered[1] && !H.draw_filtered_signal,
-		all_draw_fast    [1] = all_draw_fast    [1] && !H.resample_signal,
-		all_draw_zeroline[1] = all_draw_zeroline[1] && !H.draw_zeroline;
-	}
-
-	suppress_redraw = true;
-
-	for ( auto& A : forward_list<pair<bool*, GtkCheckMenuItem*>>
-		      ({{all_draw_original, iSFMontageDrawOriginalSignal},
-			{all_draw_filtered, iSFMontageDrawProcessedSignal},
-			{all_draw_fast,     iSFMontageDrawFast},
-			{all_draw_zeroline, iSFMontageDrawZeroLine}}) ) {
-
-		if ( A.first[0] )
-			gtk_check_menu_item_set_active( A.second, TRUE);
-		else if ( A.first[1] )
-			gtk_check_menu_item_set_active( A.second, FALSE);
-
-		gtk_check_menu_item_set_inconsistent( A.second, not (A.first[0] xor A.first[1]));
-	}
-
-	suppress_redraw = false;
+        bool        all_draw_original[2] = {true, true},
+                all_draw_filtered[2] = {true, true},
+                all_draw_fast    [2] = {true, true},
+                all_draw_zeroline[2] = {true, true};
+
+        for ( const auto& H : channels ) {
+                all_draw_original[0] = all_draw_original[0] &&  H.draw_original_signal,
+                all_draw_filtered[0] = all_draw_filtered[0] &&  H.draw_filtered_signal,
+                all_draw_fast    [0] = all_draw_fast    [0] &&  H.resample_signal,
+                all_draw_zeroline[0] = all_draw_zeroline[0] &&  H.draw_zeroline;
+
+                all_draw_original[1] = all_draw_original[1] && !H.draw_original_signal,
+                all_draw_filtered[1] = all_draw_filtered[1] && !H.draw_filtered_signal,
+                all_draw_fast    [1] = all_draw_fast    [1] && !H.resample_signal,
+                all_draw_zeroline[1] = all_draw_zeroline[1] && !H.draw_zeroline;
+        }
+
+        suppress_redraw = true;
+
+        for ( auto& A : forward_list<pair<bool*, GtkCheckMenuItem*>>
+                      ({{all_draw_original, iSFMontageDrawOriginalSignal},
+                        {all_draw_filtered, iSFMontageDrawProcessedSignal},
+                        {all_draw_fast,     iSFMontageDrawFast},
+                        {all_draw_zeroline, iSFMontageDrawZeroLine}}) ) {
+
+                if ( A.first[0] )
+                        gtk_check_menu_item_set_active( A.second, TRUE);
+                else if ( A.first[1] )
+                        gtk_check_menu_item_set_active( A.second, FALSE);
+
+                gtk_check_menu_item_set_inconsistent( A.second, not (A.first[0] xor A.first[1]));
+        }
+
+        suppress_redraw = false;
 }
 
 
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/sf.hh b/upstream/src/aghermann/ui/sf/sf.hh
index 6a908d6..fa907ed 100644
--- a/upstream/src/aghermann/ui/sf/sf.hh
+++ b/upstream/src/aghermann/ui/sf/sf.hh
@@ -45,549 +45,549 @@ namespace ui {
 class SScoringFacility
   : public SScoringFacilityWidgets {
 
-	DELETE_DEFAULT_METHODS (SScoringFacility);
+        DELETE_DEFAULT_METHODS (SScoringFacility);
 
     public:
       // ctor, dtor
-	SScoringFacility (agh::CSubject&, const string& d, const string& e,
-			  SExpDesignUI& parent);
+        SScoringFacility (agh::CSubject&, const string& d, const string& e,
+                          SExpDesignUI& parent);
        ~SScoringFacility ();
 
       // link to parent
-	SExpDesignUI&
-		_p;
-	void redraw_ssubject_timeline() const;
+        SExpDesignUI&
+                _p;
+        void redraw_ssubject_timeline() const;
 
     private:
-	agh::CSubject&
-		_csubject;
-	string	_session;
-	agh::SEpisode&
-		_sepisode;
+        agh::CSubject&
+                _csubject;
+        string        _session;
+        agh::SEpisode&
+                _sepisode;
     public:
-	agh::CSubject&			csubject() const { return _csubject; }
-	agh::SEpisode&	sepisode() const { return _sepisode; }
-	const string&			session()  const { return _session;  }
+        agh::CSubject&                        csubject() const { return _csubject; }
+        agh::SEpisode&        sepisode() const { return _sepisode; }
+        const string&                        session()  const { return _session;  }
 
       // channels
-	struct SChannel {
-
-		DELETE_DEFAULT_METHODS (SChannel);
-
-		bool operator==( const string&) const;
-		bool operator==( const SChannel&) const;
-
-		agh::CRecording&
-			crecording;
-
-		// shortcuts
-		int
-		h() const
-			{ return crecording.h(); }
-		const sigfile::SChannel&
-		schannel() const
-			{ return crecording.F().channel_by_id( h()); }
-		const char*
-		name() const
-			{ return schannel().name(); }
-
-		sigfile::SFilterPack&
-			filters;
-		list<sigfile::SAnnotation>&
-			annotations;
-		sigfile::SArtifacts&
-			artifacts;
-
-		SScoringFacility&
-			_p;
-
-	      // signal waveforms, cached here
-		valarray<TFloat>
-			signal_original,
-			signal_filtered,
-			signal_reconstituted;  // while it's hot
-		void get_signal_original();
-		void get_signal_filtered();
-
-	      // filters
-		bool have_low_pass() const;
-		bool have_high_pass() const;
-		bool have_notch_filter() const;
-		size_t n_samples() const;
-		size_t samplerate() const;
-
-	      // artifacts
-		float	percent_dirty;
-		float calculate_dirty_percent();
-		void detect_artifacts( const metrics::mc::SArtifactDetectionPP&);
-		pair<double, double>
-		mark_flat_regions_as_artifacts( double at_least_this_long, double pad);
-
-	      // annotations
-		list<sigfile::SAnnotation*>
-		in_annotations( double time) const;
-
-	      // signal metrics
-	  	static pattern::SPatternPPack<TFloat>
-			pattern_params;
-		sigproc::SCachedLowPassCourse<TFloat>
-			signal_lowpass;
-		sigproc::SCachedBandPassCourse<TFloat>
-			signal_bandpass;
-		sigproc::SCachedEnvelope<TFloat>
-			signal_envelope;
-		sigproc::SCachedDzcdf<TFloat>
-			signal_dzcdf;
-		void
-		drop_cached_signal_properties()
-			{
-				signal_lowpass.drop();
-				signal_bandpass.drop();
-				signal_envelope.drop();
-				signal_dzcdf.drop();
-			}
-
-	      // profiles
-		// psd
-		struct SProfilePSD {
-			valarray<TFloat>
-				course;
-			double	from, upto;
-			double	display_scale; // saved via libconfig, requiring it to be double
-			array<valarray<TFloat>, metrics::TBand::TBand_total>
-				course_in_bands;
-			size_t	focused_band,
-				uppermost_band;
-		};
-		void get_psd_course();
-		void get_psd_in_bands();
-		SProfilePSD
-			psd;
-		// swu
-		struct SProfileSWU {
-			valarray<TFloat>
-				course;
-			double	f0;
-			double	display_scale;
-		};
-		void get_swu_course();
-		SProfileSWU
-			swu;
-		// mc
-		struct SProfileMC {
-			valarray<TFloat>
-				course;
-			double	display_scale;
-			double	f0;
-		};
-		SProfileMC
-			mc;
-		void get_mc_course();
-
-		tuple<metrics::TType, valarray<TFloat>&>
-		which_profile( metrics::TType);
-
-		void update_profile_display_scales();
-
-	      // spectrum
-		valarray<TFloat>
-			spectrum;  // per page, is volatile
-		float	spectrum_upper_freq;
-		unsigned
-			spectrum_bins,
-			last_spectrum_bin;
-		void get_spectrum(); // at current page
-		void get_spectrum( size_t p);
-
-	      // raw profile
-		valarray<TFloat>
-			raw_profile;
-		void get_raw_profile();
-
-	      // region
-		void mark_region_as_artifact( bool do_mark);
-		void mark_region_as_annotation( const string&, sigfile::SAnnotation::TType);
-		void mark_region_as_pattern();
-
-	      // ctor, dtor
-		SChannel( agh::CRecording& r, SScoringFacility&, size_t y, int seq);
-
-		double	zeroy;
-		bool operator<( const SChannel&) const;
-
-		double	signal_display_scale;
-
-		// saved flags
-		bool	hidden,
-			draw_zeroline,
-			draw_original_signal,
-			draw_filtered_signal,
-			zeromean_original,
-			zeromean_filtered,
-			draw_psd,
-			draw_swu,
-			draw_mc,
-			draw_emg,
-			draw_psd_bands,
-			autoscale_profile,
-			draw_spectrum,
-			resample_signal,
-			resample_power,
-			draw_selection_course,
-			draw_selection_envelope,
-			draw_selection_dzcdf,
-			draw_phasic_spindle,
-			draw_phasic_Kcomplex,
-			draw_phasic_eyeblink;
-		bool	discard_marked,
-			apply_reconstituted;
-
-		forward_list<agh::confval::SValidator<bool>>	config_keys_b;
-		forward_list<agh::confval::SValidator<int>>	config_keys_d;
-		forward_list<agh::confval::SValidator<double>>	config_keys_g;
-
-		void update_channel_menu_items( double x);
-		void update_power_menu_items();
-		void selectively_enable_selection_menu_items();
-
-	      // selection and marquee
-		float	marquee_mstart,
-			marquee_mend,        // in terms of event->x
-			marquee_start,
-			marquee_end;         // set on button_release
-		double	selection_start_time,
-			selection_end_time;  // in seconds
-		size_t	selection_start,
-			selection_end;       // in samples
-		TFloat	selection_SS,
-			selection_SU;
-		size_t marquee_to_selection();
-		void put_selection( size_t a, size_t e);
-		void put_selection( double a, double e);
-	    private:
-		void _put_selection();
-
-	    public:
-		float spp() const;
-		float fine_line() const;
-		int sample_at_click( double) const;
-
-		GtkMenuItem
-			*menu_item_when_hidden;
-
-	      // comprehensive draw
-		void draw_for_montage( const string& fname, int width, int height); // to a file
-		void draw_for_montage( cairo_t*); // to montage
-
-	    protected:
-		void draw_page( cairo_t*, int wd, float zeroy, // writers to an svg file override zeroy (with 0)
-				bool draw_marquee) const;
-		void draw_overlays( cairo_t*, int wd, float zeroy) const;
-
-	      // strictly draw the signal waveform bare
-	      // (also used as such in some child dialogs)
-		void draw_signal_original( size_t width, int vdisp, cairo_t *cr) const
-			{
-				draw_signal( signal_original, width, vdisp, cr);
-			}
-		void draw_signal_filtered( size_t width, int vdisp, cairo_t *cr) const
-			{
-				draw_signal( signal_filtered, width, vdisp, cr);
-			}
-		friend class SScoringFacility;
-		void draw_signal_reconstituted( size_t width, int vdisp, cairo_t *cr) const
-			{
-				draw_signal( signal_reconstituted, width, vdisp, cr);
-			}
-	      // generic draw_signal wrapper
-		void draw_signal( const valarray<TFloat>& signal,
-				  size_t width, int vdisp, cairo_t *cr) const;
-	};
-	list<SChannel>
-		channels;
-	size_t	n_eeg_channels;
-	SChannel& operator[]( const string&);
-	SChannel& operator[]( size_t i)
-		{
-			return channel_by_idx(i);
-		}
-	SChannel& channel_by_idx( size_t i);
-
-	void
-	update_all_channels_profile_display_scale();
+        struct SChannel {
+
+                DELETE_DEFAULT_METHODS (SChannel);
+
+                bool operator==( const string&) const;
+                bool operator==( const SChannel&) const;
+
+                agh::CRecording&
+                        crecording;
+
+                // shortcuts
+                int
+                h() const
+                        { return crecording.h(); }
+                const sigfile::SChannel&
+                schannel() const
+                        { return crecording.F().channel_by_id( h()); }
+                const char*
+                name() const
+                        { return schannel().name(); }
+
+                sigfile::SFilterPack&
+                        filters;
+                list<sigfile::SAnnotation>&
+                        annotations;
+                sigfile::SArtifacts&
+                        artifacts;
+
+                SScoringFacility&
+                        _p;
+
+              // signal waveforms, cached here
+                valarray<TFloat>
+                        signal_original,
+                        signal_filtered,
+                        signal_reconstituted;  // while it's hot
+                void get_signal_original();
+                void get_signal_filtered();
+
+              // filters
+                bool have_low_pass() const;
+                bool have_high_pass() const;
+                bool have_notch_filter() const;
+                size_t n_samples() const;
+                size_t samplerate() const;
+
+              // artifacts
+                float        percent_dirty;
+                float calculate_dirty_percent();
+                void detect_artifacts( const metrics::mc::SArtifactDetectionPP&);
+                pair<double, double>
+                mark_flat_regions_as_artifacts( double at_least_this_long, double pad);
+
+              // annotations
+                list<sigfile::SAnnotation*>
+                in_annotations( double time) const;
+
+              // signal metrics
+                  static pattern::SPatternPPack<TFloat>
+                        pattern_params;
+                sigproc::SCachedLowPassCourse<TFloat>
+                        signal_lowpass;
+                sigproc::SCachedBandPassCourse<TFloat>
+                        signal_bandpass;
+                sigproc::SCachedEnvelope<TFloat>
+                        signal_envelope;
+                sigproc::SCachedDzcdf<TFloat>
+                        signal_dzcdf;
+                void
+                drop_cached_signal_properties()
+                        {
+                                signal_lowpass.drop();
+                                signal_bandpass.drop();
+                                signal_envelope.drop();
+                                signal_dzcdf.drop();
+                        }
+
+              // profiles
+                // psd
+                struct SProfilePSD {
+                        valarray<TFloat>
+                                course;
+                        double        from, upto;
+                        double        display_scale; // saved via libconfig, requiring it to be double
+                        array<valarray<TFloat>, metrics::TBand::TBand_total>
+                                course_in_bands;
+                        size_t        focused_band,
+                                uppermost_band;
+                };
+                void get_psd_course();
+                void get_psd_in_bands();
+                SProfilePSD
+                        psd;
+                // swu
+                struct SProfileSWU {
+                        valarray<TFloat>
+                                course;
+                        double        f0;
+                        double        display_scale;
+                };
+                void get_swu_course();
+                SProfileSWU
+                        swu;
+                // mc
+                struct SProfileMC {
+                        valarray<TFloat>
+                                course;
+                        double        display_scale;
+                        double        f0;
+                };
+                SProfileMC
+                        mc;
+                void get_mc_course();
+
+                tuple<metrics::TType, valarray<TFloat>&>
+                which_profile( metrics::TType);
+
+                void update_profile_display_scales();
+
+              // spectrum
+                valarray<TFloat>
+                        spectrum;  // per page, is volatile
+                float        spectrum_upper_freq;
+                unsigned
+                        spectrum_bins,
+                        last_spectrum_bin;
+                void get_spectrum(); // at current page
+                void get_spectrum( size_t p);
+
+              // raw profile
+                valarray<TFloat>
+                        raw_profile;
+                void get_raw_profile();
+
+              // region
+                void mark_region_as_artifact( bool do_mark);
+                void mark_region_as_annotation( const string&, sigfile::SAnnotation::TType);
+                void mark_region_as_pattern();
+
+              // ctor, dtor
+                SChannel( agh::CRecording& r, SScoringFacility&, size_t y, int seq);
+
+                double        zeroy;
+                bool operator<( const SChannel&) const;
+
+                double        signal_display_scale;
+
+                // saved flags
+                bool        hidden,
+                        draw_zeroline,
+                        draw_original_signal,
+                        draw_filtered_signal,
+                        zeromean_original,
+                        zeromean_filtered,
+                        draw_psd,
+                        draw_swu,
+                        draw_mc,
+                        draw_emg,
+                        draw_psd_bands,
+                        autoscale_profile,
+                        draw_spectrum,
+                        resample_signal,
+                        resample_power,
+                        draw_selection_course,
+                        draw_selection_envelope,
+                        draw_selection_dzcdf,
+                        draw_phasic_spindle,
+                        draw_phasic_Kcomplex,
+                        draw_phasic_eyeblink;
+                bool        discard_marked,
+                        apply_reconstituted;
+
+                forward_list<agh::confval::SValidator<bool>>        config_keys_b;
+                forward_list<agh::confval::SValidator<int>>        config_keys_d;
+                forward_list<agh::confval::SValidator<double>>        config_keys_g;
+
+                void update_channel_menu_items( double x);
+                void update_power_menu_items();
+                void selectively_enable_selection_menu_items();
+
+              // selection and marquee
+                float        marquee_mstart,
+                        marquee_mend,        // in terms of event->x
+                        marquee_start,
+                        marquee_end;         // set on button_release
+                double        selection_start_time,
+                        selection_end_time;  // in seconds
+                size_t        selection_start,
+                        selection_end;       // in samples
+                TFloat        selection_SS,
+                        selection_SU;
+                size_t marquee_to_selection();
+                void put_selection( size_t a, size_t e);
+                void put_selection( double a, double e);
+            private:
+                void _put_selection();
+
+            public:
+                float spp() const;
+                float fine_line() const;
+                int sample_at_click( double) const;
+
+                GtkMenuItem
+                        *menu_item_when_hidden;
+
+              // comprehensive draw
+                void draw_for_montage( const string& fname, int width, int height); // to a file
+                void draw_for_montage( cairo_t*); // to montage
+
+            protected:
+                void draw_page( cairo_t*, int wd, float zeroy, // writers to an svg file override zeroy (with 0)
+                                bool draw_marquee) const;
+                void draw_overlays( cairo_t*, int wd, float zeroy) const;
+
+              // strictly draw the signal waveform bare
+              // (also used as such in some child dialogs)
+                void draw_signal_original( size_t width, int vdisp, cairo_t *cr) const
+                        {
+                                draw_signal( signal_original, width, vdisp, cr);
+                        }
+                void draw_signal_filtered( size_t width, int vdisp, cairo_t *cr) const
+                        {
+                                draw_signal( signal_filtered, width, vdisp, cr);
+                        }
+                friend class SScoringFacility;
+                void draw_signal_reconstituted( size_t width, int vdisp, cairo_t *cr) const
+                        {
+                                draw_signal( signal_reconstituted, width, vdisp, cr);
+                        }
+              // generic draw_signal wrapper
+                void draw_signal( const valarray<TFloat>& signal,
+                                  size_t width, int vdisp, cairo_t *cr) const;
+        };
+        list<SChannel>
+                channels;
+        size_t        n_eeg_channels;
+        SChannel& operator[]( const string&);
+        SChannel& operator[]( size_t i)
+                {
+                        return channel_by_idx(i);
+                }
+        SChannel& channel_by_idx( size_t i);
+
+        void
+        update_all_channels_profile_display_scale();
 
       // collected common annotations
-	list<pair<const sigfile::CSource*, const sigfile::SAnnotation*>>
-		common_annotations;
+        list<pair<const sigfile::CSource*, const sigfile::SAnnotation*>>
+                common_annotations;
 
       // timeline
-	time_t start_time() const
-		{
-			return channels.front().crecording.F().start_time();
-		}
-
-	vector<char>
-		hypnogram;
-	size_t total_pages() const
-		{
-			return hypnogram.size();
-		}
-	size_t total_vpages() const
-		{
-			return p2ap( total_pages());
-		}
-	void get_hypnogram();
-	void put_hypnogram();
-
-	float	scored_percent,
-		scored_percent_nrem,
-		scored_percent_rem,
-		scored_percent_wake;
-
-	void calculate_scored_percent();
+        time_t start_time() const
+                {
+                        return channels.front().crecording.F().start_time();
+                }
+
+        vector<char>
+                hypnogram;
+        size_t total_pages() const
+                {
+                        return hypnogram.size();
+                }
+        size_t total_vpages() const
+                {
+                        return p2ap( total_pages());
+                }
+        void get_hypnogram();
+        void put_hypnogram();
+
+        float        scored_percent,
+                scored_percent_nrem,
+                scored_percent_rem,
+                scored_percent_wake;
+
+        void calculate_scored_percent();
 
       // state and flags
-	// volatile
-	bool	suppress_redraw:1,
-		hypnogram_button_down:1,
-		artifacts_dialog_shown:1;
-	enum class TMode {
-		scoring,
-		marking,
-		shuffling_channels,
-		moving_selection,
-		separating,
-		showing_ics,
-		showing_remixed
-	};
-	TMode	mode;
-	size_t	crosshair_at;
-	double	crosshair_at_time;
-	// persistent
-	bool	show_cur_pos_time_relative,
-		draw_crosshair,
-		alt_hypnogram;
+        // volatile
+        bool        suppress_redraw:1,
+                hypnogram_button_down:1,
+                artifacts_dialog_shown:1;
+        enum class TMode {
+                scoring,
+                marking,
+                shuffling_channels,
+                moving_selection,
+                separating,
+                showing_ics,
+                showing_remixed
+        };
+        TMode        mode;
+        size_t        crosshair_at;
+        double        crosshair_at_time;
+        // persistent
+        bool        show_cur_pos_time_relative,
+                draw_crosshair,
+                alt_hypnogram;
 
       // page and vpage index
-	size_t cur_page() const		{ return _cur_page;  }
-	size_t cur_vpage() const	{ return _cur_vpage; }
-	void set_cur_vpage( size_t p, bool touch_self = true);
-
-	size_t cur_page_start() const // in seconds
-		{
-			return _cur_page * pagesize();
-		}
-	size_t cur_page_end() const // in seconds
-		{
-			return (_cur_page + 1) * pagesize();
-		}
-
-	sigfile::SPage::TScore
-	cur_page_score() const
-		{
-			return sigfile::SPage::char2score( hypnogram[_cur_page]);
-		}
-	bool page_has_artifacts( size_t, bool check_all_channels = true) const;
-	bool page_has_annotations( size_t, const SChannel&) const;
+        size_t cur_page() const                { return _cur_page;  }
+        size_t cur_vpage() const        { return _cur_vpage; }
+        void set_cur_vpage( size_t p, bool touch_self = true);
+
+        size_t cur_page_start() const // in seconds
+                {
+                        return _cur_page * pagesize();
+                }
+        size_t cur_page_end() const // in seconds
+                {
+                        return (_cur_page + 1) * pagesize();
+                }
+
+        sigfile::SPage::TScore
+        cur_page_score() const
+                {
+                        return sigfile::SPage::char2score( hypnogram[_cur_page]);
+                }
+        bool page_has_artifacts( size_t, bool check_all_channels = true) const;
+        bool page_has_annotations( size_t, const SChannel&) const;
 
       // pagesize
-	size_t pagesize() const
-		{
-			return _p.pagesize();
-		}
-	static const array<unsigned, 9>
-		DisplayPageSizeValues;
-	static size_t
-	figure_display_pagesize_item( size_t seconds);
+        size_t pagesize() const
+                {
+                        return _p.pagesize();
+                }
+        static const array<unsigned, 9>
+                DisplayPageSizeValues;
+        static size_t
+        figure_display_pagesize_item( size_t seconds);
     private:
-	int	pagesize_item;
+        int        pagesize_item;
 
     public:
-	size_t vpagesize() const;
-	bool pagesize_is_right() const;
-	size_t cur_vpage_start() const; // in seconds
-	size_t cur_vpage_end() const; // in seconds
-	size_t p2ap( size_t p) const; // page to visible_page
-	size_t ap2p( size_t p) const;
+        size_t vpagesize() const;
+        bool pagesize_is_right() const;
+        size_t cur_vpage_start() const; // in seconds
+        size_t cur_vpage_end() const; // in seconds
+        size_t p2ap( size_t p) const; // page to visible_page
+        size_t ap2p( size_t p) const;
     private:
-	size_t	_cur_page,
-		_cur_vpage;
+        size_t        _cur_page,
+                _cur_vpage;
 
     public:
       // page location adjusted for pre- and post margins
-	float	skirting_run_per1;
-	float xvpagesize() const;
-	double cur_xvpage_start() const;
-	double cur_xvpage_end() const;
-	double time_at_click( double) const;
+        float        skirting_run_per1;
+        float xvpagesize() const;
+        double cur_xvpage_start() const;
+        double cur_xvpage_end() const;
+        double time_at_click( double) const;
 
-	void set_vpagesize_item( int item, bool touch_self = true); // touches a few wisgets
-	void set_vpagesize( size_t seconds, bool touch_self = true);
+        void set_vpagesize_item( int item, bool touch_self = true); // touches a few wisgets
+        void set_vpagesize( size_t seconds, bool touch_self = true);
 
     public:
       // ICA support
-	ica::CFastICA
-		*ica;
-	itpp::mat  // looks like it has to be double
-		ica_components;
-	size_t n_ics() const;
-
-	enum TICMapFlags : int { apply_normally = 0, dont_apply = 1 };
-	struct SICMapOptions { int m; };
-	vector<SICMapOptions>
-		ica_map;
-	typedef function<valarray<TFloat>()> TICASetupFun;
-	int setup_ica();
-	int run_ica();
-	enum class TICARemixMode { map, punch, zero };
-	TICARemixMode remix_mode;
-	static const char
-		*ica_unmapped_menu_item_label;
-	int remix_ics();
-	int restore_ics();
-	int ic_near( double y) const;
-	int ic_of( const SChannel*) const;
-	int using_ic;
-	int apply_remix( bool do_backup);
+        ica::CFastICA
+                *ica;
+        itpp::mat  // looks like it has to be double
+                ica_components;
+        size_t n_ics() const;
+
+        enum TICMapFlags : int { apply_normally = 0, dont_apply = 1 };
+        struct SICMapOptions { int m; };
+        vector<SICMapOptions>
+                ica_map;
+        typedef function<valarray<TFloat>()> TICASetupFun;
+        int setup_ica();
+        int run_ica();
+        enum class TICARemixMode { map, punch, zero };
+        TICARemixMode remix_mode;
+        static const char
+                *ica_unmapped_menu_item_label;
+        int remix_ics();
+        int restore_ics();
+        int ic_near( double y) const;
+        int ic_of( const SChannel*) const;
+        int using_ic;
+        int apply_remix( bool do_backup);
 
     public:
       // channel slots
-	template <class T>
-	float channel_y0( const T& h) const;
+        template <class T>
+        float channel_y0( const T& h) const;
 
-	SChannel*
-	channel_near( int y);
+        SChannel*
+        channel_near( int y);
 
-	float	interchannel_gap;
-	void estimate_montage_height();
-	int find_free_space();
-	void space_evenly();
-	void expand_by_factor( double);
+        float        interchannel_gap;
+        void estimate_montage_height();
+        int find_free_space();
+        void space_evenly();
+        void expand_by_factor( double);
 
-	int	n_hidden;
+        int        n_hidden;
 
-	// things to remember bwtween button_press_event_cb and motion_cb
-	double	event_y_when_shuffling;
-	float	zeroy_before_shuffling;
-	float	moving_selection_handle_offset;
+        // things to remember bwtween button_press_event_cb and motion_cb
+        double        event_y_when_shuffling;
+        float        zeroy_before_shuffling;
+        float        moving_selection_handle_offset;
 
   // montage
   // load/save/reset
     public:
-	forward_list<agh::confval::SValidator<bool>>	config_keys_b;
-	forward_list<agh::confval::SValidator<int>>	config_keys_d;
-	forward_list<agh::confval::SValidator<float>>	config_keys_g;
-	void load_montage();
-	void save_montage(); // using libconfig
-	void reset_montage();
+        forward_list<agh::confval::SValidator<bool>>        config_keys_b;
+        forward_list<agh::confval::SValidator<int>>        config_keys_d;
+        forward_list<agh::confval::SValidator<float>>        config_keys_g;
+        void load_montage();
+        void save_montage(); // using libconfig
+        void reset_montage();
 
   // draw
     public:
-	void draw_montage( cairo_t*);
-	void draw_montage( const string& fname); // to a file (uses da_wd and da_ht
+        void draw_montage( cairo_t*);
+        void draw_montage( const string& fname); // to a file (uses da_wd and da_ht
     private:
-	template <class T>
-	void _draw_matrix_to_montage( cairo_t*, const itpp::Mat<T>&);
-	void _draw_hour_ticks( cairo_t*, int, int, bool with_cursor = true);
+        template <class T>
+        void _draw_matrix_to_montage( cairo_t*, const itpp::Mat<T>&);
+        void _draw_hour_ticks( cairo_t*, int, int, bool with_cursor = true);
     public:
-	void draw_hypnogram( cairo_t*);
-	void draw_score_stats() const;
-	void draw_current_pos( double) const;
-	void queue_redraw_all() const;
+        void draw_hypnogram( cairo_t*);
+        void draw_score_stats() const;
+        void draw_current_pos( double) const;
+        void queue_redraw_all() const;
 
   // main montage menu
     public:
-	void update_main_menu_items();
-	void do_dialog_import_hypnogram();
-	void do_dialog_export_hypnogram() const;
-	void do_clear_hypnogram();
+        void update_main_menu_items();
+        void do_dialog_import_hypnogram();
+        void do_dialog_export_hypnogram() const;
+        void do_clear_hypnogram();
 
-	void do_score_forward( char score_ch);
-	void do_score_back( char score_ch);
+        void do_score_forward( char score_ch);
+        void do_score_back( char score_ch);
 
       // status bar
-	void sb_message( const string&) const;
-	void sb_clear() const;
+        void sb_message( const string&) const;
+        void sb_clear() const;
 
       // tips
-	enum TTipIdx : size_t {
-		scoring_mode,
-		ica_mode
-	};
-	void set_tooltip( TTipIdx i) const;
+        enum TTipIdx : size_t {
+                scoring_mode,
+                ica_mode
+        };
+        void set_tooltip( TTipIdx i) const;
 
       // child dialogs:
     public:
-	struct SPatternsDialog;
-	SPatternsDialog&
-	patterns_d();
+        struct SPatternsDialog;
+        SPatternsDialog&
+        patterns_d();
 
-	struct SFiltersDialog;
-	SFiltersDialog&
-	filters_d();
+        struct SFiltersDialog;
+        SFiltersDialog&
+        filters_d();
 
-	struct SPhasediffDialog;
-	SPhasediffDialog&
-	phasediff_d();
+        struct SPhasediffDialog;
+        SPhasediffDialog&
+        phasediff_d();
 
-	struct SArtifactsDialog;
-	SArtifactsDialog&
-	artifacts_d();
+        struct SArtifactsDialog;
+        SArtifactsDialog&
+        artifacts_d();
 
-	struct SArtifactsSimpleDialog;
-	SArtifactsSimpleDialog&
-	artifacts_simple_d();
+        struct SArtifactsSimpleDialog;
+        SArtifactsSimpleDialog&
+        artifacts_simple_d();
 
     private:
-	SPatternsDialog
-		*_patterns_d;
-	SFiltersDialog
-		*_filters_d;
-	SPhasediffDialog
-		*_phasediff_d;
-	SArtifactsDialog
-		*_artifacts_d;
-	SArtifactsSimpleDialog
-		*_artifacts_simple_d;
+        SPatternsDialog
+                *_patterns_d;
+        SFiltersDialog
+                *_filters_d;
+        SPhasediffDialog
+                *_phasediff_d;
+        SArtifactsDialog
+                *_artifacts_d;
+        SArtifactsSimpleDialog
+                *_artifacts_simple_d;
 
     public:
       // menu support
-	SChannel
-		*using_channel;
-	int using_channel_idx() const
-		{
-			return channel_idx( using_channel);
-		}
-	int channel_idx( SChannel* h) const
-		{
-			int i = 0;
-			for ( auto& H : channels )
-				if ( &H == h )
-					return i;
-				else ++i;
-			return -1;
-		}
-	list<sigfile::SAnnotation*>
-		over_annotations;
-	sigfile::SAnnotation*
-	interactively_choose_annotation() const;
+        SChannel
+                *using_channel;
+        int using_channel_idx() const
+                {
+                        return channel_idx( using_channel);
+                }
+        int channel_idx( SChannel* h) const
+                {
+                        int i = 0;
+                        for ( auto& H : channels )
+                                if ( &H == h )
+                                        return i;
+                                else ++i;
+                        return -1;
+                }
+        list<sigfile::SAnnotation*>
+                over_annotations;
+        sigfile::SAnnotation*
+        interactively_choose_annotation() const;
 
     private:
-	static const char* const tooltips[2];
+        static const char* const tooltips[2];
 
     public:
-	// SGeometry
-	// 	geometry;
+        // SGeometry
+        //         geometry;
 
-	static size_t
-		IntersignalSpace,
-		HypnogramHeight,
-		EMGProfileHeight;
+        static size_t
+                IntersignalSpace,
+                HypnogramHeight,
+                EMGProfileHeight;
 
     public:
-	// here's hoping configure-event comes before expose-event
-	gint	da_wd;
-	float	da_ht;  // not subject to window resize, this, but should withstand / 3 * 3
+        // here's hoping configure-event comes before expose-event
+        gint        da_wd;
+        float        da_ht;  // not subject to window resize, this, but should withstand / 3 * 3
 };
 
 
@@ -595,13 +595,13 @@ inline bool
 SScoringFacility::SChannel::
 operator==( const string& _name) const
 {
-	return _name == name();
+        return _name == name();
 }
 // inline bool
 // SScoringFacility::SChannel::
 // operator==( const SChannel& rv) const
 // {
-// 	return name == rv.name;
+//         return name == rv.name;
 // }
 
 
@@ -609,31 +609,31 @@ inline bool
 SScoringFacility::SChannel::
 have_low_pass() const
 {
-	return isfinite(filters.low_pass_cutoff)
-		&& filters.low_pass_cutoff > 0.
-		&& filters.low_pass_order > 0;
+        return isfinite(filters.low_pass_cutoff)
+                && filters.low_pass_cutoff > 0.
+                && filters.low_pass_order > 0;
 }
 
 inline bool
 SScoringFacility::SChannel::
 have_high_pass() const
 {
-	return isfinite(filters.high_pass_cutoff)
-		&& filters.high_pass_cutoff > 0.
-		&& filters.high_pass_order > 0;
+        return isfinite(filters.high_pass_cutoff)
+                && filters.high_pass_cutoff > 0.
+                && filters.high_pass_order > 0;
 }
 inline bool
 SScoringFacility::SChannel::
 have_notch_filter() const
 {
-	return filters.notch_filter != sigfile::SFilterPack::TNotchFilter::none;
+        return filters.notch_filter != sigfile::SFilterPack::TNotchFilter::none;
 }
 
 inline size_t
 SScoringFacility::SChannel::
 n_samples() const
 {
-	return signal_filtered.size();
+        return signal_filtered.size();
 }
 
 
@@ -641,7 +641,7 @@ inline bool
 SScoringFacility::SChannel::
 operator<( const SChannel& rv) const
 {
-	return zeroy < rv.zeroy;
+        return zeroy < rv.zeroy;
 }
 
 
@@ -649,21 +649,21 @@ inline float
 SScoringFacility::SChannel::
 spp() const
 {
-	return (float)samplerate() * _p.vpagesize() / _p.da_wd;
+        return (float)samplerate() * _p.vpagesize() / _p.da_wd;
 }
 inline float
 SScoringFacility::SChannel::
 fine_line() const
 {
-	return ((not resample_signal) and spp() > 1.)
-		? agh::alg::value_within( .6 / (spp() + .2), .1, 3.)
-		: .6;
+        return ((not resample_signal) and spp() > 1.)
+                ? agh::alg::value_within( .6 / (spp() + .2), .1, 3.)
+                : .6;
 }
 inline int
 SScoringFacility::SChannel::
 sample_at_click( double x) const
 {
-	return _p.time_at_click( x) * samplerate();
+        return _p.time_at_click( x) * samplerate();
 }
 
 
@@ -673,7 +673,7 @@ inline size_t
 SScoringFacility::SChannel::
 samplerate() const
 {
-	return crecording.F().samplerate(h());
+        return crecording.F().samplerate(h());
 }
 
 
@@ -682,39 +682,39 @@ inline size_t
 SScoringFacility::
 vpagesize() const
 {
-	return DisplayPageSizeValues[pagesize_item];
+        return DisplayPageSizeValues[pagesize_item];
 }
 inline bool
 SScoringFacility::
 pagesize_is_right() const
 {
-	return pagesize() == vpagesize();
+        return pagesize() == vpagesize();
 }
 
 inline size_t
 SScoringFacility::
 cur_vpage_start() const // in seconds
 {
-	return _cur_vpage * vpagesize();
+        return _cur_vpage * vpagesize();
 }
 inline size_t
 SScoringFacility::
 cur_vpage_end() const // in seconds
 {
-	return (_cur_vpage + 1) * vpagesize();
+        return (_cur_vpage + 1) * vpagesize();
 }
 inline size_t
 SScoringFacility::
 p2ap( size_t p) const // page to visible_page
 {
-	return (size_t)(p * (float)pagesize() / vpagesize());
+        return (size_t)(p * (float)pagesize() / vpagesize());
 }
 
 inline size_t
 SScoringFacility::
 ap2p( size_t p) const
 {
-	return (size_t)((p) * (float)vpagesize() / pagesize());
+        return (size_t)((p) * (float)vpagesize() / pagesize());
 }
 
 
@@ -723,32 +723,32 @@ inline float
 SScoringFacility::
 xvpagesize() const
 {
-	return (1. + 2*skirting_run_per1) * vpagesize();
+        return (1. + 2*skirting_run_per1) * vpagesize();
 }
 inline double
 SScoringFacility::
 cur_xvpage_start() const
 {
-	return cur_vpage_start() - skirting_run_per1 * vpagesize();
+        return cur_vpage_start() - skirting_run_per1 * vpagesize();
 }
 inline double
 SScoringFacility::
 cur_xvpage_end() const
 {
-	return cur_vpage_end() + skirting_run_per1 * vpagesize();
+        return cur_vpage_end() + skirting_run_per1 * vpagesize();
 }
 inline double
 SScoringFacility::
 time_at_click( double x) const
 {
-	return cur_xvpage_start() + x/da_wd * xvpagesize();
+        return cur_xvpage_start() + x/da_wd * xvpagesize();
 }
 
 inline void
 SScoringFacility::
 set_vpagesize( size_t seconds, bool touch_self)
 {
-	set_vpagesize_item( figure_display_pagesize_item( seconds), touch_self);
+        set_vpagesize_item( figure_display_pagesize_item( seconds), touch_self);
 }
 
 
@@ -757,7 +757,7 @@ inline size_t
 SScoringFacility::
 n_ics() const
 {
-	return ica->obj() . get_nrof_independent_components();
+        return ica->obj() . get_nrof_independent_components();
 }
 
 
@@ -768,8 +768,8 @@ __attribute__ ((pure))
 SScoringFacility::
 channel_y0( const T& h) const
 {
-	auto H = find( channels.begin(), channels.end(), h);
-	return ( H != channels.end() ) ? H->zeroy : NAN;
+        auto H = find( channels.begin(), channels.end(), h);
+        return ( H != channels.end() ) ? H->zeroy : NAN;
 }
 
 
@@ -780,7 +780,7 @@ channel_y0( const T& h) const
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/sf_cb.cc b/upstream/src/aghermann/ui/sf/sf_cb.cc
index ff7c7aa..18ae60b 100644
--- a/upstream/src/aghermann/ui/sf/sf_cb.cc
+++ b/upstream/src/aghermann/ui/sf/sf_cb.cc
@@ -19,23 +19,23 @@ extern "C" {
 
 gboolean
 wSF_delete_event_cb(
-	GtkWidget*,
-	GdkEvent*,
-	gpointer userdata)
+        GtkWidget*,
+        GdkEvent*,
+        gpointer userdata)
 {
-	auto& SF = *(SScoringFacility*)userdata;
+        auto& SF = *(SScoringFacility*)userdata;
 
-	SF._p.close_this_SF_now = &SF;
-	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
+        SF._p.close_this_SF_now = &SF;
+        g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
 
-	return TRUE; // to stop other handlers from being invoked for the event
+        return TRUE; // to stop other handlers from being invoked for the event
 }
 
 } // extern "C"
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/sf_cb.hh b/upstream/src/aghermann/ui/sf/sf_cb.hh
index d94522a..6060029 100644
--- a/upstream/src/aghermann/ui/sf/sf_cb.hh
+++ b/upstream/src/aghermann/ui/sf/sf_cb.hh
@@ -158,7 +158,7 @@ gboolean wSF_key_press_event_cb( GtkWidget*, GdkEventKey*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sf/widgets.hh b/upstream/src/aghermann/ui/sf/widgets.hh
index 04c6fe1..c4f0099 100644
--- a/upstream/src/aghermann/ui/sf/widgets.hh
+++ b/upstream/src/aghermann/ui/sf/widgets.hh
@@ -20,186 +20,186 @@ namespace ui {
 
 struct SScoringFacilityWidgets {
 
-	SScoringFacilityWidgets ();
+        SScoringFacilityWidgets ();
        ~SScoringFacilityWidgets ();
 
-	GtkBuilder *builder;
-
-	// storage
-	GtkListStore
-		*mSFScoringPageSize,
-		*mSFAnnotationsAtCursor;
-
-	// window
-	GtkWindow
-		*wSF;
-	// control bar
-	GtkLabel
-		*lSFHint;
-	GtkHBox
-		*cSFControlBar;
-	GtkComboBox
-		*eSFPageSize;
-	GtkSpinButton
-		*eSFCurrentPage;
-	GtkAdjustment
-		*jSFPageNo;
-	GtkLabel
-		*lSFTotalPages;
-	GtkBox
-		*cSFScoringModeContainer,
-		*cSFICAModeContainer;
-	// 1. scoring mode
-	GtkCheckMenuItem
-		*iSFMontageDrawOriginalSignal,
-		*iSFMontageDrawProcessedSignal,
-		*iSFMontageDrawZeroLine,
-		*iSFMontageDrawFast;
-	GtkMenuItem
-		*iSFMontagePatterns,
-		*iSFMontageICA,
-		*iSFMontagePhaseDiff,
-		*iSFMontageScoreAssist,
-		*iSFMontageScoreImport,
-		*iSFMontageScoreExport,
-		*iSFMontageScoreClear,
-		*iSFMontageClose,
-		*iSFMontageCloseAndNext;
-	GtkButton  // acting label
-		*eSFCurrentPos;
-	GtkButton
-		*bSFBack, *bSFForward,
-		*bSFScoreClear, *bSFScoreNREM1, *bSFScoreNREM2, *bSFScoreNREM3, *bSFScoreNREM4,
-		*bSFScoreREM, *bSFScoreWake,
-		*bSFGotoPrevUnscored, *bSFGotoNextUnscored,
-		*bSFGotoPrevArtifact, *bSFGotoNextArtifact;
-	GtkToggleButton
-		*bSFDrawCrosshair;
-	GtkTable
-		*cSFSleepStageStats;
-	GtkLabel
-		*lScoreStatsNREMPercent, *lScoreStatsREMPercent, *lScoreStatsWakePercent,
-		*lSFPercentScored;
-	GtkStatusbar
-		*sbSF;
-	guint	sbSFContextIdGeneral;
-
-	// 2. ICA mode
-	GtkComboBox
-		*eSFICARemixMode,
-		*eSFICANonlinearity,
-		*eSFICAApproach;
-	GtkListStore
-		*mSFICARemixMode,
-		*mSFICANonlinearity,
-		*mSFICAApproach;
-	GtkCheckButton
-		*eSFICAFineTune,
-		*eSFICAStabilizationMode;
-	GtkSpinButton
-		*eSFICAa1,
-		*eSFICAa2,
-		*eSFICAmu,
-		*eSFICAepsilon,
-		*eSFICANofICs,
-		*eSFICAEigVecFirst,
-		*eSFICAEigVecLast,
-		*eSFICASampleSizePercent,
-		*eSFICAMaxIterations;
-	GtkAdjustment
-		*jSFICANofICs,
-		*jSFICAEigVecFirst,
-		*jSFICAEigVecLast;
-	GtkButton
-		*bSFICATry,
-		*bSFICAApply,
-		*bSFICACancel;
-	GtkToggleButton
-		*bSFICAPreview,
-		*bSFICAShowMatrix;
-	GtkTextView
-		*tSFICAMatrix;
-	GtkDialog
-		*wSFICAMatrix;
-
-	// montage area
-	GtkDrawingArea
-		*daSFMontage,
-		*daSFHypnogram;
-	GtkExpander
-		*cSFHypnogram;
-	GtkLabel
-		*lSFOverChannel;
-	// menus
-	GtkMenu
-		*iiSFPage,
-		*iiSFPageSelection,
-		*iiSFPageAnnotation,
-		*iiSFPageProfiles,
-		*iiSFPagePhasicEvents,
-		*iiSFPageHidden,
-		*iiSFPower,
-		*iiSFScore,
-		*iiSFICAPage;
-	GtkMenuItem
-		*iSFMontageMenu;
-	GtkCheckMenuItem
-		*iSFPageShowOriginal, *iSFPageShowProcessed,
-		*iSFPageUseResample, *iSFPageDrawZeroline,
-		*iSFPageDrawPSDProfile,
-		*iSFPageDrawPSDSpectrum,
-		*iSFPageDrawSWUProfile,
-		*iSFPageDrawMCProfile,
-		*iSFPageDrawEMGProfile,
-		*iSFPowerDrawBands,
-		*iSFPowerSmooth,
-		*iSFPowerAutoscale,
-		*iSFPageSelectionDrawCourse,
-		*iSFPageSelectionDrawEnvelope,
-		*iSFPageSelectionDrawDzxdf,
-		*iSFPageDrawPhasicSpindles,
-		*iSFPageDrawPhasicKComplexes,
-		*iSFPageDrawPhasicEyeBlinks;
-	GtkMenuItem
-		*iSFPageFilter,
-		*iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
-		*iSFPageExportSignal, *iSFPageUseThisScale,
-		*iSFPageArtifactsDetect, *iSFPageArtifactsMarkFlat, *iSFPageArtifactsClear,
-		*iSFPageHide,
-		*iSFPageHidden,  // has a submenu
-		*iSFPageSpaceEvenly,
-		*iSFPageLocateSelection,
-		*iSFPageAnnotationSeparator,
-		*iSFPageAnnotationDelete,
-		*iSFPageAnnotationEdit,
-		*iSFPageAnnotationClearAll,
-		*iSFPageAnnotationGotoPrev,
-		*iSFPageAnnotationGotoNext,
-		*iSFPageSelectionMarkArtifact, *iSFPageSelectionClearArtifact,
-		*iSFPageSelectionFindPattern,
-		*iSFPageSelectionAnnotate,
-		*iSFPowerExportAll, *iSFPowerExportRange,
-		*iSFPowerUseThisScale,
-		*iSFScoreAssist, *iSFScoreImport, *iSFScoreExport, *iSFScoreClear,
-		*iSFAcceptAndTakeNext;
-	GtkSeparatorMenuItem
-		*iSFPageProfilesSubmenuSeparator;
-
-	// more important dialogs
-
-	// less important dialogs
-	GtkDialog
-		*wSFAnnotationLabel,
-		*wSFAnnotationSelector;
-	GtkEntry
-		*eSFAnnotationLabel;
-	GtkRadioButton
-		*eSFAnnotationTypePlain,
-		*eSFAnnotationTypeSpindle,
-		*eSFAnnotationTypeKComplex,
-		*eSFAnnotationTypeBlink;
-	GtkComboBox
-		*eSFAnnotationSelectorWhich;
+        GtkBuilder *builder;
+
+        // storage
+        GtkListStore
+                *mSFScoringPageSize,
+                *mSFAnnotationsAtCursor;
+
+        // window
+        GtkWindow
+                *wSF;
+        // control bar
+        GtkLabel
+                *lSFHint;
+        GtkHBox
+                *cSFControlBar;
+        GtkComboBox
+                *eSFPageSize;
+        GtkSpinButton
+                *eSFCurrentPage;
+        GtkAdjustment
+                *jSFPageNo;
+        GtkLabel
+                *lSFTotalPages;
+        GtkBox
+                *cSFScoringModeContainer,
+                *cSFICAModeContainer;
+        // 1. scoring mode
+        GtkCheckMenuItem
+                *iSFMontageDrawOriginalSignal,
+                *iSFMontageDrawProcessedSignal,
+                *iSFMontageDrawZeroLine,
+                *iSFMontageDrawFast;
+        GtkMenuItem
+                *iSFMontagePatterns,
+                *iSFMontageICA,
+                *iSFMontagePhaseDiff,
+                *iSFMontageScoreAssist,
+                *iSFMontageScoreImport,
+                *iSFMontageScoreExport,
+                *iSFMontageScoreClear,
+                *iSFMontageClose,
+                *iSFMontageCloseAndNext;
+        GtkButton  // acting label
+                *eSFCurrentPos;
+        GtkButton
+                *bSFBack, *bSFForward,
+                *bSFScoreClear, *bSFScoreNREM1, *bSFScoreNREM2, *bSFScoreNREM3, *bSFScoreNREM4,
+                *bSFScoreREM, *bSFScoreWake,
+                *bSFGotoPrevUnscored, *bSFGotoNextUnscored,
+                *bSFGotoPrevArtifact, *bSFGotoNextArtifact;
+        GtkToggleButton
+                *bSFDrawCrosshair;
+        GtkTable
+                *cSFSleepStageStats;
+        GtkLabel
+                *lScoreStatsNREMPercent, *lScoreStatsREMPercent, *lScoreStatsWakePercent,
+                *lSFPercentScored;
+        GtkStatusbar
+                *sbSF;
+        guint        sbSFContextIdGeneral;
+
+        // 2. ICA mode
+        GtkComboBox
+                *eSFICARemixMode,
+                *eSFICANonlinearity,
+                *eSFICAApproach;
+        GtkListStore
+                *mSFICARemixMode,
+                *mSFICANonlinearity,
+                *mSFICAApproach;
+        GtkCheckButton
+                *eSFICAFineTune,
+                *eSFICAStabilizationMode;
+        GtkSpinButton
+                *eSFICAa1,
+                *eSFICAa2,
+                *eSFICAmu,
+                *eSFICAepsilon,
+                *eSFICANofICs,
+                *eSFICAEigVecFirst,
+                *eSFICAEigVecLast,
+                *eSFICASampleSizePercent,
+                *eSFICAMaxIterations;
+        GtkAdjustment
+                *jSFICANofICs,
+                *jSFICAEigVecFirst,
+                *jSFICAEigVecLast;
+        GtkButton
+                *bSFICATry,
+                *bSFICAApply,
+                *bSFICACancel;
+        GtkToggleButton
+                *bSFICAPreview,
+                *bSFICAShowMatrix;
+        GtkTextView
+                *tSFICAMatrix;
+        GtkDialog
+                *wSFICAMatrix;
+
+        // montage area
+        GtkDrawingArea
+                *daSFMontage,
+                *daSFHypnogram;
+        GtkExpander
+                *cSFHypnogram;
+        GtkLabel
+                *lSFOverChannel;
+        // menus
+        GtkMenu
+                *iiSFPage,
+                *iiSFPageSelection,
+                *iiSFPageAnnotation,
+                *iiSFPageProfiles,
+                *iiSFPagePhasicEvents,
+                *iiSFPageHidden,
+                *iiSFPower,
+                *iiSFScore,
+                *iiSFICAPage;
+        GtkMenuItem
+                *iSFMontageMenu;
+        GtkCheckMenuItem
+                *iSFPageShowOriginal, *iSFPageShowProcessed,
+                *iSFPageUseResample, *iSFPageDrawZeroline,
+                *iSFPageDrawPSDProfile,
+                *iSFPageDrawPSDSpectrum,
+                *iSFPageDrawSWUProfile,
+                *iSFPageDrawMCProfile,
+                *iSFPageDrawEMGProfile,
+                *iSFPowerDrawBands,
+                *iSFPowerSmooth,
+                *iSFPowerAutoscale,
+                *iSFPageSelectionDrawCourse,
+                *iSFPageSelectionDrawEnvelope,
+                *iSFPageSelectionDrawDzxdf,
+                *iSFPageDrawPhasicSpindles,
+                *iSFPageDrawPhasicKComplexes,
+                *iSFPageDrawPhasicEyeBlinks;
+        GtkMenuItem
+                *iSFPageFilter,
+                *iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
+                *iSFPageExportSignal, *iSFPageUseThisScale,
+                *iSFPageArtifactsDetect, *iSFPageArtifactsMarkFlat, *iSFPageArtifactsClear,
+                *iSFPageHide,
+                *iSFPageHidden,  // has a submenu
+                *iSFPageSpaceEvenly,
+                *iSFPageLocateSelection,
+                *iSFPageAnnotationSeparator,
+                *iSFPageAnnotationDelete,
+                *iSFPageAnnotationEdit,
+                *iSFPageAnnotationClearAll,
+                *iSFPageAnnotationGotoPrev,
+                *iSFPageAnnotationGotoNext,
+                *iSFPageSelectionMarkArtifact, *iSFPageSelectionClearArtifact,
+                *iSFPageSelectionFindPattern,
+                *iSFPageSelectionAnnotate,
+                *iSFPowerExportAll, *iSFPowerExportRange,
+                *iSFPowerUseThisScale,
+                *iSFScoreAssist, *iSFScoreImport, *iSFScoreExport, *iSFScoreClear,
+                *iSFAcceptAndTakeNext;
+        GtkSeparatorMenuItem
+                *iSFPageProfilesSubmenuSeparator;
+
+        // more important dialogs
+
+        // less important dialogs
+        GtkDialog
+                *wSFAnnotationLabel,
+                *wSFAnnotationSelector;
+        GtkEntry
+                *eSFAnnotationLabel;
+        GtkRadioButton
+                *eSFAnnotationTypePlain,
+                *eSFAnnotationTypeSpindle,
+                *eSFAnnotationTypeKComplex,
+                *eSFAnnotationTypeBlink;
+        GtkComboBox
+                *eSFAnnotationSelectorWhich;
 
 };
 
@@ -210,7 +210,7 @@ struct SScoringFacilityWidgets {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sm/sm-construct.cc b/upstream/src/aghermann/ui/sm/sm-construct.cc
index 4962558..19a87f7 100644
--- a/upstream/src/aghermann/ui/sm/sm-construct.cc
+++ b/upstream/src/aghermann/ui/sm/sm-construct.cc
@@ -25,79 +25,79 @@ SSessionChooser::
 construct_widgets()
 {
       // load glade
-	GtkBuilder *builder = gtk_builder_new();
-	if ( !gtk_builder_add_from_resource(
-		     builder,
-		     "/org/gtk/aghermann/sm.glade",
-		     NULL) ) {
-		return -1;
-	}
-
-	gtk_builder_connect_signals( builder, NULL);
-
-	GtkCellRenderer *renderer;
-
-	mSessionChooserList =
-		gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
-
-	if ( !(AGH_GBGETOBJ (GtkDialog, 	wSessionChooser)) ||
-	     !(AGH_GBGETOBJ (GtkTreeView,	tvSessionChooserList)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSessionChooserOpen)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSessionChooserClose)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSessionChooserCreateNew)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSessionChooserRemove)) ||
-	     !(AGH_GBGETOBJ (GtkButton,		bSessionChooserQuit)) ||
-	     !(AGH_GBGETOBJ (GtkStatusbar,	sbSessionChooserStatusBar)) )
-		return -1;
-
-	G_CONNECT_1 (wSessionChooser, show);
-	G_CONNECT_1 (wSessionChooser, destroy);
-
-	G_CONNECT_2 (tvSessionChooserList, row, activated);
-	g_signal_connect( gtk_tree_view_get_selection( tvSessionChooserList), "changed",
-			  (GCallback)tvSessionChooserList_changed_cb,
-			  this);
-	G_CONNECT_1 (bSessionChooserOpen, clicked);
-	G_CONNECT_1 (bSessionChooserClose, clicked);
-	G_CONNECT_1 (bSessionChooserCreateNew, clicked);
-	G_CONNECT_1 (bSessionChooserRemove, clicked);
-	G_CONNECT_1 (bSessionChooserQuit, clicked);
-
-	gtk_tree_view_set_model( tvSessionChooserList,
-				 (GtkTreeModel*)mSessionChooserList);
-
-	g_object_set( (GObject*)tvSessionChooserList,
-		      "headers-visible", FALSE,
-		      NULL);
-
-	gtk_tree_view_set_model( tvSessionChooserList, (GtkTreeModel*)mSessionChooserList);
-	int c = 0;
-	for ( auto& C : {"Last visited", "Recordings", "Directory"} ) {
-		renderer = gtk_cell_renderer_text_new();
-		g_object_set( (GObject*)renderer,
-			      "editable", FALSE,
-			      "xalign", (c != 2) ? 1. : 0.,
-			      NULL);
-		g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (c));
-		gtk_tree_view_insert_column_with_attributes( tvSessionChooserList,
-							     -1, C, renderer,
-							     "text", c,
-							     NULL);
-		++c;
-	}
-
-	gtk_tree_view_set_headers_visible( tvSessionChooserList, TRUE);
-
-	sbChooserContextIdGeneral = gtk_statusbar_get_context_id( sbSessionChooserStatusBar, "General context");
-
-	g_object_unref( (GObject*)builder);
-
-	return 0;
+        GtkBuilder *builder = gtk_builder_new();
+        if ( !gtk_builder_add_from_resource(
+                     builder,
+                     "/org/gtk/aghermann/sm.glade",
+                     NULL) ) {
+                return -1;
+        }
+
+        gtk_builder_connect_signals( builder, NULL);
+
+        GtkCellRenderer *renderer;
+
+        mSessionChooserList =
+                gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
+        if ( !(AGH_GBGETOBJ (GtkDialog,         wSessionChooser)) ||
+             !(AGH_GBGETOBJ (GtkTreeView,        tvSessionChooserList)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSessionChooserOpen)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSessionChooserClose)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSessionChooserCreateNew)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSessionChooserRemove)) ||
+             !(AGH_GBGETOBJ (GtkButton,                bSessionChooserQuit)) ||
+             !(AGH_GBGETOBJ (GtkStatusbar,        sbSessionChooserStatusBar)) )
+                return -1;
+
+        G_CONNECT_1 (wSessionChooser, show);
+        G_CONNECT_1 (wSessionChooser, destroy);
+
+        G_CONNECT_2 (tvSessionChooserList, row, activated);
+        g_signal_connect( gtk_tree_view_get_selection( tvSessionChooserList), "changed",
+                          (GCallback)tvSessionChooserList_changed_cb,
+                          this);
+        G_CONNECT_1 (bSessionChooserOpen, clicked);
+        G_CONNECT_1 (bSessionChooserClose, clicked);
+        G_CONNECT_1 (bSessionChooserCreateNew, clicked);
+        G_CONNECT_1 (bSessionChooserRemove, clicked);
+        G_CONNECT_1 (bSessionChooserQuit, clicked);
+
+        gtk_tree_view_set_model( tvSessionChooserList,
+                                 (GtkTreeModel*)mSessionChooserList);
+
+        g_object_set( (GObject*)tvSessionChooserList,
+                      "headers-visible", FALSE,
+                      NULL);
+
+        gtk_tree_view_set_model( tvSessionChooserList, (GtkTreeModel*)mSessionChooserList);
+        int c = 0;
+        for ( auto& C : {"Last visited", "Recordings", "Directory"} ) {
+                renderer = gtk_cell_renderer_text_new();
+                g_object_set( (GObject*)renderer,
+                              "editable", FALSE,
+                              "xalign", (c != 2) ? 1. : 0.,
+                              NULL);
+                g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (c));
+                gtk_tree_view_insert_column_with_attributes( tvSessionChooserList,
+                                                             -1, C, renderer,
+                                                             "text", c,
+                                                             NULL);
+                ++c;
+        }
+
+        gtk_tree_view_set_headers_visible( tvSessionChooserList, TRUE);
+
+        sbChooserContextIdGeneral = gtk_statusbar_get_context_id( sbSessionChooserStatusBar, "General context");
+
+        g_object_unref( (GObject*)builder);
+
+        return 0;
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sm/sm.cc b/upstream/src/aghermann/ui/sm/sm.cc
index adba916..c07e24f 100644
--- a/upstream/src/aghermann/ui/sm/sm.cc
+++ b/upstream/src/aghermann/ui/sm/sm.cc
@@ -31,17 +31,17 @@ void
 SSession::
 get_session_stats()
 {
-	agh::fs::total_supported_sigfiles = 0;
-	string path = agh::str::tilda2homedir(c_str());
-	nftw( path.c_str(), agh::fs::supported_sigfile_counter, 20, 0);
-	n_recordings = agh::fs::total_supported_sigfiles;
-
-	{
-		struct stat stat0;
-		int stst = stat( (path + "/.aghermann.conf").c_str(), &stat0);
-		if ( stst != -1 )
-			last_visited = stat0.st_mtime;
-	}
+        agh::fs::total_supported_sigfiles = 0;
+        string path = agh::str::tilda2homedir(c_str());
+        nftw( path.c_str(), agh::fs::supported_sigfile_counter, 20, 0);
+        n_recordings = agh::fs::total_supported_sigfiles;
+
+        {
+                struct stat stat0;
+                int stst = stat( (path + "/.aghermann.conf").c_str(), &stat0);
+                if ( stst != -1 )
+                        last_visited = stat0.st_mtime;
+        }
 
 }
 
@@ -49,53 +49,53 @@ get_session_stats()
 SSessionChooser::
 SSessionChooser (const char* explicit_session)
       : filename (string (getenv("HOME")) + "/.config/aghermann/sessionrc"),
-	ed (nullptr)
+        ed (nullptr)
 {
-	if ( construct_widgets() )
-		throw runtime_error ("SSessionChooser::SSessionChooser(): failed to construct widgets");
-
-	read_sessionrc();
-
-	bool have_explicit_dir = (explicit_session && strlen(explicit_session) > 0);
-
-	try {
-		if ( have_explicit_dir ) {
-			char* canonicalized = canonicalize_file_name( explicit_session);
-			ed = new SExpDesignUI(
-				this, canonicalized);
-			set_unique_app_window( ed->wMainWindow);
-			free( canonicalized);
-
-		} else if ( last_dir_no == -1 ) {
-			gtk_widget_show( (GtkWidget*)wSessionChooser);
-			//set_unique_app_window( (GtkWindow*)wSessionChooser);
-
-		} else {
-			ed = new SExpDesignUI(
-				this, get_dir());
-			set_unique_app_window( ed->wMainWindow);
-		}
-	} catch (runtime_error ex) {
-		pop_ok_message( nullptr, "Huh", "%s", ex.what());
-
-		string new_experiment_dir = string (getenv("HOME")) + "/NewExperiment";
-		if ( agh::fs::mkdir_with_parents( new_experiment_dir.c_str()) ) {
-			pop_ok_message( nullptr, "Failed to create a new directory in your $HOME.",
-					       " There's nothing we can do about that.");
-		}
-		ed = new SExpDesignUI( this, new_experiment_dir);
-		// if HOME is non-writable, then don't catch: it's too seriously broken
-	}
+        if ( construct_widgets() )
+                throw runtime_error ("SSessionChooser::SSessionChooser(): failed to construct widgets");
+
+        read_sessionrc();
+
+        bool have_explicit_dir = (explicit_session && strlen(explicit_session) > 0);
+
+        try {
+                if ( have_explicit_dir ) {
+                        char* canonicalized = canonicalize_file_name( explicit_session);
+                        ed = new SExpDesignUI(
+                                this, canonicalized);
+                        set_unique_app_window( ed->wMainWindow);
+                        free( canonicalized);
+
+                } else if ( last_dir_no == -1 ) {
+                        gtk_widget_show( (GtkWidget*)wSessionChooser);
+                        //set_unique_app_window( (GtkWindow*)wSessionChooser);
+
+                } else {
+                        ed = new SExpDesignUI(
+                                this, get_dir());
+                        set_unique_app_window( ed->wMainWindow);
+                }
+        } catch (runtime_error ex) {
+                pop_ok_message( nullptr, "Huh", "%s", ex.what());
+
+                string new_experiment_dir = string (getenv("HOME")) + "/NewExperiment";
+                if ( agh::fs::mkdir_with_parents( new_experiment_dir.c_str()) ) {
+                        pop_ok_message( nullptr, "Failed to create a new directory in your $HOME.",
+                                               " There's nothing we can do about that.");
+                }
+                ed = new SExpDesignUI( this, new_experiment_dir);
+                // if HOME is non-writable, then don't catch: it's too seriously broken
+        }
 }
 
 
 SSessionChooser::
 ~SSessionChooser()
 {
-	destruct_widgets();
-	if ( ed )
-		delete ed;
-	write_sessionrc();
+        destruct_widgets();
+        if ( ed )
+                delete ed;
+        write_sessionrc();
 }
 
 
@@ -106,27 +106,27 @@ int
 SSessionChooser::
 open_selected_session()
 {
-	assert (ed == nullptr);
-	string selected = get_selected_dir();
-	if ( selected.size() == 0 )
-		return 1; // double check
-
-	try {
-		ed = new SExpDesignUI(
-			this, selected);
-		set_unique_app_window( ed->wMainWindow);
-
-		return 0;
-
-	} catch (invalid_argument ex) {
-		ed = nullptr;
-		//set_unique_app_window( (GtkWindow*)wSessionChooser);
-
-		pop_ok_message( nullptr,
-				ex.what(),
-				"Please choose another directory");
-		return -1;
-	}
+        assert (ed == nullptr);
+        string selected = get_selected_dir();
+        if ( selected.size() == 0 )
+                return 1; // double check
+
+        try {
+                ed = new SExpDesignUI(
+                        this, selected);
+                set_unique_app_window( ed->wMainWindow);
+
+                return 0;
+
+        } catch (invalid_argument ex) {
+                ed = nullptr;
+                //set_unique_app_window( (GtkWindow*)wSessionChooser);
+
+                pop_ok_message( nullptr,
+                                ex.what(),
+                                "Please choose another directory");
+                return -1;
+        }
 }
 
 
@@ -134,10 +134,10 @@ void
 SSessionChooser::
 close_current_session()
 {
-	assert (ed);
-	delete ed;
-	ed = nullptr;
-	//set_unique_app_window( unique_app, (GtkWindow*)wSessionChooser);
+        assert (ed);
+        delete ed;
+        ed = nullptr;
+        //set_unique_app_window( unique_app, (GtkWindow*)wSessionChooser);
 }
 
 
@@ -149,10 +149,10 @@ SSessionChooser::
 destruct_widgets()
 {
       // // destroy toplevels
-      // 	gtk_widget_destroy( (GtkWidget*)wSessionChooser);
+      //         gtk_widget_destroy( (GtkWidget*)wSessionChooser);
       // // and models, etc
-      // 	g_object_unref( (GObject*)mSessionChooserList);
-	// don't care
+      //         g_object_unref( (GObject*)mSessionChooserList);
+        // don't care
 }
 
 
@@ -163,22 +163,22 @@ void
 SSessionChooser::
 buf_on_status_bar( const bool)
 {
-	// gtk_statusbar_pop( sbSessionChooserStatusBar, sbChooserContextIdGeneral);
-	// gtk_statusbar_push( sbSessionChooserStatusBar, sbChooserContextIdGeneral, global::buf);
-	/// segfaults no matter what. Cannot call gtk_events_pending() from a handler.
-	// if ( ensure ) {
-	//  	g_signal_handler_block( bSessionChooserSelect, bSessionChooserSelect_clicked_cb_handler);
-	//   	gtk_flush();
-	//  	g_signal_handler_unblock( bSessionChooserSelect, bSessionChooserSelect_clicked_cb_handler);
-	// }
+        // gtk_statusbar_pop( sbSessionChooserStatusBar, sbChooserContextIdGeneral);
+        // gtk_statusbar_push( sbSessionChooserStatusBar, sbChooserContextIdGeneral, global::buf);
+        /// segfaults no matter what. Cannot call gtk_events_pending() from a handler.
+        // if ( ensure ) {
+        //          g_signal_handler_block( bSessionChooserSelect, bSessionChooserSelect_clicked_cb_handler);
+        //           gtk_flush();
+        //          g_signal_handler_unblock( bSessionChooserSelect, bSessionChooserSelect_clicked_cb_handler);
+        // }
 }
 
 void
 SSessionChooser::
 sb_progress_indicator( const char* current, const size_t n, const size_t i)
 {
-	snprintf_buf( "(%zu of %zu) %s", i, n, current);
-	buf_on_status_bar( true);
+        snprintf_buf( "(%zu of %zu) %s", i, n, current);
+        buf_on_status_bar( true);
 }
 
 
@@ -187,27 +187,27 @@ string
 SSessionChooser::
 get_selected_dir()
 {
-	auto selection = gtk_tree_view_get_selection( tvSessionChooserList);
-	GtkTreeModel *model;
-	GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
-	GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
-	g_list_free( paths);
-
-	// the only place last_dir_no becomes != -1
-	last_dir_no = gtk_tree_path_get_indices( path)[0];
-
-	GtkTreeIter iter;
-	gtk_tree_model_get_iter( model, &iter, path);
-
-	gchar *entry;
-	//unique_ptr<void,void(*)(void*)> u(entry, g_free);
-	gtk_tree_model_get( model, &iter, 2, &entry, -1);
-	string ret {entry};
-	agh::str::tilda2homedir(ret);
-	g_free(entry);
-	gtk_tree_path_free( path);
-
-	return ret;
+        auto selection = gtk_tree_view_get_selection( tvSessionChooserList);
+        GtkTreeModel *model;
+        GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
+        GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
+        g_list_free( paths);
+
+        // the only place last_dir_no becomes != -1
+        last_dir_no = gtk_tree_path_get_indices( path)[0];
+
+        GtkTreeIter iter;
+        gtk_tree_model_get_iter( model, &iter, path);
+
+        gchar *entry;
+        //unique_ptr<void,void(*)(void*)> u(entry, g_free);
+        gtk_tree_model_get( model, &iter, 2, &entry, -1);
+        string ret {entry};
+        agh::str::tilda2homedir(ret);
+        g_free(entry);
+        gtk_tree_path_free( path);
+
+        return ret;
 }
 
 
@@ -215,32 +215,32 @@ string
 SSessionChooser::
 get_dir( const int idx) const
 {
-	GtkTreeIter iter;
-	gboolean valid = gtk_tree_model_get_iter_first( (GtkTreeModel*)mSessionChooserList, &iter);
-
-	int i = 0;
-	while ( valid ) {
-		gchar *entry;
-		//unique_ptr<void,void(*)(void*)> u(entry, g_free);
-		gtk_tree_model_get( (GtkTreeModel*)mSessionChooserList, &iter,
-				    2, &entry,
-				    -1);
-		string r {entry};
-		g_free(entry);
-		agh::str::tilda2homedir(r);
-
-		if ( i++ == idx ) {
-			if ( not agh::fs::exists_and_is_writable( r) ) {
-				fprintf( stderr, "SSessionChooser::get_dir(%d): entry \"%s\" does not exist or is not a dir\n",
-					 idx, r.c_str());
-				gtk_list_store_remove( mSessionChooserList, &iter);
-				return string("");
-			} else
-				return r;
-		}
-		valid = gtk_tree_model_iter_next( (GtkTreeModel*)mSessionChooserList, &iter);
-	}
-	return string("");
+        GtkTreeIter iter;
+        gboolean valid = gtk_tree_model_get_iter_first( (GtkTreeModel*)mSessionChooserList, &iter);
+
+        int i = 0;
+        while ( valid ) {
+                gchar *entry;
+                //unique_ptr<void,void(*)(void*)> u(entry, g_free);
+                gtk_tree_model_get( (GtkTreeModel*)mSessionChooserList, &iter,
+                                    2, &entry,
+                                    -1);
+                string r {entry};
+                g_free(entry);
+                agh::str::tilda2homedir(r);
+
+                if ( i++ == idx ) {
+                        if ( not agh::fs::exists_and_is_writable( r) ) {
+                                fprintf( stderr, "SSessionChooser::get_dir(%d): entry \"%s\" does not exist or is not a dir\n",
+                                         idx, r.c_str());
+                                gtk_list_store_remove( mSessionChooserList, &iter);
+                                return string("");
+                        } else
+                                return r;
+                }
+                valid = gtk_tree_model_iter_next( (GtkTreeModel*)mSessionChooserList, &iter);
+        }
+        return string("");
 }
 
 
@@ -248,35 +248,35 @@ void
 SSessionChooser::
 read_sessionrc()
 {
-	sessions.clear();
-	try {
-		libconfig::Config conf;
-		conf.readFile( filename.c_str());
-		conf.lookupValue( "SessionLast", last_dir_no);
-		string entries_;
-		conf.lookupValue( "SessionList", entries_);
-
-		list<string> entries {agh::str::tokens_trimmed( &entries_[0], ";")};
-		if ( entries.empty() )
-			throw runtime_error ("add a cwd then");
-		for ( auto &E : entries ) {
-			sessions.emplace_back( agh::str::homedir2tilda(E));
-			sessions.back().get_session_stats();
-		}
-
-		agh::alg::ensure_within( last_dir_no, -1, (int)entries.size());
-
-	} catch (...) {
-		// create new
-		printf( "Creating new sessionrc\n");
-		char *cwd = getcwd( NULL, 0);
-		string e {cwd};
-		sessions.emplace_back( agh::str::homedir2tilda(e));
-		last_dir_no = 0;
-
-		free( cwd);
-	}
-	_sync_list_to_model();
+        sessions.clear();
+        try {
+                libconfig::Config conf;
+                conf.readFile( filename.c_str());
+                conf.lookupValue( "SessionLast", last_dir_no);
+                string entries_;
+                conf.lookupValue( "SessionList", entries_);
+
+                list<string> entries {agh::str::tokens_trimmed( &entries_[0], ";")};
+                if ( entries.empty() )
+                        throw runtime_error ("add a cwd then");
+                for ( auto &E : entries ) {
+                        sessions.emplace_back( agh::str::homedir2tilda(E));
+                        sessions.back().get_session_stats();
+                }
+
+                agh::alg::ensure_within( last_dir_no, -1, (int)entries.size());
+
+        } catch (...) {
+                // create new
+                printf( "Creating new sessionrc\n");
+                char *cwd = getcwd( NULL, 0);
+                string e {cwd};
+                sessions.emplace_back( agh::str::homedir2tilda(e));
+                last_dir_no = 0;
+
+                free( cwd);
+        }
+        _sync_list_to_model();
 }
 
 
@@ -287,21 +287,21 @@ void
 SSessionChooser::
 write_sessionrc() const
 {
-	try {
-		libconfig::Config conf;
-		conf.getRoot().add( "SessionList", libconfig::Setting::Type::TypeString)
-			= agh::str::join( sessions, ";");
-		conf.getRoot().add( "SessionLast", libconfig::Setting::Type::TypeInt)
-			= last_dir_no;
-
-		gchar *dirname = g_path_get_dirname( filename.c_str());
-		g_mkdir_with_parents( dirname, 0755);
-		g_free( dirname);
-
-		conf.writeFile( filename.c_str());
-	} catch (...) {
-		pop_ok_message( (GtkWindow*)wSessionChooser, "Error saving your sessionrc file", "(%s)", filename.c_str());
-	}
+        try {
+                libconfig::Config conf;
+                conf.getRoot().add( "SessionList", libconfig::Setting::Type::TypeString)
+                        = agh::str::join( sessions, ";");
+                conf.getRoot().add( "SessionLast", libconfig::Setting::Type::TypeInt)
+                        = last_dir_no;
+
+                gchar *dirname = g_path_get_dirname( filename.c_str());
+                g_mkdir_with_parents( dirname, 0755);
+                g_free( dirname);
+
+                conf.writeFile( filename.c_str());
+        } catch (...) {
+                pop_ok_message( (GtkWindow*)wSessionChooser, "Error saving your sessionrc file", "(%s)", filename.c_str());
+        }
 }
 
 
@@ -310,10 +310,10 @@ void
 SSessionChooser::
 conditionally_enable_buttons()
 {
-	auto selection = gtk_tree_view_get_selection( tvSessionChooserList);
-	gboolean chris = gtk_tree_selection_count_selected_rows( selection) == 1;
-	gtk_widget_set_sensitive( (GtkWidget*)bSessionChooserOpen, chris);
-	gtk_widget_set_sensitive( (GtkWidget*)bSessionChooserRemove, chris);
+        auto selection = gtk_tree_view_get_selection( tvSessionChooserList);
+        gboolean chris = gtk_tree_selection_count_selected_rows( selection) == 1;
+        gtk_widget_set_sensitive( (GtkWidget*)bSessionChooserOpen, chris);
+        gtk_widget_set_sensitive( (GtkWidget*)bSessionChooserRemove, chris);
 }
 
 
@@ -323,45 +323,45 @@ void
 SSessionChooser::
 _sync_list_to_model()
 {
-	gtk_list_store_clear( mSessionChooserList);
-	GtkTreeIter iter;
-	for ( auto &E : sessions ) {
-		gtk_list_store_append( mSessionChooserList, &iter);
-		snprintf_buf( "%d", (int)E.n_recordings);
-		gtk_list_store_set( mSessionChooserList, &iter,
-				    2, E.c_str(),
-				    1, global::buf,
-				    -1);
-		strftime( global::buf, AGH_BUF_SIZE-1, "%c", localtime(&E.last_visited));
-		gtk_list_store_set( mSessionChooserList, &iter,
-				    0, global::buf,
-				    -1);
-	}
+        gtk_list_store_clear( mSessionChooserList);
+        GtkTreeIter iter;
+        for ( auto &E : sessions ) {
+                gtk_list_store_append( mSessionChooserList, &iter);
+                snprintf_buf( "%d", (int)E.n_recordings);
+                gtk_list_store_set( mSessionChooserList, &iter,
+                                    2, E.c_str(),
+                                    1, global::buf,
+                                    -1);
+                strftime( global::buf, AGH_BUF_SIZE-1, "%c", localtime(&E.last_visited));
+                gtk_list_store_set( mSessionChooserList, &iter,
+                                    0, global::buf,
+                                    -1);
+        }
 }
 
 void
 SSessionChooser::
 _sync_model_to_list()
 {
-	sessions.clear();
-	GtkTreeIter
-		iter;
-	bool	some_items_left = gtk_tree_model_get_iter_first( (GtkTreeModel*)mSessionChooserList, &iter);
-	gchar	*entry;
-	while ( some_items_left ) {
-		gtk_tree_model_get( (GtkTreeModel*)mSessionChooserList, &iter,  // at least one entry exists,
-				    2, &entry,                             // added in read_histfile()
-				    -1);
-		sessions.emplace_back( entry);
-		sessions.back().get_session_stats();
-		g_free( entry);
-		some_items_left = gtk_tree_model_iter_next( (GtkTreeModel*)mSessionChooserList, &iter);
-	}
+        sessions.clear();
+        GtkTreeIter
+                iter;
+        bool        some_items_left = gtk_tree_model_get_iter_first( (GtkTreeModel*)mSessionChooserList, &iter);
+        gchar        *entry;
+        while ( some_items_left ) {
+                gtk_tree_model_get( (GtkTreeModel*)mSessionChooserList, &iter,  // at least one entry exists,
+                                    2, &entry,                             // added in read_histfile()
+                                    -1);
+                sessions.emplace_back( entry);
+                sessions.back().get_session_stats();
+                g_free( entry);
+                some_items_left = gtk_tree_model_iter_next( (GtkTreeModel*)mSessionChooserList, &iter);
+        }
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sm/sm.hh b/upstream/src/aghermann/ui/sm/sm.hh
index 1b9b4d8..b0a5cbf 100644
--- a/upstream/src/aghermann/ui/sm/sm.hh
+++ b/upstream/src/aghermann/ui/sm/sm.hh
@@ -31,73 +31,73 @@ namespace agh {
 namespace ui {
 
 struct SSession : public string {
-	size_t	n_groups,
-		n_subjects,
-		n_recordings;
-	time_t	last_visited;
-	// possibly something else
-	SSession (string dir_)
-	      : string (dir_),
-		n_groups (-1), n_subjects (-1), n_recordings (-1),
-		last_visited (0)
-		{
-			//get_session_stats();
-		}
-	void get_session_stats();
+        size_t        n_groups,
+                n_subjects,
+                n_recordings;
+        time_t        last_visited;
+        // possibly something else
+        SSession (string dir_)
+              : string (dir_),
+                n_groups (-1), n_subjects (-1), n_recordings (-1),
+                last_visited (0)
+                {
+                        //get_session_stats();
+                }
+        void get_session_stats();
 };
 
 
 struct SSessionChooser {
-	DELETE_DEFAULT_METHODS (SSessionChooser);
+        DELETE_DEFAULT_METHODS (SSessionChooser);
 
-	SSessionChooser (const char*);
+        SSessionChooser (const char*);
        ~SSessionChooser ();
 
-	string	title;
-	string	filename;
-	int	last_dir_no;
-	list<SSession>
-		sessions;
-
-	agh::ui::SExpDesignUI* ed;
-
-	string get_selected_dir(); // and assign last_dir_no
-	void read_sessionrc();
-	void write_sessionrc() const;
-	string get_dir( int) const;
-	string get_dir() const
-		{
-			return get_dir( last_dir_no);
-		}
-	int open_selected_session();
-	void close_current_session();
-
-	void buf_on_status_bar( bool ensure = true);
-	void sb_progress_indicator( const char*, size_t n, size_t i);
-	guint	sbChooserContextIdGeneral;
-
-	// widgets
-	int construct_widgets();
-	void destruct_widgets();
-
-	GtkListStore
-		*mSessionChooserList;
-	GtkDialog
-		*wSessionChooser;
-	GtkTreeView
-		*tvSessionChooserList;
-	GtkButton
-		*bSessionChooserOpen,
-		*bSessionChooserClose,
-		*bSessionChooserCreateNew,
-		*bSessionChooserRemove,
-		*bSessionChooserQuit;
-	GtkStatusbar
-		*sbSessionChooserStatusBar;
+        string        title;
+        string        filename;
+        int        last_dir_no;
+        list<SSession>
+                sessions;
+
+        agh::ui::SExpDesignUI* ed;
+
+        string get_selected_dir(); // and assign last_dir_no
+        void read_sessionrc();
+        void write_sessionrc() const;
+        string get_dir( int) const;
+        string get_dir() const
+                {
+                        return get_dir( last_dir_no);
+                }
+        int open_selected_session();
+        void close_current_session();
+
+        void buf_on_status_bar( bool ensure = true);
+        void sb_progress_indicator( const char*, size_t n, size_t i);
+        guint        sbChooserContextIdGeneral;
+
+        // widgets
+        int construct_widgets();
+        void destruct_widgets();
+
+        GtkListStore
+                *mSessionChooserList;
+        GtkDialog
+                *wSessionChooser;
+        GtkTreeView
+                *tvSessionChooserList;
+        GtkButton
+                *bSessionChooserOpen,
+                *bSessionChooserClose,
+                *bSessionChooserCreateNew,
+                *bSessionChooserRemove,
+                *bSessionChooserQuit;
+        GtkStatusbar
+                *sbSessionChooserStatusBar;
     // private:
-	void conditionally_enable_buttons();
-	void _sync_list_to_model();
-	void _sync_model_to_list();
+        void conditionally_enable_buttons();
+        void _sync_list_to_model();
+        void _sync_model_to_list();
 };
 
 
@@ -108,7 +108,7 @@ struct SSessionChooser {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sm/sm_cb.cc b/upstream/src/aghermann/ui/sm/sm_cb.cc
index 4c33a6c..2d4eb8a 100644
--- a/upstream/src/aghermann/ui/sm/sm_cb.cc
+++ b/upstream/src/aghermann/ui/sm/sm_cb.cc
@@ -25,205 +25,205 @@ extern "C" {
 
 void
 wSessionChooser_show_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
-	SC.last_dir_no = -1;
+        auto& SC = *(SSessionChooser*)userdata;
+        SC.last_dir_no = -1;
 
-	SC.conditionally_enable_buttons();
+        SC.conditionally_enable_buttons();
 }
 
 void
 wSessionChooser_destroy_cb(
-	GtkWidget*,
-	const gpointer userdata)
+        GtkWidget*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
+        auto& SC = *(SSessionChooser*)userdata;
 
-	SC.write_sessionrc();
+        SC.write_sessionrc();
 
-	gtk_main_quit();
+        gtk_main_quit();
 }
 
 void
 tvSessionChooserList_changed_cb(
-	GtkTreeSelection*,
-	const gpointer userdata)
+        GtkTreeSelection*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
-	SC.conditionally_enable_buttons();
+        auto& SC = *(SSessionChooser*)userdata;
+        SC.conditionally_enable_buttons();
 }
 
 void
 tvSessionChooserList_row_activated_cb(
-	GtkTreeView*,
-	GtkTreePath*,
-	GtkTreeViewColumn*,
-	const gpointer userdata)
+        GtkTreeView*,
+        GtkTreePath*,
+        GtkTreeViewColumn*,
+        const gpointer userdata)
 {
-	bSessionChooserOpen_clicked_cb( nullptr, userdata);
+        bSessionChooserOpen_clicked_cb( nullptr, userdata);
 }
 
 void
 bSessionChooserOpen_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
+        auto& SC = *(SSessionChooser*)userdata;
 
-	SBusyBlock bb (SC.wSessionChooser);
+        SBusyBlock bb (SC.wSessionChooser);
 
-	int ret = SC.open_selected_session();
+        int ret = SC.open_selected_session();
 
-	if ( ret )
-		gtk_widget_show( (GtkWidget*)SC.wSessionChooser);
-	else
-		gtk_widget_hide( (GtkWidget*)SC.wSessionChooser);
+        if ( ret )
+                gtk_widget_show( (GtkWidget*)SC.wSessionChooser);
+        else
+                gtk_widget_hide( (GtkWidget*)SC.wSessionChooser);
 }
 
 
 
 void
 bSessionChooserClose_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
+        auto& SC = *(SSessionChooser*)userdata;
 
-	SC.close_current_session();
+        SC.close_current_session();
 
-	gtk_widget_show_all( (GtkWidget*)SC.wSessionChooser);
+        gtk_widget_show_all( (GtkWidget*)SC.wSessionChooser);
 }
 
 void
 bSessionChooserQuit_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
+        auto& SC = *(SSessionChooser*)userdata;
 
-	if ( SC.ed )
-		SC.close_current_session();
+        if ( SC.ed )
+                SC.close_current_session();
 
-	// GtkTreeSelection *selection = gtk_tree_view_get_selection( (GtkTreeView*)SC.tvSessionChooserList);
-	// GtkTreeModel *model;
-	// GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
-	// if ( paths ) {
-	// 	GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
-	// 	g_list_free( paths);
+        // GtkTreeSelection *selection = gtk_tree_view_get_selection( (GtkTreeView*)SC.tvSessionChooserList);
+        // GtkTreeModel *model;
+        // GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
+        // if ( paths ) {
+        //         GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
+        //         g_list_free( paths);
 
-	// 	SC.last_dir_no = gtk_tree_path_get_indices( path)[0];
+        //         SC.last_dir_no = gtk_tree_path_get_indices( path)[0];
 
-	// 	// gtk_tree_path_free( path); // leak it
-	// }
+        //         // gtk_tree_path_free( path); // leak it
+        // }
 
-	// user is quitting from the selector, not directly from an expdesign, so
+        // user is quitting from the selector, not directly from an expdesign, so
 
-	SC.write_sessionrc();
+        SC.write_sessionrc();
 
-	gtk_main_quit();
+        gtk_main_quit();
 }
 
 
 
 void
 bSessionChooserCreateNew_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
-
-	GtkWidget *dir_chooser =
-		gtk_file_chooser_dialog_new(
-			"Locate New Experiment Directory",
-			NULL,
-			GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-			NULL);
-
-	if ( gtk_dialog_run( (GtkDialog*)dir_chooser) == GTK_RESPONSE_ACCEPT ) {
-		const char *new_dir = gtk_file_chooser_get_filename( (GtkFileChooser*)dir_chooser);
-		string new_dir_ {new_dir};
-		g_free( (void*)new_dir);
-		new_dir = agh::str::homedir2tilda(new_dir_).c_str();
-
-		GtkTreeIter iter, iter_cur;
-		GtkTreePath *path;
-		gtk_tree_view_get_cursor( SC.tvSessionChooserList, &path, NULL);
-		if ( path ) {
-			gtk_tree_model_get_iter(
-				(GtkTreeModel*)SC.mSessionChooserList,
-				&iter_cur, path);
-			gtk_list_store_insert_after(
-				SC.mSessionChooserList, &iter, &iter_cur);
-		} else
-			gtk_list_store_append(
-				SC.mSessionChooserList, &iter);
-
-		gtk_list_store_set( SC.mSessionChooserList, &iter,
-				    2, new_dir,
-				    -1);
-
-		if ( path )
-			gtk_tree_path_next( path);
-		else
-			path = gtk_tree_model_get_path(
-				(GtkTreeModel*)SC.mSessionChooserList, &iter);
-		gtk_tree_view_set_cursor(
-			SC.tvSessionChooserList,
-			path, NULL, TRUE);
-
-		SC._sync_model_to_list();
-
-		gtk_tree_path_free( path);
-
-		SC.conditionally_enable_buttons();
-	}
-
-	gtk_widget_destroy( dir_chooser);
+        auto& SC = *(SSessionChooser*)userdata;
+
+        GtkWidget *dir_chooser =
+                gtk_file_chooser_dialog_new(
+                        "Locate New Experiment Directory",
+                        NULL,
+                        GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                        NULL);
+
+        if ( gtk_dialog_run( (GtkDialog*)dir_chooser) == GTK_RESPONSE_ACCEPT ) {
+                const char *new_dir = gtk_file_chooser_get_filename( (GtkFileChooser*)dir_chooser);
+                string new_dir_ {new_dir};
+                g_free( (void*)new_dir);
+                new_dir = agh::str::homedir2tilda(new_dir_).c_str();
+
+                GtkTreeIter iter, iter_cur;
+                GtkTreePath *path;
+                gtk_tree_view_get_cursor( SC.tvSessionChooserList, &path, NULL);
+                if ( path ) {
+                        gtk_tree_model_get_iter(
+                                (GtkTreeModel*)SC.mSessionChooserList,
+                                &iter_cur, path);
+                        gtk_list_store_insert_after(
+                                SC.mSessionChooserList, &iter, &iter_cur);
+                } else
+                        gtk_list_store_append(
+                                SC.mSessionChooserList, &iter);
+
+                gtk_list_store_set( SC.mSessionChooserList, &iter,
+                                    2, new_dir,
+                                    -1);
+
+                if ( path )
+                        gtk_tree_path_next( path);
+                else
+                        path = gtk_tree_model_get_path(
+                                (GtkTreeModel*)SC.mSessionChooserList, &iter);
+                gtk_tree_view_set_cursor(
+                        SC.tvSessionChooserList,
+                        path, NULL, TRUE);
+
+                SC._sync_model_to_list();
+
+                gtk_tree_path_free( path);
+
+                SC.conditionally_enable_buttons();
+        }
+
+        gtk_widget_destroy( dir_chooser);
 }
 
 
 void
 bSessionChooserRemove_clicked_cb(
-	GtkButton*,
-	const gpointer userdata)
+        GtkButton*,
+        const gpointer userdata)
 {
-	auto& SC = *(SSessionChooser*)userdata;
-
-	GtkTreeSelection *selection = gtk_tree_view_get_selection( SC.tvSessionChooserList);
-	GtkTreeModel *model;
-	GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
-	if ( !paths )
-		return;
-	GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
-	g_list_free( paths);
-
-	GtkTreeIter iter;
-	char *entry;
-	gtk_tree_model_get_iter( model, &iter, path);
-	gtk_tree_model_get( model, &iter,
-			    0, &entry,
-			    -1);
-	// SC.sessions.remove_if( [&entry]( SSession& S) { return S == entry; });
-	gtk_list_store_remove( SC.mSessionChooserList, &iter);
-	SC._sync_model_to_list();
-
-	gtk_tree_path_free( path);
-
-	SC.last_dir_no = -1;
-
-	SC.conditionally_enable_buttons();
-	gtk_widget_show( (GtkWidget*)SC.wSessionChooser);
+        auto& SC = *(SSessionChooser*)userdata;
+
+        GtkTreeSelection *selection = gtk_tree_view_get_selection( SC.tvSessionChooserList);
+        GtkTreeModel *model;
+        GList *paths = gtk_tree_selection_get_selected_rows( selection, &model);
+        if ( !paths )
+                return;
+        GtkTreePath *path = (GtkTreePath*) g_list_nth_data( paths, 0);
+        g_list_free( paths);
+
+        GtkTreeIter iter;
+        char *entry;
+        gtk_tree_model_get_iter( model, &iter, path);
+        gtk_tree_model_get( model, &iter,
+                            0, &entry,
+                            -1);
+        // SC.sessions.remove_if( [&entry]( SSession& S) { return S == entry; });
+        gtk_list_store_remove( SC.mSessionChooserList, &iter);
+        SC._sync_model_to_list();
+
+        gtk_tree_path_free( path);
+
+        SC.last_dir_no = -1;
+
+        SC.conditionally_enable_buttons();
+        gtk_widget_show( (GtkWidget*)SC.wSessionChooser);
 }
 
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/sm/sm_cb.hh b/upstream/src/aghermann/ui/sm/sm_cb.hh
index 95bf26e..8334d41 100644
--- a/upstream/src/aghermann/ui/sm/sm_cb.hh
+++ b/upstream/src/aghermann/ui/sm/sm_cb.hh
@@ -39,7 +39,7 @@ void bSessionChooserRemove_clicked_cb( GtkButton*, gpointer);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/ui++.cc b/upstream/src/aghermann/ui/ui++.cc
index cb567d8..9db8e67 100644
--- a/upstream/src/aghermann/ui/ui++.cc
+++ b/upstream/src/aghermann/ui/ui++.cc
@@ -23,31 +23,31 @@ namespace ui {
 template <> void
 SUIVar_<GtkListStore, list<string>>::up() const
 {
-	gtk_list_store_clear( w);
-	GtkTreeIter iter;
-	for ( auto& s : *v ) {
-		gtk_list_store_append( w, &iter);
-		gtk_list_store_set(
-			w, &iter,
-			1, s.c_str(),
-			-1);
-	}
+        gtk_list_store_clear( w);
+        GtkTreeIter iter;
+        for ( auto& s : *v ) {
+                gtk_list_store_append( w, &iter);
+                gtk_list_store_set(
+                        w, &iter,
+                        1, s.c_str(),
+                        -1);
+        }
 }
 template <> void
 SUIVar_<GtkListStore, list<string>>::down() const
 {
-	v->clear();
-	GtkTreeIter
-		iter;
-	gchar	*entry;
-	while ( gtk_tree_model_get_iter_first( (GtkTreeModel*)w, &iter) ) {
-		gtk_tree_model_get(
-			(GtkTreeModel*)w, &iter,
-			1, &entry,
-			-1);
-		v->emplace_back( entry);
-		g_free( entry);
-	}
+        v->clear();
+        GtkTreeIter
+                iter;
+        gchar        *entry;
+        while ( gtk_tree_model_get_iter_first( (GtkTreeModel*)w, &iter) ) {
+                gtk_tree_model_get(
+                        (GtkTreeModel*)w, &iter,
+                        1, &entry,
+                        -1);
+                v->emplace_back( entry);
+                g_free( entry);
+        }
 }
 
 
@@ -56,7 +56,7 @@ SUIVar_<GtkListStore, list<string>>::down() const
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/ui++.hh b/upstream/src/aghermann/ui/ui++.hh
index 3e3c4d5..4c75c59 100644
--- a/upstream/src/aghermann/ui/ui++.hh
+++ b/upstream/src/aghermann/ui/ui++.hh
@@ -35,20 +35,20 @@ namespace ui {
 // SGeometry
 
 struct SGeometry {
-	int x, y, w, h;
-	SGeometry()
-	      : x (-1), y (-1), w (-1), h (-1)
-		{}
-	SGeometry( int x_, int y_, int w_, int h_)
-	      : x (x_), y (y_), w (w_), h (h_)
-		{}
-	bool is_valid() const
-		{
-			return	(x > 0) && (x < 3000) &&
-				(y > 0) && (y < 3000) &&
-				(w > 1) && (w < 50000) &&
-				(h > 1) && (h < 50000);
-		}
+        int x, y, w, h;
+        SGeometry()
+              : x (-1), y (-1), w (-1), h (-1)
+                {}
+        SGeometry( int x_, int y_, int w_, int h_)
+              : x (x_), y (y_), w (w_), h (h_)
+                {}
+        bool is_valid() const
+                {
+                        return        (x > 0) && (x < 3000) &&
+                                (y > 0) && (y < 3000) &&
+                                (w > 1) && (w < 50000) &&
+                                (h > 1) && (h < 50000);
+                }
 };
 
 
@@ -57,60 +57,60 @@ struct SGeometry {
 // connects colours to buttons and also provides useful shortcuts for cairo
 
 struct SManagedColor {
-	GdkRGBA clr;
-	GtkColorButton* btn;
-
-	SManagedColor& operator=( const SManagedColor&) = default;
-	void acquire()
-		{
-			gtk_color_chooser_get_rgba( (GtkColorChooser*)btn, &clr);
-		}
-
-	void set_source_rgb( cairo_t* cr) const
-		{
-			cairo_set_source_rgb( cr, clr.red, clr.green, clr.blue);
-		}
-	void set_source_rgba( cairo_t* cr, double alpha_override = NAN) const
-		{
-			cairo_set_source_rgba(
-				cr, clr.red, clr.green, clr.blue,
-				isfinite(alpha_override) ? alpha_override : clr.alpha);
-		}
-	void set_source_rgb_contrasting( cairo_t* cr) const
-		{
-			cairo_set_source_rgb(
-				cr, 1-clr.red, 1-clr.green, 1-clr.blue);
-		}
-	void set_source_rgba_contrasting( cairo_t* cr, double alpha_override = NAN) const
-		{
-			cairo_set_source_rgba(
-				cr, 1-clr.red, 1-clr.green, 1-clr.blue,
-				isfinite(alpha_override) ? alpha_override : clr.alpha);
-		}
-
-	void pattern_add_color_stop_rgba( cairo_pattern_t* cp, double at, double alpha_override = NAN) const
-		{
-			cairo_pattern_add_color_stop_rgba(
-				cp, at, clr.red, clr.green, clr.blue,
-				isfinite(alpha_override) ? alpha_override : clr.alpha);
-		}
+        GdkRGBA clr;
+        GtkColorButton* btn;
+
+        SManagedColor& operator=( const SManagedColor&) = default;
+        void acquire()
+                {
+                        gtk_color_chooser_get_rgba( (GtkColorChooser*)btn, &clr);
+                }
+
+        void set_source_rgb( cairo_t* cr) const
+                {
+                        cairo_set_source_rgb( cr, clr.red, clr.green, clr.blue);
+                }
+        void set_source_rgba( cairo_t* cr, double alpha_override = NAN) const
+                {
+                        cairo_set_source_rgba(
+                                cr, clr.red, clr.green, clr.blue,
+                                isfinite(alpha_override) ? alpha_override : clr.alpha);
+                }
+        void set_source_rgb_contrasting( cairo_t* cr) const
+                {
+                        cairo_set_source_rgb(
+                                cr, 1-clr.red, 1-clr.green, 1-clr.blue);
+                }
+        void set_source_rgba_contrasting( cairo_t* cr, double alpha_override = NAN) const
+                {
+                        cairo_set_source_rgba(
+                                cr, 1-clr.red, 1-clr.green, 1-clr.blue,
+                                isfinite(alpha_override) ? alpha_override : clr.alpha);
+                }
+
+        void pattern_add_color_stop_rgba( cairo_pattern_t* cp, double at, double alpha_override = NAN) const
+                {
+                        cairo_pattern_add_color_stop_rgba(
+                                cp, at, clr.red, clr.green, clr.blue,
+                                isfinite(alpha_override) ? alpha_override : clr.alpha);
+                }
 };
 
 
 enum class TGtkRefreshMode {
-	gtk, gdk
+        gtk, gdk
 };
 
 
 inline GdkColor
 contrasting_to( const GdkColor* c)
 {
-	GdkColor cc;
-	if ( c->red + c->green + c->blue < 65535*3/2 )
-		cc.red = cc.green = cc.blue = 65535;
-	else
-		cc.red = cc.green = cc.blue = 0;
-	return cc;
+        GdkColor cc;
+        if ( c->red + c->green + c->blue < 65535*3/2 )
+                cc.red = cc.green = cc.blue = 65535;
+        else
+                cc.red = cc.green = cc.blue = 0;
+        return cc;
 }
 
 
@@ -119,46 +119,46 @@ contrasting_to( const GdkColor* c)
 // SBusyBlock
 
 class SBusyBlock {
-	DELETE_DEFAULT_METHODS (SBusyBlock);
+        DELETE_DEFAULT_METHODS (SBusyBlock);
     public:
-	SBusyBlock (GtkWidget* w_)
-	      : w (w_)
-		{
-			lock();
-		}
-	// delegating ctors
-	SBusyBlock (GtkWindow* w)
-	      : SBusyBlock ((GtkWidget*)w)
-		{}
-	SBusyBlock (GtkDialog* w)
-	      : SBusyBlock ((GtkWidget*)w)
-		{}
-
-	// SBusyBlock (GtkWindow* w_)
-	//       : w ((GtkWidget*)w_)
-	// 	{
-	// 		lock();
-	// 	}
-	// SBusyBlock (GtkDialog* w_)
-	//       : w ((GtkWidget*)w_)
-	// 	{
-	// 		lock();
-	// 	}
+        SBusyBlock (GtkWidget* w_)
+              : w (w_)
+                {
+                        lock();
+                }
+        // delegating ctors
+        SBusyBlock (GtkWindow* w)
+              : SBusyBlock ((GtkWidget*)w)
+                {}
+        SBusyBlock (GtkDialog* w)
+              : SBusyBlock ((GtkWidget*)w)
+                {}
+
+        // SBusyBlock (GtkWindow* w_)
+        //       : w ((GtkWidget*)w_)
+        //         {
+        //                 lock();
+        //         }
+        // SBusyBlock (GtkDialog* w_)
+        //       : w ((GtkWidget*)w_)
+        //         {
+        //                 lock();
+        //         }
 
        ~SBusyBlock ()
-		{
-			set_cursor_busy( false, w);
-			gtk_widget_set_sensitive( w, TRUE);
-			gtk_flush();
-		}
+                {
+                        set_cursor_busy( false, w);
+                        gtk_widget_set_sensitive( w, TRUE);
+                        gtk_flush();
+                }
     private:
-	GtkWidget *w;
-	void lock()
-		{
-			gtk_widget_set_sensitive( w, FALSE);
-			set_cursor_busy( true, w);
-			gtk_flush();
-		}
+        GtkWidget *w;
+        void lock()
+                {
+                        gtk_widget_set_sensitive( w, FALSE);
+                        set_cursor_busy( true, w);
+                        gtk_flush();
+                }
 };
 
 
@@ -168,141 +168,141 @@ class SBusyBlock {
 
 class SUIVar_base {
     public:
-	virtual ~SUIVar_base ()
-		{}
-	virtual void down() const = 0;
-	virtual void up() const = 0;
+        virtual ~SUIVar_base ()
+                {}
+        virtual void down() const = 0;
+        virtual void up() const = 0;
 };
 
 
 template <typename Tw, typename Tv>
 class SUIVar_ : public SUIVar_base {
-	DELETE_DEFAULT_METHODS (SUIVar_);
+        DELETE_DEFAULT_METHODS (SUIVar_);
 
-	Tw	*w;
-	Tv	*v;
+        Tw        *w;
+        Tv        *v;
 
     public:
-	SUIVar_ (Tw* w_, Tv* v_)
-	      : w (w_), v (v_)
-		{}
-	virtual ~SUIVar_ ()
-		{}
-
-	virtual void down() const;
-	virtual void up() const;
+        SUIVar_ (Tw* w_, Tv* v_)
+              : w (w_), v (v_)
+                {}
+        virtual ~SUIVar_ ()
+                {}
+
+        virtual void down() const;
+        virtual void up() const;
 };
 
 
 template <> inline void
-SUIVar_<GtkSpinButton, double>::up()	const { gtk_spin_button_set_value( w, *v); }
+SUIVar_<GtkSpinButton, double>::up()        const { gtk_spin_button_set_value( w, *v); }
 template <> inline void
-SUIVar_<GtkSpinButton, double>::down()	const { *v = gtk_spin_button_get_value( w); }
+SUIVar_<GtkSpinButton, double>::down()        const { *v = gtk_spin_button_get_value( w); }
 
 template <> inline void
-SUIVar_<GtkSpinButton, float>::up()	const { gtk_spin_button_set_value( w, *v); }
+SUIVar_<GtkSpinButton, float>::up()        const { gtk_spin_button_set_value( w, *v); }
 template <> inline void
-SUIVar_<GtkSpinButton, float>::down()	const { *v = gtk_spin_button_get_value( w); }
+SUIVar_<GtkSpinButton, float>::down()        const { *v = gtk_spin_button_get_value( w); }
 
 template <> inline void
-SUIVar_<GtkSpinButton, int>::up()	const { gtk_spin_button_set_value( w, (double)*v); }
+SUIVar_<GtkSpinButton, int>::up()        const { gtk_spin_button_set_value( w, (double)*v); }
 template <> inline void
-SUIVar_<GtkSpinButton, int>::down()	const { *v = (int)round(gtk_spin_button_get_value( w)); }
+SUIVar_<GtkSpinButton, int>::down()        const { *v = (int)round(gtk_spin_button_get_value( w)); }
 
 template <> inline void
-SUIVar_<GtkSpinButton, size_t>::up()	const { gtk_spin_button_set_value( w, (double)*v); }
+SUIVar_<GtkSpinButton, size_t>::up()        const { gtk_spin_button_set_value( w, (double)*v); }
 template <> inline void
-SUIVar_<GtkSpinButton, size_t>::down()	const
+SUIVar_<GtkSpinButton, size_t>::down()        const
 {
-	auto t = (long int)round(gtk_spin_button_get_value( w));
-	if ( t < 0 ) {
-		fprintf( stderr, "SUIVar_<size_t> got a negative value (%ld) from your spinbutton; value has been clamped at 0\n", t);
-		*v = 0;
-	} else
-		*v = t;
+        auto t = (long int)round(gtk_spin_button_get_value( w));
+        if ( t < 0 ) {
+                fprintf( stderr, "SUIVar_<size_t> got a negative value (%ld) from your spinbutton; value has been clamped at 0\n", t);
+                *v = 0;
+        } else
+                *v = t;
 }
 
 template <> inline void
-SUIVar_<GtkComboBox, int>::up()		const { gtk_combo_box_set_active( w, *v); }
+SUIVar_<GtkComboBox, int>::up()                const { gtk_combo_box_set_active( w, *v); }
 template <> inline void
-SUIVar_<GtkComboBox, int>::down()	const { *v = gtk_combo_box_get_active( w); }
+SUIVar_<GtkComboBox, int>::down()        const { *v = gtk_combo_box_get_active( w); }
 
 template <> inline void
-SUIVar_<GtkCheckButton, bool>::up()	const { gtk_toggle_button_set_active( (GtkToggleButton*)w, *v); }
+SUIVar_<GtkCheckButton, bool>::up()        const { gtk_toggle_button_set_active( (GtkToggleButton*)w, *v); }
 template <> inline void
-SUIVar_<GtkCheckButton, bool>::down()	const { *v = gtk_toggle_button_get_active( (GtkToggleButton*)w); }
+SUIVar_<GtkCheckButton, bool>::down()        const { *v = gtk_toggle_button_get_active( (GtkToggleButton*)w); }
 
 template <> inline void
-SUIVar_<GtkRadioButton, bool>::up()	const { gtk_toggle_button_set_active( (GtkToggleButton*)w, *v); }
+SUIVar_<GtkRadioButton, bool>::up()        const { gtk_toggle_button_set_active( (GtkToggleButton*)w, *v); }
 template <> inline void
-SUIVar_<GtkRadioButton, bool>::down()	const { *v = gtk_toggle_button_get_active( (GtkToggleButton*)w); }
+SUIVar_<GtkRadioButton, bool>::down()        const { *v = gtk_toggle_button_get_active( (GtkToggleButton*)w); }
 
 template <> inline void
-SUIVar_<GtkEntry, string>::up()		const { gtk_entry_set_text( w, v->c_str()); }
+SUIVar_<GtkEntry, string>::up()                const { gtk_entry_set_text( w, v->c_str()); }
 template <> inline void
-SUIVar_<GtkEntry, string>::down()	const { v->assign( gtk_entry_get_text( w)); }
+SUIVar_<GtkEntry, string>::down()        const { v->assign( gtk_entry_get_text( w)); }
 
 
 
 class SUIVarCollection {
     public:
        ~SUIVarCollection ()
-		{
-			for ( auto& A : c )
-				delete A;
-		}
-
-	void reg( GtkSpinButton *w, float* v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, float> (w, v));
-		}
-	void reg( GtkSpinButton *w, double* v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, double> (w, v));
-		}
-	void reg( GtkSpinButton *w, int* v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, int> (w, v));
-		}
-	void reg( GtkSpinButton *w, size_t* v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, size_t> (w, v));
-		}
-	void reg( GtkComboBox *w, int* v)
-		{
-			c.push_back( new SUIVar_<GtkComboBox, int> (w, v));
-		}
-	void reg( GtkCheckButton *w, bool* v)
-		{
-			c.push_back( new SUIVar_<GtkCheckButton, bool> (w, v));
-		}
-	void reg( GtkRadioButton *w, bool* v)
-		{
-			c.push_back( new SUIVar_<GtkRadioButton, bool> (w, v));
-		}
-	void reg( GtkEntry *w, string* v)
-		{
-			c.push_back( new SUIVar_<GtkEntry, string> (w, v));
-		}
-	// odd one out
-	void reg( GtkListStore *m, list<string> *l)
-		{
-			c.push_back( new SUIVar_<GtkListStore, list<string>> (m, l));
-		}
-
-	void up() const
-		{
-			for ( auto& A : c )
-				A->up();
-		}
-	void down() const
-		{
-			for ( auto& A : c )
-				A->down();
-		}
+                {
+                        for ( auto& A : c )
+                                delete A;
+                }
+
+        void reg( GtkSpinButton *w, float* v)
+                {
+                        c.push_back( new SUIVar_<GtkSpinButton, float> (w, v));
+                }
+        void reg( GtkSpinButton *w, double* v)
+                {
+                        c.push_back( new SUIVar_<GtkSpinButton, double> (w, v));
+                }
+        void reg( GtkSpinButton *w, int* v)
+                {
+                        c.push_back( new SUIVar_<GtkSpinButton, int> (w, v));
+                }
+        void reg( GtkSpinButton *w, size_t* v)
+                {
+                        c.push_back( new SUIVar_<GtkSpinButton, size_t> (w, v));
+                }
+        void reg( GtkComboBox *w, int* v)
+                {
+                        c.push_back( new SUIVar_<GtkComboBox, int> (w, v));
+                }
+        void reg( GtkCheckButton *w, bool* v)
+                {
+                        c.push_back( new SUIVar_<GtkCheckButton, bool> (w, v));
+                }
+        void reg( GtkRadioButton *w, bool* v)
+                {
+                        c.push_back( new SUIVar_<GtkRadioButton, bool> (w, v));
+                }
+        void reg( GtkEntry *w, string* v)
+                {
+                        c.push_back( new SUIVar_<GtkEntry, string> (w, v));
+                }
+        // odd one out
+        void reg( GtkListStore *m, list<string> *l)
+                {
+                        c.push_back( new SUIVar_<GtkListStore, list<string>> (m, l));
+                }
+
+        void up() const
+                {
+                        for ( auto& A : c )
+                                A->up();
+                }
+        void down() const
+                {
+                        for ( auto& A : c )
+                                A->down();
+                }
 
     private:
-	list<SUIVar_base*> c;
+        list<SUIVar_base*> c;
 };
 
 
@@ -313,7 +313,7 @@ class SUIVarCollection {
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/ui.cc b/upstream/src/aghermann/ui/ui.cc
index ded6c04..f94f83e 100644
--- a/upstream/src/aghermann/ui/ui.cc
+++ b/upstream/src/aghermann/ui/ui.cc
@@ -26,9 +26,9 @@ void
 agh::ui::
 set_unique_app_window( GtkWindow* w)
 {
-	unique_app_watch_window(
-		global::unique_app,
-		global::main_window = w);
+        unique_app_watch_window(
+                global::unique_app,
+                global::main_window = w);
 }
 
 // own init
@@ -38,34 +38,34 @@ agh::ui::
 prepare_for_expdesign()
 {
       // tell me what they are
-	global::client_pointer =
-		gdk_device_manager_get_client_pointer(
-			gdk_display_get_device_manager( gdk_display_get_default()));
-
-	{
-		auto scr = gdk_screen_get_default();
-
-		using global::hdpmm;
-		using global::vdpmm;
-
-		hdpmm = (double)gdk_screen_get_width ( scr) / gdk_screen_get_width_mm ( scr);
-		vdpmm = (double)gdk_screen_get_height( scr) / gdk_screen_get_height_mm( scr);
-		printf( "Screen xdpmm is %g v, %g h\n", hdpmm, vdpmm);
-		gdk_screen_set_resolution( scr, (hdpmm + vdpmm)/2);
-	}
-
-	GResource
-		*gresource
-		= g_resource_load(
-			PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE,
-			NULL);
-	if ( !gresource ) {
-		fprintf( stderr, "Bad or missing " PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE);
-		return -1;
-	}
-	g_resources_register( gresource);
-
-	return 0;
+        global::client_pointer =
+                gdk_device_manager_get_client_pointer(
+                        gdk_display_get_device_manager( gdk_display_get_default()));
+
+        {
+                auto scr = gdk_screen_get_default();
+
+                using global::hdpmm;
+                using global::vdpmm;
+
+                hdpmm = (double)gdk_screen_get_width ( scr) / gdk_screen_get_width_mm ( scr);
+                vdpmm = (double)gdk_screen_get_height( scr) / gdk_screen_get_height_mm( scr);
+                printf( "Screen xdpmm is %g v, %g h\n", hdpmm, vdpmm);
+                gdk_screen_set_resolution( scr, (hdpmm + vdpmm)/2);
+        }
+
+        GResource
+                *gresource
+                = g_resource_load(
+                        PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE,
+                        NULL);
+        if ( !gresource ) {
+                fprintf( stderr, "Bad or missing " PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE);
+                return -1;
+        }
+        g_resources_register( gresource);
+
+        return 0;
 }
 
 
@@ -80,88 +80,88 @@ prepare_for_expdesign()
 void
 agh::ui::
 cairo_put_banner( cairo_t *cr, const float wd, const float ht,
-		  const char *text,
-		  const float font_size,
-		  const float r, const float g, const float b,
-		  const float a)
+                  const char *text,
+                  const float font_size,
+                  const float r, const float g, const float b,
+                  const float a)
 {
-	cairo_set_font_size( cr, font_size);
-	cairo_set_source_rgba( cr, r, g, b, a);
-	cairo_text_extents_t extents;
-	cairo_text_extents( cr, text, &extents);
-	double	idox = wd/2 - extents.width/2,
-		idoy = ht/2 + extents.height/2;
-	cairo_move_to( cr, idox, idoy);
-	cairo_show_text( cr, text);
-	cairo_stroke( cr);
+        cairo_set_font_size( cr, font_size);
+        cairo_set_source_rgba( cr, r, g, b, a);
+        cairo_text_extents_t extents;
+        cairo_text_extents( cr, text, &extents);
+        double        idox = wd/2 - extents.width/2,
+                idoy = ht/2 + extents.height/2;
+        cairo_move_to( cr, idox, idoy);
+        cairo_show_text( cr, text);
+        cairo_stroke( cr);
 }
 
 
 void
 agh::ui::
 cairo_draw_signal( cairo_t *cr, const valarray<TFloat>& V,
-		   const ssize_t start, const ssize_t end,
-		   const size_t hspan, const float hoff, const float voff, const float scale,
-		   const unsigned short decimate,
-		   const TDrawSignalDirection direction,
-		   const TDrawSignalPathOption continue_path_option)
+                   const ssize_t start, const ssize_t end,
+                   const size_t hspan, const float hoff, const float voff, const float scale,
+                   const unsigned short decimate,
+                   const TDrawSignalDirection direction,
+                   const TDrawSignalPathOption continue_path_option)
 {
-	bool continue_path = continue_path_option == TDrawSignalPathOption::yes;
-	switch ( direction ) {
-
-	case TDrawSignalDirection::forward:
-		if ( unlikely (start < 0) )
-			(continue_path ? cairo_line_to : cairo_move_to)(
-				cr, hoff + ((double)(0 - start))/(end-start) * hspan, 0 + voff);
-		else
-			(continue_path ? cairo_line_to : cairo_move_to)(
-				cr, hoff,
-				voff - V[start] * scale);
-		for ( ssize_t i = max((ssize_t)1, start); i < end && i < (ssize_t)V.size(); i += decimate )
-			if ( isfinite(V[i]) )
-				cairo_line_to( cr, hoff + ((double)(i - start))/(end-start) * hspan,
-					       voff - V[i] * scale);
-	    break;
-
-	case TDrawSignalDirection::backward:
-		if ( unlikely (end > (ssize_t)V.size()) )
-			(continue_path ? cairo_line_to : cairo_move_to)(
-				cr, hoff + ((double)(V.size()-1 - start))/(end-start) * hspan, 0 + voff);
-		else
-			(continue_path ? cairo_line_to : cairo_move_to)(
-				cr, hoff,
-				voff - V[end-1] * scale);
-		for ( ssize_t i = min(end, (ssize_t)V.size()) - 1-1; i >= 0 && i >= start; i -= decimate )
-			if ( isfinite(V[i]) )
-				cairo_line_to( cr, hoff + ((double)(i - start))/(end-start) * hspan,
-					       voff - V[i] * scale);
-	    break;
-	}
-//	cairo_stroke( cr);
+        bool continue_path = continue_path_option == TDrawSignalPathOption::yes;
+        switch ( direction ) {
+
+        case TDrawSignalDirection::forward:
+                if ( unlikely (start < 0) )
+                        (continue_path ? cairo_line_to : cairo_move_to)(
+                                cr, hoff + ((double)(0 - start))/(end-start) * hspan, 0 + voff);
+                else
+                        (continue_path ? cairo_line_to : cairo_move_to)(
+                                cr, hoff,
+                                voff - V[start] * scale);
+                for ( ssize_t i = max((ssize_t)1, start); i < end && i < (ssize_t)V.size(); i += decimate )
+                        if ( isfinite(V[i]) )
+                                cairo_line_to( cr, hoff + ((double)(i - start))/(end-start) * hspan,
+                                               voff - V[i] * scale);
+            break;
+
+        case TDrawSignalDirection::backward:
+                if ( unlikely (end > (ssize_t)V.size()) )
+                        (continue_path ? cairo_line_to : cairo_move_to)(
+                                cr, hoff + ((double)(V.size()-1 - start))/(end-start) * hspan, 0 + voff);
+                else
+                        (continue_path ? cairo_line_to : cairo_move_to)(
+                                cr, hoff,
+                                voff - V[end-1] * scale);
+                for ( ssize_t i = min(end, (ssize_t)V.size()) - 1-1; i >= 0 && i >= start; i -= decimate )
+                        if ( isfinite(V[i]) )
+                                cairo_line_to( cr, hoff + ((double)(i - start))/(end-start) * hspan,
+                                               voff - V[i] * scale);
+            break;
+        }
+//        cairo_stroke( cr);
 }
 
 
 void
 agh::ui::
 cairo_draw_envelope( cairo_t *cr, const valarray<TFloat>& V,
-		     ssize_t start, ssize_t end,
-		     const size_t hspan,
-		     const float hoff, const float voff,
-		     const float scale)
+                     ssize_t start, ssize_t end,
+                     const size_t hspan,
+                     const float hoff, const float voff,
+                     const float scale)
 {
-	agh::alg::ensure_within( start, (ssize_t)0, (ssize_t)V.size());
-	agh::alg::ensure_within( end,   (ssize_t)0, (ssize_t)V.size());
-
-	double dps = (double)(end - start) / hspan;
-	cairo_move_to( cr, hoff, voff);
-	ssize_t i = start;
-	for ( ; i < end; ++i )
-		cairo_line_to( cr, i / dps,
-			       voff - V[i] * scale/2);
-	for ( --i; i > start; --i )
-		cairo_line_to( cr, i / dps,
-			       voff + V[i] * scale/2);
-	cairo_fill( cr);
+        agh::alg::ensure_within( start, (ssize_t)0, (ssize_t)V.size());
+        agh::alg::ensure_within( end,   (ssize_t)0, (ssize_t)V.size());
+
+        double dps = (double)(end - start) / hspan;
+        cairo_move_to( cr, hoff, voff);
+        ssize_t i = start;
+        for ( ; i < end; ++i )
+                cairo_line_to( cr, i / dps,
+                               voff - V[i] * scale/2);
+        for ( --i; i > start; --i )
+                cairo_line_to( cr, i / dps,
+                               voff + V[i] * scale/2);
+        cairo_fill( cr);
 }
 
 
@@ -176,9 +176,9 @@ void
 agh::ui::
 gtk_combo_box_set_model_properly( GtkComboBox *cb, GtkListStore *m)
 {
-	gtk_combo_box_set_model( cb, (GtkTreeModel*)m);
-	gtk_combo_box_set_id_column( cb, 0);
-	gtk_cell_layout_set_renderer( cb);
+        gtk_combo_box_set_model( cb, (GtkTreeModel*)m);
+        gtk_combo_box_set_id_column( cb, 0);
+        gtk_cell_layout_set_renderer( cb);
 }
 
 
@@ -186,79 +186,79 @@ void
 agh::ui::
 gtk_cell_layout_set_renderer( GtkComboBox *cb)
 {
-	GtkCellRenderer *r = gtk_cell_renderer_text_new();
-	gtk_cell_layout_pack_start(
-		(GtkCellLayout*)cb,
-		r,
-		FALSE);
-	gtk_cell_layout_set_attributes(
-		(GtkCellLayout*)cb, r,
-		"text", 0,
-		NULL);
+        GtkCellRenderer *r = gtk_cell_renderer_text_new();
+        gtk_cell_layout_pack_start(
+                (GtkCellLayout*)cb,
+                r,
+                FALSE);
+        gtk_cell_layout_set_attributes(
+                (GtkCellLayout*)cb, r,
+                "text", 0,
+                NULL);
 }
 
 void
 agh::ui::
 pop_ok_message( GtkWindow *parent,
-		const char* primary_text,
-		const char* fmt, ...)
+                const char* primary_text,
+                const char* fmt, ...)
 {
-	auto W = (GtkMessageDialog*)
-		gtk_message_dialog_new_with_markup(
-			parent,
-			(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
-			GTK_MESSAGE_INFO,
-			GTK_BUTTONS_OK,
-			primary_text, NULL);
-
-	if ( fmt ) {
-		va_list ap;
-		va_start (ap, fmt);
-
-		char *_;
-		if (vasprintf( &_, fmt, ap) <= 0)
-			abort();
-		va_end (ap);
-		gtk_message_dialog_format_secondary_markup( W, "%s", _);
-		free( (void*)_);
-	}
-
-	gtk_dialog_run( (GtkDialog*)W);
-
-	gtk_widget_destroy( (GtkWidget*)W);
+        auto W = (GtkMessageDialog*)
+                gtk_message_dialog_new_with_markup(
+                        parent,
+                        (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
+                        GTK_MESSAGE_INFO,
+                        GTK_BUTTONS_OK,
+                        primary_text, NULL);
+
+        if ( fmt ) {
+                va_list ap;
+                va_start (ap, fmt);
+
+                char *_;
+                if (vasprintf( &_, fmt, ap) <= 0)
+                        abort();
+                va_end (ap);
+                gtk_message_dialog_format_secondary_markup( W, "%s", _);
+                free( (void*)_);
+        }
+
+        gtk_dialog_run( (GtkDialog*)W);
+
+        gtk_widget_destroy( (GtkWidget*)W);
 }
 
 
 gint
 agh::ui::
 pop_question( GtkWindow* parent,
-	      const char* primary_text,
-	      const char* fmt, ...)
+              const char* primary_text,
+              const char* fmt, ...)
 {
-	auto W = (GtkMessageDialog*)
-		gtk_message_dialog_new_with_markup(
-			parent,
-			(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
-			GTK_MESSAGE_INFO,
-			GTK_BUTTONS_YES_NO,
-			primary_text, NULL);
-
-	if ( fmt ) {
-		va_list ap;
-		va_start (ap, fmt);
-
-		char *_;
-		if (vasprintf( &_, fmt, ap) <= 0)
-			abort();
-		va_end (ap);
-		gtk_message_dialog_format_secondary_markup( W, "%s", _);
-		free( (void*)_);
-	}
-
-	gint response = gtk_dialog_run( (GtkDialog*)W);
-	gtk_widget_destroy( (GtkWidget*)W);
-
-	return response;
+        auto W = (GtkMessageDialog*)
+                gtk_message_dialog_new_with_markup(
+                        parent,
+                        (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
+                        GTK_MESSAGE_INFO,
+                        GTK_BUTTONS_YES_NO,
+                        primary_text, NULL);
+
+        if ( fmt ) {
+                va_list ap;
+                va_start (ap, fmt);
+
+                char *_;
+                if (vasprintf( &_, fmt, ap) <= 0)
+                        abort();
+                va_end (ap);
+                gtk_message_dialog_format_secondary_markup( W, "%s", _);
+                free( (void*)_);
+        }
+
+        gint response = gtk_dialog_run( (GtkDialog*)W);
+        gtk_widget_destroy( (GtkWidget*)W);
+
+        return response;
 }
 
 
@@ -268,19 +268,19 @@ void
 agh::ui::
 set_cursor_busy( bool busy, GtkWidget *wid)
 {
-	static GdkCursor *cursor_busy   = NULL,
-			 *cursor_normal = NULL;
-	if ( cursor_normal == NULL) {
-		cursor_busy   = gdk_cursor_new_from_name( gdk_display_get_default(), "watch");
-		cursor_normal = gdk_cursor_new_from_name( gdk_display_get_default(), "left_ptr");
-	}
-
-	gdk_window_set_cursor( gtk_widget_get_window( wid), busy ? cursor_busy : cursor_normal);
+        static GdkCursor *cursor_busy   = NULL,
+                         *cursor_normal = NULL;
+        if ( cursor_normal == NULL) {
+                cursor_busy   = gdk_cursor_new_from_name( gdk_display_get_default(), "watch");
+                cursor_normal = gdk_cursor_new_from_name( gdk_display_get_default(), "left_ptr");
+        }
+
+        gdk_window_set_cursor( gtk_widget_get_window( wid), busy ? cursor_busy : cursor_normal);
 }
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/aghermann/ui/ui.hh b/upstream/src/aghermann/ui/ui.hh
index 2f020af..3bd852b 100644
--- a/upstream/src/aghermann/ui/ui.hh
+++ b/upstream/src/aghermann/ui/ui.hh
@@ -42,8 +42,8 @@ void set_unique_app_window( GtkWindow*);
 inline void
 gtk_flush()
 {
-	while ( gtk_events_pending() )
-		gtk_main_iteration();
+        while ( gtk_events_pending() )
+                gtk_main_iteration();
 }
 
 void gtk_combo_box_set_model_properly( GtkComboBox*, GtkListStore*);
@@ -56,47 +56,47 @@ enum class TDrawSignalPathOption { yes, no };
 
 void
 cairo_draw_signal( cairo_t*,
-		   const valarray<TFloat>&,
-		   ssize_t start, ssize_t end,
-		   size_t da_wd, float hdisp, float vdisp, float display_scale,
-		   unsigned short decimate = 1,
-		   TDrawSignalDirection direction = TDrawSignalDirection::forward,
-		   TDrawSignalPathOption continue_path = TDrawSignalPathOption::yes);
+                   const valarray<TFloat>&,
+                   ssize_t start, ssize_t end,
+                   size_t da_wd, float hdisp, float vdisp, float display_scale,
+                   unsigned short decimate = 1,
+                   TDrawSignalDirection direction = TDrawSignalDirection::forward,
+                   TDrawSignalPathOption continue_path = TDrawSignalPathOption::yes);
 
 inline void
 cairo_draw_signal( cairo_t *cr,
-		   const itpp::Mat<double>& signal, int row,
-		   ssize_t start, ssize_t end,
-		   size_t width, double hdisp, double vdisp, float display_scale,
-		   unsigned short decimate = 1,
-		   TDrawSignalDirection direction = TDrawSignalDirection::forward,
-		   TDrawSignalPathOption continue_path = TDrawSignalPathOption::yes)
+                   const itpp::Mat<double>& signal, int row,
+                   ssize_t start, ssize_t end,
+                   size_t width, double hdisp, double vdisp, float display_scale,
+                   unsigned short decimate = 1,
+                   TDrawSignalDirection direction = TDrawSignalDirection::forward,
+                   TDrawSignalPathOption continue_path = TDrawSignalPathOption::yes)
 {
-	valarray<TFloat> tmp (end - start); // avoid copying other rows, cols
-	for ( ssize_t c = 0; c < (end-start); ++c )
-		if ( likely (start + c > 0 && start + c < (ssize_t)signal.size()) )
-			tmp[c] = signal(row, start + c);
-	cairo_draw_signal( cr,
-			   tmp, 0, end-start,
-			   width, hdisp, vdisp, display_scale,
-			   decimate,
-			   direction,
-			   continue_path);
+        valarray<TFloat> tmp (end - start); // avoid copying other rows, cols
+        for ( ssize_t c = 0; c < (end-start); ++c )
+                if ( likely (start + c > 0 && start + c < (ssize_t)signal.size()) )
+                        tmp[c] = signal(row, start + c);
+        cairo_draw_signal( cr,
+                           tmp, 0, end-start,
+                           width, hdisp, vdisp, display_scale,
+                           decimate,
+                           direction,
+                           continue_path);
 }
 
 void
 cairo_draw_envelope( cairo_t*,
-		     const valarray<TFloat>&,
-		     ssize_t start, ssize_t end,
-		     size_t da_wd, float hdisp, float vdisp, float display_scale);
+                     const valarray<TFloat>&,
+                     ssize_t start, ssize_t end,
+                     size_t da_wd, float hdisp, float vdisp, float display_scale);
 
 
 void
 cairo_put_banner( cairo_t *cr,
-		  float wd, float ht,
-		  const char *text,
-		  float font_size = 18,
-		  float r = .1, float g = .1, float b = .1, float a = .3);
+                  float wd, float ht,
+                  const char *text,
+                  float font_size = 18,
+                  float r = .1, float g = .1, float b = .1, float a = .3);
 
 
 
@@ -107,18 +107,18 @@ void set_cursor_busy( bool busy, GtkWidget *wid);
 
 
 
-#define AGH_GBGETOBJ(Type, A)				\
-	(A = (Type*)(gtk_builder_get_object( builder, #A)))
+#define AGH_GBGETOBJ(Type, A)                                \
+        (A = (Type*)(gtk_builder_get_object( builder, #A)))
 
-#define AGH_GBGETOBJ3(B, Type, A)			\
-	(A = (Type*)(gtk_builder_get_object( B, #A)))
+#define AGH_GBGETOBJ3(B, Type, A)                        \
+        (A = (Type*)(gtk_builder_get_object( B, #A)))
 
-#define G_CONNECT_1(W, A)						\
-	g_signal_connect(W, #A, (GCallback)W ## _ ## A ## _cb, this)
-#define G_CONNECT_2(W, A1, A2)						\
-	g_signal_connect(W, #A1 "-" #A2, (GCallback)W ## _ ## A1 ## _ ## A2 ## _cb, this)
-#define G_CONNECT_3(W, A1, A2, A3)					\
-	g_signal_connect(W, #A1 "-" #A2 "-" #A3, (GCallback)W ## _ ## A1 ## _ ## A2 ## _ ## A3 ## _cb, this)
+#define G_CONNECT_1(W, A)                                                \
+        g_signal_connect(W, #A, (GCallback)W ## _ ## A ## _cb, this)
+#define G_CONNECT_2(W, A1, A2)                                                \
+        g_signal_connect(W, #A1 "-" #A2, (GCallback)W ## _ ## A1 ## _ ## A2 ## _cb, this)
+#define G_CONNECT_3(W, A1, A2, A3)                                        \
+        g_signal_connect(W, #A1 "-" #A2 "-" #A3, (GCallback)W ## _ ## A1 ## _ ## A2 ## _ ## A3 ## _cb, this)
 
 }
 } // namespace agh::ui
@@ -127,7 +127,7 @@ void set_cursor_busy( bool busy, GtkWidget *wid);
 
 // Local Variables:
 // Mode: c++
-// indent-tabs-mode: 8
+// indent-tabs-mode: nil
 // tab-width: 8
 // c-basic-offset: 8
 // End:
diff --git a/upstream/src/libmetrics/mc-artifacts.ii b/upstream/src/libmetrics/mc-artifacts.ii
index ab36a8e..8a520a4 100644
--- a/upstream/src/libmetrics/mc-artifacts.ii
+++ b/upstream/src/libmetrics/mc-artifacts.ii
@@ -16,41 +16,41 @@ extern template vector<size_t> detect_artifacts( const valarray<TFloat>&, size_t
 template <typename T>
 vector<size_t> // don't estimate, use pi*B*x^2 (E) as provided
 detect_artifacts( const valarray<T>& signal, size_t sr,
-		  const SArtifactDetectionPP& P)
+                  const SArtifactDetectionPP& P)
 {
-	auto	sssu
-		= do_sssu_reduction(
-			signal,
-			sr, P.scope, P.scope,
-			P.mc_gain, P.iir_backpolate,
-			P.f0, P.fc, P.bandwidth);
-	valarray<T>
-		sssu_diff = {sssu.first - sssu.second};
-
-	sigproc::smooth( sssu_diff, P.smooth_side);
-
-	double E;
-	if ( P.estimate_E )
-		E = P.use_range
-			? estimate_E(
-				sssu_diff,
-				P.sssu_hist_size,
-				P.dmin, P.dmax)
-			: estimate_E(
-				sssu_diff,
-				P.sssu_hist_size);
-	else
-		E = P.E;
-
-	vector<size_t>
-		marked;
-	for ( size_t p = 0; p < sssu_diff.size(); ++p )
-		if ( sssu_diff[p] < E + E * P.lower_thr ||
-		     sssu_diff[p] > E + E * P.upper_thr ) {
-			marked.push_back(p);
-		}
-
-	return marked;
+        auto        sssu
+                = do_sssu_reduction(
+                        signal,
+                        sr, P.scope, P.scope,
+                        P.mc_gain, P.iir_backpolate,
+                        P.f0, P.fc, P.bandwidth);
+        valarray<T>
+                sssu_diff = {sssu.first - sssu.second};
+
+        sigproc::smooth( sssu_diff, P.smooth_side);
+
+        double E;
+        if ( P.estimate_E )
+                E = P.use_range
+                        ? estimate_E(
+                                sssu_diff,
+                                P.sssu_hist_size,
+                                P.dmin, P.dmax)
+                        : estimate_E(
+                                sssu_diff,
+                                P.sssu_hist_size);
+        else
+                E = P.E;
+
+        vector<size_t>
+                marked;
+        for ( size_t p = 0; p < sssu_diff.size(); ++p )
+                if ( sssu_diff[p] < E + E * P.lower_thr ||
+                     sssu_diff[p] > E + E * P.upper_thr ) {
+                        marked.push_back(p);
+                }
+
+        return marked;
 }
 
 // Local Variables:
diff --git a/upstream/src/libsigproc/ext-filters.ii b/upstream/src/libsigproc/ext-filters.ii
index bb1faed..73e4c1f 100644
--- a/upstream/src/libsigproc/ext-filters.ii
+++ b/upstream/src/libsigproc/ext-filters.ii
@@ -19,59 +19,59 @@ valarray<T>
 CFilterIIR<T>::
 apply( const valarray<T>& in, bool use_first_sample_to_reset)
 {
-	if ( unlikely (poles.size() == 0) )
-		throw runtime_error ("Unitialized CFilterIIR");
+        if ( unlikely (poles.size() == 0) )
+                throw runtime_error ("Unitialized CFilterIIR");
 
-	valarray<T> out (in.size());
+        valarray<T> out (in.size());
 
-	size_t i, l;
+        size_t i, l;
 
-	int d;
-	switch ( CFilter_base<T>::direction ) {
-	case sigproc::forward:
-		i = 0;
-		l = in.size();
-		d = 1;
-	    break;
-	case sigproc::back:
-		i = in.size()-1;
-		l = 0-1;
-		d = -1;
-	    break;
-	default:
-		throw invalid_argument ("sigproc::CFilterIIR::apply(): direction?");
-	}
+        int d;
+        switch ( CFilter_base<T>::direction ) {
+        case sigproc::forward:
+                i = 0;
+                l = in.size();
+                d = 1;
+            break;
+        case sigproc::back:
+                i = in.size()-1;
+                l = 0-1;
+                d = -1;
+            break;
+        default:
+                throw invalid_argument ("sigproc::CFilterIIR::apply(): direction?");
+        }
 
-	for ( ; i != l; i += d ) {
-		filter_state_z[0] = in[i];
-		if ( unlikely (use_first_sample_to_reset) ) {
-			reset( filter_state_z[0]);
-			use_first_sample_to_reset = false;
-		}
-		// Compute new output sample
-		T R = 0.;
-		// Add past output-values
-		size_t j;
-		for ( j = 1; j < poles.size(); ++j )
-			R += poles[j] * filter_state_p[j];
-		// Not anticipate = do not include current input sample in output value
-		// Anticipate = include current input sample in output value
-		if ( anticipate) // Add past input-values
-			for ( j = 0; j < zeros.size(); ++j )
-				R += zeros[j] * filter_state_z[j];
-		// Do backpolation (FilterStateP[1] = Last out-sample)
-		out[i] = back_polate * filter_state_p[1] + (1.0 - back_polate) * R;
-		// Scale result
-		// TODO: Check if removing extra checks was ok
-		// Update filter state
-		for ( j = filter_state_p.size()-1; j >= 2; --j )
-			filter_state_p[j] = filter_state_p[j-1];
-		filter_state_p[1] = R;
-		for ( j = filter_state_z.size()-1; j >= 1; --j )
-			filter_state_z[j] = filter_state_z[j-1];
-	}
+        for ( ; i != l; i += d ) {
+                filter_state_z[0] = in[i];
+                if ( unlikely (use_first_sample_to_reset) ) {
+                        reset( filter_state_z[0]);
+                        use_first_sample_to_reset = false;
+                }
+                // Compute new output sample
+                T R = 0.;
+                // Add past output-values
+                size_t j;
+                for ( j = 1; j < poles.size(); ++j )
+                        R += poles[j] * filter_state_p[j];
+                // Not anticipate = do not include current input sample in output value
+                // Anticipate = include current input sample in output value
+                if ( anticipate) // Add past input-values
+                        for ( j = 0; j < zeros.size(); ++j )
+                                R += zeros[j] * filter_state_z[j];
+                // Do backpolation (FilterStateP[1] = Last out-sample)
+                out[i] = back_polate * filter_state_p[1] + (1.0 - back_polate) * R;
+                // Scale result
+                // TODO: Check if removing extra checks was ok
+                // Update filter state
+                for ( j = filter_state_p.size()-1; j >= 2; --j )
+                        filter_state_p[j] = filter_state_p[j-1];
+                filter_state_p[1] = R;
+                for ( j = filter_state_z.size()-1; j >= 1; --j )
+                        filter_state_z[j] = filter_state_z[j-1];
+        }
 
-	return out;
+        return out;
 }
 
 // Local Variables:
diff --git a/upstream/src/libsigproc/sigproc.ii b/upstream/src/libsigproc/sigproc.ii
index 24cabe8..27a858b 100644
--- a/upstream/src/libsigproc/sigproc.ii
+++ b/upstream/src/libsigproc/sigproc.ii
@@ -25,21 +25,21 @@ template <typename T>
 void
 smooth( valarray<T>& a, size_t side)
 {
-	if ( side == 0 )
-		return;
+        if ( side == 0 )
+                return;
 
-	size_t	both = side * 2 + 1;
+        size_t        both = side * 2 + 1;
 
-	valarray<T> tmp (a.size() + 2*side);
-	tmp[ slice (0              , side, 1)     ] = a[0];
-	tmp[ slice (side           , a.size(), 1) ] = a;
-	tmp[ slice (side + a.size(), side, 1)     ] = a[a.size()-1];
+        valarray<T> tmp (a.size() + 2*side);
+        tmp[ slice (0              , side, 1)     ] = a[0];
+        tmp[ slice (side           , a.size(), 1) ] = a;
+        tmp[ slice (side + a.size(), side, 1)     ] = a[a.size()-1];
 
-	valarray<T> dst (a.size());
-	for ( size_t i = 0; i < a.size(); ++i )
-		dst[i] = valarray<T>{tmp[ slice (i, both, 1) ]}.sum() / both;
+        valarray<T> dst (a.size());
+        for ( size_t i = 0; i < a.size(); ++i )
+                dst[i] = valarray<T>{tmp[ slice (i, both, 1) ]}.sum() / both;
 
-	a = dst;
+        a = dst;
 }
 
 
@@ -48,7 +48,7 @@ template <typename T>
 void
 normalize( valarray<T>& a)
 {
-	a /= a.max();
+        a /= a.max();
 }
 
 
@@ -56,10 +56,10 @@ template <typename T>
 valarray<T>
 derivative( const valarray<T>& a)
 {
-	valarray<T> out (a.size());
-	for ( size_t i = 1; i < a.size(); ++i )
-		out[i-1] = a[i] - a[i-1];
-	return move( out);
+        valarray<T> out (a.size());
+        for ( size_t i = 1; i < a.size(); ++i )
+                out[i-1] = a[i] - a[i-1];
+        return move( out);
 }
 
 
@@ -70,34 +70,34 @@ derivative( const valarray<T>& a)
 template <typename T, class Container>
 valarray<T>
 interpolate( const vector<unsigned long>& xi,
-	     unsigned samplerate, const Container& y, double dt)
+             unsigned samplerate, const Container& y, double dt)
 {
-	size_t i;
-	valarray<double>
-		x_known (xi.size()),
-		y_known (xi.size());
-	for ( i = 0; i < xi.size(); ++i ) {
-		x_known[i] = (double)xi[i] / samplerate;
-		y_known[i] = y[ xi[i] ];
-	}
-
-	gsl_spline *spline = gsl_spline_alloc( gsl_interp_akima, xi.size());
-	gsl_interp_accel *acc = gsl_interp_accel_alloc();
-
-	gsl_spline_init( spline, &x_known[0], &y_known[0], xi.size());
-
-	double	t;
-	size_t	pad = (1./samplerate / dt) // this I understand
-			/ 2;                // this, I don't
-	valarray<T>
-		out (ceilf((x_known[x_known.size()-1] - x_known[0] + 1./samplerate) / dt) + 1);
-	for ( i = pad, t = x_known[0]; t < x_known[x_known.size()-1]; ++i, t += dt )
-		out[i] = gsl_spline_eval( spline, t, acc);
-
-	gsl_interp_accel_free( acc);
-	gsl_spline_free( spline);
-
-	return move( out);
+        size_t i;
+        valarray<double>
+                x_known (xi.size()),
+                y_known (xi.size());
+        for ( i = 0; i < xi.size(); ++i ) {
+                x_known[i] = (double)xi[i] / samplerate;
+                y_known[i] = y[ xi[i] ];
+        }
+
+        gsl_spline *spline = gsl_spline_alloc( gsl_interp_akima, xi.size());
+        gsl_interp_accel *acc = gsl_interp_accel_alloc();
+
+        gsl_spline_init( spline, &x_known[0], &y_known[0], xi.size());
+
+        double        t;
+        size_t        pad = (1./samplerate / dt) // this I understand
+                        / 2;                // this, I don't
+        valarray<T>
+                out (ceilf((x_known[x_known.size()-1] - x_known[0] + 1./samplerate) / dt) + 1);
+        for ( i = pad, t = x_known[0]; t < x_known[x_known.size()-1]; ++i, t += dt )
+                out[i] = gsl_spline_eval( spline, t, acc);
+
+        gsl_interp_accel_free( acc);
+        gsl_spline_free( spline);
+
+        return move( out);
 }
 
 
@@ -108,60 +108,60 @@ interpolate( const vector<unsigned long>& xi,
 template <typename T>
 size_t
 envelope( const SSignalRef<T>& in,
-	  double dh_,  // tightness, sec
-	  double dt_,
-	  valarray<T>* env_lp = nullptr,    // return interpolated
-	  valarray<T>* env_up = nullptr,
-	  vector<unsigned long> *mini_p = nullptr, // return vector of extremum indices
-	  vector<unsigned long> *maxi_p = nullptr)
+          double dh_,  // tightness, sec
+          double dt_,
+          valarray<T>* env_lp = nullptr,    // return interpolated
+          valarray<T>* env_up = nullptr,
+          vector<unsigned long> *mini_p = nullptr, // return vector of extremum indices
+          vector<unsigned long> *maxi_p = nullptr)
 {
-	auto&	S = in.signal;
-	ssize_t	n_samples = S.size(),
-		dh2 = dh_ * in.samplerate / 2;
-
-	vector<unsigned long>
-		mini,
-		maxi;
-
-	// always put a point at start
-	mini.push_back( 0);
-	maxi.push_back( 0);
-
-	// auto dS = derivative(in.signal); // will skip over many extrema due to quantization
-	ssize_t	i;
-	for ( i = dh2; i < n_samples-dh2; ++i ) {
-		auto lmax = S[ slice (i-dh2, dh2+dh2, 1) ].max();
-		if ( S[i] == lmax && i != i-dh2 && i+dh2 ) {
-			maxi.push_back(i);
-			i += dh2 - 1;
-			continue;
-		}
-	}
-	for ( i = dh2; i < n_samples-dh2; ++i ) {
-		auto lmin = S[ slice (i-dh2, dh2+dh2, 1) ].min();
-		if ( S[i] == lmin && i != i-dh2 && i+dh2 ) {
-			mini.push_back(i);
-			i += dh2 - 1;
-		}
-	}
-
-	// put a point at end
-	mini.push_back( i);
-	maxi.push_back( i);
-
-	if ( mini.size() > 5 && maxi.size() > 5 ) {
-		if ( env_lp )
-			*env_lp = interpolate<T>( mini, in.samplerate, in.signal, dt_);
-		if ( env_up )
-			*env_up = interpolate<T>( maxi, in.samplerate, in.signal, dt_);
-		if ( mini_p )
-			*mini_p = mini;
-		if ( maxi_p )
-			*maxi_p = maxi;
-
-		return maxi.size();
-	} else
-		return 0;
+        auto&        S = in.signal;
+        ssize_t        n_samples = S.size(),
+                dh2 = dh_ * in.samplerate / 2;
+
+        vector<unsigned long>
+                mini,
+                maxi;
+
+        // always put a point at start
+        mini.push_back( 0);
+        maxi.push_back( 0);
+
+        // auto dS = derivative(in.signal); // will skip over many extrema due to quantization
+        ssize_t        i;
+        for ( i = dh2; i < n_samples-dh2; ++i ) {
+                auto lmax = S[ slice (i-dh2, dh2+dh2, 1) ].max();
+                if ( S[i] == lmax && i != i-dh2 && i+dh2 ) {
+                        maxi.push_back(i);
+                        i += dh2 - 1;
+                        continue;
+                }
+        }
+        for ( i = dh2; i < n_samples-dh2; ++i ) {
+                auto lmin = S[ slice (i-dh2, dh2+dh2, 1) ].min();
+                if ( S[i] == lmin && i != i-dh2 && i+dh2 ) {
+                        mini.push_back(i);
+                        i += dh2 - 1;
+                }
+        }
+
+        // put a point at end
+        mini.push_back( i);
+        maxi.push_back( i);
+
+        if ( mini.size() > 5 && maxi.size() > 5 ) {
+                if ( env_lp )
+                        *env_lp = interpolate<T>( mini, in.samplerate, in.signal, dt_);
+                if ( env_up )
+                        *env_up = interpolate<T>( maxi, in.samplerate, in.signal, dt_);
+                if ( mini_p )
+                        *mini_p = mini;
+                if ( maxi_p )
+                        *maxi_p = maxi;
+
+                return maxi.size();
+        } else
+                return 0;
 }
 
 
@@ -178,57 +178,57 @@ dzcdf( const SSignalRef<T>& in,
        size_t smooth_side)
 {
       // // prepare with context
-      // 	ssize_t	csa = (ssize_t)sa - sigma * in.samplerate/2,
-      // 		csz = (ssize_t)sz + sigma * in.samplerate/2;
-      // 	agh::alg::ensure_within( csa, 0, in.signal.size());
-      // 	agh::alg::ensure_within( csz, 0, in.signal.size());
-      // 	size_t	dsa = sa - csa,
-      // 		dsz = csz - sz;
-
-	valarray<T>
-		// tmp (in.signal [slice (csa, csz-csa, 1)]);
-		tmp (in.signal);
-	smooth( tmp, smooth_side);
-	valarray<T>
-		deriv = derivative( tmp);
+      //         ssize_t        csa = (ssize_t)sa - sigma * in.samplerate/2,
+      //                 csz = (ssize_t)sz + sigma * in.samplerate/2;
+      //         agh::alg::ensure_within( csa, 0, in.signal.size());
+      //         agh::alg::ensure_within( csz, 0, in.signal.size());
+      //         size_t        dsa = sa - csa,
+      //                 dsz = csz - sz;
+
+        valarray<T>
+                // tmp (in.signal [slice (csa, csz-csa, 1)]);
+                tmp (in.signal);
+        smooth( tmp, smooth_side);
+        valarray<T>
+                deriv = derivative( tmp);
 
       // collect zerocrossings
-	vector<size_t> izx;
-	for ( size_t i = 1; i < in.signal.size(); ++i )
-		if ( agh::alg::sign( deriv[i-1]) != agh::alg::sign( deriv[i]) )
-			izx.push_back( i);
+        vector<size_t> izx;
+        for ( size_t i = 1; i < in.signal.size(); ++i )
+                if ( agh::alg::sign( deriv[i-1]) != agh::alg::sign( deriv[i]) )
+                        izx.push_back( i);
 
       // prepare structures for interpolation
-	size_t out_size = (double)in.signal.size()/in.samplerate / dt;
-	vector<unsigned long> xi (out_size);
-	valarray<T> y (in.signal.size());
+        size_t out_size = (double)in.signal.size()/in.samplerate / dt;
+        vector<unsigned long> xi (out_size);
+        valarray<T> y (in.signal.size());
 
       // calculate the bloody zcdf
-	double	window = 4*dt; // half a second, good enough
-	double	t, tdiff;
-	size_t	I = 0, J;
-	for ( size_t i = 0; i < out_size; ++i ) {
-		t = i*dt;
-		xi[i] = t * in.samplerate;
-		for ( J = I; J > 0; --J ) {
-			tdiff = (double)izx[J]/in.samplerate - t;
-			if ( tdiff >  window )
-				continue;
-			if ( tdiff < -window )
-				break;
-			y[ xi[i] ] += exp( -gsl_pow_2(tdiff) / gsl_pow_2(sigma));
-		}
-		for ( ; J < izx.size(); ++J ) {
-			tdiff = (double)izx[J]/in.samplerate - t;
-			if ( tdiff < -window )
-				continue;
-			if ( tdiff >  window )
-				break;
-			y[ xi[i] ] += exp( -gsl_pow_2(tdiff) / gsl_pow_2(sigma));
-		}
-		I = J;
-	}
-	return move( interpolate<T>( xi, in.samplerate, y, 1./in.samplerate));
+        double        window = 4*dt; // half a second, good enough
+        double        t, tdiff;
+        size_t        I = 0, J;
+        for ( size_t i = 0; i < out_size; ++i ) {
+                t = i*dt;
+                xi[i] = t * in.samplerate;
+                for ( J = I; J > 0; --J ) {
+                        tdiff = (double)izx[J]/in.samplerate - t;
+                        if ( tdiff >  window )
+                                continue;
+                        if ( tdiff < -window )
+                                break;
+                        y[ xi[i] ] += exp( -gsl_pow_2(tdiff) / gsl_pow_2(sigma));
+                }
+                for ( ; J < izx.size(); ++J ) {
+                        tdiff = (double)izx[J]/in.samplerate - t;
+                        if ( tdiff < -window )
+                                continue;
+                        if ( tdiff >  window )
+                                break;
+                        y[ xi[i] ] += exp( -gsl_pow_2(tdiff) / gsl_pow_2(sigma));
+                }
+                I = J;
+        }
+        return move( interpolate<T>( xi, in.samplerate, y, 1./in.samplerate));
 }
 
 
@@ -238,56 +238,56 @@ dzcdf( const SSignalRef<T>& in,
 template <typename T>
 double
 sig_diff( const valarray<T>& a, const valarray<T>& b,
-	  int d)
+          int d)
 {
-	double diff = 0.;
-	if ( d > 0 )
-		for ( size_t i =  d; i < a.size(); ++i )
-			diff += fdim( a[i - d], b[i]);
-	else
-		for ( size_t i = -d; i < a.size(); ++i )
-			diff += fdim( a[i], b[i + d]);
-	return diff;
+        double diff = 0.;
+        if ( d > 0 )
+                for ( size_t i =  d; i < a.size(); ++i )
+                        diff += fdim( a[i - d], b[i]);
+        else
+                for ( size_t i = -d; i < a.size(); ++i )
+                        diff += fdim( a[i], b[i + d]);
+        return diff;
 }
 
 template <typename T>
 double
 phase_diff( const SSignalRef<T>& sig1,
-	    const SSignalRef<T>& sig2,
-	    size_t sa, size_t sz,
-	    double fa, double fz,
-	    unsigned order,
-	    size_t scope)
+            const SSignalRef<T>& sig2,
+            size_t sa, size_t sz,
+            double fa, double fz,
+            unsigned order,
+            size_t scope)
 {
-	if ( sig1.samplerate != sig2.samplerate )
-		throw invalid_argument ("sigproc::phase_diff(): sig1.samplerate != sig2.samplerate");
-	if ( order == 0 )
-		throw invalid_argument ("sigproc::phase_diff(): order == 0");
+        if ( sig1.samplerate != sig2.samplerate )
+                throw invalid_argument ("sigproc::phase_diff(): sig1.samplerate != sig2.samplerate");
+        if ( order == 0 )
+                throw invalid_argument ("sigproc::phase_diff(): order == 0");
 
       // bandpass sig1 and sig2
-	valarray<T>
-		sig1p = exstrom::band_pass( valarray<T> (&sig1.signal[sa], sz - sa), sig1.samplerate, fa, fz, order, true),
-		sig2p = exstrom::band_pass( valarray<T> (&sig2.signal[sa], sz - sa), sig2.samplerate, fa, fz, order, true);
+        valarray<T>
+                sig1p = exstrom::band_pass( valarray<T> (&sig1.signal[sa], sz - sa), sig1.samplerate, fa, fz, order, true),
+                sig2p = exstrom::band_pass( valarray<T> (&sig2.signal[sa], sz - sa), sig2.samplerate, fa, fz, order, true);
 
       // slide one against the other a little
-	double	diff = INFINITY, old_diff, diff_min = INFINITY;
-	int	dist, dist_min = 0;
-	// go east
-	dist = 0;
-	do {
-		old_diff = diff;
-		if ( (diff = sig_diff( sig1p, sig2p, dist)) < diff_min )
-			diff_min = diff, dist_min = dist;
-	} while ( -(dist--) < (int)scope && old_diff > diff );  // proceed until the first minimum
-	// and west
-	dist = 0, old_diff = INFINITY;
-	do {
-		old_diff = diff;
-		if ( (diff = sig_diff( sig1p, sig2p, dist)) < diff_min )
-			diff_min = diff, dist_min = dist;
-	} while (  (dist++) < (int)scope && old_diff > diff );
-
-	return (double)dist_min / sig1.samplerate;
+        double        diff = INFINITY, old_diff, diff_min = INFINITY;
+        int        dist, dist_min = 0;
+        // go east
+        dist = 0;
+        do {
+                old_diff = diff;
+                if ( (diff = sig_diff( sig1p, sig2p, dist)) < diff_min )
+                        diff_min = diff, dist_min = dist;
+        } while ( -(dist--) < (int)scope && old_diff > diff );  // proceed until the first minimum
+        // and west
+        dist = 0, old_diff = INFINITY;
+        do {
+                old_diff = diff;
+                if ( (diff = sig_diff( sig1p, sig2p, dist)) < diff_min )
+                        diff_min = diff, dist_min = dist;
+        } while (  (dist++) < (int)scope && old_diff > diff );
+
+        return (double)dist_min / sig1.samplerate;
 }
 
 

-- 
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