[med-svn] [SCM] aghermann branch, master, updated. 06bda7dfaa687aaf0708a024d192024e2cd58421

Andrei Zavada johnhommer at gmail.com
Thu Jan 24 00:43:55 UTC 2013


The following commit has been merged in the master branch:
commit b8e19da6c5d044aba340dd7fd8cf3f466b7f6342
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Tue Jan 22 02:22:12 2013 +0200

    patterns WIP

diff --git a/data/dialogs.glade b/data/dialogs.glade
index e330e51..e522854 100644
--- a/data/dialogs.glade
+++ b/data/dialogs.glade
@@ -328,7 +328,7 @@
                     <property name="xalign">0</property>
                     <property name="xpad">5</property>
                     <property name="ypad">15</property>
-                    <property name="label" translatable="yes"><b><big><big>Aghermann 0.7.6</big></big></b>
+                    <property name="label"><b><big><big>Aghermann 0.8</big></big></b> Pig Iron
 <a href="http://johnhommer.com/academic/code/aghermann">johnhommer.com/academic/code/aghermann</a></property>
                     <property name="use_markup">True</property>
                   </object>
diff --git a/data/sf.glade b/data/sf.glade
index 49be96c..4413675 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -17,6 +17,18 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
   </object>
+  <object class="GtkMenu" id="iiSFFDField">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="menuitem4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">menuitem4</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
   <object class="GtkMenu" id="iiSFICAPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -637,38 +649,40 @@
     <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="jPatternEnvTightness">
-    <property name="lower">1</property>
+    <property name="lower">0.050000000000000003</property>
     <property name="upper">20</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">5</property>
-  </object>
-  <object class="GtkAdjustment" id="jPatternParameterD">
-    <property name="upper">2</property>
-    <property name="value">0.01</property>
+    <property name="value">0.25</property>
     <property name="step_increment">0.01</property>
-    <property name="page_increment">0.10000000000000001</property>
+    <property name="page_increment">5</property>
   </object>
   <object class="GtkAdjustment" id="jPatternStrictnessA">
     <property name="lower">0.01</property>
     <property name="upper">100</property>
-    <property name="value">0.0099999997764825821</property>
+    <property name="value">0.10000000000000001</property>
     <property name="step_increment">0.01</property>
     <property name="page_increment">1</property>
   </object>
   <object class="GtkAdjustment" id="jPatternStrictnessB">
     <property name="lower">0.01</property>
     <property name="upper">100</property>
-    <property name="value">0.01</property>
+    <property name="value">0.10000000000000001</property>
     <property name="step_increment">0.01</property>
     <property name="page_increment">1</property>
   </object>
   <object class="GtkAdjustment" id="jPatternStrictnessC">
+    <property name="lower">0.01</property>
     <property name="upper">100</property>
     <property name="value">0.10000000000000001</property>
     <property name="step_increment">0.010000003501772881</property>
     <property name="page_increment">1</property>
   </object>
+  <object class="GtkAdjustment" id="jPatternStrictnessD">
+    <property name="lower">0.01</property>
+    <property name="upper">2</property>
+    <property name="value">0.10000000000000001</property>
+    <property name="step_increment">0.01</property>
+    <property name="page_increment">0.10000000000000001</property>
+  </object>
   <object class="GtkAdjustment" id="jPhaseDiffBandwidth">
     <property name="lower">0.25</property>
     <property name="upper">2</property>
@@ -1509,75 +1523,59 @@
       <action-widget response="-5">bFilterOK</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkDialog" id="wSFFD">
+  <object class="GtkDialog" id="wSFArtifactDetection">
     <property name="can_focus">False</property>
-    <property name="border_width">10</property>
-    <property name="title" translatable="yes">Find/manage patterns</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">normal</property>
-    <property name="skip_taskbar_hint">True</property>
-    <property name="skip_pager_hint">True</property>
-    <property name="gravity">north</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Artifact Detection</property>
+    <property name="type_hint">dialog</property>
     <property name="transient_for">wScoringFacility</property>
-    <signal name="close" handler="gtk_widget_hide" swapped="no"/>
-    <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox16">
-        <property name="visible">True</property>
+      <object class="GtkBox" id="dialog-vbox9">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area16">
-            <property name="visible">True</property>
+          <object class="GtkButtonBox" id="dialog-action_area9">
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="bSFFDDismiss">
-                <property name="label" translatable="yes">_Dismiss</property>
+              <object class="GtkButton" id="bSFADCancel">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="relief">half</property>
-                <property name="use_underline">True</property>
-                <signal name="clicked" handler="gtk_widget_hide" object="wSFPD" swapped="yes"/>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
                 <property name="position">0</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="bSFFDGotoPrevious">
-                <property name="label" translatable="yes">_Previous</property>
+              <object class="GtkToggleButton" id="bSFADPreview">
+                <property name="label" translatable="yes">Preview</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="relief">half</property>
-                <property name="use_underline">True</property>
-                <accelerator key="p" signal="activate"/>
+                <property name="receives_default">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="bSFFDGotoNext">
-                <property name="label" translatable="yes">_Next</property>
+              <object class="GtkButton" id="bSFADApply">
+                <property name="label">gtk-apply</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="relief">half</property>
-                <property name="use_underline">True</property>
-                <accelerator key="n" signal="activate"/>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
                 <property name="position">2</property>
               </packing>
             </child>
@@ -1590,1239 +1588,46 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box9">
+          <object class="GtkGrid" id="grid4">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="border_width">10</property>
             <property name="orientation">vertical</property>
+            <property name="row_spacing">5</property>
             <child>
-              <object class="GtkBox" id="box11">
+              <object class="GtkLabel" id="lSFADInfo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_top">5</property>
                 <property name="margin_bottom">5</property>
-                <child>
-                  <object class="GtkLabel" id="label45">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="xpad">5</property>
-                    <property name="label" translatable="yes">Find pattern</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                      <attribute name="scale" value="1.1000000000000001"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkHBox" id="cSFFDLabelBox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkButton" id="bSFFDDiscard">
-                        <property name="label" translatable="yes">Dis_card</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="relief">half</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="bSFFDSave">
-                        <property name="label" translatable="yes">_Save</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="relief">half</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkComboBox" id="eSFFDPatternList">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">fafa</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                  <attribute name="scale" value="1.1000000000000001"/>
+                </attributes>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkSeparator" id="separator9">
+              <object class="GtkSeparator" id="separator12">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">7</property>
+                <property name="height">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkHBox" id="hbox6">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_top">5</property>
-                <property name="spacing">8</property>
-                <child>
-                  <object class="GtkTable" id="cSFFDControls">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="n_rows">2</property>
-                    <child>
-                      <object class="GtkTable" id="cSFFDParameters">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="n_rows">12</property>
-                        <property name="n_columns">3</property>
-                        <property name="row_spacing">5</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDDZCDFSigma">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternDZCDFSigma</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">10</property>
-                            <property name="bottom_attach">11</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDBandPassFrom">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternBandPassFrom</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label175">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Between:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label176">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Sigma:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">10</property>
-                            <property name="bottom_attach">11</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label178">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">10</property>
-                            <property name="bottom_attach">11</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label179">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Order:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDBandPassOrder">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternBandPassOrder</property>
-                            <property name="snap_to_ticks">True</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label180">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">6</property>
-                            <property name="bottom_attach">7</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label181">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes"><b>Derivative ZC density</b></property>
-                            <property name="use_markup">True</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">8</property>
-                            <property name="bottom_attach">9</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label182">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes"><b>Target frequency</b></property>
-                            <property name="use_markup">True</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label183">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Step:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">9</property>
-                            <property name="bottom_attach">10</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDDZCDFStep">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternDZCDFStep</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">9</property>
-                            <property name="bottom_attach">10</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label184">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">sec</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">9</property>
-                            <property name="bottom_attach">10</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label185">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes"><b>Envelope</b></property>
-                            <property name="use_markup">True</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label186">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Tightness:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDEnvTightness">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternEnvTightness</property>
-                            <property name="snap_to_ticks">True</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label187">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">points</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkHSeparator" id="hseparator8">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                            <property name="y_padding">8</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkHSeparator" id="hseparator9">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">7</property>
-                            <property name="bottom_attach">8</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                            <property name="y_padding">8</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label188">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Smooth:</property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">11</property>
-                            <property name="bottom_attach">12</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDDZCDFSmooth">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternDZCDFSmooth</property>
-                            <property name="snap_to_ticks">True</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">11</property>
-                            <property name="bottom_attach">12</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label189">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">points</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">11</property>
-                            <property name="bottom_attach">12</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label44">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">and </property>
-                          </object>
-                          <packing>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDBandPassUpto">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternBandPassUpto</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label177">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Hz</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkTable" id="cSFFDCriteria">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="n_rows">6</property>
-                        <property name="n_columns">2</property>
-                        <property name="row_spacing">5</property>
-                        <child>
-                          <object class="GtkLabel" id="label191">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Fit of envelope centre</property>
-                            <property name="tooltip_text" translatable="yes">Fit of envelope centre</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Env. mid:</property>
-                            <attributes>
-                              <attribute name="scale" value="0.90000000000000002"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDParameterA">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternStrictnessA</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label192">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Fit of envelope breadth</property>
-                            <property name="tooltip_text" translatable="yes">Fit of envelope breadth</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Env. breadth:</property>
-                            <attributes>
-                              <attribute name="scale" value="0.90000000000000002"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDParameterB">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternStrictnessB</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label193">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Target frequency fit</property>
-                            <property name="tooltip_text" translatable="yes">Target frequency fit</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">Target freq:</property>
-                            <attributes>
-                              <attribute name="scale" value="0.90000000000000002"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDParameterC">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternStrictnessC</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label194">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Higher values mean looser fit criteria
-on individual parameters</property>
-                            <property name="tooltip_text" translatable="yes">Higher values mean looser fit criteria
-on individual parameters</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">1</property>
-                            <property name="label" translatable="yes"><b>Strictness criteria:</b></property>
-                            <property name="use_markup">True</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSeparator" id="separator3">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="valign">end</property>
-                          </object>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label49">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_tooltip">True</property>
-                            <property name="tooltip_markup" translatable="yes">Deriv. zerocrossing density</property>
-                            <property name="tooltip_text" translatable="yes">Deriv. zerocrossing density</property>
-                            <property name="xalign">1</property>
-                            <property name="xpad">5</property>
-                            <property name="label" translatable="yes">DZCDF:</property>
-                            <attributes>
-                              <attribute name="scale" value="0.90000000000000002"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="eSFFDParameterD">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="invisible_char">•</property>
-                            <property name="xalign">1</property>
-                            <property name="overwrite_mode">True</property>
-                            <property name="invisible_char_set">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="adjustment">jPatternParameterD</property>
-                            <property name="digits">2</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="padding">2</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkVBox" id="vbox9">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkScrolledWindow" id="swSFFDThing">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <object class="GtkViewport" id="vpSFFDThing">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="resize_mode">queue</property>
-                            <child>
-                              <object class="GtkDrawingArea" id="daSFFDThing">
-                                <property name="visible">True</property>
-                                <property name="app_paintable">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="padding">2</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="lSFFDParametersBrief">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="xpad">5</property>
-                        <property name="ypad">3</property>
-                        <property name="label" translatable="yes">(parameters brief)</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkScrolledWindow" id="swSFFDField">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <object class="GtkViewport" id="vpSFFDField">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkDrawingArea" id="daSFFDField">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkBox" id="box12">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="halign">start</property>
-                        <property name="valign">end</property>
-                        <property name="orientation">vertical</property>
-                        <child>
-                          <object class="GtkTable" id="cSFFDSearchButton">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="n_columns">3</property>
-                            <child>
-                              <object class="GtkButton" id="bSFFDSearch">
-                                <property name="label" translatable="yes">Search</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <property name="focus_on_click">False</property>
-                              </object>
-                              <packing>
-                                <property name="x_options"/>
-                                <property name="y_options"/>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label46">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="xpad">5</property>
-                                <property name="label" translatable="yes"> in channel </property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="x_options"/>
-                                <property name="y_options"/>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkComboBox" id="eSFFDChannel">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">end</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">2</property>
-                                <property name="right_attach">3</property>
-                                <property name="x_options"/>
-                                <property name="y_options"/>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkTable" id="cSFFDAgainButton">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <child>
-                              <object class="GtkButton" id="bSFFDAgain">
-                                <property name="label" translatable="yes">Modify pattern</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="lSFFDSimilarity">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="xpad">5</property>
-                        <property name="label" translatable="yes">(similarity info)</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">5</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSeparator" id="separator18">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="margin_top">5</property>
-            <property name="margin_bottom">5</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-1">bSFFDDismiss</action-widget>
-      <action-widget response="-1">bSFFDGotoPrevious</action-widget>
-      <action-widget response="-1">bSFFDGotoNext</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkDialog" id="wSFADSaveProfileName">
-    <property name="width_request">200</property>
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">New AD profile</property>
-    <property name="modal">True</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="skip_taskbar_hint">True</property>
-    <property name="transient_for">wSFFD</property>
-    <signal name="close" handler="gtk_widget_hide_on_delete" swapped="no"/>
-    <signal name="response" handler="gtk_widget_hide_on_delete" swapped="no"/>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox13">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child>
-          <object class="GtkLabel" id="label43">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Profile _name:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">eSFADSaveProfileNameName</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="eSFADSaveProfileNameName">
-            <property name="width_request">130</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="can_default">True</property>
-            <property name="invisible_char">•</property>
-            <property name="activates_default">True</property>
-            <property name="invisible_char_set">True</property>
-            <property name="primary_icon_activatable">False</property>
-            <property name="secondary_icon_activatable">False</property>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area13">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="button8">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-                <property name="focus_on_click">False</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button9">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-                <property name="focus_on_click">False</property>
-                <accelerator key="Return" signal="activate"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">3</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-6">button8</action-widget>
-      <action-widget response="-5">button9</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkDialog" id="wSFArtifactDetection">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Artifact Detection</property>
-    <property name="type_hint">dialog</property>
-    <property name="transient_for">wScoringFacility</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox9">
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area9">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="bSFADCancel">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkToggleButton" id="bSFADPreview">
-                <property name="label" translatable="yes">Preview</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="bSFADApply">
-                <property name="label">gtk-apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkGrid" id="grid4">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">10</property>
-            <property name="orientation">vertical</property>
-            <property name="row_spacing">5</property>
-            <child>
-              <object class="GtkLabel" id="lSFADInfo">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_top">5</property>
-                <property name="margin_bottom">5</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">fafa</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                  <attribute name="scale" value="1.1000000000000001"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">3</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSeparator" id="separator12">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">7</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label21">
+              <object class="GtkLabel" id="label21">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_right">5</property>
@@ -3326,23 +2131,161 @@ on individual parameters</property>
                   <placeholder/>
                 </child>
                 <child>
-                  <placeholder/>
+                  <placeholder/>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label33">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_right">5</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">MC Gain:</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="eSFADMCGain">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_frame">False</property>
+                    <property name="invisible_char">•</property>
+                    <property name="xalign">1</property>
+                    <property name="shadow_type">none</property>
+                    <property name="overwrite_mode">True</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">jSFADMCGain</property>
+                    <property name="digits">1</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label28">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_right">5</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">F<sub>0</sub>:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="eSFADF0">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_frame">False</property>
+                    <property name="invisible_char">•</property>
+                    <property name="xalign">1</property>
+                    <property name="shadow_type">none</property>
+                    <property name="overwrite_mode">True</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">jSFADF0</property>
+                    <property name="digits">2</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label27">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">5</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Hz</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label29">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_right">5</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">F<sub>cutoff</sub>:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="eSFADFc">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_frame">False</property>
+                    <property name="invisible_char">•</property>
+                    <property name="xalign">1</property>
+                    <property name="shadow_type">none</property>
+                    <property name="overwrite_mode">True</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="adjustment">jSFADFc</property>
+                    <property name="digits">2</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label30">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_right">5</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Bandwidth:</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label32">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">5</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Hz</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label33">
+                  <object class="GtkLabel" id="label31">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_right">5</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">MC Gain:</property>
+                    <property name="margin_left">5</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Hz</property>
                   </object>
                   <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkSpinButton" id="eSFADMCGain">
+                  <object class="GtkSpinButton" id="eSFADBandwidth">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="has_frame">False</property>
@@ -3351,28 +2294,31 @@ on individual parameters</property>
                     <property name="shadow_type">none</property>
                     <property name="overwrite_mode">True</property>
                     <property name="invisible_char_set">True</property>
-                    <property name="adjustment">jSFADMCGain</property>
-                    <property name="digits">1</property>
+                    <property name="adjustment">jSFADBandwidth</property>
+                    <property name="digits">2</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label28">
+                  <object class="GtkLabel" id="label34">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="margin_right">5</property>
                     <property name="xalign">1</property>
-                    <property name="label" translatable="yes">F<sub>0</sub>:</property>
-                    <property name="use_markup">True</property>
+                    <property name="label" translatable="yes">Back-polate factor:</property>
                   </object>
+                  <packing>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                  </packing>
                 </child>
                 <child>
-                  <object class="GtkSpinButton" id="eSFADF0">
+                  <object class="GtkSpinButton" id="eSFADBackpolate">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="has_frame">False</property>
@@ -3381,314 +2327,1386 @@ on individual parameters</property>
                     <property name="shadow_type">none</property>
                     <property name="overwrite_mode">True</property>
                     <property name="invisible_char_set">True</property>
-                    <property name="adjustment">jSFADF0</property>
+                    <property name="adjustment">jSFADBackpolate</property>
                     <property name="digits">2</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
+                <property name="width">3</property>
+                <property name="height">7</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSeparator" id="separator20">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_top">5</property>
+                <property name="margin_bottom">5</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">14</property>
+                <property name="width">7</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="eSFADSingleChannelPreview">
+                <property name="label" translatable="yes">Hide other channels in preview</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">4</property>
+                <property name="top_attach">13</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSeparator" id="separator2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">12</property>
+                <property name="width">7</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box8">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="spacing">3</property>
                 <child>
-                  <object class="GtkLabel" id="label27">
+                  <object class="GtkButton" id="bSFADProfileDelete">
+                    <property name="label" translatable="yes">Delete</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="margin_left">5</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Hz</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label29">
+                  <object class="GtkButton" id="bSFADProfileSave">
+                    <property name="label" translatable="yes">Save</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="eSFADProfiles">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_right">5</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">F<sub>cutoff</sub>:</property>
-                    <property name="use_markup">True</property>
                   </object>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="left_attach">4</property>
+                <property name="top_attach">0</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="lSFADDirtyPercent">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">13</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">bSFADCancel</action-widget>
+      <action-widget response="-1">bSFADPreview</action-widget>
+      <action-widget response="-5">bSFADApply</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="wSFFD">
+    <property name="can_focus">False</property>
+    <property name="border_width">10</property>
+    <property name="title" translatable="yes">Find/manage patterns</property>
+    <property name="default_width">800</property>
+    <property name="default_height">500</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">normal</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="gravity">north</property>
+    <property name="transient_for">wScoringFacility</property>
+    <signal name="close" handler="gtk_widget_hide" swapped="no"/>
+    <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox16">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area16">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="bSFFDDismiss">
+                <property name="label" translatable="yes">_Dismiss</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="relief">half</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="gtk_widget_hide" object="wSFFD" swapped="yes"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkBox" id="box12">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">end</property>
+                <property name="orientation">vertical</property>
+                <property name="homogeneous">True</property>
                 <child>
-                  <object class="GtkSpinButton" id="eSFADFc">
+                  <object class="GtkTable" id="cSFFDSearchButton">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="has_frame">False</property>
-                    <property name="invisible_char">•</property>
-                    <property name="xalign">1</property>
-                    <property name="shadow_type">none</property>
-                    <property name="overwrite_mode">True</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="adjustment">jSFADFc</property>
-                    <property name="digits">2</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="n_columns">3</property>
+                    <child>
+                      <object class="GtkButton" id="bSFFDSearch">
+                        <property name="label" translatable="yes">Search</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="focus_on_click">False</property>
+                      </object>
+                      <packing>
+                        <property name="x_options"/>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label46">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="xpad">5</property>
+                        <property name="label" translatable="yes"> in channel </property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options"/>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="eSFFDChannel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">end</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="x_options"/>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label30">
+                  <object class="GtkTable" id="cSFFDAgainButton">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_right">5</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Bandwidth:</property>
+                    <property name="halign">start</property>
+                    <child>
+                      <object class="GtkButton" id="bSFFDAgain">
+                        <property name="label" translatable="yes">Modify pattern</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                      </object>
+                    </child>
                   </object>
                   <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label32">
+                  <object class="GtkBox" id="cSFFDSearching">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_left">5</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Hz</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="label50">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Searching …</property>
+                        <attributes>
+                          <attribute name="style" value="italic"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box9">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="box11">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_top">5</property>
+                <property name="margin_bottom">5</property>
                 <child>
-                  <object class="GtkLabel" id="label31">
+                  <object class="GtkLabel" id="label45">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_left">5</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Hz</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="eSFADBandwidth">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="has_frame">False</property>
-                    <property name="invisible_char">•</property>
-                    <property name="xalign">1</property>
-                    <property name="shadow_type">none</property>
-                    <property name="overwrite_mode">True</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="adjustment">jSFADBandwidth</property>
-                    <property name="digits">2</property>
+                    <property name="xpad">5</property>
+                    <property name="label" translatable="yes">Find pattern</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                      <attribute name="scale" value="1.1000000000000001"/>
+                    </attributes>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label34">
+                  <object class="GtkHBox" id="cSFFDLabelBox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_right">5</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Back-polate factor:</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="eSFADBackpolate">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="has_frame">False</property>
-                    <property name="invisible_char">•</property>
-                    <property name="xalign">1</property>
-                    <property name="shadow_type">none</property>
-                    <property name="overwrite_mode">True</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="adjustment">jSFADBackpolate</property>
-                    <property name="digits">2</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">5</property>
-                <property name="width">3</property>
-                <property name="height">7</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSeparator" id="separator20">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_top">5</property>
-                <property name="margin_bottom">5</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">14</property>
-                <property name="width">7</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="eSFADSingleChannelPreview">
-                <property name="label" translatable="yes">Hide other channels in preview</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="xalign">0</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
+                    <child>
+                      <object class="GtkButton" id="bSFFDDiscard">
+                        <property name="label" translatable="yes">Dis_card</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="relief">half</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="bSFFDSave">
+                        <property name="label" translatable="yes">_Save</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="relief">half</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="eSFFDPatternList">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </object>
               <packing>
-                <property name="left_attach">4</property>
-                <property name="top_attach">13</property>
-                <property name="width">3</property>
-                <property name="height">1</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkSeparator" id="separator2">
+              <object class="GtkSeparator" id="separator9">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">12</property>
-                <property name="width">7</property>
-                <property name="height">1</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="box8">
+              <object class="GtkHBox" id="hbox6">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">3</property>
+                <property name="margin_top">5</property>
+                <property name="spacing">8</property>
                 <child>
-                  <object class="GtkButton" id="bSFADProfileDelete">
-                    <property name="label" translatable="yes">Delete</property>
+                  <object class="GtkTable" id="cSFFDControls">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="n_rows">2</property>
+                    <child>
+                      <object class="GtkTable" id="cSFFDParameters">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="n_rows">12</property>
+                        <property name="n_columns">3</property>
+                        <property name="row_spacing">5</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDDZCDFSigma">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternDZCDFSigma</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">10</property>
+                            <property name="bottom_attach">11</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDBandPassFrom">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternBandPassFrom</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label175">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Between:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label176">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Sigma:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">10</property>
+                            <property name="bottom_attach">11</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label178">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">10</property>
+                            <property name="bottom_attach">11</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label179">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Order:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDBandPassOrder">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternBandPassOrder</property>
+                            <property name="snap_to_ticks">True</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label180">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label181">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes"><b>Derivative ZC density</b></property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">8</property>
+                            <property name="bottom_attach">9</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label182">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes"><b>Target frequency</b></property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label183">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Step:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">9</property>
+                            <property name="bottom_attach">10</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDDZCDFStep">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternDZCDFStep</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">9</property>
+                            <property name="bottom_attach">10</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label184">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">sec</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">9</property>
+                            <property name="bottom_attach">10</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label185">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes"><b>Envelope</b></property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label186">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text" translatable="yes">Scope of local extrema</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Scope:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDEnvTightness">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternEnvTightness</property>
+                            <property name="digits">2</property>
+                            <property name="snap_to_ticks">True</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label187">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">sec</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHSeparator" id="hseparator8">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                            <property name="y_padding">8</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHSeparator" id="hseparator9">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">7</property>
+                            <property name="bottom_attach">8</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                            <property name="y_padding">8</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label188">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Smooth:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">11</property>
+                            <property name="bottom_attach">12</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDDZCDFSmooth">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternDZCDFSmooth</property>
+                            <property name="snap_to_ticks">True</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">11</property>
+                            <property name="bottom_attach">12</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label189">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">points</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">11</property>
+                            <property name="bottom_attach">12</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label44">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">and </property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDBandPassUpto">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternBandPassUpto</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label177">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Hz</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkTable" id="cSFFDCriteria">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="n_rows">6</property>
+                        <property name="n_columns">2</property>
+                        <property name="row_spacing">5</property>
+                        <child>
+                          <object class="GtkLabel" id="label191">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup" translatable="yes">Fit of envelope centre</property>
+                            <property name="tooltip_text" translatable="yes">Fit of envelope centre</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Env. mid:</property>
+                            <attributes>
+                              <attribute name="scale" value="0.90000000000000002"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDParameterA">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternStrictnessA</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label192">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup" translatable="yes">Fit of envelope breadth</property>
+                            <property name="tooltip_text" translatable="yes">Fit of envelope breadth</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Env. breadth:</property>
+                            <attributes>
+                              <attribute name="scale" value="0.90000000000000002"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDParameterB">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternStrictnessB</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label193">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup" translatable="yes">Target frequency fit</property>
+                            <property name="tooltip_text" translatable="yes">Target frequency fit</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">Target freq:</property>
+                            <attributes>
+                              <attribute name="scale" value="0.90000000000000002"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDParameterC">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternStrictnessC</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label194">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup" translatable="yes">Higher values mean looser fit criteria
+on individual parameters</property>
+                            <property name="tooltip_text" translatable="yes">Higher values mean looser fit criteria
+on individual parameters</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">1</property>
+                            <property name="label" translatable="yes"><b>Strictness criteria:</b></property>
+                            <property name="use_markup">True</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSeparator" id="separator3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="valign">end</property>
+                          </object>
+                          <packing>
+                            <property name="right_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label49">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="has_tooltip">True</property>
+                            <property name="tooltip_markup" translatable="yes">Deriv. zerocrossing density</property>
+                            <property name="tooltip_text" translatable="yes">Deriv. zerocrossing density</property>
+                            <property name="xalign">1</property>
+                            <property name="xpad">5</property>
+                            <property name="label" translatable="yes">DZCDF:</property>
+                            <attributes>
+                              <attribute name="scale" value="0.90000000000000002"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="eSFFDParameterD">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_frame">False</property>
+                            <property name="invisible_char">•</property>
+                            <property name="xalign">1</property>
+                            <property name="overwrite_mode">True</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="adjustment">jPatternStrictnessD</property>
+                            <property name="digits">2</property>
+                            <property name="numeric">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="pack_type">end</property>
+                    <property name="padding">2</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="bSFADProfileSave">
-                    <property name="label" translatable="yes">Save</property>
+                  <object class="GtkVBox" id="cSFFDDrawingAreas">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkScrolledWindow" id="swSFFDThing">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkViewport" id="vpSFFDThing">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="resize_mode">queue</property>
+                            <child>
+                              <object class="GtkDrawingArea" id="daSFFDThing">
+                                <property name="visible">True</property>
+                                <property name="app_paintable">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="events">GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="padding">2</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="lSFFDParametersBrief">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="xpad">5</property>
+                        <property name="ypad">3</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkScrolledWindow" id="swSFFDField">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkViewport" id="vpSFFDField">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkDrawingArea" id="daSFFDField">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="lSFFDFoundInfo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="xpad">5</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
+                    <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="pack_type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkComboBox" id="eSFADProfiles">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
-                <property name="left_attach">4</property>
-                <property name="top_attach">0</property>
-                <property name="width">3</property>
-                <property name="height">1</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
               </packing>
             </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkSeparator" id="separator18">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">5</property>
+            <property name="margin_bottom">5</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-1">bSFFDDismiss</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="wSFADSaveProfileName">
+    <property name="width_request">200</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">New AD profile</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="transient_for">wSFFD</property>
+    <signal name="close" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <signal name="response" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox13">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkLabel" id="label43">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Profile _name:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">eSFADSaveProfileNameName</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="eSFADSaveProfileNameName">
+            <property name="width_request">130</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="invisible_char">•</property>
+            <property name="activates_default">True</property>
+            <property name="invisible_char_set">True</property>
+            <property name="primary_icon_activatable">False</property>
+            <property name="secondary_icon_activatable">False</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area13">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkLabel" id="lSFADDirtyPercent">
+              <object class="GtkButton" id="button8">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">13</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
+              <object class="GtkButton" id="button9">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+                <accelerator key="Return" signal="activate"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="pack_type">end</property>
+            <property name="position">3</property>
           </packing>
         </child>
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">bSFADCancel</action-widget>
-      <action-widget response="-1">bSFADPreview</action-widget>
-      <action-widget response="-5">bSFADApply</action-widget>
+      <action-widget response="-6">button8</action-widget>
+      <action-widget response="-5">button9</action-widget>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="wSFFDPatternName">
@@ -4831,15 +4849,15 @@ on individual parameters</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreWake">
-                        <property name="label" translatable="yes">☺</property>
+                      <object class="GtkButton" id="bScoreClear">
+                        <property name="label" translatable="yes">⌫</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="w" signal="activate"/>
+                        <accelerator key="q" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -4848,15 +4866,15 @@ on individual parameters</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreClear">
-                        <property name="label" translatable="yes">⌫</property>
+                      <object class="GtkButton" id="bScoreWake">
+                        <property name="label" translatable="yes">☺</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="q" signal="activate"/>
+                        <accelerator key="w" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -5091,17 +5109,18 @@ on individual parameters</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
-                        <property name="label" translatable="yes">Δφ</property>
+                      <object class="GtkToggleButton" id="bSFShowFindDialog">
+                        <property name="label" translatable="yes">_Find</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
+                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
                         <property name="valign">center</property>
+                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F4" signal="activate"/>
+                        <accelerator key="F3" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -5111,18 +5130,17 @@ on individual parameters</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowFindDialog">
-                        <property name="label" translatable="yes">_Find</property>
+                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
+                        <property name="label" translatable="yes">Δφ</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
+                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
                         <property name="valign">center</property>
-                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F3" signal="activate"/>
+                        <accelerator key="F4" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -5947,6 +5965,8 @@ skew:	𝑔(𝑢) = 𝑢2</property>
       <widget name="bSFFDDiscard"/>
       <widget name="bSFFDAgain"/>
       <widget name="bSFFDSearch"/>
+      <widget name="bSFFDSearch"/>
+      <widget name="bSFFDAgain"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="zSFFDControls">
diff --git a/src/patterns/patterns.hh b/src/patterns/patterns.hh
index 2674b35..84d3c2d 100644
--- a/src/patterns/patterns.hh
+++ b/src/patterns/patterns.hh
@@ -137,7 +137,11 @@ class CPatternTool
 
 
 
-enum TOrigin { subject, experiment, user, system };
+enum TOrigin { transient, subject, experiment, user, system };
+
+extern const char*
+	origin_markers[5];
+
 
 template <typename T>
 struct SPattern {
diff --git a/src/ui/sf/sf-channel.cc b/src/ui/sf/sf-channel.cc
index 84f5ea5..77112ca 100644
--- a/src/ui/sf/sf-channel.cc
+++ b/src/ui/sf/sf-channel.cc
@@ -139,7 +139,7 @@ SChannel( agh::CRecording& r,
 	} else if ( type == sigfile::SChannel::TType::emg ) {
 		valarray<TFloat> env_u, env_l;
  		sigproc::envelope( {signal_original, samplerate()},
-				   5, 1.,
+				   .5, 1.,
 				   &env_l, &env_u);
 		emg_profile.resize( env_l.size());
 		emg_profile = env_u - env_l;
@@ -284,6 +284,21 @@ get_mc_course()
 }
 
 
+valarray<TFloat>&
+aghui::SScoringFacility::SChannel::
+which_profile( metrics::TType type)
+{
+	switch ( type ) {
+	case metrics::TType::mc:
+		return get_mc_course(), mc.course;
+	case metrics::TType::psd:
+		return get_psd_course(), psd.course;
+	case metrics::TType::swu:
+		return get_swu_course(), swu.course;
+	default:
+		throw runtime_error ("which profile is it?");
+	}
+}
 
 
 void
@@ -448,7 +463,7 @@ void
 aghui::SScoringFacility::SChannel::
 mark_region_as_pattern()
 {
-	_p.find_dialog.load_pattern( *this);
+	_p.find_dialog.import_from_selection( *this);
 	gtk_widget_show( (GtkWidget*)_p.wSFFD);
 }
 
diff --git a/src/ui/sf/sf-construct.cc b/src/ui/sf/sf-construct.cc
index 8d4b9d5..9e5d5d0 100644
--- a/src/ui/sf/sf-construct.cc
+++ b/src/ui/sf/sf-construct.cc
@@ -384,15 +384,15 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !AGH_GBGETOBJ (GtkDrawingArea,	daSFFDThing) ||
 	     !AGH_GBGETOBJ (GtkScrolledWindow,	swSFFDThing) ||
 	     !AGH_GBGETOBJ (GtkDrawingArea,	daSFFDField) ||
+	     !AGH_GBGETOBJ (GtkMenu,		iiSFFDField) ||
 	     !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,		bSFFDGotoPrevious) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFFDGotoNext) ||
 	     !AGH_GBGETOBJ (GtkButton,		bSFFDSave) ||
 	     !AGH_GBGETOBJ (GtkButton,		bSFFDDiscard) ||
 	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDEnvTightness) ||
@@ -408,7 +408,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !AGH_GBGETOBJ (GtkSpinButton,	eSFFDParameterD) ||
 	     !AGH_GBGETOBJ (GtkHBox,		cSFFDLabelBox) ||
 	     !AGH_GBGETOBJ (GtkLabel,		lSFFDParametersBrief) ||
-	     !AGH_GBGETOBJ (GtkLabel,		lSFFDSimilarity) ||
+	     !AGH_GBGETOBJ (GtkLabel,		lSFFDFoundInfo) ||
 	     !AGH_GBGETOBJ (GtkComboBox,	eSFFDPatternList) ||
 	     !AGH_GBGETOBJ (GtkComboBox,	eSFFDChannel) ||
 	     !AGH_GBGETOBJ (GtkDialog,		wSFFDPatternName) ||
@@ -429,15 +429,13 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	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 (bSFFDSave, clicked);
 	G_CONNECT_1 (bSFFDDiscard, clicked);
 	G_CONNECT_1 (bSFFDSearch, clicked);
 	G_CONNECT_1 (bSFFDAgain, clicked);
 
-	for ( auto& W : {bSFFDGotoNext, bSFFDGotoPrevious} )
-		g_signal_connect( W, "clicked",
-				  (GCallback)bSFFDGoto_clicked_cb,
-				  this);
 	for ( auto& W : {eSFFDEnvTightness,
 			 eSFFDBandPassFrom, eSFFDBandPassUpto, eSFFDBandPassOrder,
 			 eSFFDDZCDFStep, eSFFDDZCDFSigma, eSFFDDZCDFSmooth} )
diff --git a/src/ui/sf/sf-montage.cc b/src/ui/sf/sf-montage.cc
index 0f5010f..132e506 100644
--- a/src/ui/sf/sf-montage.cc
+++ b/src/ui/sf/sf-montage.cc
@@ -254,7 +254,7 @@ draw_page( cairo_t *cr,
 
 		if ( selection_end - selection_start > 5 ) {  // don't mark end if selection is too short
 		      // signal properties
-			auto& Pp = _p.find_dialog.Pp;
+			auto& Pp = _p.find_dialog.Pp2;
 			if ( draw_selection_envelope ) {
 				valarray<TFloat>
 					selection {(draw_filtered_signal
@@ -266,7 +266,7 @@ draw_page( cairo_t *cr,
 					env_u, env_l;
 				if ( sigproc::envelope(
 					     {selection, samplerate()},
-					     Pp.env_tightness,
+					     Pp.env_scope,
 					     1./samplerate(),
 					     &env_l, &env_u) != 0 ) {
 					cairo_set_source_rgba( cr, 1, 1, 1, .6);
diff --git a/src/ui/sf/sf-montage_cb.cc b/src/ui/sf/sf-montage_cb.cc
index 2863bb3..f5b474f 100644
--- a/src/ui/sf/sf-montage_cb.cc
+++ b/src/ui/sf/sf-montage_cb.cc
@@ -50,13 +50,15 @@ daSFMontage_draw_cb( GtkWidget *wid, cairo_t *cr, gpointer userdata)
 }
 
 
-static void
+inline namespace {
+void
 radio_item_setter( GtkWidget *i, 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);
 }
+} // inline namespace
 
 gboolean
 daSFMontage_button_press_event_cb( GtkWidget *wid, GdkEventButton *event, gpointer userdata)
@@ -187,12 +189,14 @@ daSFMontage_button_press_event_cb( GtkWidget *wid, GdkEventButton *event, gpoint
 
 
 
+inline 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);
 }
+}
 
 gboolean
 daSFMontage_motion_notify_event_cb( GtkWidget *wid, GdkEventMotion *event, gpointer userdata)
@@ -840,14 +844,12 @@ iSFPageSelectionMarkArtifact_activate_cb( GtkMenuItem *menuitem, gpointer userda
 {
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& H = SF.using_channel;
-	if ( H->selection_end - H->selection_start > 5 ) {
-		aghui::SBusyBlock bb (SF.wScoringFacility);
+	aghui::SBusyBlock bb (SF.wScoringFacility);
 
-		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
@@ -855,14 +857,12 @@ iSFPageSelectionClearArtifact_activate_cb( GtkMenuItem *menuitem, gpointer userd
 {
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& H = SF.using_channel;
-	if ( H->selection_end - H->selection_start > 5 ) {
-		aghui::SBusyBlock bb (SF.wScoringFacility);
+	aghui::SBusyBlock bb (SF.wScoringFacility);
 
-		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
diff --git a/src/ui/sf/sf-patterns-draw.cc b/src/ui/sf/sf-patterns-draw.cc
index c307080..32c6b27 100644
--- a/src/ui/sf/sf-patterns-draw.cc
+++ b/src/ui/sf/sf-patterns-draw.cc
@@ -21,13 +21,9 @@ aghui::SScoringFacility::SFindDialog::
 set_thing_da_width( int width)
 {
 	g_object_set( (GObject*)_p.daSFFDThing,
-		      "width-request", da_thing_wd = width,
+		      "width-request", da_thing_wd = max( width+5, 600),
 		      "height-request", da_thing_ht,
 		      NULL);
-	g_object_set( (GObject*)_p.swSFFDThing,
-		      "width-request", min( width+5, 600),
-		      "height-request", da_thing_ht + 30,
-		      NULL);
 }
 
 void
@@ -35,13 +31,9 @@ aghui::SScoringFacility::SFindDialog::
 set_field_da_width( int width)
 {
 	g_object_set( (GObject*)_p.daSFFDField,
-		      "width-request", da_field_wd = width,
+		      "width-request", da_field_wd = max( width+5, 600),
 		      "height-request", da_field_ht,
 		      NULL);
-	g_object_set( (GObject*)_p.swSFFDField,
-		      "width-request", min( width+5, 600),
-		      "height-request", da_thing_ht + 30,
-		      NULL);
 }
 
 
@@ -50,17 +42,15 @@ void
 aghui::SScoringFacility::SFindDialog::
 draw_thing( cairo_t *cr)
 {
-	if ( thing.size() == 0 ) {
-		set_thing_da_width( 200);
+	if ( not Q or Q->thing.size() == 0 ) {
 		aghui::cairo_put_banner( cr, da_thing_wd, da_thing_ht, "(no selection)");
 		return;
-	} else {
 	}
 
       // ticks
 	cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
 	cairo_set_font_size( cr, 9);
-	double	seconds = (double)thing.size() / samplerate;
+	double	seconds = (double)Q->thing.size() / Q->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);
@@ -78,33 +68,35 @@ draw_thing( cairo_t *cr)
 		}
 	}
 
-	size_t	run = pattern_size_essential();
+	size_t	run = Q->pattern_size_essential();
 
-      // snippet
+      // thing
+	int	zeroline = da_thing_ht/2;
 	cairo_set_source_rgb( cr, 0., 0., 0.);
 	cairo_set_line_width( cr, .8);
-	aghui::cairo_draw_signal( cr, thing, 0, thing.size(),
-				  da_thing_wd, 0, da_thing_ht/3, thing_display_scale);
+	aghui::cairo_draw_signal( cr, Q->thing, 0, Q->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)context_before / thing.size() * da_thing_wd, da_thing_ht);
-	cairo_rectangle( cr, (float)(context_before + run) / thing.size() * da_thing_wd, 0,
-			 (float)(context_after) / thing.size() * da_thing_wd, da_thing_ht);
+	cairo_rectangle( cr, 0., 0., (float)Q->context_before / Q->thing.size() * da_thing_wd, da_thing_ht);
+	cairo_rectangle( cr, (float)(Q->context_before + run) / Q->thing.size() * da_thing_wd, 0,
+			 (float)(Q->context_after) / Q->thing.size() * da_thing_wd, da_thing_ht);
 	cairo_fill( cr);
 	cairo_stroke( cr);
 
 	if ( draw_details ) {
 		valarray<TFloat>
 			env_u, env_l,
-			course,
+			target_freq,
 			dzcdf;
 	      // envelope
 		{
-			if ( sigproc::envelope( {thing, samplerate}, Pp.env_tightness,
-						1./samplerate,
+			if ( sigproc::envelope( {Q->thing, Q->samplerate}, Q->Pp.env_scope,
+						1./Q->samplerate,
 						&env_l, &env_u) == 0 ) {
 				aghui::cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Selection is too short");
 				goto out;
@@ -112,51 +104,50 @@ draw_thing( cairo_t *cr)
 
 			_p._p.CwB[SExpDesignUI::TColour::sf_selection].set_source_rgba_contrasting( cr, .3);
 			aghui::cairo_draw_signal( cr, env_u, 0, env_u.size(),
-						  da_thing_wd, 0, da_thing_ht/2, thing_display_scale);
+						  da_thing_wd, 0, zeroline, thing_display_scale);
 			aghui::cairo_draw_signal( cr, env_l, 0, env_l.size(),
-						  da_thing_wd, 0, da_thing_ht/2, thing_display_scale, 1,
-						  aghui::TDrawSignalDirection::backward, true);
+						  da_thing_wd, 0, zeroline, thing_display_scale,
+						  1, aghui::TDrawSignalDirection::backward, true);
 			cairo_close_path( cr);
 			cairo_fill( cr);
 			cairo_stroke( cr);
 		}
-
 	      // target frequency
 		{
-			if ( Pp.bwf_ffrom >= Pp.bwf_fupto ) {
+			if ( Q->Pp.bwf_ffrom >= Q->Pp.bwf_fupto ) {
 				aghui::cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Bad band-pass range");
 				goto out;
 			}
-			course = exstrom::band_pass(
-				thing, samplerate,
-				Pp.bwf_ffrom, Pp.bwf_fupto, Pp.bwf_order, true);
+			target_freq = exstrom::band_pass(
+				Q->thing, Q->samplerate,
+				Q->Pp.bwf_ffrom, Q->Pp.bwf_fupto, Q->Pp.bwf_order, true);
 
 			cairo_set_source_rgba( cr, 0.3, 0.3, 0.3, .5);
 			cairo_set_line_width( cr, 3.);
-			aghui::cairo_draw_signal( cr, course, 0, course.size(),
-						  da_thing_wd, 0, da_thing_ht/3, thing_display_scale);
+			aghui::cairo_draw_signal( cr, target_freq, 0, target_freq.size(),
+						  da_thing_wd, 0, zeroline, thing_display_scale);
 			cairo_stroke( cr);
 		}
 
 	      // dzcdf
 		{
-			if ( samplerate < 10 ) {
+			if ( Q->samplerate < 10 ) {
 				aghui::cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Samplerate is too low");
 				goto out;
 			}
-			if ( Pp.dzcdf_step * 10 > pattern_length() ) { // require at least 10 dzcdf points
+			if ( Q->Pp.dzcdf_step * 10 > Q->pattern_length() ) { // require at least 10 dzcdf points
 				aghui::cairo_put_banner( cr, da_thing_wd, da_thing_ht, "Selection is too short");
 				goto out;
 			}
 
-			dzcdf = sigproc::dzcdf( sigproc::SSignalRef<TFloat> {thing, samplerate},
-						Pp.dzcdf_step, Pp.dzcdf_sigma, Pp.dzcdf_smooth);
+			dzcdf = sigproc::dzcdf( sigproc::SSignalRef<TFloat> {Q->thing, Q->samplerate},
+						Q->Pp.dzcdf_step, Q->Pp.dzcdf_sigma, Q->Pp.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.);
 			aghui::cairo_draw_signal( cr, dzcdf, 0, dzcdf.size(),
-						  da_thing_wd, 0, da_thing_ht/2-5, dzcdf_display_scale);
+						  da_thing_wd, 0, zeroline, dzcdf_display_scale);
 			cairo_stroke( cr);
 		}
 	}
@@ -168,19 +159,61 @@ void
 aghui::SScoringFacility::SFindDialog::
 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.);
 	cairo_move_to( cr, 0, da_field_ht/2);
-	printf( "draw %d %d %g\n", da_field_wd, da_field_ht, field_display_scale);
+	auto& profile = field_channel->which_profile( field_profile_type);
 	aghui::cairo_draw_signal(
 		cr,
-		field_channel->psd.course, 0, field_channel->psd.course.size(),
-		da_field_wd, 0., da_field_ht/2, field_display_scale,
+		profile, 0, profile.size(),
+		da_field_wd, 0., da_field_ht/2,
+		field_display_scale,
 		1, TDrawSignalDirection::forward, true);
 	cairo_line_to( cr, da_field_wd, da_field_ht/2);
 	cairo_fill( cr);
+	cairo_stroke( cr);
 
+      // occurrences
+	if ( occurrences.size() ) {
+		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 * .75 - 5,
+				2, 10);
+			cairo_fill( cr);
+			cairo_stroke( cr);
+		}
+	} else
+		aghui::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, .5);
+	valarray<TFloat> tmp (diff_line.size());
+
+#define KEKE(R,G,B,N)		 \
+	cairo_set_source_rgba( cr, R, G, B, 1.); \
+	for ( size_t i = 0; i < diff_line.size(); ++i ) tmp[i] = get<N>(diff_line[i]); \
+	aghui::cairo_draw_signal( cr, tmp, 0, tmp.size(), da_field_wd, 0., da_field_ht-20, get<N>(criteria) / 20); \
 	cairo_stroke( cr);
+
+	// FAFA;
+	// KEKE(.1, .5, .8, 0);
+	// FAFA;
+	// KEKE(.5, .1, .8, 1);
+	// FAFA;
+	// KEKE(.1, .8, .5, 2);
+	// FAFA;
+	// KEKE(.5, .8, .1, 3);
+#undef KEKE
 }
 
 // eof
diff --git a/src/ui/sf/sf-patterns-enumerate.cc b/src/ui/sf/sf-patterns-enumerate.cc
index a67c330..fff35ba 100644
--- a/src/ui/sf/sf-patterns-enumerate.cc
+++ b/src/ui/sf/sf-patterns-enumerate.cc
@@ -11,9 +11,6 @@
  */
 
 #include <tuple>
-#include <dirent.h>
-#include <sys/stat.h>
-
 #include "ui/misc.hh"
 #include "sf.hh"
 
@@ -22,34 +19,41 @@ using namespace std;
 
 void
 aghui::SScoringFacility::SFindDialog::
-load_pattern( SScoringFacility::SChannel& field)
+import_from_selection( SScoringFacility::SChannel& field)
 {
 	// double check, possibly redundant after due check in callback
 	size_t	run = field.selection_end - field.selection_start;
 	if ( run == 0 )
 		return;
 
-	field_channel = &field;
-	context_before = (field.selection_start < context_pad)
+	size_t	context_before = (field.selection_start < context_pad)
 		? context_pad - field.selection_start
-		: context_pad;
-	context_after  = (field.selection_end + context_pad > field.n_samples())
+		: context_pad,
+		context_after  = (field.selection_end + context_pad > field.n_samples())
 		? field.n_samples() - field.selection_end
 		: context_pad;
-	size_t	full_sample = context_before + run + context_after;
+	pattern::SPattern<TFloat> tim (
+		"(unnamed)", TPatternOrigin::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
+	((patterns.back().origin == pattern::TOrigin::transient)
+	 ? patterns.back()
+	 : (patterns.push_back(), patterns.back())
+		) = tim;
+
+	field_channel = &field;
 
-	thing.resize( full_sample);
-	thing = field.signal_filtered[ slice (field.selection_start - context_before,
-						full_sample, 1) ];
-				// or _p.selection_*
-	samplerate = field.samplerate();
 	thing_display_scale = field.signal_display_scale;
 
 	set_thing_da_width( full_sample / field.spp());
 
 	preselect_channel( field.name);
 	preselect_entry( NULL, 0);
-	gtk_label_set_markup( _p.lSFFDSimilarity, "");
+	setup_controls_for_find();
 
 	gtk_widget_queue_draw( (GtkWidget*)_p.daSFFDThing);
 }
@@ -57,125 +61,115 @@ load_pattern( SScoringFacility::SChannel& field)
 
 
 
-void
-aghui::SScoringFacility::SFindDialog::
-load_pattern( const char *label, bool do_globally)
+const char*
+	origin_markers[5] = {
+	"[S]", "[U]", "[E]", "", "~",
+};
+
+string
+make_system_patterns_location()
 {
-	if ( do_globally ) {
-		snprintf_buf( "%s/.patterns/%s", _p._p.ED->session_dir().c_str(), label);
-	} else {
-		string j_dir = _p._p.ED->subject_dir( _p.csubject());
-		snprintf_buf( "%s/.patterns/%s", j_dir.c_str(), label);
-	}
+	DEF_UNIQUE_CHARP (buf);
+	ASPRINTF( &buf, "%s/patterns", PACKAGE_DATADIR);
+	string ret (buf);
+	return ret;
+}
 
-	FILE *fd = fopen( __buf__, "r");
-	if ( fd ) {
-		size_t	full_sample;
-		if ( fscanf( fd,
-			     (sizeof(TFloat) == sizeof(float))
-			     ?
-			     "%u  %u %lg %lg  %lg %lg %u "
-			     " %g %g %g %g\n"
-			     "%zu %zu %zu %zu\n"
-			     "--DATA--\n"
-			     :
-			     "%u  %u %lg %lg  %lg %lg %u "
-			     " %lg %lg %lg %lg\n"
-			     "%zu %zu %zu %zu\n"
-			     "--DATA--\n"
-			     ,
-			     &Pp.env_tightness,
-			     &Pp.bwf_order, &Pp.bwf_ffrom, &Pp.bwf_fupto,
-			     &Pp.dzcdf_step, &Pp.dzcdf_sigma, &Pp.dzcdf_smooth,
-			     &get<0>(criteria), &get<1>(criteria), &get<2>(criteria), &get<3>(criteria),
-			     &samplerate, &full_sample, &context_before, &context_after) == 14 ) {
-
-			thing.resize( full_sample);
-			for ( size_t i = 0; i < full_sample; ++i ) {
-				double d;
-				if ( fscanf( fd, "%la", &d) != 1 ) {
-					fprintf( stderr, "load_pattern(): short read at sample %zu from %s; "
-						 "Removing file\n", i, __buf__);
-					thing.resize( 0);
-					fclose( fd);
-					unlink( __buf__);
-					enumerate_patterns_to_combo();
-					return;
-				} else
-					thing[i] = d;
-			}
+string
+make_user_patterns_location()
+{
+	DEF_UNIQUE_CHARP (buf);
+	ASPRINTF( &buf, "%s/.local/share/aghermann/patterns", getenv("HOME"));
+	string ret (buf);
+	return ret;
+}
 
-			if ( samplerate != field_channel->samplerate() ) {
-				printf( "Loaded pattern has samplerate different from the current samplerate (%zu vs %zu); it will be resampled now.",
-					samplerate, field_channel->samplerate());
-				double fac = (double)field_channel->samplerate() / samplerate;
-				thing =
-					sigproc::resample( thing, 0, full_sample,
-							   fac * full_sample);
-				context_before *= fac;
-				context_after  *= fac;
-			}
+string
+make_experiment_patterns_location( const agh::CExpDesign& ED)
+{
+	DEF_UNIQUE_CHARP (buf);
+	ASPRINTF( &buf, "%s/.patterns", ED->session_dir().c_str());
+	string ret (buf);
+	return ret;
+}
 
-			thing_display_scale = field_channel->signal_display_scale;
-			W_V.up();
+string
+make_subject_patterns_location(const agh::CExpDesign& ED, const agh::CSubject& J)
+{
+	DEF_UNIQUE_CHARP (buf);
+	ASPRINTF( &buf, "%s/.patterns", ED->subject_dir( J).c_str());
+	string ret (buf);
+	return ret;
+}
 
-			set_thing_da_width( full_sample / field_channel->spp());
+}
 
-		} else {
-			thing.resize( 0);
-			fprintf( stderr, "load_pattern(): corrupted %s; "
-				 "Removing file\n", __buf__);
-			thing.resize( 0);
-			unlink( __buf__);
-			enumerate_patterns_to_combo();
-		}
+void
+aghui::SScoringFacility::SFindDialog::
+load_patterns()
+{
+	list<patterns::SPattern>
+		collected;
+	for ( auto& L : {
+			patterns::load_patterns_from_location(
+				make_system_patterns_location(),
+				patterns::SPattern::TOrigin::system);
+			patterns::load_patterns_from_location(
+				make_user_patterns_location(),
+				patterns::SPattern::TOrigin::user);
+			patterns::load_patterns_from_location(
+				make_experiment_patterns_location( _p._p.ED),
+				patterns::SPattern::TOrigin::experiment);
+			patterns::load_patterns_from_location(
+				make_subject_patterns_location( _p._p.ED, _p.csubject()),
+				patterns::SPattern::TOrigin::subject)
+				} )
+		collected.splice( collected.end(), L);
 
-		fclose( fd);
 
-	} else {
-		fprintf( stderr, "load_pattern(): failed to open %s; "
-			 "Removing file\n", __buf__);
-		unlink( __buf__);
+	g_signal_handler_block( _p.eSFFDPatternList, _p.eSFFDPatternList_changed_cb_handler_id);
+	gtk_list_store_clear( _p.mSFFDPatterns);
+
+	GtkTreeIter iter;
+	for ( auto& P : collected ) {
+		snprintf_buf( "%s %s", origin_marker[P.origin], P.name.c_str());
+		gtk_list_store_append( _p.mSFFDPatterns, &iter);
+		gtk_list_store_set( _p.mSFFDPatterns, &iter,
+				    0, __buf__,
+				    -1);
 	}
-}
 
+	gtk_combo_box_set_active_iter( _p.eSFFDPatternList, NULL);
+	g_signal_handler_unblock( _p.eSFFDPatternList, _p.eSFFDPatternList_changed_cb_handler_id);
+}
 
 
 
 void
 aghui::SScoringFacility::SFindDialog::
-save_pattern( const char *label, bool do_globally)
+save_patterns()
 {
-	if ( do_globally ) {
-		snprintf_buf( "%s/.patterns", _p._p.ED->session_dir().c_str());
-		if ( mkdir( __buf__, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) )
-			fprintf( stderr, "SScoringFacility::SFindDialog::save_pattern(): mkdir('%s') failed\n", __buf__);
-		snprintf_buf( "%s/.patterns/%s", _p._p.ED->session_dir().c_str(), label);
-	} else {
-		string j_dir = _p._p.ED->subject_dir( _p.csubject());
-		snprintf_buf( "%s/.patterns", j_dir.c_str());
-		if ( mkdir( __buf__, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) )
-			fprintf( stderr, "SScoringFacility::SFindDialog::save_pattern(): mkdir('%s') failed\n", __buf__);
-		snprintf_buf( "%s/.patterns/%s", j_dir.c_str(), label);
-	}
-	FILE *fd = fopen( __buf__, "w");
-	if ( fd ) {
-		fprintf( fd,
-			 "%u  %u %g %g  %g %g %u  %g %g %g %g\n"
-			 "%zu  %zu %zu %zu\n"
-			 "--DATA--\n",
-			 Pp.env_tightness, Pp.bwf_order, Pp.bwf_ffrom, Pp.bwf_fupto,
-			 Pp.dzcdf_step, Pp.dzcdf_sigma, Pp.dzcdf_smooth,
-			 get<0>(criteria), get<1>(criteria), get<2>(criteria), get<3>(criteria),
-			 samplerate, thing.size(), context_before, context_after);
-		for ( size_t i = 0; i < thing.size(); ++i )
-			fprintf( fd, "%a\n", (double)thing[i]);
-		fclose( fd);
-	}
+	for ( auto& P : patterns )
+		if ( not P.saved ) {
+			switch ( P.origin ) {
+			case patterns::SPattern::TOrigin::transient: // never save these two
+			case patterns::SPattern::TOrigin::system:
+			    break;
+			case patterns::SPattern::TOrigin::user:
+				pattern::save_pattern( P, (make_user_patterns_location() + '/' + P.name).c_str());
+			    break;
+			case patterns::SPattern::TOrigin::experiment:
+				pattern::save_pattern( P, (make_experiment_patterns_location(_p._p.ED) + '/' + P.name).c_str());
+			    break;
+			case patterns::SPattern::TOrigin::subject:
+				pattern::save_pattern( P, (make_subject_patterns_location(_p._p.ED, _p.csubject()) + '/' + P.name).c_str());
+			    break;
+			}
+			P.saved = true;
+		}
 }
 
 
-
 void
 aghui::SScoringFacility::SFindDialog::
 discard_pattern( const char *label, bool do_globally)
@@ -193,61 +187,6 @@ discard_pattern( const char *label, bool do_globally)
 
 
 
-inline namespace {
-int
-scandir_filter( const struct dirent *e)
-{
-	return strcmp( e->d_name, ".") && strcmp( e->d_name, "..");
-}
-const char
-	*globally_marker = "[global] ";
-}
-
-
-void
-aghui::SScoringFacility::SFindDialog::
-enumerate_patterns_to_combo()
-{
-	g_signal_handler_block( _p.eSFFDPatternList, _p.eSFFDPatternList_changed_cb_handler_id);
-	gtk_list_store_clear( _p.mSFFDPatterns);
-
-	GtkTreeIter iter;
-
-	struct dirent **eps;
-	int n;
-	snprintf_buf( "%s/.patterns", _p._p.ED->session_dir().c_str());
-	n = scandir( __buf__, &eps, scandir_filter, alphasort);
-//	printf( "n = %d in %s\n", n, __buf__);
-	if ( n >= 0 ) {
-		for ( int cnt = 0; cnt < n; ++cnt ) {
-			snprintf_buf( "%s%s", globally_marker, eps[cnt]->d_name);
-			gtk_list_store_append( _p.mSFFDPatterns, &iter);
-			gtk_list_store_set( _p.mSFFDPatterns, &iter,
-					    0, __buf__,
-					    -1);
-			free( eps[cnt]);
-		}
-		free( (void*)eps);
-	}
-	string j_dir = _p._p.ED->subject_dir( _p.csubject());
-	snprintf_buf( "%s/.patterns", j_dir.c_str());
-	n = scandir( __buf__, &eps, scandir_filter, alphasort);
-//	printf( "n = %d in %s\n", n, __buf__);
-	if ( n >= 0 ) {
-		for ( int cnt = 0; cnt < n; ++cnt ) {
-			gtk_list_store_append( _p.mSFFDPatterns, &iter);
-			gtk_list_store_set( _p.mSFFDPatterns, &iter,
-					    0, eps[cnt]->d_name,
-					    -1);
-			free( eps[cnt]);
-		}
-		free( (void*)eps);
-	}
-	gtk_combo_box_set_active_iter( _p.eSFFDPatternList, NULL);
-	g_signal_handler_unblock( _p.eSFFDPatternList, _p.eSFFDPatternList_changed_cb_handler_id);
-}
-
-
 
 
 
diff --git a/src/ui/sf/sf-patterns.cc b/src/ui/sf/sf-patterns.cc
index b373a90..3dfcc5d 100644
--- a/src/ui/sf/sf-patterns.cc
+++ b/src/ui/sf/sf-patterns.cc
@@ -18,30 +18,39 @@ using namespace std;
 
 aghui::SScoringFacility::SFindDialog::
 SFindDialog (SScoringFacility& parent)
-      : Pp {2,  0., 1.5, 1,  .1, .5, 3},
-	Pp2 (Pp),
+      : Q (nullptr),
+	Pp2 {.25,  0., 1.5, 1,  .1, .5, 3},
 	cpattern (nullptr),
 	increment (.05),
+	field_profile_type (metrics::TType::mc),
 	draw_details (true),
 	_p (parent)
 {
-	W_V.reg( _p.eSFFDEnvTightness, 	&Pp.env_tightness);
-	W_V.reg( _p.eSFFDBandPassOrder, 	&Pp.bwf_order);
-	W_V.reg( _p.eSFFDBandPassFrom, 	&Pp.bwf_ffrom);
-	W_V.reg( _p.eSFFDBandPassUpto, 	&Pp.bwf_fupto);
-	W_V.reg( _p.eSFFDDZCDFStep, 		&Pp.dzcdf_step);
-	W_V.reg( _p.eSFFDDZCDFSigma, 	&Pp.dzcdf_sigma);
-	W_V.reg( _p.eSFFDDZCDFSmooth, 	&Pp.dzcdf_smooth);
+	suppress_w_v = true;
+	W_V.reg( _p.eSFFDEnvTightness, 	&Pp2.env_scope);
+	W_V.reg( _p.eSFFDBandPassOrder, &Pp2.bwf_order);
+	W_V.reg( _p.eSFFDBandPassFrom, 	&Pp2.bwf_ffrom);
+	W_V.reg( _p.eSFFDBandPassUpto, 	&Pp2.bwf_fupto);
+	W_V.reg( _p.eSFFDDZCDFStep, 	&Pp2.dzcdf_step);
+	W_V.reg( _p.eSFFDDZCDFSigma, 	&Pp2.dzcdf_sigma);
+	W_V.reg( _p.eSFFDDZCDFSmooth, 	&Pp2.dzcdf_smooth);
 
 	W_V.reg( _p.eSFFDParameterA, 	&get<0>(criteria));
 	W_V.reg( _p.eSFFDParameterB, 	&get<1>(criteria));
 	W_V.reg( _p.eSFFDParameterC, 	&get<2>(criteria));
 	W_V.reg( _p.eSFFDParameterD, 	&get<3>(criteria));
+
+	W_V.up();
+	suppress_w_v = false;
+
+	load_patterns();
 }
 
 aghui::SScoringFacility::SFindDialog::
 ~SFindDialog ()
 {
+	save_patterns();
+
 	if ( cpattern )
 		delete cpattern;
 	// g_object_unref( mPatterns);
@@ -58,30 +67,24 @@ void
 aghui::SScoringFacility::SFindDialog::
 search()
 {
-	set_field_da_width( _p.total_pages() * 3);
-	field_display_scale =
-		agh::alg::calibrate_display_scale(
-			field_channel->psd.course, _p.total_pages(),
-			da_field_ht);
-
-	if ( unlikely (not field_channel or thing.size() == 0) )
+	if ( unlikely
+	     (not field_channel or not Q or Q->thing.size() == 0) )
 		return;
 
-	if ( !(Pp == Pp2) || field_channel != field_channel_saved) {
-		Pp2 = Pp;
+	if ( field_channel != field_channel_saved )
 		field_channel_saved = field_channel;
-	}
-	cpattern = new pattern::CPattern<TFloat>
-		({thing, field_channel->samplerate()},
-		 context_before, context_after,
-		 Pp);
+
+	cpattern = new pattern::CPatternTool<TFloat>
+		({Q->thing, Q->samplerate},
+		 Q->context_before, Q->context_after,
+		 Q->Pp);
 	diff_line =
 		(cpattern->do_search(
-			field_channel->signal_envelope( Pp.env_tightness).first,
-			field_channel->signal_envelope( Pp.env_tightness).second,
-			field_channel->signal_bandpass( Pp.bwf_ffrom, Pp.bwf_fupto, Pp.bwf_order),
-			field_channel->signal_dzcdf( Pp.dzcdf_step, Pp.dzcdf_sigma, Pp.dzcdf_smooth),
-			increment * samplerate),
+			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 * Q->samplerate),
 		 cpattern->diff);
 
 	delete cpattern;
@@ -93,16 +96,47 @@ size_t
 aghui::SScoringFacility::SFindDialog::
 find_occurrences()
 {
+	assert (Q); // that button must be hidden
 	occurrences.resize(0);
-	for ( size_t i = 0; i < diff_line.size(); ++i )
-		if ( diff_line[i].good_enough( criteria) )
+	size_t inc = max((int)(increment * Q->samplerate), 1);
+	for ( size_t i = 0; i < diff_line.size(); i += inc )
+		if ( diff_line[i].good_enough( criteria) ) {
 			occurrences.push_back(i);
+			i += pattern_size_essential()/inc * inc; // avoid overlapping occurrences *and* ensure we hit the stride
+		}
+
+	restore_annotations();
+	occurrences_to_annotations();
+
 	return occurrences.size();
 }
 
 
+void
+aghui::SScoringFacility::SFindDialog::
+occurrences_to_annotations()
+{
+	for ( size_t o = 0; o < occurrences.size(); ++o )
+		sigfile::mark_annotation(
+			field_channel->annotations,
+			occurrences[o], occurrences[o] + pattern_size_essential(),
+			(snprintf_buf("%s (%zu)", pattern_name.c_str(), o), __buf__));
+}
 
+void
+aghui::SScoringFacility::SFindDialog::
+save_annotations()
+{
+	saved_annotations = field_channel->annotations;
+}
 
+void
+aghui::SScoringFacility::SFindDialog::
+restore_annotations()
+{
+	field_channel->annotations = saved_annotations;
+	saved_annotations.clear();
+}
 
 
 
@@ -112,11 +146,29 @@ aghui::SScoringFacility::SFindDialog::
 setup_controls_for_find()
 {
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearchButton, TRUE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearching, FALSE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDAgainButton, FALSE);
+
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDParameters, TRUE);
 
 	gtk_widget_set_visible( (GtkWidget*)_p.swSFFDField, FALSE);
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDCriteria, FALSE);
+
+	gtk_label_set_markup( _p.lSFFDFoundInfo, "");
+}
+
+void
+aghui::SScoringFacility::SFindDialog::
+setup_controls_for_wait()
+{
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearchButton, FALSE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearching, TRUE);
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDAgainButton, FALSE);
+
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDParameters, TRUE);
+
+	gtk_widget_set_visible( (GtkWidget*)_p.swSFFDField, FALSE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDCriteria, FALSE);
 }
 
 void
@@ -124,11 +176,13 @@ aghui::SScoringFacility::SFindDialog::
 setup_controls_for_tune()
 {
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearchButton, FALSE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDSearching, FALSE);
+	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDAgainButton, TRUE);
+
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDParameters, FALSE);
 
 	gtk_widget_set_visible( (GtkWidget*)_p.swSFFDField, TRUE);
 	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDCriteria, TRUE);
-	gtk_widget_set_visible( (GtkWidget*)_p.cSFFDAgainButton, TRUE);
 }
 
 
@@ -162,4 +216,21 @@ preselect_channel( const char *ch)
 
 
 
+size_t
+aghui::SScoringFacility::SFindDialog::
+nearest_occurrence( 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;
+}
+
+
 // eof
diff --git a/src/ui/sf/sf-patterns_cb.cc b/src/ui/sf/sf-patterns_cb.cc
index e198e3e..80d4f22 100644
--- a/src/ui/sf/sf-patterns_cb.cc
+++ b/src/ui/sf/sf-patterns_cb.cc
@@ -10,13 +10,16 @@
  *         License:  GPL
  */
 
+#include <sys/time.h>
+
 #include "ui/misc.hh"
 #include "sf.hh"
 
 using namespace std;
 
 
-#define globally_marker "[G]"
+#define globally_G_marker "[G]"
+#define globally_E_marker "[E]"
 
 using namespace aghui;
 
@@ -28,7 +31,6 @@ daSFFDThing_draw_cb( GtkWidget *wid, cairo_t *cr, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
-	FAFA;
 	FD.draw_thing( cr);
 
 	return TRUE;
@@ -40,7 +42,6 @@ daSFFDField_draw_cb( GtkWidget *wid, cairo_t *cr, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
-	FAFA;
 	FD.draw_field( cr);
 
 	return TRUE;
@@ -107,6 +108,40 @@ daSFFDField_scroll_event_cb( GtkWidget *wid, GdkEventScroll *event, gpointer use
 	return TRUE;
 }
 
+gboolean
+daSFFDField_button_press_event_cb( GtkWidget *wid, GdkEventButton *event, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& FD = SF.find_dialog;
+
+	switch ( event->button ) {
+	case 1:
+		SF.set_cur_vpage( ((double)FD.occurrences[FD.highlighted_occurrence] / FD.diff_line.size()) * SF.total_vpages());
+	    break;
+	case 3:
+		gtk_menu_popup( SF.iiSFFDField,
+				NULL, NULL, NULL, NULL, 3, event->time);
+	    break;
+	}
+	gtk_widget_queue_draw( wid);
+
+	return TRUE;
+}
+
+
+gboolean
+daSFFDField_motion_notify_event_cb( GtkWidget *wid, GdkEventMotion *event, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& FD = SF.find_dialog;
+
+	FD.highlighted_occurrence = FD.nearest_occurrence( event->x);
+
+	gtk_widget_queue_draw( wid);
+
+	return TRUE;
+}
+
 
 
 void
@@ -115,7 +150,35 @@ bSFFDSearch_clicked_cb( GtkButton *button, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
+	aghui::SBusyBlock bb (SF.wSFFD);
+
+	FD.setup_controls_for_wait();
+	gtk_flush();
+	FD.search();
+
+	FD.set_field_da_width( SF.total_pages() * 3);
+
+	FD.field_display_scale =
+		(FD.field_channel->type == sigfile::SChannel::TType::eeg)
+		? agh::alg::calibrate_display_scale(
+			FD.field_channel->which_profile(FD.field_profile_type),
+			SF.total_pages(),
+			FD.da_field_ht)
+		: agh::alg::calibrate_display_scale(
+			FD.field_channel->signal_filtered,
+			SF.total_pages(),
+			FD.da_field_ht);
+
+	FD.save_annotations();
+
 	FD.setup_controls_for_tune();
+	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.Pp.env_scope,
+		      FD.Pp.bwf_ffrom, FD.Pp.bwf_fupto, FD.Pp.bwf_order,
+		      FD.Pp.dzcdf_step, FD.Pp.dzcdf_sigma, FD.Pp.dzcdf_smooth);
+	gtk_label_set_markup( SF.lSFFDParametersBrief, __buf__);
 }
 
 void
@@ -124,34 +187,62 @@ bSFFDAgain_clicked_cb( GtkButton *button, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
-	
+	FD.restore_annotations();
+	FD.occurrences.clear();
+
 	FD.setup_controls_for_find();
 }
 
+
 void
-bSFFDGoto_clicked_cb( GtkButton *button, gpointer userdata)
+eSFFD_any_pattern_value_changed_cb( GtkSpinButton *spinbutton, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
-	bool	go_forward = button == FD._p.bSFFDGotoNext;
-
-	SF.using_channel = FD.field_channel;
-
-	
-	double	next_at = 0.;
-	FAFA;
-	
-	SF.suppress_redraw = true;
-	SF.set_cur_vpage(
-		next_at / FD.samplerate / SF.vpagesize());
-	SF.suppress_redraw = false;
-	SF.queue_redraw_all();
-
-	snprintf_buf( "%zu match%s\n",
-		      FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es");
-	gtk_label_set_markup( FD._p.lSFFDSimilarity, __buf__);
+	if ( FD.suppress_w_v )
+		return;
+
+	FD.W_V.down();
+	FD.setup_controls_for_find();
+
+	gtk_widget_queue_draw( (GtkWidget*)FD._p.daSFFDThing);
 }
 
+inline 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);
+}
+}
+
+void
+eSFFD_any_criteria_value_changed_cb( GtkSpinButton *spinbutton, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& FD = SF.find_dialog;
+	if ( FD.suppress_w_v )
+		return;
+
+	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();
+
+		snprintf_buf( "%zu match%s\n",
+			      FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es");
+		gtk_label_set_markup( FD._p.lSFFDFoundInfo, __buf__);
+
+		gtk_widget_queue_draw( (GtkWidget*)FD._p.daSFFDField);
+	}
+}
+
+
 
 
 
@@ -164,8 +255,8 @@ bSFFDSave_clicked_cb( GtkButton *button, gpointer userdata)
 
 	const char *label = gtk_combo_box_get_active_id( FD._p.eSFFDPatternList);
 	if ( label ) {
-		if ( strncmp( label, globally_marker, strlen( globally_marker)) == 0 )
-			label += strlen( globally_marker);
+		if ( strncmp( label, globally_E_marker, strlen( globally_E_marker)) == 0 )
+			label += strlen( globally_E_marker);
 		gtk_entry_set_text( FD._p.eSFFDPatternNameName, label);
 	}
 	if ( gtk_dialog_run( FD._p.wSFFDPatternName) == GTK_RESPONSE_OK ) {
@@ -188,20 +279,10 @@ bSFFDDiscard_clicked_cb( GtkButton *button, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
-	GtkTreeIter iter;
-	if ( gtk_combo_box_get_active_iter( FD._p.eSFFDPatternList, &iter) == FALSE )
+	gint ci = gtk_combo_box_get_active( combo);
+	if ( ci == -1 )
 		return;
-	char *label;
-	gtk_tree_model_get( (GtkTreeModel*)FD._p.mSFFDPatterns, &iter,
-			    0, &label,
-			    -1);
-	gboolean do_globally = strncmp( label, globally_marker,
-					strlen( globally_marker)) == 0;
-	char *fname = do_globally
-		? label + strlen( globally_marker)
-		: label;
-	FD.discard_pattern( fname, do_globally);
-	free( label);
+
 	g_signal_handler_block( FD._p.eSFFDPatternList, FD._p.eSFFDPatternList_changed_cb_handler_id);
 	FD.preselect_entry( nullptr, do_globally);
 	g_signal_handler_unblock( FD._p.eSFFDPatternList, FD._p.eSFFDPatternList_changed_cb_handler_id);
@@ -214,21 +295,18 @@ eSFFDPatternList_changed_cb( GtkComboBox *combo, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
-	GtkTreeIter iter;
-	if ( gtk_combo_box_get_active_iter( combo, &iter) == FALSE )
+	if ( FD.Q ) {
+		FD.Q->Pp = FD.Pp2;
+		FD.Q->criteria = FD.criteria;
+	}
+
+	gint ci = gtk_combo_box_get_active( combo);
+	if ( ci == -1 )
 		return;
-	char *label;
-	gtk_tree_model_get( (GtkTreeModel*)FD._p.mSFFDPatterns, &iter,
-			    0, &label,
-			    -1);
-	gboolean do_globally = strncmp( label, globally_marker, strlen( globally_marker)) == 0;
-	char *fname = do_globally
-		? label + strlen( globally_marker)
-		: label;
-	FD.load_pattern( fname, do_globally);
-	free( label);
 
-	gtk_label_set_markup( FD._p.lSFFDSimilarity, "");
+	FD.Q = &FD.patterns[ci];
+	FD.Pp2 = FD.Q->Pp;
+	FD.criteria = FD.Q->criteria;
 
 	gtk_widget_queue_draw( (GtkWidget*)FD._p.daSFFDThing);
 }
@@ -257,30 +335,6 @@ eSFFDChannel_changed_cb( GtkComboBox *combo, gpointer userdata)
 	g_free( label);
 }
 
-void
-eSFFD_any_pattern_value_changed_cb( GtkSpinButton *spinbutton, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& FD = SF.find_dialog;
-
-	FD.W_V.down();
-	FD.setup_controls_for_find();
-
-	gtk_widget_queue_draw( (GtkWidget*)FD._p.daSFFDThing);
-}
-
-void
-eSFFD_any_criteria_value_changed_cb( GtkSpinButton *spinbutton, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& FD = SF.find_dialog;
-
-	FD.W_V.down();
-	FD.find_occurrences();
-
-	gtk_widget_queue_draw( (GtkWidget*)FD._p.daSFFDField);
-}
-
 
 void
 wSFFD_show_cb( GtkWidget *widget, gpointer userdata)
@@ -288,7 +342,10 @@ wSFFD_show_cb( GtkWidget *widget, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
+	FD.setup_controls_for_find();
+	FD.suppress_w_v = true;
 	FD.W_V.up();
+	FD.suppress_w_v = false;
 	FD.enumerate_patterns_to_combo();
 
 	if ( FD._p.using_channel == nullptr ) // not invoked for a preselected signal via a menu
@@ -305,6 +362,13 @@ wSFFD_hide_cb( GtkWidget *widget, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& FD = SF.find_dialog;
 
+	if ( not FD.occurrences.empty() )  // closing while dialog is in matching state
+		if ( GTK_RESPONSE_YES !=
+		     aghui::pop_question( SF.wScoringFacility, "Keep annotations?") )
+			FD.restore_annotations();
+
+	FD.occurrences.clear();
+
 	gtk_toggle_button_set_active( (GtkToggleButton*)FD.field_channel->_p.bSFShowFindDialog, FALSE);
 }
 
diff --git a/src/ui/sf/sf-widgets.hh b/src/ui/sf/sf-widgets.hh
index 4a82c87..173011e 100644
--- a/src/ui/sf/sf-widgets.hh
+++ b/src/ui/sf/sf-widgets.hh
@@ -191,12 +191,13 @@ struct SScoringFacilityWidgets {
 		*cSFFDCriteria,
 		*cSFFDSearchButton,
 		*cSFFDAgainButton;
+	GtkBox	*cSFFDSearching;
 	GtkDrawingArea
 		*daSFFDThing,
 		*daSFFDField;
+	GtkMenu	*iiSFFDField;
 	GtkButton
 		*bSFFDSearch, *bSFFDAgain,
-		*bSFFDGotoNext, *bSFFDGotoPrevious,
 		*bSFFDSave, *bSFFDDiscard;
 	GtkSpinButton
 		*eSFFDEnvTightness,
@@ -208,7 +209,7 @@ struct SScoringFacilityWidgets {
 		*cSFFDLabelBox;
 	GtkLabel
 		*lSFFDParametersBrief,
-		*lSFFDSimilarity;
+		*lSFFDFoundInfo;
 	GtkDialog
 		*wSFFDPatternName;
 	GtkEntry
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 9b0d62b..ea206e4 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -24,7 +24,7 @@
 #include "common/config-validate.hh"
 #include "sigproc/winfun.hh"
 #include "sigproc/sigproc.hh"
-#include "sigproc/patterns.hh"
+#include "patterns/patterns.hh"
 #include "metrics/phasic-events.hh"
 #include "expdesign/primaries.hh"
 #include "ica/ica.hh"
@@ -111,10 +111,8 @@ class SScoringFacility
 
 	      // artifacts
 		float	percent_dirty;
-		float
-		calculate_dirty_percent();
-		void
-		detect_artifacts( const metrics::mc::SArtifactDetectionPP&);
+		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);
 
@@ -177,8 +175,9 @@ class SScoringFacility
 			mc;
 		void get_mc_course();
 
-		void
-		update_profile_display_scales();
+		valarray<TFloat>& which_profile( metrics::TType);
+
+		void update_profile_display_scales();
 
 	      // spectrum
 		valarray<TFloat>
@@ -198,8 +197,7 @@ class SScoringFacility
 	      // phasic events
 		map<metrics::phasic::TEventTypes, list<agh::alg::SSpan<double>>>
 			phasic_events;
-		void
-		get_phasic_events();
+		void get_phasic_events();
 
 	      // region
 		void mark_region_as_artifact( bool do_mark);
@@ -215,7 +213,7 @@ class SScoringFacility
 			}
 
 		double	zeroy;
-		bool operator<( const SChannel& rv) const;
+		bool operator<( const SChannel&) const;
 
 		double	signal_display_scale;
 
@@ -507,46 +505,51 @@ class SScoringFacility
 		SFindDialog (SScoringFacility& parent);
 	       ~SFindDialog ();
 
-	      // loadable
-		valarray<TFloat>
-			thing;
-		size_t	samplerate;
-		size_t	context_before,
-			context_after;
-		static const size_t
-			context_pad = 100;
-		size_t pattern_size_essential() const;
-		double pattern_length() const; // in seconds
-		double pattern_length_essential() const;
-
-		void load_pattern( SScoringFacility::SChannel&); // load selection on this channel
-		void load_pattern( const char*, bool globally); // load named
-		void save_pattern( const char*, bool globally);
-		void discard_pattern( const char*, bool globally);
+	      // saved patterns
+		vector<pattern::SPattern<TFloat>>
+			patterns;
+		pattern::SPattern<TFloat>
+			*Q;
+
+		void import_from_selection( SScoringFacility::SChannel&);
+		void load_patterns();
+		void save_patterns();
 
 	      // finding tool
 	  	pattern::SPatternPPack<TFloat>
-			Pp,
 			Pp2;
-		pattern::CPattern<TFloat>
+		pattern::CPatternTool<TFloat>
 			*cpattern;
 		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;
 
+	      // field
 		SScoringFacility::SChannel
 			*field_channel,
 			*field_channel_saved;
+		list<sigfile::SAnnotation>
+			saved_annotations;
+		void occurrences_to_annotations();
+		void save_annotations();
+		void restore_annotations();
+
+		metrics::TType
+			field_profile_type; // where appropriate; otherwise draw compressed raw
 
 	      // draw
-		bool	draw_details:1;
+		bool	draw_details:1,
+			suppress_w_v:1;
 		void draw_thing( cairo_t*);
 		void draw_field( cairo_t*);
 		float	thing_display_scale,
@@ -556,16 +559,16 @@ class SScoringFacility
 		SUIVarCollection
 			W_V;
 
-		void enumerate_patterns_to_combo();
 		void preselect_entry( const char*, bool globally);
 		void preselect_channel( const char*);
 
 		void setup_controls_for_find();
+		void setup_controls_for_wait();
 		void setup_controls_for_tune();
 
 		static const int
-			da_thing_ht = 220,
-			da_field_ht = 230;
+			da_thing_ht = 200,
+			da_field_ht = 130;
 		int	da_thing_wd,
 			da_field_wd;
 		void set_thing_da_width( int);
@@ -838,28 +841,6 @@ SScoringFacility::channel_y0( const T& h) const
 }
 
 
-
-
-inline size_t
-SScoringFacility::SFindDialog::pattern_size_essential() const
-{
-	return thing.size() - context_before - context_after;
-}
-
-inline double
-SScoringFacility::SFindDialog::pattern_length() const
-{
-	return (double)thing.size() / samplerate;
-}
-
-inline double
-SScoringFacility::SFindDialog::pattern_length_essential() const
-{
-	return (double)pattern_size_essential() / samplerate;
-}
-
-
-
 } // namespace aghui
 
 #endif
diff --git a/src/ui/sf/sf_cb.hh b/src/ui/sf/sf_cb.hh
index 42d1e7d..0f8de3a 100644
--- a/src/ui/sf/sf_cb.hh
+++ b/src/ui/sf/sf_cb.hh
@@ -153,11 +153,12 @@ void eSFFDPatternList_changed_cb( GtkComboBox*, gpointer);
 void eSFFDChannel_changed_cb( GtkComboBox*, gpointer);
 gboolean daSFFDField_draw_cb( GtkWidget*, cairo_t*, gpointer);
 gboolean daSFFDField_scroll_event_cb( GtkWidget*, GdkEventScroll*, gpointer);
+gboolean daSFFDField_button_press_event_cb( GtkWidget*, GdkEventButton*, gpointer);
+gboolean daSFFDField_motion_notify_event_cb( GtkWidget*, GdkEventMotion*, gpointer);
 gboolean daSFFDThing_draw_cb( GtkWidget*, cairo_t*, gpointer);
 gboolean daSFFDThing_scroll_event_cb( GtkWidget*, GdkEventScroll*, gpointer);
 void bSFFDSearch_clicked_cb( GtkButton*, gpointer);
 void bSFFDAgain_clicked_cb( GtkButton*, gpointer);
-void bSFFDGoto_clicked_cb( GtkButton*, gpointer);
 void bSFFDSave_clicked_cb( GtkButton*, gpointer);
 void bSFFDDiscard_clicked_cb( GtkButton*, gpointer);
 void eSFFD_any_pattern_value_changed_cb( GtkSpinButton*, gpointer);

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list