The following commit has been merged in the master branch:
commit 7a7839530f64ba3cf590bf34234f9fafb802b7d1
Author: Andrei Zavada <[email protected]>
Date:   Sun Feb 3 13:23:09 2013 +0200

    show annotation type in global annotation dialog

diff --git a/data/mw-dialogs.glade b/data/mw-dialogs.glade
index d6699bd..39e88da 100644
--- a/data/mw-dialogs.glade
+++ b/data/mw-dialogs.glade
@@ -1546,6 +1546,24 @@ With bug reports, either send yours to &lt;a 
href="mailto:aghermann-users@lists.
                 <property name="position">2</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkCheckButton" 
id="eGlobalAnnotationsShowPhasicEvents">
+                <property name="label" translatable="yes">Show _phasic 
events</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="margin_top">5</property>
+                <property name="margin_bottom">5</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</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">True</property>
@@ -2718,18 +2736,6 @@ With bug reports, either send yours to &lt;a 
href="mailto:aghermann-users@lists.
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
                   <object class="GtkEntry" id="eSubjectDetailsShortName">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
@@ -2762,6 +2768,18 @@ With bug reports, either send yours to &lt;a 
href="mailto:aghermann-users@lists.
                     <property name="height">1</property>
                   </packing>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/src/ui/mw/construct.cc b/src/ui/mw/construct.cc
index 106f4cb..9cc2d11 100644
--- a/src/ui/mw/construct.cc
+++ b/src/ui/mw/construct.cc
@@ -39,10 +39,11 @@ SExpDesignUIWidgets ()
        mAllChannels =
                gtk_list_store_new( 1, G_TYPE_STRING);
        mGlobalAnnotations =
-               gtk_tree_store_new( 6,
+               gtk_tree_store_new( 7,
                                    G_TYPE_STRING, // id
                                    G_TYPE_STRING, // at pages
                                    G_TYPE_STRING, // channel
+                                   G_TYPE_STRING, // type
                                    G_TYPE_STRING, // label
                                    G_TYPE_BOOLEAN, G_TYPE_POINTER);
        mGlobalADProfiles =
@@ -610,8 +611,10 @@ SExpDesignUIWidgets ()
 
       // ----------- wGlobalAnnotations
        if ( !AGH_GBGETOBJ (GtkDialog,          wGlobalAnnotations) ||
-            !AGH_GBGETOBJ (GtkTreeView,        tvGlobalAnnotations) )
+            !AGH_GBGETOBJ (GtkTreeView,        tvGlobalAnnotations) ||
+            !AGH_GBGETOBJ (GtkCheckButton,     
eGlobalAnnotationsShowPhasicEvents) )
                throw runtime_error ("Failed to construct widgets");
+
        gtk_tree_view_set_model( tvGlobalAnnotations,
                                 (GtkTreeModel*)mGlobalAnnotations);
 
@@ -622,9 +625,10 @@ SExpDesignUIWidgets ()
                          (GCallback)gtk_tree_view_expand_all,
                          NULL);
        G_CONNECT_2 (tvGlobalAnnotations, row, activated);
+       FAFA;
 
        int c = 0;
-       for ( auto column : {"Recording", "Page(s)", "Channel", "Label"} ) {
+       for ( auto column : {"Recording", "Page(s)", "Channel", "Type", 
"Label"} ) {
                GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
                g_object_set( (GObject*)renderer,
                              "editable", FALSE,
@@ -642,6 +646,8 @@ SExpDesignUIWidgets ()
        gtk_tree_view_append_column( tvGlobalAnnotations,
                                     gtk_tree_view_column_new());
 
+       G_CONNECT_1 (eGlobalAnnotationsShowPhasicEvents, toggled);
+
       // ------------- wGlobalArtifactDetection
        if ( !AGH_GBGETOBJ (GtkDialog,          wGlobalArtifactDetection) ||
             !AGH_GBGETOBJ (GtkComboBox,        eGlobalADProfiles) ||
diff --git a/src/ui/mw/mainmenu_cb.cc b/src/ui/mw/mainmenu_cb.cc
index a38abe5..d254865 100644
--- a/src/ui/mw/mainmenu_cb.cc
+++ b/src/ui/mw/mainmenu_cb.cc
@@ -38,6 +38,10 @@ void
 iExpAnnotations_activate_cb( GtkMenuItem*, gpointer userdata)
 {
        auto& ED = *(SExpDesignUI*)userdata;
+       ED.suppress_redraw = true;
+       gtk_toggle_button_set_active( 
(GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents,  
ED.only_plain_global_annotations);
+       gtk_toggle_button_set_active( 
(GtkToggleButton*)ED.eGlobalAnnotationsShowPhasicEvents, 
!ED.only_plain_global_annotations);
+       ED.suppress_redraw = false;
        gtk_dialog_run( ED.wGlobalAnnotations);
 }
 
@@ -82,6 +86,18 @@ tvGlobalAnnotations_row_activated_cb( GtkTreeView* tree_view,
 
 
 
+void
+eGlobalAnnotationsShowPhasicEvents_toggled_cb( GtkToggleButton* b, gpointer 
userdata)
+{
+       auto& ED = *(SExpDesignUI*)userdata;
+       if ( ED.suppress_redraw )
+               return;
+       ED.only_plain_global_annotations = not gtk_toggle_button_get_active( b);
+       ED.populate_mGlobalAnnotations();
+}
+
+
+
 
 
 void
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index a586423..8a73980 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -138,6 +138,7 @@ SExpDesignUI (aghui::SSessionChooser *parent,
        finalize_ui (false),
        suppress_redraw (false),
        dl_pid (-1),
+       only_plain_global_annotations (true),
        close_this_SF_now (nullptr),
        display_profile_type (metrics::TType::psd),
        active_profile_psd_freq_from (2.),
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 1443459..f1becb8 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -197,6 +197,7 @@ class SExpDesignUI
        };
        forward_list<SAnnotation>
                global_annotations;
+       bool only_plain_global_annotations;
 
        // samplerates
        list<size_t>
diff --git a/src/ui/mw/mw_cb.hh b/src/ui/mw/mw_cb.hh
index 1cb36fb..38228de 100644
--- a/src/ui/mw/mw_cb.hh
+++ b/src/ui/mw/mw_cb.hh
@@ -52,6 +52,7 @@ void eMsmtProfileParamsSWUF0_value_changed_cb( 
GtkSpinButton*, gpointer);
 void eMsmtProfileParamsMCF0_value_changed_cb( GtkSpinButton*, gpointer);
 
 void tvGlobalAnnotations_row_activated_cb( GtkTreeView*, GtkTreePath*, 
GtkTreeViewColumn*, gpointer);
+void eGlobalAnnotationsShowPhasicEvents_toggled_cb( GtkToggleButton*, 
gpointer);
 
 void cGroupExpander_activate_cb( GtkExpander*, gpointer);
 void iiSubjectTimeline_show_cb( GtkWidget*, gpointer);
diff --git a/src/ui/mw/populate.cc b/src/ui/mw/populate.cc
index dca983d..b95d06f 100644
--- a/src/ui/mw/populate.cc
+++ b/src/ui/mw/populate.cc
@@ -256,7 +256,14 @@ __reconnect_sessions_combo()
 }
 
 
-
+inline namespace {
+const char*
+annotation_type_s( sigfile::SAnnotation::TType t)
+{
+       static const char* types[] = {"", "S", "K", "E"};
+       return types[t];
+}
+}
 
 void
 aghui::SExpDesignUI::
@@ -308,24 +315,28 @@ populate_mGlobalAnnotations()
                                                                            
mannotations_visibility_switch_col, TRUE,
                                                                            -1);
                                                }
-                                               for ( auto &A : annotations ) {
-
-                                                       
global_annotations.emplace_front( J, D.first, E, A);
-
-                                                       auto pages = 
A.page_span( pagesize()) * 1u;
-                                                       if ( pages.a == pages.z 
)
-                                                               snprintf_buf( 
"%u", pages.a + 1);
-                                                       else
-                                                               snprintf_buf( 
"%u-%u", pages.a + 1, pages.z + 1);
-                                                       gtk_tree_store_append( 
mGlobalAnnotations, &iter_a, &iter_e);
-                                                       gtk_tree_store_set( 
mGlobalAnnotations, &iter_a,
-                                                                           1, 
__buf__,
-                                                                           2, 
A.channel(),
-                                                                           3, 
A.label.c_str(),
-                                                                           
mannotations_ref_col, (gpointer)&global_annotations.front(),
-                                                                           
mannotations_visibility_switch_col, TRUE,
-                                                                           -1);
-                                               }
+
+                                               for ( auto &A : annotations )
+                                                       if ( 
(only_plain_global_annotations and
+                                                             A.type == 
sigfile::SAnnotation::plain) or
+                                                            not 
only_plain_global_annotations ) {
+                                                               
global_annotations.emplace_front( J, D.first, E, A);
+
+                                                               auto pages = 
A.page_span( pagesize()) * 1u;
+                                                               if ( pages.a == 
pages.z )
+                                                                       
snprintf_buf( "%u", pages.a + 1);
+                                                               else
+                                                                       
snprintf_buf( "%u-%u", pages.a + 1, pages.z + 1);
+                                                               
gtk_tree_store_append( mGlobalAnnotations, &iter_a, &iter_e);
+                                                               
gtk_tree_store_set( mGlobalAnnotations, &iter_a,
+                                                                               
    1, __buf__,
+                                                                               
    2, A.channel(),
+                                                                               
    3, annotation_type_s(A.type),
+                                                                               
    4, A.label.c_str(),
+                                                                               
    mannotations_ref_col, (gpointer)&global_annotations.front(),
+                                                                               
    mannotations_visibility_switch_col, TRUE,
+                                                                               
    -1);
+                                                       }
                                        }
                                }
                        }
diff --git a/src/ui/mw/widgets.hh b/src/ui/mw/widgets.hh
index 5d2de3a..37856d8 100644
--- a/src/ui/mw/widgets.hh
+++ b/src/ui/mw/widgets.hh
@@ -63,7 +63,7 @@ struct SExpDesignUIWidgets {
                msimulations_visibility_switch_col = 14,
                msimulations_modref_col = msimulations_visibility_switch_col + 
1;
        static const auto
-               mannotations_visibility_switch_col = 4,
+               mannotations_visibility_switch_col = 5,
                mannotations_ref_col = mannotations_visibility_switch_col + 1;
 
       // misc
@@ -278,6 +278,8 @@ struct SExpDesignUIWidgets {
                *wGlobalAnnotations;
        GtkTreeView
                *tvGlobalAnnotations;
+       GtkCheckButton
+               *eGlobalAnnotationsShowPhasicEvents;
 
        // subject details
        GtkDialog

-- 
Sleep experiment manager

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

Reply via email to