The following commit has been merged in the master branch:
commit 04a910c3d9820a2e9b700308a9ba89ee1d266568
Author: Andrei Zavada <[email protected]>
Date:   Sun Feb 3 11:59:43 2013 +0200

    decruft, ICM and strings touchup

diff --git a/data/mw-dialogs.glade b/data/mw-dialogs.glade
index 3cc10ee..d6699bd 100644
--- a/data/mw-dialogs.glade
+++ b/data/mw-dialogs.glade
@@ -321,7 +321,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkLabel" id="lVersion">
+                  <object class="GtkLabel" id="lAboutVersion">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="valign">start</property>
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index b0ac3c1..c21efce 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -185,8 +185,10 @@ CEDFFile (const char *fname_, int flags_)
                                        aa, az,
                                        agh::str::trim(an),
                                        (SAnnotation::TType)type);
-                       else
+                       else {
+                               fprintf( stderr, "Bad annotation: (%d %zu %zu 
%50s)\n", type, aa, az, an.c_str());
                                break;
+                       }
                }
                H.annotations.sort();
        }
diff --git a/src/metrics/phasic-events.hh b/src/metrics/phasic-events.hh
deleted file mode 100644
index 8d03a88..0000000
--- a/src/metrics/phasic-events.hh
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *       File name:  metrics/phasic-events.hh
- *         Project:  Aghermann
- *          Author:  Andrei Zavada <[email protected]>
- *
- * Initial version:  2013-01-03
- *
- *         Purpose:  CPhasicEventEstimator and related stuff
- *
- *         License:  GPL
- */
-
-#ifndef _METRICS_PHASIC_EVENTS_H
-#define _METRICS_PHASIC_EVENTS_H
-
-#include <list>
-
-#include "common/alg.hh"
-#include "libsigfile/source.hh"
-#include "forward-decls.hh"
-
-#if HAVE_CONFIG_H && !defined(VERSION)
-#  include "config.h"
-#endif
-
-using namespace std;
-
-namespace metrics {
-namespace phasic {
-
-enum TEventTypes {
-       spindle,
-       K_complex
-};
-
-template <typename T>
-list<agh::alg::SSpan<double>>
-detect_spindles( const sigfile::SNamedChannel<T>&);
-
-template <typename T>
-list<agh::alg::SSpan<double>>
-detect_Kcomplexes( const sigfile::SNamedChannel<T>&);
-
-
-#include "phasic-events.ii"
-
-} // namespace phasic
-} // namespace metrics
-
-
-#endif // _METRICS_PHASIC_EVENTS_H
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: 8
-// End:
diff --git a/src/metrics/phasic-events.ii b/src/metrics/phasic-events.ii
deleted file mode 100644
index dba81c2..0000000
--- a/src/metrics/phasic-events.ii
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *       File name:  metrics/phasic-events.ii
- *         Project:  Aghermann
- *          Author:  Andrei Zavada <[email protected]>
- * Initial version:  2013-01-04
- *
- *         Purpose:  phasic event detection
- *
- *         License:  GPL
- */
-
-
-template <typename T>
-list<agh::alg::SSpan<double>>
-detect_spindles( const sigfile::SNamedChannel<T>&)
-{
-       list<agh::alg::SSpan<double>> ret;
-       
-       return ret;
-}
-
-template <typename T>
-list<agh::alg::SSpan<double>>
-detect_Kcomplexes( const sigfile::SNamedChannel<T>&)
-{
-       list<agh::alg::SSpan<double>> ret;
-       
-       return ret;
-}
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: 8
-// End:
diff --git a/src/ui/mw/construct.cc b/src/ui/mw/construct.cc
index 65a4dfd..106f4cb 100644
--- a/src/ui/mw/construct.cc
+++ b/src/ui/mw/construct.cc
@@ -507,8 +507,9 @@ SExpDesignUIWidgets ()
 
       // ========= child widgets
       // ----- wAbout
-       if ( !(AGH_GBGETOBJ (GtkDialog,         wAbout)) ||
-            !(AGH_GBGETOBJ (GtkNotebook,       cAboutTabs)) )
+       if ( !AGH_GBGETOBJ (GtkDialog,          wAbout) ||
+            !AGH_GBGETOBJ (GtkNotebook,        cAboutTabs) ||
+            !AGH_GBGETOBJ (GtkLabel,           lAboutVersion) )
                throw runtime_error ("Failed to construct widgets");
 
       // ------- wEDFFileDetails
diff --git a/src/ui/mw/measurements.cc b/src/ui/mw/measurements.cc
index 1731237..69194c3 100644
--- a/src/ui/mw/measurements.cc
+++ b/src/ui/mw/measurements.cc
@@ -60,7 +60,8 @@ void
 aghui::SExpDesignUI::SSubjectPresentation::
 draw_timeline( cairo_t *cr) const
 {
-       bool have_episodes = cprofile != nullptr && not 
cprofile->mm_list().empty();
+       bool have_episodes = cprofile && not cprofile->mm_list().empty();
+
        if ( not have_episodes ) {
                cairo_move_to( cr, 50, timeline_height()/2+9);
                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, 
CAIRO_FONT_WEIGHT_NORMAL);
diff --git a/src/ui/mw/measurements_cb.cc b/src/ui/mw/measurements_cb.cc
index 1bb54f6..0bf9495 100644
--- a/src/ui/mw/measurements_cb.cc
+++ b/src/ui/mw/measurements_cb.cc
@@ -1,4 +1,3 @@
-// ;-*-C++-*-
 /*
  *       File name:  ui/mw/mw-measurements_cb.cc
  *         Project:  Aghermann
@@ -226,5 +225,7 @@ iSubjectTimelineResetMontage_activate_cb( GtkMenuItem 
*checkmenuitem, gpointer u
 
 }
 
-// eof
-
+// Local Variables:
+// Mode: c++
+// indent-tabs-mode: 8
+// End:
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index a8e9d94..b9e1ef0 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -83,7 +83,7 @@ create_cprofile()
                tl_start = 
csubject.measurements[*_p._p._AghDi].episodes.front().start_rel;
        } catch (...) {  // can be invalid_argument (no recording in such 
session/channel) or some TSimPrepError
                cprofile = nullptr;
-               fprintf( stderr, "SSubjectPresentation::SSubjectPresentation(): 
subject %s has no recordings in session %s channel %s\n",
+               fprintf( stderr, "SSubjectPresentation::SSubjectPresentation(): 
subject \"%s\" has no recordings in session \"%s\" channel \"%s\"\n",
                         csubject.short_name.c_str(), _p._p.AghD(), 
_p._p.AghT());
        }
 }
@@ -385,10 +385,9 @@ figure_binsize_item()
 aghui::SExpDesignUI::
 ~SExpDesignUI ()
 {
-       if ( dl_pid > 0 ) {
-               fprintf( stderr, "killing dl process %d\n", dl_pid);
+       if ( dl_pid > 0 )
                kill( dl_pid, SIGTERM);
-       }
+
        save_settings();
        save_artifact_detection_profiles();
        delete ED;
diff --git a/src/ui/mw/simulations.cc b/src/ui/mw/simulations.cc
index 054e850..7062e77 100644
--- a/src/ui/mw/simulations.cc
+++ b/src/ui/mw/simulations.cc
@@ -110,7 +110,7 @@ populate_2()
                                                            -1);
                                } else {
                                        gtk_tree_store_set( mSimulations, 
&iter_h,
-                                                           1, "(untried)",
+                                                           1, "(untried — 
click to run)",
                                                            
msimulations_modref_col, virgin,
                                                            -1);
                                }
diff --git a/src/ui/mw/widgets.hh b/src/ui/mw/widgets.hh
index 23269ff..154a3a0 100644
--- a/src/ui/mw/widgets.hh
+++ b/src/ui/mw/widgets.hh
@@ -234,6 +234,8 @@ struct SExpDesignUIWidgets {
                *wAbout;
        GtkNotebook
                *cAboutTabs;
+       GtkLabel
+               *lAboutVersion;
 
        // scan log
        GtkDialog
diff --git a/src/ui/sf/channel.cc b/src/ui/sf/channel.cc
index 7b43068..cd8eef3 100644
--- a/src/ui/sf/channel.cc
+++ b/src/ui/sf/channel.cc
@@ -145,10 +145,6 @@ SChannel( agh::CRecording& r,
        } else if ( type == sigfile::SChannel::TType::emg )
                get_raw_profile();
 
-      // prevent exceptions from phasic_events.at
-       phasic_events[metrics::phasic::TEventTypes::spindle].clear();
-       phasic_events[metrics::phasic::TEventTypes::K_complex].clear();
-
       // let it be so to avoid libconfig::readFile throwing exceptions
        psd.display_scale = mc.display_scale = swu.display_scale =
                emg_display_scale = DBL_MIN;
@@ -507,7 +503,7 @@ mark_region_as_pattern()
 
 void
 aghui::SScoringFacility::SChannel::
-update_channel_check_menu_items()
+update_channel_menu_items( double x)
 {
        _p.suppress_redraw = true;
 
@@ -545,12 +541,23 @@ update_channel_check_menu_items()
        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawMCProfile,   is_eeg);
        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGProfile,  is_emg);
 
+       double cpos = _p.time_at_click( x);
+
+       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageHidden, _p.n_hidden > 0);
+
+       bool have_any = not annotations.empty();
+       bool over_any = not (_p.over_annotations = in_annotations( cpos)) . 
empty();
+       gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageAnnotation, have_any);
+       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationEdit, over_any);
+       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationDelete, 
over_any);
+       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationSeparator, 
over_any);
+
        _p.suppress_redraw = false;
 }
 
 void
 aghui::SScoringFacility::SChannel::
-update_power_check_menu_items()
+update_power_menu_items()
 {
        _p.suppress_redraw = true;
        gtk_check_menu_item_set_active( _p.iSFPageDrawEMGProfile, 
(gboolean)draw_emg);
@@ -565,18 +572,6 @@ update_power_check_menu_items()
 }
 
 
-void
-aghui::SScoringFacility::SChannel::
-selectively_enable_page_menu_items( double x)
-{
-       double cpos = _p.time_at_click( x);
-
-       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageHidden, _p.n_hidden > 0);
-       bool over_any =
-               not (_p.over_annotations = in_annotations( cpos)) . empty();
-       gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageAnnotation, over_any);
-       gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationSeparator, 
over_any);
-}
 
 void
 aghui::SScoringFacility::SChannel::
diff --git a/src/ui/sf/montage-overlays.cc b/src/ui/sf/montage-overlays.cc
index d35a1c8..3d49751 100644
--- a/src/ui/sf/montage-overlays.cc
+++ b/src/ui/sf/montage-overlays.cc
@@ -23,13 +23,15 @@ aghui::SScoringFacility::SChannel::
 draw_overlays( cairo_t* cr,
               int wd, float zeroy) const
 {
+       if ( _p.mode != TMode::scoring )
+               return;
+
        float   pbot = zeroy + _p.interchannel_gap / 2.2,
                ptop = zeroy - _p.interchannel_gap / 2.2;
        bool    overlay = false;
 
        // PSD profile
-       if ( _p.mode == TMode::scoring and
-            draw_psd and type == sigfile::SChannel::TType::eeg ) {
+       if ( draw_psd and type == sigfile::SChannel::TType::eeg ) {
                overlay = true;
 
                cairo_set_line_width( cr, 1.);
@@ -173,8 +175,7 @@ draw_overlays( cairo_t* cr,
                }
        }
 
-       if ( _p.mode == TMode::scoring and
-            draw_mc and type == sigfile::SChannel::TType::eeg ) {
+       if ( draw_mc and type == sigfile::SChannel::TType::eeg ) {
                overlay = true;
 
                cairo_set_line_width( cr, 1.);
@@ -221,8 +222,7 @@ draw_overlays( cairo_t* cr,
 
        }
 
-       if ( _p.mode == TMode::scoring and
-            draw_swu and type == sigfile::SChannel::TType::eeg ) {
+       if ( draw_swu and type == sigfile::SChannel::TType::eeg ) {
                overlay = true;
 
                cairo_set_line_width( cr, 1.);
@@ -276,7 +276,7 @@ draw_overlays( cairo_t* cr,
        }
 
       // EMG profile
-       if ( _p.mode == TMode::scoring and draw_emg and
+       if ( draw_emg and
             type == sigfile::SChannel::TType::emg ) {
                overlay = true;
 
@@ -319,7 +319,7 @@ draw_overlays( cairo_t* cr,
        }
 
       // samples per pixel
-       if ( _p.mode == TMode::scoring and resample_signal ) {
+       if ( resample_signal ) {
                _p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
                cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, 
CAIRO_FONT_WEIGHT_BOLD);
                cairo_set_font_size( cr, 8);
diff --git a/src/ui/sf/montage_cb.cc b/src/ui/sf/montage_cb.cc
index 99ed059..88eb077 100644
--- a/src/ui/sf/montage_cb.cc
+++ b/src/ui/sf/montage_cb.cc
@@ -61,10 +61,12 @@ radio_item_setter( GtkWidget *i, gpointer u)
 }
 } // inline namespace
 
+
 gboolean
 daSFMontage_button_press_event_cb( GtkWidget *wid, GdkEventButton *event, 
gpointer userdata)
 {
        auto& SF = *(SScoringFacility*)userdata;
+
        if ( SF.mode == aghui::SScoringFacility::TMode::showing_ics ) {
                if ( SF.ica_components.size() == 0 )
                        return TRUE;
@@ -92,6 +94,7 @@ daSFMontage_button_press_event_cb( GtkWidget *wid, 
GdkEventButton *event, gpoint
                }
                return TRUE;
        }
+
        if ( SF.mode == aghui::SScoringFacility::TMode::showing_remixed ) {
                if ( SF.ica_components.size() == 0 )
                        return TRUE;
@@ -124,7 +127,7 @@ daSFMontage_button_press_event_cb( GtkWidget *wid, 
GdkEventButton *event, gpoint
                        gtk_widget_queue_draw( wid);
                    break;
                case 3:
-                       Ch->update_power_check_menu_items();
+                       Ch->update_power_menu_items();
                        gtk_menu_popup( SF.iiSFPower,
                                        NULL, NULL, NULL, NULL, 3, event->time);
                    break;
@@ -160,9 +163,8 @@ daSFMontage_button_press_event_cb( GtkWidget *wid, 
GdkEventButton *event, gpoint
                                gtk_menu_popup( SF.iiSFPageHidden,
                                                NULL, NULL, NULL, NULL, 3, 
event->time);
                        else {
-                               Ch->selectively_enable_page_menu_items( 
event->x);
-                               Ch->update_channel_check_menu_items();
-                               Ch->update_power_check_menu_items();
+                               Ch->update_channel_menu_items( event->x);
+                               Ch->update_power_menu_items();
                                double cpos = SF.time_at_click( event->x);
                                gtk_menu_popup( agh::alg::overlap(
                                                        
Ch->selection_start_time, Ch->selection_end_time,
@@ -295,7 +297,7 @@ daSFMontage_button_release_event_cb( GtkWidget *wid, 
GdkEventButton *event, gpoi
                        Ch->put_selection( Ch->selection_start, 
Ch->selection_end);
                        gtk_widget_queue_draw( wid);
                        Ch->selectively_enable_selection_menu_items();
-                       Ch->update_channel_check_menu_items();
+                       Ch->update_channel_menu_items( event->x);
                        if ( fabs(SF.using_channel->marquee_mstart - 
SF.using_channel->marquee_mend) > 5 ) {
                                gtk_menu_popup( SF.iiSFPageSelection,
                                                NULL, NULL, NULL, NULL, 3, 
event->time);
@@ -777,6 +779,9 @@ iSFPageUseThisScale_activate_cb( GtkMenuItem *menuitem, 
gpointer userdata)
 }
 
 
+
+
+
 void
 iSFPageAnnotationDelete_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
 {
@@ -809,7 +814,7 @@ iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, 
gpointer userdata)
                (SF.over_annotations.size() == 1)
                ? SF.over_annotations.front()
                : SF.interactively_choose_annotation();
-       if ( which == NULL )
+       if ( not which )
                return;
 
        gtk_entry_set_text( SF.eSFAnnotationLabel, which->label.c_str());
diff --git a/src/ui/sf/phasic-events.cc b/src/ui/sf/phasic-events.cc
deleted file mode 100644
index 481016f..0000000
--- a/src/ui/sf/phasic-events.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *       File name:  ui/sf/phasic-events.cc
- *         Project:  Aghermann
- *          Author:  Andrei Zavada <[email protected]>
- * Initial version:  2013-01-04
- *
- *         Purpose:  scoring facility: phasic events
- *
- *         License:  GPL
- */
-
-#include "sf.hh"
-// I'd rather have these two includes in the reverse order, except
-// that g++ takes an issue with namespace sigproc, which appears in
-// sigproc/sigproc.hh and, independently, in sigproc/winfun.hh.
-//
-// This is what I get if winfun.hh comes first:
-//
-// In file included from sf-phasic-events.cc:14:
-// sf.hh:121: error: 'SCachedLowPassCourse' in namespace 'sigproc' does not 
name a type
-// sf.hh:123: error: 'SCachedBandPassCourse' in namespace 'sigproc' does not 
name a type
-// sf.hh:125: error: 'SCachedEnvelope' in namespace 'sigproc' does not name a 
type
-// sf.hh:127: error: 'SCachedDzcdf' in namespace 'sigproc' does not name a type
-//
-// No idea why they, being included in this order: winfun.hh, sigproc.hh,
-// cause g++ do forget all declarations from the latter.
-#include "metrics/phasic-events.hh"
-
-using namespace std;
-
-void
-aghui::SScoringFacility::SChannel::
-get_phasic_events()
-{
-       using namespace metrics::phasic;
-       auto H = sigfile::SNamedChannel<int> (crecording.F(), _h);
-       phasic_events[TEventTypes::spindle] =
-               detect_spindles( H);
-       phasic_events[TEventTypes::K_complex] =
-               detect_Kcomplexes( H);
-}
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: 8
-// End:
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 94f3481..7ef7bc9 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -630,9 +630,6 @@ load_montage()
                         ex.getLine(), ex.getError());
                return;
        } catch (libconfig::FileIOException ex) {
-               fprintf( stderr, "Failed reading montage file %s: %s\n",
-                        montage_file.c_str(),
-                        "ubuntu people please upgrade your libconfig to see 
this message"); // ex.what());
                return;
        }
        confval::get( config_keys_b, conf);
@@ -680,13 +677,6 @@ save_montage()
        }
 }
 
-void
-aghui::SScoringFacility::
-reset_montage()
-{
-       FAFA;
-}
-
 
 
 void
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index b7bb730..a4e9522 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -24,7 +24,6 @@
 #include "sigproc/sigproc.hh"
 #include "patterns/patterns.hh"
 #include "metrics/mc-artifacts.hh"
-#include "metrics/phasic-events.hh"
 #include "expdesign/primaries.hh"
 #include "ica/ica.hh"
 #include "ui/globals.hh"
@@ -199,11 +198,6 @@ class SScoringFacility
              // emg
                double  emg_display_scale;
 
-             // phasic events
-               map<metrics::phasic::TEventTypes, list<agh::alg::SSpan<double>>>
-                       phasic_events;
-               void get_phasic_events();
-
              // region
                void mark_region_as_artifact( bool do_mark);
                void mark_region_as_annotation( const char*, 
sigfile::SAnnotation::TType);
@@ -249,9 +243,8 @@ class SScoringFacility
                forward_list<confval::SValidator<bool>>         config_keys_b;
                forward_list<confval::SValidator<int>>          config_keys_d;
                forward_list<confval::SValidator<double>>       config_keys_g;
-               void update_channel_check_menu_items();
-               void update_power_check_menu_items();
-               void selectively_enable_page_menu_items( double event_x);
+               void update_channel_menu_items( double x);
+               void update_power_menu_items();
                void selectively_enable_selection_menu_items();
 
              // selection and marquee
diff --git a/src/ui/sf/sf_cb.cc b/src/ui/sf/sf_cb.cc
index 7064a03..46213a1 100644
--- a/src/ui/sf/sf_cb.cc
+++ b/src/ui/sf/sf_cb.cc
@@ -250,7 +250,7 @@ iSFAcceptAndTakeNext_activate_cb( GtkMenuItem *menuitem, 
gpointer userdata)
 
 
 
-// ------- cleanup
+
 
 gboolean
 wSF_delete_event_cb( GtkWidget*, GdkEvent*, gpointer userdata)

-- 
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