[med-svn] [aghermann] 05/23: correctly generalize drawn state of montage things on main SF menu

andrei zavada hmmr-guest at alioth.debian.org
Sat Aug 17 18:05:39 UTC 2013


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

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

commit 0fa833c3a3ce61f3558ed19f9047c3d97c326bf1
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sat Aug 3 14:34:24 2013 +0300

    correctly generalize drawn state of montage things on main SF menu
    
    with some ICM
---
 data/sf.glade                         |  594 +++++++++++++++++++--------------
 src/aghermann/ui/sf/Makefile.am       |    8 +-
 src/aghermann/ui/sf/construct.cc      |   48 ++-
 src/aghermann/ui/sf/controls_cb.cc    |  194 +++++++++++
 src/aghermann/ui/sf/d/patterns_cb.cc  |    2 -
 src/aghermann/ui/sf/d/phasediff_cb.cc |    4 +-
 src/aghermann/ui/sf/ica_cb.cc         |   29 +-
 src/aghermann/ui/sf/mainmenu_cb.cc    |  312 +++++++++++++++++
 src/aghermann/ui/sf/sf.cc             |   47 ++-
 src/aghermann/ui/sf/sf.hh             |   16 +-
 src/aghermann/ui/sf/sf_cb.cc          |  300 +----------------
 src/aghermann/ui/sf/sf_cb.hh          |   22 +-
 src/aghermann/ui/sf/widgets.hh        |   29 +-
 13 files changed, 991 insertions(+), 614 deletions(-)

diff --git a/data/sf.glade b/data/sf.glade
index 4fd528f..3b06d44 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -80,7 +80,7 @@
       <object class="GtkMenuItem" id="iSFPageView">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_View</property>
+        <property name="label" translatable="yes">_Draw</property>
         <property name="use_underline">True</property>
         <child type="submenu">
           <object class="GtkMenu" id="menu1">
@@ -107,8 +107,8 @@
               <object class="GtkCheckMenuItem" id="iSFPageUseResample">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="tooltip_text" translatable="yes">Downsample signal</property>
-                <property name="label" translatable="yes">Fast dra_w</property>
+                <property name="tooltip_text" translatable="yes">Decimate to fit one sample per horizontal pixel</property>
+                <property name="label" translatable="yes">_Downsample</property>
                 <property name="use_underline">True</property>
                 <property name="active">True</property>
               </object>
@@ -159,79 +159,74 @@
                 </child>
               </object>
             </child>
-            <child>
-              <object class="GtkSeparatorMenuItem" id="menuitem2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkMenuItem" id="iSFPageUseThisScale">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="tooltip_text" translatable="yes">Use current display scale for all other channels</property>
-                <property name="label" translatable="yes">_Set scale to current</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkMenuItem" id="iSFPageLocateSelection">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Locate selection</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
           </object>
         </child>
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="iSFPageFilter">
+      <object class="GtkMenuItem" id="iSFPageUseThisScale">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="tooltip_text" translatable="yes">Low-pass and high-pass</property>
-        <property name="label" translatable="yes">_Filters...</property>
+        <property name="tooltip_text" translatable="yes">Use current display scale for all other channels</property>
+        <property name="label" translatable="yes">_Set scale to current</property>
         <property name="use_underline">True</property>
       </object>
     </child>
     <child>
-      <object class="GtkSeparatorMenuItem" id="menuitem10">
+      <object class="GtkMenuItem" id="iSFPageLocateSelection">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Locate selection</property>
+        <property name="use_underline">True</property>
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="menuitem9">
+      <object class="GtkMenuItem" id="iiSFPageProfiles">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Ar_tifacts</property>
+        <property name="label" translatable="yes">_Profile</property>
         <property name="use_underline">True</property>
         <child type="submenu">
-          <object class="GtkMenu" id="menu3">
+          <object class="GtkMenu" id="menu5">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkMenuItem" id="iSFPageArtifactsDetect">
+              <object class="GtkCheckMenuItem" id="iSFPageDrawPSDProfile">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Detect...</property>
+                <property name="label" translatable="yes">_PSD profile</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageArtifactsMarkFlat">
+              <object class="GtkCheckMenuItem" id="iSFPageDrawPSDSpectrum">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Mark flat regions...</property>
+                <property name="label" translatable="yes">PSD spectr_um</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageArtifactsClear">
+              <object class="GtkCheckMenuItem" id="iSFPageDrawSWUProfile">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Clear all</property>
+                <property name="label" translatable="yes">_SWU profile</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkCheckMenuItem" id="iSFPageDrawMCProfile">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">µ_Continuity profile</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkCheckMenuItem" id="iSFPageDrawEMGProfile">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">E_MG profile</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
@@ -243,7 +238,7 @@
       <object class="GtkMenuItem" id="iiSFPageAnnotation">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Annotations</property>
+        <property name="label" translatable="yes">A_nnotations</property>
         <property name="use_underline">True</property>
         <child type="submenu">
           <object class="GtkMenu" id="menu2">
@@ -306,66 +301,51 @@
       </object>
     </child>
     <child>
-      <object class="GtkSeparatorMenuItem" id="menuitem3">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="iSFPageHide">
+      <object class="GtkSeparatorMenuItem" id="menuitem2">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Hide</property>
-        <property name="use_underline">True</property>
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="iSFPageHidden">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Show hi_dden</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="iSFPageSpaceEvenly">
+      <object class="GtkMenuItem" id="iSFPageFilter">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Space evenl_y</property>
+        <property name="tooltip_text" translatable="yes">Low-pass and high-pass</property>
+        <property name="label" translatable="yes">_Filters...</property>
         <property name="use_underline">True</property>
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="menuitem99">
+      <object class="GtkMenuItem" id="menuitem9">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Export</property>
+        <property name="label" translatable="yes">_Artifacts</property>
         <property name="use_underline">True</property>
         <child type="submenu">
-          <object class="GtkMenu" id="menu4">
+          <object class="GtkMenu" id="menu3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkMenuItem" id="iSFPageExportSignal">
+              <object class="GtkMenuItem" id="iSFPageArtifactsDetect">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Export signal</property>
+                <property name="label" translatable="yes">_Detect...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageSaveChannelAsSVG">
+              <object class="GtkMenuItem" id="iSFPageArtifactsMarkFlat">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Save cha_nnel as SVG</property>
+                <property name="label" translatable="yes">_Mark flat regions...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageSaveMontageAsSVG">
+              <object class="GtkMenuItem" id="iSFPageArtifactsClear">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Save m_ontage as SVG</property>
+                <property name="label" translatable="yes">_Clear all</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
@@ -374,58 +354,66 @@
       </object>
     </child>
     <child>
-      <object class="GtkSeparatorMenuItem" id="iSFPageProfilesSubmenuSeparator">
+      <object class="GtkSeparatorMenuItem" id="menuitem3">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="iiSFPageProfiles">
+      <object class="GtkMenuItem" id="iSFPageHide">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Profiles</property>
+        <property name="label" translatable="yes">_Hide</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="iSFPageHidden">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Show hi_dden</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="iSFPageSpaceEvenly">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Space evenl_y</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="menuitem99">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Export</property>
         <property name="use_underline">True</property>
         <child type="submenu">
-          <object class="GtkMenu" id="menu5">
+          <object class="GtkMenu" id="menu4">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawPSDProfile">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_PSD profile</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawPSDSpectrum">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">PSD spectr_um</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawSWUProfile">
+              <object class="GtkMenuItem" id="iSFPageExportSignal">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_SWU profile</property>
+                <property name="label" translatable="yes">_Export signal...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawMCProfile">
+              <object class="GtkMenuItem" id="iSFPageSaveChannelAsSVG">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">µ_Continuity profile</property>
+                <property name="label" translatable="yes">Save cha_nnel as SVG...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
             <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawEMGProfile">
+              <object class="GtkMenuItem" id="iSFPageSaveMontageAsSVG">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">E_MG profile</property>
+                <property name="label" translatable="yes">Save _montage as SVG...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
@@ -433,6 +421,12 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="iSFPageProfilesSubmenuSeparator">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
   </object>
   <object class="GtkMenu" id="iiSFPageHidden">
     <property name="visible">True</property>
@@ -839,13 +833,196 @@
             <property name="can_focus">False</property>
             <property name="border_width">2</property>
             <child>
-              <object class="GtkLabel" id="lSFHint">
+              <object class="GtkBox" id="box7">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="valign">center</property>
-                <property name="label" translatable="yes"><i>hint</i></property>
-                <property name="use_markup">True</property>
-                <property name="angle">90</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">5</property>
+                <child>
+                  <object class="GtkMenuBar" id="iiSFMontag">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkMenuItem" id="iSFMontageMenu">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_Montage</property>
+                        <property name="use_underline">True</property>
+                        <child type="submenu">
+                          <object class="GtkMenu" id="menu7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkMenuItem" id="menuitem11">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">_Draw</property>
+                                <property name="use_underline">True</property>
+                                <child type="submenu">
+                                  <object class="GtkMenu" id="menu8">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkCheckMenuItem" id="iSFMontageDrawOriginalSignal">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Original signal</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkCheckMenuItem" id="iSFMontageDrawProcessedSignal">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Processed signal</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkCheckMenuItem" id="iSFMontageDrawFast">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="tooltip_text" translatable="yes">Decimate to fit one sample per horizontal pixel</property>
+                                        <property name="label" translatable="yes">_Downsample</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkCheckMenuItem" id="iSFMontageDrawZeroLine">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Zero line</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkSeparatorMenuItem" id="menuitem12">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="iSFMontagePatterns">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">_Patterns...</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="iSFMontageICA">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="tooltip_text" translatable="yes">Independent Component Analysis</property>
+                                <property name="label" translatable="yes">_ICA</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="menuitem13">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">_Score</property>
+                                <property name="use_underline">True</property>
+                                <child type="submenu">
+                                  <object class="GtkMenu" id="menu9">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkMenuItem" id="iSFMontageScoreAssist">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Assist...</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkMenuItem" id="iSFMontageScoreImport">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Import...</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkMenuItem" id="iSFMontageScoreExport">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">_Export...</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkMenuItem" id="iSFMontageScoreClear">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">Clear...</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="iSFMontagePhaseDiff">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Phase di_fference...</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkSeparatorMenuItem" id="menuitem10">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="iSFMontageClose">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">_Close</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkMenuItem" id="iSFMontageCloseAndNext">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Close and take _next</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="lSFHint">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="valign">center</property>
+                    <property name="label" translatable="yes"><i>hint</i></property>
+                    <property name="use_markup">True</property>
+                  </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>
@@ -855,21 +1032,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkMenuToolButton" id="bSFAccept">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="valign">center</property>
-                <property name="label">Score</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-apply</property>
-                <accelerator key="Return" signal="clicked" modifiers="GDK_MOD1_MASK"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="pack_type">end</property>
-                <property name="position">1</property>
-              </packing>
+              <placeholder/>
             </child>
             <child>
               <object class="GtkGrid" id="grid3">
@@ -1062,9 +1225,6 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <placeholder/>
-                    </child>
-                    <child>
                       <object class="GtkTable" id="table2">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -1139,11 +1299,60 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <placeholder/>
+                      <object class="GtkGrid" id="grid2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="halign">start</property>
+                        <property name="valign">center</property>
+                        <property name="hexpand">True</property>
+                        <property name="row_spacing">2</property>
+                        <child>
+                          <object class="GtkLabel" id="lSFOverChannel">
+                            <property name="can_focus">False</property>
+                            <property name="valign">start</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0</property>
+                            <attributes>
+                              <attribute name="scale" value="0.69999999999999996"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkStatusbar" id="sbSF">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="valign">end</property>
+                            <property name="hexpand">True</property>
+                            <property name="spacing">2</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <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="GtkButton" id="bSFScoreNREM1">
@@ -1159,7 +1368,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">3</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>
@@ -1176,7 +1385,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">5</property>
+                        <property name="position">3</property>
                       </packing>
                     </child>
                     <child>
@@ -1193,7 +1402,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">6</property>
+                        <property name="position">4</property>
                       </packing>
                     </child>
                     <child>
@@ -1210,7 +1419,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">7</property>
+                        <property name="position">5</property>
                       </packing>
                     </child>
                     <child>
@@ -1227,41 +1436,41 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">9</property>
+                        <property name="position">6</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bSFScoreClear">
-                        <property name="label" translatable="yes">⌫</property>
+                      <object class="GtkButton" id="bSFScoreWake">
+                        <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>
                         <property name="fill">True</property>
-                        <property name="position">10</property>
+                        <property name="position">7</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bSFScoreWake">
-                        <property name="label" translatable="yes">☺</property>
+                      <object class="GtkButton" id="bSFScoreClear">
+                        <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>
                         <property name="fill">True</property>
-                        <property name="position">10</property>
+                        <property name="position">8</property>
                       </packing>
                     </child>
                     <child>
@@ -1393,7 +1602,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">11</property>
+                        <property name="position">9</property>
                       </packing>
                     </child>
                     <child>
@@ -1405,75 +1614,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">12</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkGrid" id="grid2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="halign">start</property>
-                        <property name="valign">center</property>
-                        <property name="hexpand">True</property>
-                        <property name="row_spacing">2</property>
-                        <child>
-                          <object class="GtkLabel" id="lSFOverChannel">
-                            <property name="can_focus">False</property>
-                            <property name="valign">start</property>
-                            <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
-                            <attributes>
-                              <attribute name="scale" value="0.69999999999999996"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkStatusbar" id="sbSF">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="halign">start</property>
-                            <property name="valign">end</property>
-                            <property name="hexpand">True</property>
-                            <property name="spacing">2</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">14</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="bSFRunICA">
-                        <property name="label" translatable="yes">I_CA</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="valign">center</property>
-                        <property name="use_underline">True</property>
-                        <property name="focus_on_click">False</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">14</property>
+                        <property name="position">9</property>
                       </packing>
                     </child>
                     <child>
@@ -1487,48 +1628,7 @@
                         <property name="fill">True</property>
                         <property name="padding">3</property>
                         <property name="pack_type">end</property>
-                        <property name="position">15</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <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">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="F3" signal="activate"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">17</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <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">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="focus_on_click">False</property>
-                        <accelerator key="F4" signal="activate"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">17</property>
+                        <property name="position">11</property>
                       </packing>
                     </child>
                     <child>
@@ -1548,7 +1648,7 @@
                         <property name="expand">False</property>
                         <property name="fill">False</property>
                         <property name="pack_type">end</property>
-                        <property name="position">18</property>
+                        <property name="position">12</property>
                       </packing>
                     </child>
                   </object>
diff --git a/src/aghermann/ui/sf/Makefile.am b/src/aghermann/ui/sf/Makefile.am
index deed960..795bdd6 100644
--- a/src/aghermann/ui/sf/Makefile.am
+++ b/src/aghermann/ui/sf/Makefile.am
@@ -10,18 +10,20 @@ noinst_LIBRARIES := liba.a
 liba_a_SOURCES := \
 	channel.cc \
 	construct.cc \
+	controls_cb.cc \
 	hypnogram.cc \
 	hypnogram_cb.cc \
 	ica.cc \
 	ica_cb.cc \
-	montage.cc \
+	mainmenu_cb.cc \
 	montage-overlays.cc \
+	montage.cc \
 	montage_cb.cc \
-	widgets.hh \
 	sf.cc \
 	sf.hh \
-	sf_cb.hh \
 	sf_cb.cc \
+	sf_cb.hh \
+	widgets.hh \
 	d/artifacts.hh \
 	d/artifacts.cc \
 	d/artifacts-construct.cc \
diff --git a/src/aghermann/ui/sf/construct.cc b/src/aghermann/ui/sf/construct.cc
index a7c9d41..d04ff5b 100644
--- a/src/aghermann/ui/sf/construct.cc
+++ b/src/aghermann/ui/sf/construct.cc
@@ -50,13 +50,28 @@ SScoringFacilityWidgets ()
 	     !AGH_GBGETOBJ (GtkButton,		bSFGotoNextUnscored) ||
 	     !AGH_GBGETOBJ (GtkButton,		bSFGotoPrevArtifact) ||
 	     !AGH_GBGETOBJ (GtkButton,		bSFGotoNextArtifact) ||
+	     !AGH_GBGETOBJ (GtkToggleButton,	bSFDrawCrosshair) )
+		throw runtime_error ("Failed to construct SF widgets (0)");
 
-	     !AGH_GBGETOBJ (GtkToggleButton,	bSFShowFindDialog) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	bSFShowPhaseDiffDialog) ||
-	     !AGH_GBGETOBJ (GtkToggleButton,	bSFDrawCrosshair) ||
-	     !AGH_GBGETOBJ (GtkButton,		bSFRunICA) )
+	if ( !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageMenu) ||
+	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawOriginalSignal) ||
+	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawProcessedSignal) ||
+	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawZeroLine) ||
+	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDrawFast) ||
+//	     !AGH_GBGETOBJ (GtkCheckMenuItem,	iSFMontageDraw) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontagePatterns) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageICA) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontagePhaseDiff) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreAssist) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreImport) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreExport) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageScoreClear) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageClose) ||
+	     !AGH_GBGETOBJ (GtkMenuItem,	iSFMontageCloseAndNext) )
 		throw runtime_error ("Failed to construct SF widgets (1)");
 
+	G_CONNECT_1 (iSFMontageMenu, activate);
+
 	G_CONNECT_2 (wSF, delete, event);
 	G_CONNECT_3 (wSF, key, press, event);
 
@@ -77,9 +92,20 @@ SScoringFacilityWidgets ()
 	G_CONNECT_1 (bSFGotoPrevArtifact, clicked);
 
 	G_CONNECT_1 (bSFDrawCrosshair, toggled);
-	G_CONNECT_1 (bSFShowFindDialog, toggled);
-	G_CONNECT_1 (bSFShowPhaseDiffDialog, toggled);
-	G_CONNECT_1 (bSFRunICA, clicked);
+
+	G_CONNECT_1 (iSFMontageDrawOriginalSignal, toggled);
+	G_CONNECT_1 (iSFMontageDrawProcessedSignal, toggled);
+	G_CONNECT_1 (iSFMontageDrawFast, toggled);
+	G_CONNECT_1 (iSFMontageDrawZeroLine, toggled);
+	G_CONNECT_1 (iSFMontagePatterns, activate);
+	G_CONNECT_1 (iSFMontagePhaseDiff, activate);
+	G_CONNECT_1 (iSFMontageICA, activate);
+	G_CONNECT_1 (iSFMontageScoreAssist, activate);
+	G_CONNECT_1 (iSFMontageScoreImport, activate);
+	G_CONNECT_1 (iSFMontageScoreExport, activate);
+	G_CONNECT_1 (iSFMontageScoreClear, activate);
+	G_CONNECT_1 (iSFMontageClose, activate);
+	G_CONNECT_1 (iSFMontageCloseAndNext, activate);
 
 	if ( !(AGH_GBGETOBJ (GtkButton,		bSFScoreClear)) ||
 	     !(AGH_GBGETOBJ (GtkButton,		bSFScoreNREM1)) ||
@@ -105,9 +131,6 @@ SScoringFacilityWidgets ()
 
 	if ( !(AGH_GBGETOBJ (GtkDrawingArea,	daSFMontage)) ||
 	     !(AGH_GBGETOBJ (GtkDrawingArea,	daSFHypnogram)) ||
-	     !(AGH_GBGETOBJ (GtkMenuToolButton,	bSFAccept)) ||
-	     !(AGH_GBGETOBJ (GtkMenu,		iiSFAccept)) ||
-	     !(AGH_GBGETOBJ (GtkMenuItem,	iSFAcceptAndTakeNext)) ||
 	     !(AGH_GBGETOBJ (GtkStatusbar,	sbSF)) )
 		throw runtime_error ("Failed to construct SF widgets (3)");
 
@@ -126,11 +149,6 @@ SScoringFacilityWidgets ()
 	G_CONNECT_3 (daSFHypnogram, button, release, event);
 	G_CONNECT_3 (daSFHypnogram, motion, notify, event);
 
-	gtk_menu_tool_button_set_menu( bSFAccept, (GtkWidget*)iiSFAccept);
-
-	G_CONNECT_1 (bSFAccept, clicked);
-	G_CONNECT_1 (iSFAcceptAndTakeNext, activate);
-
 	// ICA
 	if ( !(AGH_GBGETOBJ (GtkComboBox,	eSFICARemixMode)) ||
 	     !(AGH_GBGETOBJ (GtkComboBox,	eSFICANonlinearity)) ||
diff --git a/src/aghermann/ui/sf/controls_cb.cc b/src/aghermann/ui/sf/controls_cb.cc
new file mode 100644
index 0000000..0440aeb
--- /dev/null
+++ b/src/aghermann/ui/sf/controls_cb.cc
@@ -0,0 +1,194 @@
+/*
+ *       File name:  aghermann/ui/sf/controls_cb.cc
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <johnhommer at gmail.com>
+ * Initial version:  2011-06-29
+ *
+ *         Purpose:  scoring facility widget callbacks
+ *
+ *         License:  GPL
+ */
+
+#include "sf.hh"
+
+using namespace std;
+using namespace aghui;
+
+extern "C" {
+
+// ---------- page value_changed
+
+void
+eSFPageSize_changed_cb(
+	GtkComboBox *combobox,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	SF.set_vpagesize_item( gtk_combo_box_get_active( combobox), false);
+	SF.queue_redraw_all();
+}
+
+void
+eSFCurrentPage_value_changed_cb(
+	GtkSpinButton *spinbutton,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	SF.set_cur_vpage( gtk_spin_button_get_value( spinbutton) - 1, false);
+	SF.queue_redraw_all();
+}
+
+
+
+// -------------- various buttons
+
+
+void bSFScoreNREM1_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem1)); }
+void bSFScoreNREM2_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem2)); }
+void bSFScoreNREM3_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem3)); }
+void bSFScoreNREM4_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem4)); }
+void bSFScoreREM_clicked_cb  ( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::rem));   }
+void bSFScoreWake_clicked_cb ( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::wake));  }
+void bSFScoreClear_clicked_cb( GtkButton*, gpointer u)  { ((SScoringFacility*)u)->do_score_back   ( sigfile::SPage::score_code(sigfile::SPage::TScore::none));  }
+
+
+
+
+
+void
+bSFForward_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	auto current = SF.cur_vpage();
+	if ( current < SF.total_vpages() - 1 )
+		SF.set_cur_vpage( current+1);
+	SF.sb_clear();
+}
+
+void
+bSFBack_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	auto current = SF.cur_vpage();
+	if ( current > 0 )
+		SF.set_cur_vpage( current-1);
+	SF.sb_clear();
+}
+
+
+void
+eSFCurrentPos_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	SF.show_cur_pos_time_relative = !SF.show_cur_pos_time_relative;
+	SF.draw_current_pos( NAN);
+}
+
+
+void
+bSFGotoPrevUnscored_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	if ( SF.cur_page() == 0 )
+		return;
+
+	size_t p = SF.cur_page();
+	while ( --p != (size_t)-1 )
+		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
+			SF.sb_clear();
+			SF.set_cur_vpage( SF.p2ap(p));
+			return;
+		}
+	SF.sb_message( "No more unscored pages before this");
+}
+
+void
+bSFGotoNextUnscored_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.cur_page() == SF.total_pages()-1 )
+		return;
+
+	size_t p = SF.cur_page();
+	while ( ++p < SF.total_pages() )
+		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
+			SF.sb_clear();
+			SF.set_cur_vpage( SF.p2ap(p));
+			return;
+		}
+	SF.sb_message( "No more unscored pages after this");
+}
+
+
+
+
+void
+bSFGotoPrevArtifact_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	if ( SF.cur_vpage() == 0 )
+		return;
+
+	size_t p = SF.cur_vpage();
+	while ( --p != (size_t)-1 )
+		if ( SF.page_has_artifacts( p, false)) {
+			SF.sb_clear();
+			SF.set_cur_vpage( p);
+			return;
+		}
+	SF.sb_message( "No more dirty pages before this");
+}
+
+void
+bSFGotoNextArtifact_clicked_cb(
+	GtkButton*,
+	gpointer userdata)
+{
+	auto &SF = *(SScoringFacility*)userdata;
+	if ( SF.cur_vpage() == SF.total_vpages()-1 )
+		return;
+	size_t p = SF.cur_vpage();
+	while ( ++p < SF.total_vpages() )
+		if ( SF.page_has_artifacts( p)) {
+			SF.sb_clear();
+			SF.set_cur_vpage( p);
+			return;
+		}
+	SF.sb_message( "No more dirty pages after this");
+}
+
+
+
+
+
+void
+bSFDrawCrosshair_toggled_cb(
+	GtkToggleButton*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	SF.draw_crosshair = !SF.draw_crosshair;
+	SF.queue_redraw_all();
+}
+
+
+
+} // extern "C"
+
+// Local Variables:
+// Mode: c++
+// indent-tabs-mode: 8
+// tab-width: 8
+// End:
diff --git a/src/aghermann/ui/sf/d/patterns_cb.cc b/src/aghermann/ui/sf/d/patterns_cb.cc
index a46609a..f9aafc8 100644
--- a/src/aghermann/ui/sf/d/patterns_cb.cc
+++ b/src/aghermann/ui/sf/d/patterns_cb.cc
@@ -490,8 +490,6 @@ wSFFD_hide_cb(
 			SF.queue_redraw_all();
 		}
 	}
-
-	gtk_toggle_button_set_active( (GtkToggleButton*)FD.field_channel->_p.bSFShowFindDialog, FALSE);
 }
 
 
diff --git a/src/aghermann/ui/sf/d/phasediff_cb.cc b/src/aghermann/ui/sf/d/phasediff_cb.cc
index 206beb5..c887d6d 100644
--- a/src/aghermann/ui/sf/d/phasediff_cb.cc
+++ b/src/aghermann/ui/sf/d/phasediff_cb.cc
@@ -191,9 +191,9 @@ wSFPD_hide_cb(
 	GtkWidget *wid,
 	const gpointer userdata)
 {
-	auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
+	// auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
 
-	gtk_toggle_button_set_active( PD._p.bSFShowPhaseDiffDialog, FALSE);
+	
 }
 
 } // extern "C"
diff --git a/src/aghermann/ui/sf/ica_cb.cc b/src/aghermann/ui/sf/ica_cb.cc
index fc7f13f..0fb4503 100644
--- a/src/aghermann/ui/sf/ica_cb.cc
+++ b/src/aghermann/ui/sf/ica_cb.cc
@@ -19,29 +19,6 @@ using namespace aghui;
 
 extern "C" {
 
-void
-bSFRunICA_clicked_cb(
-	GtkButton*,
-	gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.setup_ica() == 0 ) {
-		SF.mode = SScoringFacility::TMode::showing_ics;
-		gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, FALSE);
-		gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, TRUE);
-
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, FALSE);
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
-
-		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFAccept, FALSE);
-		SF.set_tooltip( SScoringFacility::TTipIdx::ica_mode);
-		SF.queue_redraw_all();
-	}
-}
-
-
 
 void
 eSFICANonlinearity_changed_cb(
@@ -303,7 +280,8 @@ bSFICAApply_clicked_cb(
 	SF.mode = SScoringFacility::TMode::scoring;
 	gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
 	gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.bSFAccept, TRUE);
+	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
+	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
 	SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
 
 	SF.queue_redraw_all();
@@ -324,7 +302,8 @@ bSFICACancel_clicked_cb(
 	SF.mode = SScoringFacility::TMode::scoring;
 	gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, TRUE);
 	gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, FALSE);
-	gtk_widget_set_sensitive( (GtkWidget*)SF.bSFAccept, TRUE);
+	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, TRUE);
+	gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, TRUE);
 	SF.set_tooltip( SScoringFacility::TTipIdx::scoring_mode);
 
 	SF.queue_redraw_all();
diff --git a/src/aghermann/ui/sf/mainmenu_cb.cc b/src/aghermann/ui/sf/mainmenu_cb.cc
new file mode 100644
index 0000000..74e21e6
--- /dev/null
+++ b/src/aghermann/ui/sf/mainmenu_cb.cc
@@ -0,0 +1,312 @@
+/*
+ *       File name:  aghermann/ui/sf/mainmenu_cb.cc
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <johnhommer at gmail.com>
+ * Initial version:  2013-08-03
+ *
+ *         Purpose:  scoring facility main menu callbacks
+ *
+ *         License:  GPL
+ */
+
+#include "sf.hh"
+#include "d/patterns.hh"
+#include "d/phasediff.hh"
+
+using namespace std;
+using namespace aghui;
+
+extern "C" {
+
+
+void
+iSFMontageMenu_activate_cb(
+	const GtkMenuItem *menuitem,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	SF.update_main_menu_items();
+}
+
+
+
+void
+iSFMontageDrawOriginalSignal_toggled_cb(
+	GtkCheckMenuItem *checkmenuitem,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+
+	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+
+	for ( auto& H : SF.channels ) {
+		H.draw_original_signal = indeed;
+		if ( not H.draw_original_signal and not H.draw_filtered_signal )
+			H.draw_filtered_signal = true;
+	}
+
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+
+	SF.update_main_menu_items();
+}
+
+
+void
+iSFMontageDrawProcessedSignal_toggled_cb(
+	GtkCheckMenuItem *checkmenuitem,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+
+	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+
+	for ( auto& H : SF.channels ) {
+		H.draw_filtered_signal = indeed;
+		if ( not H.draw_original_signal and not H.draw_filtered_signal )
+			H.draw_original_signal = true;
+	}
+
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+
+	SF.update_main_menu_items();
+}
+
+
+void
+iSFMontageDrawFast_toggled_cb(
+	GtkCheckMenuItem *checkmenuitem,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+
+	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+
+	for ( auto& H : SF.channels )
+		H.resample_signal = indeed;
+
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
+
+void
+iSFMontageDrawZeroLine_toggled_cb(
+	GtkCheckMenuItem *checkmenuitem,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+
+	bool indeed = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+
+	for ( auto& H : SF.channels )
+		H.draw_zeroline = indeed;
+
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
+
+
+void
+iSFMontagePatterns_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	SF.patterns_d().setup_controls_for_find();
+	gtk_widget_show( (GtkWidget*)SF.patterns_d().wSFFD);
+}
+
+
+
+void
+iSFMontagePhaseDiff_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	gtk_widget_show( (GtkWidget*)SF.phasediff_d().wSFPD);
+}
+
+
+void
+iSFMontageICA_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.setup_ica() == 0 ) {
+		SF.mode = SScoringFacility::TMode::showing_ics;
+		gtk_widget_set_visible( (GtkWidget*)SF.cSFScoringModeContainer, FALSE);
+		gtk_widget_set_visible( (GtkWidget*)SF.cSFICAModeContainer, TRUE);
+
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICATry, TRUE);
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAShowMatrix, FALSE);
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAPreview, FALSE);
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFICAApply, FALSE);
+
+		gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageClose, FALSE);
+		gtk_widget_set_sensitive( (GtkWidget*)SF.iSFMontageCloseAndNext, FALSE);
+		SF.set_tooltip( SScoringFacility::TTipIdx::ica_mode);
+		SF.queue_redraw_all();
+	} else
+		gdk_window_beep( gtk_widget_get_window( (GtkWidget*)SF.wSF));
+}
+
+
+
+
+
+
+
+void
+iSFMontageScoreAssist_activate_cb(
+	const GtkMenuItem*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	
+}
+
+void
+iSFMontageScoreImport_activate_cb(
+	const GtkMenuItem*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	
+}
+
+void
+iSFMontageScoreExport_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	const auto& SF = *(SScoringFacility*)userdata;
+	
+}
+
+void
+iSFMontageScoreClear_activate_cb(
+	const GtkMenuItem*,
+	gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	
+}
+
+
+
+void
+iSFMontageClose_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	SF._p.close_this_SF_now = &SF;
+	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
+}
+
+
+void
+iSFMontageCloseAndNext_activate_cb(
+	const GtkMenuItem*,
+	const gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& ED = SF._p; // keep same parent
+
+	ED.using_subject->create_cprofile();
+	gtk_widget_queue_draw( (GtkWidget*)ED.using_subject->da);
+
+	SBusyBlock bb (SF.wSF);
+	// guaranteed to have next(E)
+
+	SF._p.close_this_SF_now = &SF;
+	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
+
+	auto& J = SF.csubject();
+	new SScoringFacility(
+		J, SF.session().c_str(),
+		next( J.measurements[SF.session()].episode_iter_by_name(SF.sepisode().name())) -> name(),
+		ED); // ED records SScoringFacility::this alright
+}
+
+
+
+
+namespace {
+
+#define EVENT_X 30
+
+size_t position_for_channel = -1;
+void channel_menu_position( GtkMenu *menu,
+			    gint *x,
+			    gint *y,
+			    gboolean *push_in,
+			    gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	int mwx, mwy, rwx, rwy;
+	gtk_window_get_position( SF.wSF, &mwx, &mwy);
+	gdk_window_get_position( gtk_widget_get_window( (GtkWidget*)SF.daSFMontage), &rwx, &rwy);
+	if ( position_for_channel < SF.channels.size() ) {
+		*x = mwx + rwx + EVENT_X;
+		*y = mwy + rwx + SF[position_for_channel].zeroy-20;
+	} else
+		*x = *y = 0;
+}
+
+}
+
+gboolean
+wSF_key_press_event_cb( GtkWidget *wid, GdkEventKey *event, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	if ( event->type == GDK_KEY_RELEASE or
+	     !(event->state & GDK_MOD1_MASK) )
+		return FALSE;
+
+#define KEKE(N) \
+	position_for_channel = N-1;					\
+	if ( position_for_channel < SF.channels.size() ) {		\
+		SF.using_channel = &SF[position_for_channel];		\
+		SF.using_channel->update_channel_menu_items( EVENT_X);	\
+		gtk_menu_popup( SF.iiSFPage, NULL, NULL, channel_menu_position, userdata, 3, event->time); \
+	} else								\
+		gdk_beep();						\
+	return TRUE;
+
+	switch ( event->keyval ) {
+	case GDK_KEY_1: KEKE(1);
+	case GDK_KEY_2: KEKE(2);
+	case GDK_KEY_3: KEKE(3);
+	case GDK_KEY_4: KEKE(4);
+	case GDK_KEY_5: KEKE(5);
+	case GDK_KEY_6: KEKE(6);
+	case GDK_KEY_7: KEKE(7);
+	case GDK_KEY_8: KEKE(8);
+	case GDK_KEY_9: KEKE(9);
+	case GDK_KEY_0: KEKE(10);
+	}
+#undef KEKE
+	return FALSE;
+}
+
+
+} // extern "C"
+
+// Local Variables:
+// Mode: c++
+// indent-tabs-mode: 8
+// tab-width: 8
+// End:
diff --git a/src/aghermann/ui/sf/sf.cc b/src/aghermann/ui/sf/sf.cc
index defd566..0153b0a 100644
--- a/src/aghermann/ui/sf/sf.cc
+++ b/src/aghermann/ui/sf/sf.cc
@@ -227,12 +227,12 @@ SScoringFacility (agh::CSubject& J,
 
 	// grey out phasediff button if there are fewer than 2 EEG channels
 	gtk_widget_set_sensitive(
-		(GtkWidget*)bSFShowPhaseDiffDialog,
+		(GtkWidget*)iSFMontagePhaseDiff,
 		(n_eeg_channels >= 2));
 
 	// desensitize iSFAcceptAndTakeNext unless there are more episodes
 	gtk_widget_set_sensitive(
-		(GtkWidget*)iSFAcceptAndTakeNext,
+		(GtkWidget*)iSFMontageCloseAndNext,
 		J.measurements.at(D).episodes.back().name() != E);
 	// (de)sensitize various toolbar toggle buttons
 	gtk_toggle_button_set_active(
@@ -795,6 +795,49 @@ set_tooltip( TTipIdx i) const
 }
 
 
+
+void
+aghui::SScoringFacility::
+update_main_menu_items()
+{
+	bool	all_draw_original[2] = {true, true},
+		all_draw_filtered[2] = {true, true},
+		all_draw_fast    [2] = {true, true},
+		all_draw_zeroline[2] = {true, true};
+	for ( const auto& H : channels ) {
+		all_draw_original[0]  = all_draw_original[0] && H.draw_original_signal,
+		all_draw_filtered[0]  = all_draw_filtered[0] && H.draw_filtered_signal,
+		all_draw_fast    [0]  = all_draw_fast    [0] && H.resample_signal,
+		all_draw_zeroline[0]  = all_draw_zeroline[0] && H.draw_zeroline;
+
+		all_draw_original[1]  = all_draw_original[1] && !H.draw_original_signal,
+		all_draw_filtered[1]  = all_draw_filtered[1] && !H.draw_filtered_signal,
+		all_draw_fast    [1]  = all_draw_fast    [1] && !H.resample_signal,
+		all_draw_zeroline[1]  = all_draw_zeroline[1] && !H.draw_zeroline;
+	}
+
+	suppress_redraw = true;
+
+#define KEKE(A,B)						\
+	if ( A[0] )						\
+		gtk_check_menu_item_set_active( B, TRUE);	\
+	else if ( A[1] )					\
+		gtk_check_menu_item_set_active( B, FALSE);	\
+	else							\
+		gtk_check_menu_item_set_inconsistent( B, TRUE);
+
+	KEKE (all_draw_original, iSFMontageDrawOriginalSignal);
+	KEKE (all_draw_filtered, iSFMontageDrawProcessedSignal);
+	KEKE (all_draw_fast,     iSFMontageDrawFast);
+	KEKE (all_draw_zeroline, iSFMontageDrawZeroLine);
+
+#undef KEKE
+
+	suppress_redraw = false;
+}
+
+
+
 // Local Variables:
 // Mode: c++
 // indent-tabs-mode: 8
diff --git a/src/aghermann/ui/sf/sf.hh b/src/aghermann/ui/sf/sf.hh
index 9ec1606..ff528d1 100644
--- a/src/aghermann/ui/sf/sf.hh
+++ b/src/aghermann/ui/sf/sf.hh
@@ -244,6 +244,7 @@ class SScoringFacility
 		forward_list<agh::confval::SValidator<bool>>	config_keys_b;
 		forward_list<agh::confval::SValidator<int>>	config_keys_d;
 		forward_list<agh::confval::SValidator<double>>	config_keys_g;
+
 		void update_channel_menu_items( double x);
 		void update_power_menu_items();
 		void selectively_enable_selection_menu_items();
@@ -349,7 +350,7 @@ class SScoringFacility
 	bool	suppress_redraw:1,
 		hypnogram_button_down:1,
 		artifacts_dialog_shown:1;
-	enum TMode {
+	enum class TMode {
 		scoring,
 		marking,
 		shuffling_channels,
@@ -469,16 +470,18 @@ class SScoringFacility
 	float	zeroy_before_shuffling;
 	float	moving_selection_handle_offset;
 
+  // montage
+  // load/save/reset
     public:
-      // montage
-	// load/save/reset
 	forward_list<agh::confval::SValidator<bool>>	config_keys_b;
 	forward_list<agh::confval::SValidator<int>>	config_keys_d;
 	forward_list<agh::confval::SValidator<float>>	config_keys_g;
 	void load_montage();
 	void save_montage(); // using libconfig
 	void reset_montage();
-	// draw
+
+  // draw
+    public:
 	void draw_montage( cairo_t*);
 	void draw_montage( const string& fname); // to a file (uses da_wd and da_ht
     private:
@@ -491,6 +494,11 @@ class SScoringFacility
 	void draw_current_pos( double) const;
 	void queue_redraw_all() const;
 
+  // main montage menu
+    public:
+	void update_main_menu_items();
+
+    public:
 	void do_score_forward( char score_ch);
 	void do_score_back( char score_ch);
 
diff --git a/src/aghermann/ui/sf/sf_cb.cc b/src/aghermann/ui/sf/sf_cb.cc
index 8ae37a5..24e7ba0 100644
--- a/src/aghermann/ui/sf/sf_cb.cc
+++ b/src/aghermann/ui/sf/sf_cb.cc
@@ -9,12 +9,7 @@
  *         License:  GPL
  */
 
-#include "aghermann/ui/mw/mw.hh"
-
 #include "sf.hh"
-#include "widgets.hh"
-#include "d/patterns.hh"
-#include "d/phasediff.hh"
 
 using namespace std;
 using namespace aghui;
@@ -22,298 +17,11 @@ using namespace aghui;
 extern "C" {
 
 
-// gboolean
-// wScoringFacility_configure_event_cb( GtkWidget *, GdkEventConfigure *event, gpointer userdata)
-// {
-// 	auto &SF = *(SScoringFacility*)userdata;
-// 	if ( SF.suppress_redraw )
-// 		return FALSE;
-
-// 	if ( event->type == GDK_CONFIGURE )
-// 		SF.geometry = {
-// 			event -> x,
-// 			event -> y,
-// 			event -> width,
-// 			event -> height
-// 		};
-// 	return FALSE; // whatever
-// }
-
-
-// ---------- page value_changed
-
-
-void
-eSFPageSize_changed_cb( GtkComboBox *combobox, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	SF.set_vpagesize_item( gtk_combo_box_get_active( combobox), false);
-	SF.queue_redraw_all();
-}
-
-void
-eSFCurrentPage_value_changed_cb( GtkSpinButton *spinbutton, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.set_cur_vpage( gtk_spin_button_get_value( spinbutton) - 1, false);
-	SF.queue_redraw_all();
-}
-
-
-
-// -------------- various buttons
-
-
-void bSFScoreNREM1_clicked_cb( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem1)); }
-void bSFScoreNREM2_clicked_cb( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem2)); }
-void bSFScoreNREM3_clicked_cb( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem3)); }
-void bSFScoreNREM4_clicked_cb( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::nrem4)); }
-void bSFScoreREM_clicked_cb  ( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::rem));   }
-void bSFScoreWake_clicked_cb ( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_forward( sigfile::SPage::score_code(sigfile::SPage::TScore::wake));  }
-void bSFScoreClear_clicked_cb( GtkButton *_, gpointer u)  { ((SScoringFacility*)u)->do_score_back   ( sigfile::SPage::score_code(sigfile::SPage::TScore::none));  }
-
-
-
-
-
-void
-bSFForward_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	auto current = SF.cur_vpage();
-	if ( current < SF.total_vpages() - 1 )
-		SF.set_cur_vpage( current+1);
-	SF.sb_clear();
-}
-
-void
-bSFBack_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	auto current = SF.cur_vpage();
-	if ( current > 0 )
-		SF.set_cur_vpage( current-1);
-	SF.sb_clear();
-}
-
-
-void
-eSFCurrentPos_clicked_cb( GtkButton*,
-			  gpointer   userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.show_cur_pos_time_relative = !SF.show_cur_pos_time_relative;
-	SF.draw_current_pos( NAN);
-}
-
-
-void
-bSFGotoPrevUnscored_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_page() == 0 )
-		return;
-	size_t p = SF.cur_page();
-	while ( --p != (size_t)-1 )
-		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
-			SF.sb_clear();
-			SF.set_cur_vpage( SF.p2ap(p));
-			return;
-		}
-	SF.sb_message( "No more unscored pages before this");
-}
-
-void
-bSFGotoNextUnscored_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_page() == SF.total_pages()-1 )
-		return;
-	size_t p = SF.cur_page();
-	while ( ++p < SF.total_pages() )
-		if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
-			SF.sb_clear();
-			SF.set_cur_vpage( SF.p2ap(p));
-			return;
-		}
-	SF.sb_message( "No more unscored pages after this");
-}
-
-
-
-
-void
-bSFGotoPrevArtifact_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_vpage() == 0 )
-		return;
-	size_t p = SF.cur_vpage();
-	while ( --p != (size_t)-1 )
-		if ( SF.page_has_artifacts( p, false)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more dirty pages before this");
-}
-
-void
-bSFGotoNextArtifact_clicked_cb( GtkButton *button, gpointer userdata)
-{
-	auto &SF = *(SScoringFacility*)userdata;
-	if ( SF.cur_vpage() == SF.total_vpages()-1 )
-		return;
-	size_t p = SF.cur_vpage();
-	while ( ++p < SF.total_vpages() )
-		if ( SF.page_has_artifacts( p)) {
-			SF.sb_clear();
-			SF.set_cur_vpage( p);
-			return;
-		}
-	SF.sb_message( "No more dirty pages after this");
-}
-
-
-
-
-
-void
-bSFDrawCrosshair_toggled_cb( GtkToggleButton *button, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	SF.draw_crosshair = !SF.draw_crosshair;
-	SF.queue_redraw_all();
-}
-
-
-
-
-
-void
-bSFShowFindDialog_toggled_cb( GtkToggleButton *togglebutton, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( gtk_toggle_button_get_active( togglebutton) ) {
-		SF.patterns_d().setup_controls_for_find();
-		gtk_widget_show( (GtkWidget*)SF.patterns_d().wSFFD);
-	} else
-		gtk_widget_hide( (GtkWidget*)SF.patterns_d().wSFFD);
-}
-
-
-
-void
-bSFShowPhaseDiffDialog_toggled_cb( GtkToggleButton *togglebutton, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	if ( gtk_toggle_button_get_active( togglebutton) ) {
-		gtk_widget_show( (GtkWidget*)SF.phasediff_d().wSFPD);
-	} else
-		gtk_widget_hide( (GtkWidget*)SF.phasediff_d().wSFPD);
-}
-
-
-
-
-
-void
-bSFAccept_clicked_cb( GtkToolButton *button, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-
-	SF._p.close_this_SF_now = &SF;
-	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
-}
-
-
-void
-iSFAcceptAndTakeNext_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	auto& ED = SF._p; // keep same parent
-
-	ED.using_subject->create_cprofile();
-	gtk_widget_queue_draw( (GtkWidget*)ED.using_subject->da);
-
-	SBusyBlock bb (SF.wSF);
-	// guaranteed to have next(E)
-
-	auto& J = SF.csubject();
-	new SScoringFacility(
-		J, SF.session().c_str(),
-		next( J.measurements[SF.session()].episode_iter_by_name(SF.sepisode().name())) -> name(),
-		ED);
-
-	SF._p.close_this_SF_now = &SF;
-	g_signal_emit_by_name( SF._p.bMainCloseThatSF, "clicked");
-}
-
-
-
-
-namespace {
-
-#define EVENT_X 30
-
-size_t position_for_channel = -1;
-void channel_menu_position( GtkMenu *menu,
-			    gint *x,
-			    gint *y,
-			    gboolean *push_in,
-			    gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-	int mwx, mwy, rwx, rwy;
-	gtk_window_get_position( SF.wSF, &mwx, &mwy);
-	gdk_window_get_position( gtk_widget_get_window( (GtkWidget*)SF.daSFMontage), &rwx, &rwy);
-	if ( position_for_channel < SF.channels.size() ) {
-		*x = mwx + rwx + EVENT_X;
-		*y = mwy + rwx + SF[position_for_channel].zeroy-20;
-	} else
-		*x = *y = 0;
-}
-
-}
-
-gboolean
-wSF_key_press_event_cb( GtkWidget *wid, GdkEventKey *event, gpointer userdata)
-{
-	auto& SF = *(SScoringFacility*)userdata;
-
-	if ( event->type == GDK_KEY_RELEASE or
-	     !(event->state & GDK_MOD1_MASK) )
-		return FALSE;
-
-#define KEKE(N) \
-	position_for_channel = N-1;					\
-	if ( position_for_channel < SF.channels.size() ) {		\
-		SF.using_channel = &SF[position_for_channel];		\
-		SF.using_channel->update_channel_menu_items( EVENT_X);	\
-		gtk_menu_popup( SF.iiSFPage, NULL, NULL, channel_menu_position, userdata, 3, event->time); \
-	} else								\
-		gdk_beep();						\
-	return TRUE;
-
-	switch ( event->keyval ) {
-	case GDK_KEY_1: KEKE(1);
-	case GDK_KEY_2: KEKE(2);
-	case GDK_KEY_3: KEKE(3);
-	case GDK_KEY_4: KEKE(4);
-	case GDK_KEY_5: KEKE(5);
-	case GDK_KEY_6: KEKE(6);
-	case GDK_KEY_7: KEKE(7);
-	case GDK_KEY_8: KEKE(8);
-	case GDK_KEY_9: KEKE(9);
-	case GDK_KEY_0: KEKE(10);
-	}
-#undef KEKE
-	return FALSE;
-}
-
-
 gboolean
-wSF_delete_event_cb( GtkWidget*, GdkEvent*, gpointer userdata)
+wSF_delete_event_cb(
+	GtkWidget*,
+	GdkEvent*,
+	gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
 
diff --git a/src/aghermann/ui/sf/sf_cb.hh b/src/aghermann/ui/sf/sf_cb.hh
index ce87f5b..e79476e 100644
--- a/src/aghermann/ui/sf/sf_cb.hh
+++ b/src/aghermann/ui/sf/sf_cb.hh
@@ -47,10 +47,21 @@ void bSFGotoNextUnscored_clicked_cb( GtkButton*, gpointer);
 void bSFGotoPrevArtifact_clicked_cb( GtkButton*, gpointer);
 void bSFGotoNextArtifact_clicked_cb( GtkButton*, gpointer);
 void bSFDrawCrosshair_toggled_cb( GtkToggleButton*, gpointer);
-void bSFShowFindDialog_toggled_cb( GtkToggleButton*, gpointer);
-void bSFShowPhaseDiffDialog_toggled_cb( GtkToggleButton*, gpointer);
-void bSFRunICA_clicked_cb( GtkButton*, gpointer);
-//void bSFResetMontage_clicked_cb( GtkButton*, gpointer);
+
+void iSFMontageMenu_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageDrawOriginalSignal_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFMontageDrawProcessedSignal_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFMontageDrawFast_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFMontageDrawZeroLine_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFMontagePatterns_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontagePhaseDiff_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageICA_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageScoreAssist_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageScoreImport_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageScoreExport_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageScoreClear_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageClose_activate_cb( GtkMenuItem*, gpointer);
+void iSFMontageCloseAndNext_activate_cb( GtkMenuItem*, gpointer);
 
 
 void eSFICARemixMode_changed_cb( GtkComboBox*, gpointer);
@@ -75,9 +86,6 @@ void bSFICAApply_clicked_cb( GtkButton*, gpointer);
 void bSFICACancel_clicked_cb( GtkButton*, gpointer);
 
 
-void bSFAccept_clicked_cb( GtkToolButton*, gpointer);
-void iSFAcceptAndTakeNext_activate_cb( GtkMenuItem*, gpointer);
-
 void iSFPageShowOriginal_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageShowProcessed_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageUseResample_toggled_cb( GtkCheckMenuItem*, gpointer);
diff --git a/src/aghermann/ui/sf/widgets.hh b/src/aghermann/ui/sf/widgets.hh
index 4d7a919..b536bd5 100644
--- a/src/aghermann/ui/sf/widgets.hh
+++ b/src/aghermann/ui/sf/widgets.hh
@@ -49,6 +49,21 @@ struct SScoringFacilityWidgets {
 		*cSFScoringModeContainer,
 		*cSFICAModeContainer;
 	// 1. scoring mode
+	GtkCheckMenuItem
+		*iSFMontageDrawOriginalSignal,
+		*iSFMontageDrawProcessedSignal,
+		*iSFMontageDrawZeroLine,
+		*iSFMontageDrawFast;
+	GtkMenuItem
+		*iSFMontagePatterns,
+		*iSFMontageICA,
+		*iSFMontagePhaseDiff,
+		*iSFMontageScoreAssist,
+		*iSFMontageScoreImport,
+		*iSFMontageScoreExport,
+		*iSFMontageScoreClear,
+		*iSFMontageClose,
+		*iSFMontageCloseAndNext;
 	GtkButton  // acting label
 		*eSFCurrentPos;
 	GtkButton
@@ -58,11 +73,7 @@ struct SScoringFacilityWidgets {
 		*bSFGotoPrevUnscored, *bSFGotoNextUnscored,
 		*bSFGotoPrevArtifact, *bSFGotoNextArtifact;
 	GtkToggleButton
-		*bSFDrawCrosshair,
-		*bSFShowFindDialog, *bSFShowPhaseDiffDialog;
-	GtkButton
-	//*bSFResetMontage,
-		*bSFRunICA;
+		*bSFDrawCrosshair;
 	GtkTable
 		*cSFSleepStageStats;
 	GtkLabel
@@ -110,12 +121,6 @@ struct SScoringFacilityWidgets {
 	GtkDialog
 		*wSFICAMatrix;
 
-	// common controls (contd)
-	GtkMenuToolButton
-		*bSFAccept;
-	GtkMenu
-		*iiSFAccept;
-
 	// montage area
 	GtkDrawingArea
 		*daSFMontage,
@@ -135,6 +140,8 @@ struct SScoringFacilityWidgets {
 		*iiSFPower,
 		*iiSFScore,
 		*iiSFICAPage;
+	GtkMenuItem
+		*iSFMontageMenu;
 	GtkCheckMenuItem
 		*iSFPageShowOriginal, *iSFPageShowProcessed,
 		*iSFPageUseResample, *iSFPageDrawZeroline,

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



More information about the debian-med-commit mailing list