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

Andrei Zavada johnhommer at gmail.com
Sun Feb 3 12:53:23 UTC 2013


The following commit has been merged in the master branch:
commit 2664c84f6b68f94065fb25e2d1e9fe53b67f47f1
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Feb 3 13:31:06 2013 +0200

    bundled glade-bound commit for SF improvements
    
    - check menu items for various phasic events;
    - annotation navigation and clear-all;
    - annotation type selection;

diff --git a/data/sf.glade b/data/sf.glade
index 41c8a12..4fd528f 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -122,6 +122,44 @@
               </object>
             </child>
             <child>
+              <object class="GtkMenuItem" id="iiSFPagePhasicEvents">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Pha_sic events</property>
+                <property name="use_underline">True</property>
+                <child type="submenu">
+                  <object class="GtkMenu" id="menu6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkCheckMenuItem" id="iSFPageDrawPhasicEyeBlinks">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_Eye blinks</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkCheckMenuItem" id="iSFPageDrawPhasicSpindles">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_Spindles</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkCheckMenuItem" id="iSFPageDrawPhasicKComplexes">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_K-complexes</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
               <object class="GtkSeparatorMenuItem" id="menuitem2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -202,22 +240,24 @@
       </object>
     </child>
     <child>
-      <object class="GtkSeparatorMenuItem" id="iSFPageAnnotationSeparator">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </object>
-    </child>
-    <child>
       <object class="GtkMenuItem" id="iiSFPageAnnotation">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Annotation</property>
+        <property name="label" translatable="yes">_Annotations</property>
         <property name="use_underline">True</property>
         <child type="submenu">
           <object class="GtkMenu" id="menu2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
+              <object class="GtkMenuItem" id="iSFPageAnnotationEdit">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Edit...</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
               <object class="GtkMenuItem" id="iSFPageAnnotationDelete">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -226,10 +266,38 @@
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageAnnotationEdit">
+              <object class="GtkSeparatorMenuItem" id="iSFPageAnnotationSeparator">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Edit...</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="iSFPageAnnotationClearAll">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Clear All...</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparatorMenuItem" id="menuitem4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="iSFPageAnnotationGotoPrev">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Previous</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkMenuItem" id="iSFPageAnnotationGotoNext">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">_Next</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
@@ -365,36 +433,6 @@
         </child>
       </object>
     </child>
-    <child>
-      <object class="GtkMenuItem" id="iiSFPagePhasicEvents">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Pha_sic events</property>
-        <property name="use_underline">True</property>
-        <child type="submenu">
-          <object class="GtkMenu" id="menu6">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawPhasicSpindles">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Spindles</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkCheckMenuItem" id="iSFPageDrawPhasicKComplexes">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_K-complexes</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
   </object>
   <object class="GtkMenu" id="iiSFPageHidden">
     <property name="visible">True</property>
@@ -729,6 +767,7 @@
   </object>
   <object class="GtkWindow" id="wSF">
     <property name="can_focus">False</property>
+    <property name="events">GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property>
     <property name="title" translatable="yes">Aghermann Scoring Facility</property>
     <property name="window_position">center</property>
     <property name="default_width">1024</property>
@@ -1192,15 +1231,15 @@
                       </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>
@@ -1209,15 +1248,15 @@
                       </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>
@@ -1452,17 +1491,18 @@
                       </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>
@@ -1472,18 +1512,17 @@
                       </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>
@@ -2285,7 +2324,40 @@ skew:	𝑔(𝑢) = 𝑢2</property>
       <object class="GtkBox" id="dialog-vbox4">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">10</property>
+        <child>
+          <object class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkEntry" id="eSFAnnotationLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="margin_top">5</property>
+                <property name="margin_bottom">5</property>
+                <property name="max_length">120</property>
+                <property name="invisible_char">•</property>
+                <property name="activates_default">True</property>
+                <property name="invisible_char_set">True</property>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes"><b>Annotation name</b></property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area4">
             <property name="can_focus">False</property>
@@ -2329,47 +2401,104 @@ skew:	𝑔(𝑢) = 𝑢2</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box1">
+          <object class="GtkFrame" id="frame2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="border_width">10</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">5</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
             <child>
-              <object class="GtkLabel" id="label1">
+              <object class="GtkBox" id="box13">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">_Annotation label:</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">eSFAnnotationLabel</property>
+                <property name="margin_left">3</property>
+                <property name="margin_right">3</property>
+                <property name="margin_top">3</property>
+                <property name="margin_bottom">3</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">3</property>
+                <child>
+                  <object class="GtkRadioButton" id="eSFAnnotationTypePlain">
+                    <property name="label" translatable="yes">_Plain</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="eSFAnnotationTypeSpindle">
+                    <property name="label" translatable="yes">_Spindle</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">eSFAnnotationTypePlain</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="eSFAnnotationTypeKComplex">
+                    <property name="label" translatable="yes">_K-complex</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">eSFAnnotationTypePlain</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="eSFAnnotationTypeBlink">
+                    <property name="label" translatable="yes">_Eye blink</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">eSFAnnotationTypePlain</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
-            <child>
-              <object class="GtkEntry" id="eSFAnnotationLabel">
+            <child type="label">
+              <object class="GtkLabel" id="label51">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="max_length">120</property>
-                <property name="invisible_char">•</property>
-                <property name="activates_default">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes"><b>Type</b></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>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>
@@ -2450,7 +2579,6 @@ skew:	𝑔(𝑢) = 𝑢2</property>
                 <property name="xalign">0.0099999997764825821</property>
                 <property name="label" translatable="yes">_Annotations under pointer:</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">eSFAnnotationLabel</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -2595,7 +2723,7 @@ skew:	𝑔(𝑢) = 𝑢2</property>
       <action-widget response="-1">button7</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkSizeGroup" id="sizegroup1">
+  <object class="GtkSizeGroup" id="zModeContainers">
     <widgets>
       <widget name="cSFICAModeContainer"/>
       <widget name="cSFScoringModeContainer"/>
diff --git a/src/ui/sf/channel.cc b/src/ui/sf/channel.cc
index cd8eef3..7fa2631 100644
--- a/src/ui/sf/channel.cc
+++ b/src/ui/sf/channel.cc
@@ -63,6 +63,7 @@ SChannel( agh::CRecording& r,
 	draw_selection_dzcdf (false),
 	draw_phasic_spindle (true),
 	draw_phasic_Kcomplex (true),
+	draw_phasic_eyeblink (true),
 	apply_reconstituted (false),
 	config_keys_b ({
 		confval::SValidator<bool>( string(1, seq) + ".hidden",			&hidden),
@@ -77,6 +78,7 @@ SChannel( agh::CRecording& r,
 		confval::SValidator<bool>( string(1, seq) + ".draw_mc",			&draw_mc),
 		confval::SValidator<bool>( string(1, seq) + ".draw_phasic_spindle",	&draw_phasic_spindle),
 		confval::SValidator<bool>( string(1, seq) + ".draw_phasic_Kcomplex",	&draw_phasic_Kcomplex),
+		confval::SValidator<bool>( string(1, seq) + ".draw_phasic_eyeblink",	&draw_phasic_eyeblink),
 		confval::SValidator<bool>( string(1, seq) + ".autoscale_profile",	&autoscale_profile),
 		confval::SValidator<bool>( string(1, seq) + ".resample_signal",		&resample_signal),
 		confval::SValidator<bool>( string(1, seq) + ".resample_power",		&resample_power),
@@ -523,6 +525,10 @@ update_channel_menu_items( double x)
 	gtk_check_menu_item_set_active( _p.iSFPageDrawMCProfile,   draw_mc);
 	gtk_check_menu_item_set_active( _p.iSFPageDrawSWUProfile,  draw_swu);
 
+	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicSpindles,   draw_phasic_spindle);
+	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicKComplexes, draw_phasic_Kcomplex);
+	gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicEyeBlinks,  draw_phasic_eyeblink);
+
 	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawCourse,   draw_selection_course);
 	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
 	gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawDzxdf,    draw_selection_dzcdf);
@@ -532,7 +538,6 @@ update_channel_menu_items( double x)
 		have_profile = is_eeg or is_emg;
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageProfilesSubmenuSeparator, have_profile);
 	gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageProfiles,                have_profile);
-	gtk_widget_set_visible( (GtkWidget*)_p.iiSFPagePhasicEvents,            have_profile);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDProfile,  is_eeg);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDSpectrum, is_eeg);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawSWUProfile,  is_eeg);
diff --git a/src/ui/sf/construct.cc b/src/ui/sf/construct.cc
index facb21a..0480df3 100644
--- a/src/ui/sf/construct.cc
+++ b/src/ui/sf/construct.cc
@@ -217,6 +217,9 @@ SScoringFacilityWidgets ()
 	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawSWUProfile)) ||
 	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawMCProfile)) ||
 	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawEMGProfile)) ||
+	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicSpindles)) ||
+	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicKComplexes)) ||
+	     !(AGH_GBGETOBJ (GtkCheckMenuItem, 		iSFPageDrawPhasicEyeBlinks)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageFilter)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSaveChannelAsSVG)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSaveMontageAsSVG)) ||
@@ -233,6 +236,9 @@ SScoringFacilityWidgets ()
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationSeparator)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationDelete)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationEdit)) ||
+	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationClearAll)) ||
+	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationGotoNext)) ||
+	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageAnnotationGotoPrev)) ||
 
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionMarkArtifact)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFPageSelectionClearArtifact)) ||
@@ -264,17 +270,18 @@ SScoringFacilityWidgets ()
 
 	G_CONNECT_1 (iSFPageAnnotationDelete, activate);
 	G_CONNECT_1 (iSFPageAnnotationEdit, activate);
+	G_CONNECT_1 (iSFPageAnnotationClearAll, activate);
+	G_CONNECT_1 (iSFPageAnnotationGotoPrev, activate);
+	G_CONNECT_1 (iSFPageAnnotationGotoNext, activate);
 
 	G_CONNECT_1 (iSFPageSelectionMarkArtifact, activate);
 	G_CONNECT_1 (iSFPageSelectionClearArtifact, activate);
 	G_CONNECT_1 (iSFPageSelectionFindPattern, activate);
 	G_CONNECT_1 (iSFPageSelectionAnnotate, activate);
-
 	G_CONNECT_1 (iSFPageSelectionDrawCourse, toggled);
 	G_CONNECT_1 (iSFPageSelectionDrawEnvelope, toggled);
 	G_CONNECT_1 (iSFPageSelectionDrawDzxdf, toggled);
 
-
 	G_CONNECT_1 (iSFPageFilter, activate);
 	G_CONNECT_1 (iSFPageSaveChannelAsSVG, activate);
 	G_CONNECT_1 (iSFPageSaveMontageAsSVG, activate);
@@ -294,6 +301,10 @@ SScoringFacilityWidgets ()
 	G_CONNECT_1 (iSFPageDrawSWUProfile, toggled);
 	G_CONNECT_1 (iSFPageDrawEMGProfile, toggled);
 
+	G_CONNECT_1 (iSFPageDrawPhasicSpindles, toggled);
+	G_CONNECT_1 (iSFPageDrawPhasicKComplexes, toggled);
+	G_CONNECT_1 (iSFPageDrawPhasicEyeBlinks, toggled);
+
 	G_CONNECT_1 (iSFPowerExportRange, activate);
 	G_CONNECT_1 (iSFPowerExportAll, activate);
 	G_CONNECT_1 (iSFPowerSmooth, toggled);
@@ -308,10 +319,14 @@ SScoringFacilityWidgets ()
 
       // petty dialogs
 	// annotations
-	if ( !(AGH_GBGETOBJ (GtkDialog,			wSFAnnotationLabel)) ||
-	     !(AGH_GBGETOBJ (GtkEntry,			eSFAnnotationLabel)) ||
-	     !(AGH_GBGETOBJ (GtkDialog,			wSFAnnotationSelector)) ||
-	     !(AGH_GBGETOBJ (GtkComboBox,		eSFAnnotationSelectorWhich)) )
+	if ( !AGH_GBGETOBJ (GtkDialog,			wSFAnnotationLabel) ||
+	     !AGH_GBGETOBJ (GtkEntry,			eSFAnnotationLabel) ||
+	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypePlain) ||
+	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeSpindle) ||
+	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeKComplex) ||
+	     !AGH_GBGETOBJ (GtkRadioButton,		eSFAnnotationTypeBlink) ||
+	     !AGH_GBGETOBJ (GtkDialog,			wSFAnnotationSelector) ||
+	     !AGH_GBGETOBJ (GtkComboBox,		eSFAnnotationSelectorWhich) )
 		throw runtime_error ("Failed to construct SF widgets (6)");
 
 	mSFAnnotationsAtCursor = gtk_list_store_new(1, G_TYPE_STRING);
diff --git a/src/ui/sf/montage_cb.cc b/src/ui/sf/montage_cb.cc
index db20431..a5ae6eb 100644
--- a/src/ui/sf/montage_cb.cc
+++ b/src/ui/sf/montage_cb.cc
@@ -628,6 +628,36 @@ iSFPageDrawEMGProfile_toggled_cb( GtkCheckMenuItem *checkmenuitem, gpointer user
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 }
 
+void
+iSFPageDrawPhasicSpindles_toggled_cb( GtkCheckMenuItem *checkmenuitem, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+	SF.using_channel->draw_phasic_spindle = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
+void
+iSFPageDrawPhasicKComplexes_toggled_cb( GtkCheckMenuItem *checkmenuitem, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+	SF.using_channel->draw_phasic_Kcomplex = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
+void
+iSFPageDrawPhasicEyeBlinks_toggled_cb( GtkCheckMenuItem *checkmenuitem, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	if ( SF.suppress_redraw )
+		return;
+	SF.using_channel->draw_phasic_eyeblink = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
 
 void
 iSFPageFilter_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
@@ -827,11 +857,37 @@ iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
 		return;
 
 	gtk_entry_set_text( SF.eSFAnnotationLabel, which->label.c_str());
+	switch ( which->type ) {
+	case sigfile::SAnnotation::TType::phasic_event_spindle:
+		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle, TRUE);
+		break;
+	case sigfile::SAnnotation::TType::phasic_event_K_complex:
+		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex, TRUE);
+		break;
+	case sigfile::SAnnotation::TType::eyeblink:
+		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink, TRUE);
+		break;
+	case sigfile::SAnnotation::TType::plain:
+	default:
+		gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypePlain, TRUE);
+		break;
+	}
+
 	if ( GTK_RESPONSE_OK ==
 	     gtk_dialog_run( SF.wSFAnnotationLabel) ) {
 		const char* new_label = gtk_entry_get_text( SF.eSFAnnotationLabel);
+		auto new_type =
+			gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
+			? sigfile::SAnnotation::TType::phasic_event_spindle
+			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
+			? sigfile::SAnnotation::TType::phasic_event_K_complex
+			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
+			? sigfile::SAnnotation::TType::eyeblink
+			: sigfile::SAnnotation::TType::plain;
+
 		if ( strlen(new_label) > 0 ) {
 			which->label = new_label;
+			which->type = new_type;
 			SF._p.populate_mGlobalAnnotations();
 			gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 		}
@@ -839,6 +895,63 @@ iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
 }
 
 
+void
+iSFPageAnnotationClearAll_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	char* chnamee = g_markup_escape_text( SF.using_channel->name, -1);
+	if ( GTK_RESPONSE_YES
+	     == pop_question( SF.wSF,
+			      "Sure you want to delete all annotations in channel <b>%s</b>?",
+			      chnamee) ) {
+		SF.using_channel->annotations.clear();
+
+		SF._p.populate_mGlobalAnnotations();
+		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+	}
+	g_free( chnamee);
+}
+
+
+void
+iSFPageAnnotationGotoNext_activate_cb( GtkMenuItem*, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	if ( SF.cur_vpage() == SF.total_vpages()-1 )
+		return;
+	size_t p = SF.cur_vpage();
+	while ( ++p < SF.total_vpages() )
+		if ( SF.page_has_annotations( p, *SF.using_channel)) {
+			SF.sb_clear();
+			SF.set_cur_vpage( p);
+			return;
+		}
+	SF.sb_message( "No more annotations after this");
+}
+
+void
+iSFPageAnnotationGotoPrev_activate_cb( GtkMenuItem*, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+
+	if ( SF.cur_vpage() == 0 )
+		return;
+	size_t p = SF.cur_vpage();
+	while ( --p != (size_t)-1 )
+		if ( SF.page_has_annotations( p, *SF.using_channel)) {
+			SF.sb_clear();
+			SF.set_cur_vpage( p);
+			return;
+		}
+	SF.sb_message( "No more annotations before this");
+}
+
+
+
+
+
 
 void
 iSFICAPageMapIC_activate_cb( GtkRadioMenuItem* i, gpointer u)
@@ -907,14 +1020,25 @@ void
 iSFPageSelectionAnnotate_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
+
 	gtk_entry_set_text( SF.eSFAnnotationLabel, "");
+
 	if ( GTK_RESPONSE_OK ==
 	     gtk_dialog_run( (GtkDialog*)SF.wSFAnnotationLabel) ) {
 		auto new_ann = gtk_entry_get_text( SF.eSFAnnotationLabel);
 		if ( strlen( new_ann) == 0 )
 			return;
 
-		SF.using_channel->mark_region_as_annotation( new_ann);
+		auto type =
+			gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
+			? sigfile::SAnnotation::TType::phasic_event_spindle
+			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
+			? sigfile::SAnnotation::TType::phasic_event_K_complex
+			: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
+			? sigfile::SAnnotation::TType::eyeblink
+			: sigfile::SAnnotation::TType::plain;
+
+		SF.using_channel->mark_region_as_annotation( new_ann, type);
 
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index d16d60e..13bca70 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -547,6 +547,23 @@ page_has_artifacts( size_t p, bool search_all) const
 }
 
 
+bool
+aghui::SScoringFacility::
+page_has_annotations( size_t p, const SChannel& H) const
+{
+	int	half_pad_samples = skirting_run_per1 * vpagesize() * H.samplerate();
+	int	cvpa =  p    * pagesize() * H.samplerate() - half_pad_samples,
+		cvpe = (p+1) * pagesize() * H.samplerate() + half_pad_samples;
+	for ( auto &A : H.annotations )
+		if ( agh::alg::overlap( (int)A.span.a, (int)A.span.z, cvpa, cvpe) )
+			return true;
+		else if ( (int)A.span.a > cvpe )  // no more up to and on current page
+			return false;
+	return false;
+}
+
+
+
 void
 aghui::SScoringFacility::
 draw_score_stats() const
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index eb84355..9cc4c1a 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -236,7 +236,8 @@ class SScoringFacility
 			draw_selection_envelope,
 			draw_selection_dzcdf,
 			draw_phasic_spindle,
-			draw_phasic_Kcomplex;
+			draw_phasic_Kcomplex,
+			draw_phasic_eyeblink;
 		bool	discard_marked,
 			apply_reconstituted;
 
@@ -378,6 +379,7 @@ class SScoringFacility
 			return sigfile::SPage::char2score( hypnogram[_cur_page]);
 		}
 	bool page_has_artifacts( size_t, bool check_all_channels = true) const;
+	bool page_has_annotations( size_t, const SChannel&) const;
 
       // pagesize
 	size_t pagesize() const
@@ -814,6 +816,9 @@ void iSFPageDrawPSDSpectrum_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageDrawSWUProfile_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageDrawMCProfile_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageDrawEMGProfile_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFPageDrawPhasicSpindles_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFPageDrawPhasicKComplexes_toggled_cb( GtkCheckMenuItem*, gpointer);
+void iSFPageDrawPhasicEyeBlinks_toggled_cb( GtkCheckMenuItem*, gpointer);
 
 void iSFPageSelectionDrawCourse_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageSelectionDrawEnvelope_toggled_cb( GtkCheckMenuItem*, gpointer);
@@ -823,6 +828,9 @@ void iSFICAPageMapIC_activate_cb( GtkRadioMenuItem*, gpointer);
 
 void iSFPageAnnotationDelete_activate_cb( GtkMenuItem*, gpointer);
 void iSFPageAnnotationEdit_activate_cb( GtkMenuItem*, gpointer);
+void iSFPageAnnotationClearAll_activate_cb( GtkMenuItem*, gpointer);
+void iSFPageAnnotationGotoPrev_activate_cb( GtkMenuItem*, gpointer);
+void iSFPageAnnotationGotoNext_activate_cb( GtkMenuItem*, gpointer);
 
 void iSFPageSelectionMarkArtifact_activate_cb( GtkMenuItem*, gpointer);
 void iSFPageSelectionClearArtifact_activate_cb( GtkMenuItem*, gpointer);
diff --git a/src/ui/sf/widgets.hh b/src/ui/sf/widgets.hh
index d423499..be41d04 100644
--- a/src/ui/sf/widgets.hh
+++ b/src/ui/sf/widgets.hh
@@ -148,7 +148,10 @@ struct SScoringFacilityWidgets {
 		*iSFPowerAutoscale,
 		*iSFPageSelectionDrawCourse,
 		*iSFPageSelectionDrawEnvelope,
-		*iSFPageSelectionDrawDzxdf;
+		*iSFPageSelectionDrawDzxdf,
+		*iSFPageDrawPhasicSpindles,
+		*iSFPageDrawPhasicKComplexes,
+		*iSFPageDrawPhasicEyeBlinks;
 	GtkMenuItem
 		*iSFPageFilter,
 		*iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
@@ -161,6 +164,9 @@ struct SScoringFacilityWidgets {
 		*iSFPageAnnotationSeparator,
 		*iSFPageAnnotationDelete,
 		*iSFPageAnnotationEdit,
+		*iSFPageAnnotationClearAll,
+		*iSFPageAnnotationGotoPrev,
+		*iSFPageAnnotationGotoNext,
 		*iSFPageSelectionMarkArtifact, *iSFPageSelectionClearArtifact,
 		*iSFPageSelectionFindPattern,
 		*iSFPageSelectionAnnotate,
@@ -179,6 +185,11 @@ struct SScoringFacilityWidgets {
 		*wSFAnnotationSelector;
 	GtkEntry
 		*eSFAnnotationLabel;
+	GtkRadioButton
+		*eSFAnnotationTypePlain,
+		*eSFAnnotationTypeSpindle,
+		*eSFAnnotationTypeKComplex,
+		*eSFAnnotationTypeBlink;
 	GtkComboBox
 		*eSFAnnotationSelectorWhich;
 

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list