The following commit has been merged in the master branch:
commit 1b4e6997dec5db76d6887ccf3388fd69e10131e8
Author: andrei zavada <[email protected]>
Date:   Thu Jan 24 19:37:55 2013 +0000

    splitting sf child dialogs WIP

diff --git a/configure.ac b/configure.ac
index 3074b69..17dc7bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,7 @@ AC_OUTPUT([
        src/ui/sm/Makefile
        src/ui/mw/Makefile
        src/ui/sf/Makefile
+       src/ui/sf/dialogs/Makefile
        src/ui/mf/Makefile
        src/tools/Makefile
        data/Makefile
diff --git a/src/ui/sf/Makefile.am b/src/ui/sf/Makefile.am
index 5591e87..ad2d6a4 100644
--- a/src/ui/sf/Makefile.am
+++ b/src/ui/sf/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS := dialogs
+
 AM_CXXFLAGS := \
        -std=c++11 -fno-rtti -Wdeprecated-declarations -Wall \
        $(GTK_CFLAGS)  $(UNIQUE_CFLAGS)  $(CAIRO_CFLAGS) $(LIBCONFIGXX_CFLAGS) \
@@ -8,28 +10,17 @@ AM_CXXFLAGS := \
 noinst_LIBRARIES := liba.a
 
 liba_a_SOURCES := \
-       sf-artifacts.cc \
-       sf-artifacts_cb.cc \
-       sf-channel.cc \
-       sf-construct.cc \
-       sf-filter.cc \
-       sf-filter_cb.cc \
-       sf-hypnogram.cc \
-       sf-hypnogram_cb.cc \
-       sf-ica.cc \
-       sf-ica_cb.cc \
-       sf-montage.cc \
-       sf-montage-overlays.cc \
-       sf-montage_cb.cc \
-       sf-patterns.hh \
-       sf-patterns.cc \
-       sf-patterns-draw.cc \
-       sf-patterns-enumerate.cc \
-       sf-patterns_cb.cc \
-       sf-phasediff.cc \
-       sf-phasediff_cb.cc \
-       sf-phasic-events.cc \
-       sf-widgets.hh \
+       channel.cc \
+       construct.cc \
+       hypnogram.cc \
+       hypnogram_cb.cc \
+       ica.cc \
+       ica_cb.cc \
+       montage.cc \
+       montage-overlays.cc \
+       montage_cb.cc \
+       phasic-events.cc \
+       widgets.hh \
        sf.cc \
        sf.hh \
        sf_cb.cc \
diff --git a/src/ui/sf/sf-channel.cc b/src/ui/sf/channel.cc
similarity index 100%
rename from src/ui/sf/sf-channel.cc
rename to src/ui/sf/channel.cc
diff --git a/src/ui/sf/sf-construct.cc b/src/ui/sf/construct.cc
similarity index 76%
rename from src/ui/sf/sf-construct.cc
rename to src/ui/sf/construct.cc
index 7d6bd44..efb307f 100644
--- a/src/ui/sf/sf-construct.cc
+++ b/src/ui/sf/construct.cc
@@ -14,7 +14,7 @@
 
 #include "ui/mw/mw.hh"
 #include "ui/ui.hh"
-#include "sf-widgets.hh"
+#include "widgets.hh"
 #include "sf_cb.hh"
 
 using namespace std;
@@ -321,56 +321,6 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
        mSFAnnotationsAtCursor = gtk_list_store_new(1, G_TYPE_STRING);
        gtk_combo_box_set_model_properly( eSFAnnotationSelectorWhich, 
mSFAnnotationsAtCursor);
 
-       // artifact detection
-       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);
-
-       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);
-
        // simple artifact detection
        if ( !AGH_GBGETOBJ (GtkDialog,          
wSFSimpleArtifactDetectionParams) ||
             !AGH_GBGETOBJ (GtkSpinButton,      
eSFSimpleArtifactDetectionMinFlatRegionSize) ||
@@ -379,54 +329,6 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 
 
 
-       // aghui::SScoringFacility::SFiltersDialog::
-
-      // ------- wSFFilter
-       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);
-
-      // ------- wPhaseDiff
-       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)");
-
-       gtk_combo_box_set_model_properly(
-               eSFPDChannelA, _p.mEEGChannels);
-       eSFPDChannelA_changed_cb_handler_id =
-               G_CONNECT_1 (eSFPDChannelA, changed);
-
-       gtk_combo_box_set_model_properly( eSFPDChannelB, _p.mEEGChannels);
-       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);
 }
 
 
diff --git a/src/ui/sf/dialogs/Makefile.am b/src/ui/sf/dialogs/Makefile.am
index ed46d5d..fd01072 100644
--- a/src/ui/sf/dialogs/Makefile.am
+++ b/src/ui/sf/dialogs/Makefile.am
@@ -8,6 +8,7 @@ AM_CXXFLAGS := \
 noinst_LIBRARIES := liba.a
 
 liba_a_SOURCES := \
+       artifacts.hh \
        artifacts.cc \
        artifacts-construct.cc \
        artifacts_cb.cc \
diff --git a/src/ui/sf/dialogs/artifacts-construct.cc 
b/src/ui/sf/dialogs/artifacts-construct.cc
new file mode 100644
index 0000000..e8d60e4
--- /dev/null
+++ b/src/ui/sf/dialogs/artifacts-construct.cc
@@ -0,0 +1,79 @@
+/*
+ *       File name:  ui/sf/dialogs/artifacts-construct.cc
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <[email protected]>
+ * Initial version:  2013-10-24
+ *
+ *         Purpose:  scoring facility Artifacts construct
+ *
+ *         License:  GPL
+ */
+
+#include <stdexcept>
+
+#include "ui/ui.hh"
+#include "artifacts.hh"
+
+using namespace std;
+
+
+aghui::SScoringFacility::SArtifactsDialogWidgets::
+SArtifactsDialogWidgets (SScoringFacility& _p)
+{
+       builder = gtk_builder_new();
+       if ( !gtk_builder_add_from_resource( builder, 
"/org/gtk/aghermann/sf-artifacts.glade", NULL) ) {
+               g_object_unref( (GObject*)builder);
+               throw runtime_error( "Failed to load SF::artifacts glade 
resource");
+       }
+       gtk_builder_connect_signals( builder, NULL);
+
+       // artifact detection
+       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);
+
+       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);
+}
diff --git a/src/ui/sf/dialogs/artifacts.hh b/src/ui/sf/dialogs/artifacts.hh
new file mode 100644
index 0000000..67a4ab3
--- /dev/null
+++ b/src/ui/sf/dialogs/artifacts.hh
@@ -0,0 +1,99 @@
+/*
+ *       File name:  ui/sf/dialogs/artifacts.hh
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <[email protected]>
+ * Initial version:  2013-01-24
+ *
+ *         Purpose:  scoring facility Artifacts
+ *
+ *         License:  GPL
+ */
+
+#ifndef _AGH_UI_SF_ARTIFACTS_H
+#define _AGH_UI_SF_ARTIFACTS_H
+
+#include <gtk/gtk.h>
+#include "patterns/patterns.hh"
+#include "ui/forward-decls.hh"
+#include "ui/sf/sf.hh"
+
+namespace aghui {
+
+struct SArtifactsDialogWidgets;
+struct SArtifactsDialog
+    : public SArtifactsDialog {
+       DELETE_DEFAULT_METHODS (SArtifactDetectionDialog);
+
+       SArtifactsDialog (SScoringFacility&);
+       ~SArtifactsDialog ();
+
+       metrics::mc::SArtifactDetectionPP
+               P;
+       sigfile::SArtifacts
+               artifacts_backup;
+       bool    orig_signal_visible_backup;
+       list<pair<SChannel*, bool>>
+               channels_visible_backup;
+       bool    suppress_preview_handler;
+       SUIVarCollection
+               W_V;
+
+       SScoringFacility&
+               _p;
+};
+
+struct SArtifactsDialogWidgets {
+       DELETE_DEFAULT_METHODS (SArtifactsDialogWidgets);
+
+       SArtifactsDialogWidgets (SScoringFacility&);
+       ~SArtifactsDialogWidgets ();
+
+       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;
+};
+
+} // namespace aghui
+
diff --git a/src/ui/sf/dialogs/sf-filter.cc b/src/ui/sf/dialogs/filter.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-filter.cc
rename to src/ui/sf/dialogs/filter.cc
diff --git a/src/ui/sf/dialogs/sf-filter_cb.cc b/src/ui/sf/dialogs/filter_cb.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-filter_cb.cc
rename to src/ui/sf/dialogs/filter_cb.cc
diff --git a/src/ui/sf/dialogs/filters-construct.cc 
b/src/ui/sf/dialogs/filters-construct.cc
new file mode 100644
index 0000000..4549b31
--- /dev/null
+++ b/src/ui/sf/dialogs/filters-construct.cc
@@ -0,0 +1,20 @@
+       // aghui::SScoringFacility::SFiltersDialog::
+
+      // ------- wSFFilter
+       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);
+
diff --git a/src/ui/sf/dialogs/filters.hh b/src/ui/sf/dialogs/filters.hh
new file mode 100644
index 0000000..3c7bfb2
--- /dev/null
+++ b/src/ui/sf/dialogs/filters.hh
@@ -0,0 +1,32 @@
+
+       struct SFiltersDialog {
+               DELETE_DEFAULT_METHODS (SFiltersDialog);
+
+               SFiltersDialog (SScoringFacility& parent)
+                     : _p (parent)
+                       {}
+             ~SFiltersDialog ();
+
+               SUIVarCollection
+                       W_V;
+
+               SScoringFacility&
+                       _p;
+       };
+
+
+
+       // filters dialog
+       GtkDialog
+               *wSFFilters;
+       GtkLabel
+               *lSFFilterCaption;
+       GtkSpinButton
+               *eSFFilterLowPassCutoff, *eSFFilterHighPassCutoff,
+               *eSFFilterLowPassOrder, *eSFFilterHighPassOrder;
+       GtkComboBox
+               *eSFFilterNotchFilter;
+       GtkListStore
+               *mSFFilterNotchFilter;
+       GtkButton
+               *bSFFilterOK;
diff --git a/src/ui/sf/dialogs/sf-patterns-construct.cc 
b/src/ui/sf/dialogs/patterns-construct.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-patterns-construct.cc
rename to src/ui/sf/dialogs/patterns-construct.cc
diff --git a/src/ui/sf/dialogs/sf-patterns-draw.cc 
b/src/ui/sf/dialogs/patterns-draw.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-patterns-draw.cc
rename to src/ui/sf/dialogs/patterns-draw.cc
diff --git a/src/ui/sf/dialogs/sf-patterns-enumerate.cc 
b/src/ui/sf/dialogs/patterns-enumerate.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-patterns-enumerate.cc
rename to src/ui/sf/dialogs/patterns-enumerate.cc
diff --git a/src/ui/sf/dialogs/sf-patterns.cc b/src/ui/sf/dialogs/patterns.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-patterns.cc
rename to src/ui/sf/dialogs/patterns.cc
diff --git a/src/ui/sf/dialogs/sf-patterns.hh b/src/ui/sf/dialogs/patterns.hh
similarity index 67%
rename from src/ui/sf/dialogs/sf-patterns.hh
rename to src/ui/sf/dialogs/patterns.hh
index 2a74536..44d9b3e 100644
--- a/src/ui/sf/dialogs/sf-patterns.hh
+++ b/src/ui/sf/dialogs/patterns.hh
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  ui/sf/sf-patterns.hh
+ *       File name:  ui/sf/dialogs/patterns.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <[email protected]>
  * Initial version:  2013-01-24
@@ -108,6 +108,54 @@ struct SScoringFacility::SFindDialog {
                _p;
 };
 
+
+
+       // find/patterns dialog
+       GtkListStore
+               *mSFFDPatterns;
+       GtkDialog
+               *wSFFD;
+       GtkComboBox
+               *eSFFDChannel,
+               *eSFFDPatternList;
+       GtkScrolledWindow
+               *swSFFDThing,
+               *swSFFDField;
+       GtkTable
+               *cSFFDParameters,
+               *cSFFDCriteria,
+               *cSFFDSearchButton,
+               *cSFFDAgainButton;
+       GtkBox  *cSFFDSearching;
+       GtkDrawingArea
+               *daSFFDThing,
+               *daSFFDField;
+       GtkMenu *iiSFFDField;
+       GtkButton
+               *bSFFDSearch, *bSFFDAgain,
+               *bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
+       GtkSpinButton
+               *eSFFDEnvTightness,
+               *eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
+               *eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
+               *eSFFDParameterA, *eSFFDParameterB,
+               *eSFFDParameterC, *eSFFDParameterD;
+       GtkHBox
+               *cSFFDLabelBox;
+       GtkLabel
+               *lSFFDParametersBrief,
+               *lSFFDFoundInfo;
+       GtkDialog
+               *wSFFDPatternSave;
+       GtkEntry
+               *eSFFDPatternSaveName;
+       GtkToggleButton
+               *eSFFDPatternSaveOriginSubject,
+               *eSFFDPatternSaveOriginExperiment,
+               *eSFFDPatternSaveOriginUser;
+       gulong  eSFFDChannel_changed_cb_handler_id,
+               eSFFDPatternList_changed_cb_handler_id;
+
 } // namespace aghui
 
 // eof
diff --git a/src/ui/sf/dialogs/sf-patterns_cb.cc 
b/src/ui/sf/dialogs/patterns_cb.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-patterns_cb.cc
rename to src/ui/sf/dialogs/patterns_cb.cc
diff --git a/src/ui/sf/dialogs/phasediff-construct.cc 
b/src/ui/sf/dialogs/phasediff-construct.cc
new file mode 100644
index 0000000..8f8b3e4
--- /dev/null
+++ b/src/ui/sf/dialogs/phasediff-construct.cc
@@ -0,0 +1,28 @@
+      // ------- wPhaseDiff
+       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)");
+
+       gtk_combo_box_set_model_properly(
+               eSFPDChannelA, _p.mEEGChannels);
+       eSFPDChannelA_changed_cb_handler_id =
+               G_CONNECT_1 (eSFPDChannelA, changed);
+
+       gtk_combo_box_set_model_properly( eSFPDChannelB, _p.mEEGChannels);
+       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);
diff --git a/src/ui/sf/dialogs/sf-phasediff.cc b/src/ui/sf/dialogs/phasediff.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-phasediff.cc
rename to src/ui/sf/dialogs/phasediff.cc
diff --git a/src/ui/sf/dialogs/phasediff.hh b/src/ui/sf/dialogs/phasediff.hh
new file mode 100644
index 0000000..8001452
--- /dev/null
+++ b/src/ui/sf/dialogs/phasediff.hh
@@ -0,0 +1,51 @@
+       struct SPhasediffDialog {
+               DELETE_DEFAULT_METHODS (SPhasediffDialog);
+
+               SPhasediffDialog (SScoringFacility&);
+              ~SPhasediffDialog ();
+
+               const SChannel
+                       *channel1,
+                       *channel2;
+               bool    use_original_signal;
+               float   from,
+                       upto;
+
+               unsigned
+                       bwf_order,
+                       scope;
+               float   display_scale;
+
+               valarray<TFloat>
+                       course;
+               size_t  smooth_side;
+               void update_course();
+
+               const SChannel* channel_from_cbox( GtkComboBox *cbox);
+               void preselect_channel( GtkComboBox *cbox, const char *ch);
+
+               void draw( cairo_t* cr, int wd, int ht);
+
+               bool suspend_draw;
+
+               SScoringFacility&
+                       _p;
+       };
+
+
+       // 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;
+
diff --git a/src/ui/sf/dialogs/sf-phasediff_cb.cc 
b/src/ui/sf/dialogs/phasediff_cb.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-phasediff_cb.cc
rename to src/ui/sf/dialogs/phasediff_cb.cc
diff --git a/src/ui/sf/dialogs/sf-phasic-events.cc 
b/src/ui/sf/dialogs/phasic-events.cc
similarity index 100%
rename from src/ui/sf/dialogs/sf-phasic-events.cc
rename to src/ui/sf/dialogs/phasic-events.cc
diff --git a/src/ui/sf/sf-hypnogram.cc b/src/ui/sf/hypnogram.cc
similarity index 100%
rename from src/ui/sf/sf-hypnogram.cc
rename to src/ui/sf/hypnogram.cc
diff --git a/src/ui/sf/sf-hypnogram_cb.cc b/src/ui/sf/hypnogram_cb.cc
similarity index 100%
rename from src/ui/sf/sf-hypnogram_cb.cc
rename to src/ui/sf/hypnogram_cb.cc
diff --git a/src/ui/sf/sf-ica.cc b/src/ui/sf/ica.cc
similarity index 100%
rename from src/ui/sf/sf-ica.cc
rename to src/ui/sf/ica.cc
diff --git a/src/ui/sf/sf-ica_cb.cc b/src/ui/sf/ica_cb.cc
similarity index 100%
rename from src/ui/sf/sf-ica_cb.cc
rename to src/ui/sf/ica_cb.cc
diff --git a/src/ui/sf/sf-montage-overlays.cc b/src/ui/sf/montage-overlays.cc
similarity index 100%
rename from src/ui/sf/sf-montage-overlays.cc
rename to src/ui/sf/montage-overlays.cc
diff --git a/src/ui/sf/sf-montage.cc b/src/ui/sf/montage.cc
similarity index 100%
rename from src/ui/sf/sf-montage.cc
rename to src/ui/sf/montage.cc
diff --git a/src/ui/sf/sf-montage_cb.cc b/src/ui/sf/montage_cb.cc
similarity index 100%
rename from src/ui/sf/sf-montage_cb.cc
rename to src/ui/sf/montage_cb.cc
diff --git a/src/ui/sf/sf-widgets.hh b/src/ui/sf/sf-widgets.hh
deleted file mode 100644
index 2c65922..0000000
--- a/src/ui/sf/sf-widgets.hh
+++ /dev/null
@@ -1,321 +0,0 @@
-// ;-*-C++-*-
-/*
- *       File name:  ui/sf/sf-widgets.hh
- *         Project:  Aghermann
- *          Author:  Andrei Zavada <[email protected]>
- * Initial version:  2012-10-06
- *
- *         Purpose:  scoring facility widgets class
- *
- *         License:  GPL
- */
-
-#ifndef _AGH_UI_SCORING_FACILITY_WIDGETS_H
-#define _AGH_UI_SCORING_FACILITY_WIDGETS_H
-
-#include <gtk/gtk.h>
-#include "ui/forward-decls.hh"
-
-namespace aghui {
-
-struct SScoringFacilityWidgets {
-
-       // we load and construct own widget set (wSF and all its contents)
-       // ourself, for every SScoringFacility instance being created, so
-       // construct_widgets below takes an arg
-       GtkBuilder *builder;
-       SScoringFacilityWidgets (SExpDesignUI&);
-       ~SScoringFacilityWidgets ();
-
-       // 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
-       GtkButton  // acting label
-               *eSFCurrentPos;
-       GtkButton
-               *bSFBack, *bSFForward,
-               *bSFScoreClear, *bSFScoreNREM1, *bSFScoreNREM2, *bSFScoreNREM3, 
*bSFScoreNREM4,
-               *bSFScoreREM, *bSFScoreWake,
-               *bSFGotoPrevUnscored, *bSFGotoNextUnscored,
-               *bSFGotoPrevArtifact, *bSFGotoNextArtifact;
-       GtkToggleButton
-               *bSFDrawCrosshair,
-               *bSFShowFindDialog, *bSFShowPhaseDiffDialog;
-       GtkButton
-       //*bSFResetMontage,
-               *bSFRunICA;
-       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;
-
-       // common controls (contd)
-       GtkMenuToolButton
-               *bSFAccept;
-       GtkMenu
-               *iiSFAccept;
-
-       // montage area
-       GtkDrawingArea
-               *daSFMontage,
-               *daSFHypnogram;
-       GtkExpander
-               *cSFHypnogram;
-       GtkLabel
-               *lSFOverChannel;
-       // menus
-       GtkMenu
-               *iiSFPage,
-               *iiSFPageSelection,
-               *iiSFPageAnnotation,
-               *iiSFPageProfiles,
-               *iiSFPagePhasicEvents,
-               *iiSFPageHidden,
-               *iiSFPower,
-               *iiSFScore,
-               *iiSFICAPage;
-       GtkCheckMenuItem
-               *iSFPageShowOriginal, *iSFPageShowProcessed,
-               *iSFPageUseResample, *iSFPageDrawZeroline,
-               *iSFPageDrawPSDProfile,
-               *iSFPageDrawPSDSpectrum,
-               *iSFPageDrawSWUProfile,
-               *iSFPageDrawMCProfile,
-               *iSFPageDrawEMGProfile,
-               *iSFPowerDrawBands,
-               *iSFPowerSmooth,
-               *iSFPowerAutoscale,
-               *iSFPageSelectionDrawCourse,
-               *iSFPageSelectionDrawEnvelope,
-               *iSFPageSelectionDrawDzxdf;
-       GtkMenuItem
-               *iSFPageFilter,
-               *iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
-               *iSFPageExportSignal, *iSFPageUseThisScale,
-               *iSFPageArtifactsDetect, *iSFPageArtifactsMarkFlat, 
*iSFPageArtifactsClear,
-               *iSFPageHide,
-               *iSFPageHidden,  // has a submenu
-               *iSFPageSpaceEvenly,
-               *iSFPageLocateSelection,
-               *iSFPageAnnotationSeparator,
-               *iSFPageAnnotationDelete,
-               *iSFPageAnnotationEdit,
-               *iSFPageSelectionMarkArtifact, *iSFPageSelectionClearArtifact,
-               *iSFPageSelectionFindPattern,
-               *iSFPageSelectionAnnotate,
-               *iSFPowerExportAll, *iSFPowerExportRange,
-               *iSFPowerUseThisScale,
-               *iSFScoreAssist, *iSFScoreImport, *iSFScoreExport, 
*iSFScoreClear,
-               *iSFAcceptAndTakeNext;
-       GtkSeparatorMenuItem
-               *iSFPageProfilesSubmenuSeparator;
-
-       // more important dialogs
-       // find/patterns dialog
-       GtkListStore
-               *mSFFDPatterns;
-       GtkDialog
-               *wSFFD;
-       GtkComboBox
-               *eSFFDChannel,
-               *eSFFDPatternList;
-       GtkScrolledWindow
-               *swSFFDThing,
-               *swSFFDField;
-       GtkTable
-               *cSFFDParameters,
-               *cSFFDCriteria,
-               *cSFFDSearchButton,
-               *cSFFDAgainButton;
-       GtkBox  *cSFFDSearching;
-       GtkDrawingArea
-               *daSFFDThing,
-               *daSFFDField;
-       GtkMenu *iiSFFDField;
-       GtkButton
-               *bSFFDSearch, *bSFFDAgain,
-               *bSFFDProfileSave, *bSFFDProfileDiscard, *bSFFDProfileRevert;
-       GtkSpinButton
-               *eSFFDEnvTightness,
-               *eSFFDBandPassFrom, *eSFFDBandPassUpto, *eSFFDBandPassOrder,
-               *eSFFDDZCDFStep, *eSFFDDZCDFSigma, *eSFFDDZCDFSmooth,
-               *eSFFDParameterA, *eSFFDParameterB,
-               *eSFFDParameterC, *eSFFDParameterD;
-       GtkHBox
-               *cSFFDLabelBox;
-       GtkLabel
-               *lSFFDParametersBrief,
-               *lSFFDFoundInfo;
-       GtkDialog
-               *wSFFDPatternSave;
-       GtkEntry
-               *eSFFDPatternSaveName;
-       GtkToggleButton
-               *eSFFDPatternSaveOriginSubject,
-               *eSFFDPatternSaveOriginExperiment,
-               *eSFFDPatternSaveOriginUser;
-       gulong  eSFFDChannel_changed_cb_handler_id,
-               eSFFDPatternList_changed_cb_handler_id;
-
-       // filters dialog
-       GtkDialog
-               *wSFFilters;
-       GtkLabel
-               *lSFFilterCaption;
-       GtkSpinButton
-               *eSFFilterLowPassCutoff, *eSFFilterHighPassCutoff,
-               *eSFFilterLowPassOrder, *eSFFilterHighPassOrder;
-       GtkComboBox
-               *eSFFilterNotchFilter;
-       GtkListStore
-               *mSFFilterNotchFilter;
-       GtkButton
-               *bSFFilterOK;
-
-       // 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;
-
-       // artifact detection dialog
-       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;
-
-       // less important dialogs
-       GtkDialog
-               *wSFAnnotationLabel,
-               *wSFAnnotationSelector,
-               *wSFSimpleArtifactDetectionParams;
-       GtkEntry
-               *eSFAnnotationLabel;
-       GtkComboBox
-               *eSFAnnotationSelectorWhich;
-       GtkSpinButton
-               *eSFSimpleArtifactDetectionMinFlatRegionSize,
-               *eSFSimpleArtifactDetectionPad;
-
-};
-
-} // namespace aghui
-
-#endif
-
-// eof
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 3e56b97..00ace08 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -80,10 +80,10 @@ SScoringFacility (agh::CSubject& J,
                confval::SValidator<float>("montage.interchannel_gap",  
&interchannel_gap,      confval::SValidator<float>::SVFRangeIn (0., 400.)),
                confval::SValidator<float>("montage.height",            &da_ht, 
                confval::SValidator<float>::SVFRangeIn (10., 4000.)),
        }),
-       find_dialog (nullptr),
-       filters_dialog (*this),
-       phasediff_dialog (*this),
-       artifact_detection_dialog (*this),
+       patterns_dialog (nullptr),
+       filters_dialog (nullptr),
+       phasediff_dialog (nullptr),
+       artifact_dialog (nullptr),
        using_channel (nullptr),
        da_ht (NAN) // bad value, to be estimated unless previously saved
 {
@@ -265,8 +265,14 @@ aghui::SScoringFacility::
        if ( ica )
                delete ica;
 
-       if ( find_dialog )
-               delete find_dialog;
+       if ( artifacts_dialog )
+               delete artifacts_dialog;
+       if ( patterns_dialog )
+               delete patterns_dialog;
+       if ( phasediff_dialog )
+               delete phasediff_dialog;
+       if ( filters_dialog )
+               delete filters_dialog;
 
        // put scores
        put_hypnogram();
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 47c735e..2762bcb 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -495,86 +495,21 @@ class SScoringFacility
        void set_tooltip( TTipIdx i) const;
 
       // child dialogs:
-       struct SFindDialog;
-       SFindDialog
-               *find_dialog;
+       struct SPatternsDialog;
+       SPatternsDialog
+               *patterns_dialog;
 
-       struct SFiltersDialog {
-               DELETE_DEFAULT_METHODS (SFiltersDialog);
-
-               SFiltersDialog (SScoringFacility& parent)
-                     : _p (parent)
-                       {}
-             ~SFiltersDialog ();
-
-               SUIVarCollection
-                       W_V;
-
-               SScoringFacility&
-                       _p;
-       };
+       struct SFiltersDialog;
        SFiltersDialog
-               filters_dialog;
-
-       struct SPhasediffDialog {
-               DELETE_DEFAULT_METHODS (SPhasediffDialog);
-
-               SPhasediffDialog (SScoringFacility&);
-              ~SPhasediffDialog ();
-
-               const SChannel
-                       *channel1,
-                       *channel2;
-               bool    use_original_signal;
-               float   from,
-                       upto;
-
-               unsigned
-                       bwf_order,
-                       scope;
-               float   display_scale;
+               *filters_dialog;
 
-               valarray<TFloat>
-                       course;
-               size_t  smooth_side;
-               void update_course();
-
-               const SChannel* channel_from_cbox( GtkComboBox *cbox);
-               void preselect_channel( GtkComboBox *cbox, const char *ch);
-
-               void draw( cairo_t* cr, int wd, int ht);
-
-               bool suspend_draw;
-
-               SScoringFacility&
-                       _p;
-       };
+       struct SPhasediffDialog;
        SPhasediffDialog
-               phasediff_dialog;
-
-      // artifacts
-       struct SArtifactDetectionDialog {
-               DELETE_DEFAULT_METHODS (SArtifactDetectionDialog);
-
-               SArtifactDetectionDialog (SScoringFacility&);
-              ~SArtifactDetectionDialog ();
-
-               metrics::mc::SArtifactDetectionPP
-                       P;
-               sigfile::SArtifacts
-                       artifacts_backup;
-               bool    orig_signal_visible_backup;
-               list<pair<SChannel*, bool>>
-                       channels_visible_backup;
-               bool    suppress_preview_handler;
-               SUIVarCollection
-                       W_V;
+               *phasediff_dialog;
 
-               SScoringFacility&
-                       _p;
-       };
+       struct SArtifactDetectionDialog;
        SArtifactDetectionDialog
-               artifact_detection_dialog;
+               *artifact_dialog;
        void populate_mSFADProfiles();
 
       // menu support
diff --git a/src/ui/sf/sf_cb.cc b/src/ui/sf/sf_cb.cc
index 31b60e9..95dc487 100644
--- a/src/ui/sf/sf_cb.cc
+++ b/src/ui/sf/sf_cb.cc
@@ -197,9 +197,9 @@ bSFShowFindDialog_toggled_cb( GtkToggleButton 
*togglebutton, gpointer userdata)
                        SF.find_dialog =
                                new aghui::SScoringFacility::SFindDialog (SF);
                SF.find_dialog->setup_controls_for_find();
-               gtk_widget_show( (GtkWidget*)SF.wSFFD);
+               gtk_widget_show( (GtkWidget*)SF.find_dialog->wSFFD);
        } else
-               gtk_widget_hide( (GtkWidget*)SF.wSFFD);
+               gtk_widget_hide( (GtkWidget*)SF.find_dialog->wSFFD);
 }
 
 
@@ -209,9 +209,13 @@ bSFShowPhaseDiffDialog_toggled_cb( GtkToggleButton 
*togglebutton, gpointer userd
 {
        auto& SF = *(SScoringFacility*)userdata;
        if ( gtk_toggle_button_get_active( togglebutton) ) {
-               gtk_widget_show( (GtkWidget*)SF.wSFPD);
+               if ( not SF.phasediff_dialog )
+                       SF.phasediff_dialog =
+                               new aghui::SScoringFacility::SPhasediffDialog 
(SF);
+               SF.phasediff_dialog->setup_controls_for_find();
+               gtk_widget_show( (GtkWidget*)SF.phasediff_dialog->wSFPD);
        } else
-               gtk_widget_hide( (GtkWidget*)SF.wSFPD);
+               gtk_widget_hide( (GtkWidget*)SF.phasediff_dialog->wSFPD);
 }
 
 
diff --git a/src/ui/sf/widgets.hh b/src/ui/sf/widgets.hh
new file mode 100644
index 0000000..1163859
--- /dev/null
+++ b/src/ui/sf/widgets.hh
@@ -0,0 +1,198 @@
+// ;-*-C++-*-
+/*
+ *       File name:  ui/sf/sf-widgets.hh
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <[email protected]>
+ * Initial version:  2012-10-06
+ *
+ *         Purpose:  scoring facility widgets class
+ *
+ *         License:  GPL
+ */
+
+#ifndef _AGH_UI_SCORING_FACILITY_WIDGETS_H
+#define _AGH_UI_SCORING_FACILITY_WIDGETS_H
+
+#include <gtk/gtk.h>
+#include "ui/forward-decls.hh"
+
+namespace aghui {
+
+struct SScoringFacilityWidgets {
+
+       // we load and construct own widget set (wSF and all its contents)
+       // ourself, for every SScoringFacility instance being created, so
+       // construct_widgets below takes an arg
+       GtkBuilder *builder;
+       SScoringFacilityWidgets (SExpDesignUI&);
+       ~SScoringFacilityWidgets ();
+
+       // 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
+       GtkButton  // acting label
+               *eSFCurrentPos;
+       GtkButton
+               *bSFBack, *bSFForward,
+               *bSFScoreClear, *bSFScoreNREM1, *bSFScoreNREM2, *bSFScoreNREM3, 
*bSFScoreNREM4,
+               *bSFScoreREM, *bSFScoreWake,
+               *bSFGotoPrevUnscored, *bSFGotoNextUnscored,
+               *bSFGotoPrevArtifact, *bSFGotoNextArtifact;
+       GtkToggleButton
+               *bSFDrawCrosshair,
+               *bSFShowFindDialog, *bSFShowPhaseDiffDialog;
+       GtkButton
+       //*bSFResetMontage,
+               *bSFRunICA;
+       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;
+
+       // common controls (contd)
+       GtkMenuToolButton
+               *bSFAccept;
+       GtkMenu
+               *iiSFAccept;
+
+       // montage area
+       GtkDrawingArea
+               *daSFMontage,
+               *daSFHypnogram;
+       GtkExpander
+               *cSFHypnogram;
+       GtkLabel
+               *lSFOverChannel;
+       // menus
+       GtkMenu
+               *iiSFPage,
+               *iiSFPageSelection,
+               *iiSFPageAnnotation,
+               *iiSFPageProfiles,
+               *iiSFPagePhasicEvents,
+               *iiSFPageHidden,
+               *iiSFPower,
+               *iiSFScore,
+               *iiSFICAPage;
+       GtkCheckMenuItem
+               *iSFPageShowOriginal, *iSFPageShowProcessed,
+               *iSFPageUseResample, *iSFPageDrawZeroline,
+               *iSFPageDrawPSDProfile,
+               *iSFPageDrawPSDSpectrum,
+               *iSFPageDrawSWUProfile,
+               *iSFPageDrawMCProfile,
+               *iSFPageDrawEMGProfile,
+               *iSFPowerDrawBands,
+               *iSFPowerSmooth,
+               *iSFPowerAutoscale,
+               *iSFPageSelectionDrawCourse,
+               *iSFPageSelectionDrawEnvelope,
+               *iSFPageSelectionDrawDzxdf;
+       GtkMenuItem
+               *iSFPageFilter,
+               *iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
+               *iSFPageExportSignal, *iSFPageUseThisScale,
+               *iSFPageArtifactsDetect, *iSFPageArtifactsMarkFlat, 
*iSFPageArtifactsClear,
+               *iSFPageHide,
+               *iSFPageHidden,  // has a submenu
+               *iSFPageSpaceEvenly,
+               *iSFPageLocateSelection,
+               *iSFPageAnnotationSeparator,
+               *iSFPageAnnotationDelete,
+               *iSFPageAnnotationEdit,
+               *iSFPageSelectionMarkArtifact, *iSFPageSelectionClearArtifact,
+               *iSFPageSelectionFindPattern,
+               *iSFPageSelectionAnnotate,
+               *iSFPowerExportAll, *iSFPowerExportRange,
+               *iSFPowerUseThisScale,
+               *iSFScoreAssist, *iSFScoreImport, *iSFScoreExport, 
*iSFScoreClear,
+               *iSFAcceptAndTakeNext;
+       GtkSeparatorMenuItem
+               *iSFPageProfilesSubmenuSeparator;
+
+       // more important dialogs
+
+       // less important dialogs
+       GtkDialog
+               *wSFAnnotationLabel,
+               *wSFAnnotationSelector,
+               *wSFSimpleArtifactDetectionParams;
+       GtkEntry
+               *eSFAnnotationLabel;
+       GtkComboBox
+               *eSFAnnotationSelectorWhich;
+       GtkSpinButton
+               *eSFSimpleArtifactDetectionMinFlatRegionSize,
+               *eSFSimpleArtifactDetectionPad;
+
+};
+
+} // namespace aghui
+
+#endif
+
+// eof

-- 
Sleep experiment manager

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

Reply via email to