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

andrei zavada johnhommer at gmail.com
Fri Nov 16 00:50:24 UTC 2012


The following commit has been merged in the master branch:
commit 45a4d811378175f9124a88eb4eef709e5c15c797
Author: andrei zavada <johnhommer at gmail.com>
Date:   Sat Oct 20 17:39:31 2012 +0300

    WIP

diff --git a/data/sf.glade b/data/sf.glade
index 3abdf71..b4b5548 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -1,18 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkMenu" id="iiSFAccept">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="iSFAcceptAndTakeNext">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Accept and proceed to next episode</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-  </object>
   <object class="GtkAdjustment" id="jHighPassCutoff">
     <property name="upper">100</property>
     <property name="step_increment">0.25</property>
@@ -110,6 +98,18 @@
     <property name="step_increment">0.25</property>
     <property name="page_increment">1</property>
   </object>
+  <object class="GtkMenu" id="iiSFAccept">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="iSFAcceptAndTakeNext">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Accept and proceed to next episode</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
   <object class="GtkAdjustment" id="jSFADBackpolate">
     <property name="upper">1</property>
     <property name="value">0.5</property>
@@ -2924,15 +2924,15 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreWake">
-                        <property name="label" translatable="yes">☺</property>
+                      <object class="GtkButton" id="bScoreClear">
+                        <property name="label" translatable="yes">⌫</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="w" signal="activate"/>
+                        <accelerator key="q" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -2941,15 +2941,15 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreClear">
-                        <property name="label" translatable="yes">⌫</property>
+                      <object class="GtkButton" id="bScoreWake">
+                        <property name="label" translatable="yes">☺</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="q" signal="activate"/>
+                        <accelerator key="w" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -3184,17 +3184,18 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
-                        <property name="label" translatable="yes">Δφ</property>
+                      <object class="GtkToggleButton" id="bSFShowFindDialog">
+                        <property name="label" translatable="yes">_Find</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
+                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
                         <property name="valign">center</property>
+                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F4" signal="activate"/>
+                        <accelerator key="F3" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -3204,18 +3205,17 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowFindDialog">
-                        <property name="label" translatable="yes">_Find</property>
+                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
+                        <property name="label" translatable="yes">Δφ</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
+                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
                         <property name="valign">center</property>
-                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F3" signal="activate"/>
+                        <accelerator key="F4" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -4011,6 +4011,7 @@ skew:	𝑔(𝑢) = 𝑢2</property>
     <property name="transient_for">wScoringFacility</property>
     <signal name="close" handler="gtk_widget_hide" swapped="no"/>
     <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <signal name="response" handler="gtk_widget_hide" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox9">
         <property name="can_focus">False</property>
@@ -4950,7 +4951,17 @@ skew:	𝑔(𝑢) = 𝑢2</property>
               <placeholder/>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkLabel" id="lSFADDirtyPercent">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">label</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">13</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
             </child>
           </object>
           <packing>
diff --git a/src/ui/ed-construct.cc b/src/ui/ed-construct.cc
index 0b05b5c..b755a9e 100644
--- a/src/ui/ed-construct.cc
+++ b/src/ui/ed-construct.cc
@@ -169,55 +169,6 @@ SExpDesignUIWidgets ()
 			   NULL, 0, GDK_ACTION_COPY);
 	gtk_drag_dest_add_uri_targets( (GtkWidget*)(cMeasurements));
 
-	// annotations
-	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalAnnotations) ||
-	     !AGH_GBGETOBJ (GtkTreeView,	tvGlobalAnnotations) )
-		throw runtime_error ("Failed to construct widgets");
-	gtk_tree_view_set_model( tvGlobalAnnotations,
-				 (GtkTreeModel*)mGlobalAnnotations);
-
-	g_object_set( (GObject*)tvGlobalAnnotations,
-		      "expander-column", 0,
-		      NULL);
-	g_signal_connect( tvGlobalAnnotations, "map",
-			  (GCallback)gtk_tree_view_expand_all,
-			  NULL);
-	g_signal_connect( tvGlobalAnnotations, "row-activated",
-			  (GCallback)tvGlobalAnnotations_row_activated_cb,
-			  this);
-
-	renderer = gtk_cell_renderer_text_new();
-	for ( auto t = 0; t < mannotations_visibility_switch_col; ++t ) {
-		renderer = gtk_cell_renderer_text_new();
-		g_object_set( (GObject*)renderer,
-			      "editable", FALSE,
-			      NULL);
-		g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (t));
-		col = gtk_tree_view_column_new_with_attributes( mannotations_column_names[t],
-								renderer,
-								"text", t,
-								NULL);
-		gtk_tree_view_column_set_expand( col, TRUE);
-		gtk_tree_view_append_column( tvGlobalAnnotations, col);
-	}
-	gtk_tree_view_append_column( tvGlobalAnnotations,
-				     gtk_tree_view_column_new());
-
-	// artifact detection profiles
-	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalArtifactDetection) ||
-	     !AGH_GBGETOBJ (GtkComboBox,	eGlobalADProfiles) ||
-	     !AGH_GBGETOBJ (GtkCheckButton,	eGlobalADKeepExisting) )
-		throw runtime_error ("Failed to construct widgets");
-
-	gtk_combo_box_set_model( eGlobalADProfiles,
-				 (GtkTreeModel*)mGlobalADProfiles);
-	gtk_combo_box_set_id_column( eGlobalADProfiles, 0);
-
-	renderer = gtk_cell_renderer_text_new();
-	gtk_cell_layout_pack_start( (GtkCellLayout*)eGlobalADProfiles, renderer, FALSE);
-	gtk_cell_layout_set_attributes( (GtkCellLayout*)eGlobalADProfiles, renderer,
-					"text", 0,
-					NULL);
 
      // --------- tabs
 	if ( !AGH_GBGETOBJ (GtkNotebook,	tTaskSelector) ||
@@ -758,6 +709,59 @@ SExpDesignUIWidgets ()
 	     !AGH_GBGETOBJ (GtkCheckButton,	eMontageDefaultsOverride) )
 		throw runtime_error ("Failed to construct widgets");
 
+      // ----------- annotations
+	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalAnnotations) ||
+	     !AGH_GBGETOBJ (GtkTreeView,	tvGlobalAnnotations) )
+		throw runtime_error ("Failed to construct widgets");
+	gtk_tree_view_set_model( tvGlobalAnnotations,
+				 (GtkTreeModel*)mGlobalAnnotations);
+
+	g_object_set( (GObject*)tvGlobalAnnotations,
+		      "expander-column", 0,
+		      NULL);
+	g_signal_connect( tvGlobalAnnotations, "map",
+			  (GCallback)gtk_tree_view_expand_all,
+			  NULL);
+	g_signal_connect( tvGlobalAnnotations, "row-activated",
+			  (GCallback)tvGlobalAnnotations_row_activated_cb,
+			  this);
+
+	renderer = gtk_cell_renderer_text_new();
+	for ( auto t = 0; t < mannotations_visibility_switch_col; ++t ) {
+		renderer = gtk_cell_renderer_text_new();
+		g_object_set( (GObject*)renderer,
+			      "editable", FALSE,
+			      NULL);
+		g_object_set_data( (GObject*)renderer, "column", GINT_TO_POINTER (t));
+		col = gtk_tree_view_column_new_with_attributes( mannotations_column_names[t],
+								renderer,
+								"text", t,
+								NULL);
+		gtk_tree_view_column_set_expand( col, TRUE);
+		gtk_tree_view_append_column( tvGlobalAnnotations, col);
+	}
+	gtk_tree_view_append_column( tvGlobalAnnotations,
+				     gtk_tree_view_column_new());
+
+      // ------------- artifact detection profiles
+	if ( !AGH_GBGETOBJ (GtkDialog,		wGlobalArtifactDetection) ||
+	     !AGH_GBGETOBJ (GtkComboBox,	eGlobalADProfiles) ||
+	     !AGH_GBGETOBJ (GtkCheckButton,	eGlobalADKeepExisting) )
+		throw runtime_error ("Failed to construct widgets");
+
+	gtk_combo_box_set_model( eGlobalADProfiles,
+				 (GtkTreeModel*)mGlobalADProfiles);
+	gtk_combo_box_set_id_column( eGlobalADProfiles, 0);
+
+	renderer = gtk_cell_renderer_text_new();
+	gtk_cell_layout_pack_start( (GtkCellLayout*)eGlobalADProfiles, renderer, FALSE);
+	gtk_cell_layout_set_attributes( (GtkCellLayout*)eGlobalADProfiles, renderer,
+					"text", 0,
+					NULL);
+
+	g_signal_connect( eGlobalADProfiles, "changed",
+			  (GCallback)eGlobalADProfiles_changed_cb,
+			  this);
 	pango_font_description_free( font_desc);
 }
 
diff --git a/src/ui/ed-widgets.hh b/src/ui/ed-widgets.hh
index cab26b9..aafff37 100644
--- a/src/ui/ed-widgets.hh
+++ b/src/ui/ed-widgets.hh
@@ -308,6 +308,8 @@ struct SExpDesignUIWidgets {
 		*eGlobalADProfiles;
 	GtkCheckButton
 		*eGlobalADKeepExisting;
+	GtkButton
+		*bGlobalADOK;
 
       // colours
 	enum TColour {
diff --git a/src/ui/ed_cb.cc b/src/ui/ed_cb.cc
index bde48c2..12f5ac1 100644
--- a/src/ui/ed_cb.cc
+++ b/src/ui/ed_cb.cc
@@ -142,82 +142,102 @@ iExpGloballyDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
 {
 	auto& ED = *(SExpDesignUI*)userdata;
 
-	if ( GTK_RESPONSE_OK ==
-	     gtk_dialog_run( ED.wGlobalArtifactDetection) ) {
-		auto& P = ED.global_artifact_detection_profiles[
-			gtk_combo_box_get_active_id(ED.eGlobalADProfiles)];
-		bool keep_existing = gtk_toggle_button_get_active( (GtkToggleButton*)ED.eGlobalADKeepExisting);
-
-		using namespace agh;
-		CExpDesign::TRecordingOpFun F =
-			[&]( CRecording& R)
-			{
-				auto& F = R.F();
-				for ( auto& H : R.F().channel_list() ) {
-					auto	sr = F.samplerate(H.c_str());
-					auto	af = F.artifacts(H.c_str());
-
-					auto	signal_original
-						= F.get_signal_original(H.c_str());
-					auto	sssu =
-						sigfile::CBinnedMC::do_sssu_reduction(
-							signal_original,
-							sr, P.scope,
-							P.mc_gain, P.iir_backpolate,
-							P.f0, P.fc, P.bandwidth);
-					valarray<TFloat>
-						sssu_diff =
-						{sssu.first - sssu.second};
-
-					sigproc::smooth( sssu_diff, P.smooth_side);
-
-					double E;
-					if ( P.estimate_E )
-						E = P.use_range
-							? sigfile::CBinnedMC::estimate_E(
-								sssu_diff,
-								P.sssu_hist_size,
-								P.dmin, P.dmax)
-							: sigfile::CBinnedMC::estimate_E(
-								sssu_diff,
-								P.sssu_hist_size);
-					else
-						E = P.E;
-
-					auto marked =
-					sigfile::CBinnedMC::detect_artifacts(
+	if ( GTK_RESPONSE_OK !=
+	     gtk_dialog_run( ED.wGlobalArtifactDetection) )
+		return; // just to save on indents in those lambdas below
+
+	auto& P = ED.global_artifact_detection_profiles[
+		gtk_combo_box_get_active_id(ED.eGlobalADProfiles)];
+	bool keep_existing = gtk_toggle_button_get_active( (GtkToggleButton*)ED.eGlobalADKeepExisting);
+
+	using namespace agh;
+	CExpDesign::TRecordingOpFun F =
+		[&]( CRecording& R)
+		{
+			auto& F = R.F();
+			for ( auto& H : R.F().channel_list() ) {
+				auto	sr = F.samplerate(H.c_str());
+				auto&	af = F.artifacts(H.c_str());
+
+				auto	signal_original
+					= F.get_signal_original(H.c_str());
+				auto	sssu =
+					sigfile::CBinnedMC::do_sssu_reduction(
+						signal_original,
+						sr, P.scope,
+						P.mc_gain, P.iir_backpolate,
+						P.f0, P.fc, P.bandwidth);
+				valarray<TFloat>
+					sssu_diff
+					= {sssu.first - sssu.second};
+
+				sigproc::smooth( sssu_diff, P.smooth_side);
+
+				double E;
+				if ( P.estimate_E )
+					E = P.use_range
+						? sigfile::CBinnedMC::estimate_E(
+							sssu_diff,
+							P.sssu_hist_size,
+							P.dmin, P.dmax)
+						: sigfile::CBinnedMC::estimate_E(
+							sssu_diff,
+							P.sssu_hist_size);
+				else
+					E = P.E;
+
+				auto	marked
+					= sigfile::CBinnedMC::detect_artifacts(
 						sssu_diff,
 						P.upper_thr, P.lower_thr,
 						E);
-					if ( not keep_existing )
-						af.clear_all();
-					for ( size_t p = 0; p < marked.size(); ++p )
-						af.mark_artifact(
-							marked[p] * P.scope * sr, (marked[p]+1) * P.scope * sr);
-				}
-			};
-		CExpDesign::TRecordingReportFun G =
-			[&]( const CJGroup&, const CSubject& J, const string&, const CSubject::SEpisode& E, const CRecording& R,
-			     size_t i, size_t total)
-			{
-				snprintf_buf(
-					"(%zu of %zu) Detect artifacts in %s/%s/%s:%s", i, total,
-					ED.ED->group_of(J), J.name(), E.name(), R.F().channel_by_id(R.h()));
-				ED.buf_on_main_status_bar();
-				gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
-				gdk_window_process_updates(
-					gtk_widget_get_parent_window( (GtkWidget*)ED.cMeasurements),
-					TRUE);
-			};
-		CExpDesign::TRecordingFilterFun filter =
-			[&]( CRecording& R)
-			{
-				return R.signal_type() == sigfile::SChannel::TType::eeg;
-			};
-		ED.ED -> for_all_recordings( F, G, filter);
+				if ( not keep_existing )
+					af.clear_all();
+				for ( size_t p = 0; p < marked.size(); ++p )
+					af.mark_artifact(
+						marked[p] * P.scope * sr,
+						(marked[p]+1) * P.scope * sr);
+			}
+		};
+	CExpDesign::TRecordingReportFun G =
+		[&]( const CJGroup&, const CSubject& J, const string&, const CSubject::SEpisode& E, const CRecording& R,
+		     size_t i, size_t total)
+		{
+			snprintf_buf(
+				"(%zu of %zu) Detect artifacts in %s/%s/%s:%s", i, total,
+				ED.ED->group_of(J), J.name(), E.name(), R.F().channel_by_id(R.h()));
+			ED.buf_on_main_status_bar();
+			gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+			gdk_window_process_updates(
+				gtk_widget_get_parent_window( (GtkWidget*)ED.cMeasurements),
+				TRUE);
+		};
+	CExpDesign::TRecordingFilterFun filter =
+		[&]( CRecording& R)
+		{
+			return R.signal_type() == sigfile::SChannel::TType::eeg;
+		};
+
+	ED.ED -> for_all_recordings( F, G, filter);
+
+	for ( auto& SF : ED.open_scoring_facilities ) {
+		for ( auto& H : SF->channels )
+			if ( H.type == sigfile::SChannel::TType::eeg )
+				H.get_signal_filtered();
+		SF->queue_redraw_all();
 	}
 }
 
+void
+eGlobalADProfiles_changed_cb( GtkComboBox *b, gpointer userdata)
+{
+	auto& ED = *(SExpDesignUI*)userdata;
+
+	gtk_widget_set_sensitive(
+		(GtkWidget*)ED.bGlobalADOK,
+		ED.global_artifact_detection_profiles.size() > 0);
+}
+
 
 
 void
diff --git a/src/ui/ed_cb.hh b/src/ui/ed_cb.hh
index fb04506..d5825e5 100644
--- a/src/ui/ed_cb.hh
+++ b/src/ui/ed_cb.hh
@@ -29,6 +29,7 @@ void iExpPurgeComputed_activate_cb( GtkMenuItem*, gpointer);
 void iExpAnnotations_activate_cb( GtkMenuItem*, gpointer);
 void iExpBasicSADetectUltradianCycles_activate_cb( GtkMenuItem*, gpointer);
 void iExpGloballyDetectArtifacts_activate_cb( GtkMenuItem*, gpointer);
+void eGlobalADProfiles_changed_cb( GtkComboBox*, gpointer);
 void iExpClose_activate_cb( GtkMenuItem*, gpointer);
 void iExpQuit_activate_cb( GtkMenuItem*, gpointer);
 void iMontageSetDefaults_activate_cb( GtkMenuItem*, gpointer);
diff --git a/src/ui/sf-artifacts.cc b/src/ui/sf-artifacts.cc
index f7a6033..212f695 100644
--- a/src/ui/sf-artifacts.cc
+++ b/src/ui/sf-artifacts.cc
@@ -37,8 +37,6 @@ SArtifactDetectionDialog (aghui::SScoringFacility& p_)
 	W_V.reg( _p.eSFADHistBins,	(int*)&P.sssu_hist_size);
 	W_V.reg( _p.eSFADSmoothSide,	(int*)&P.smooth_side);
 	W_V.reg( _p.eSFADUseThisRange,	&P.use_range);
-
-	W_V.up();
 }
 
 
diff --git a/src/ui/sf-artifacts_cb.cc b/src/ui/sf-artifacts_cb.cc
index e7f15fd..be091f4 100644
--- a/src/ui/sf-artifacts_cb.cc
+++ b/src/ui/sf-artifacts_cb.cc
@@ -10,6 +10,7 @@
  *         License:  GPL
  */
 
+#include "misc.hh"
 #include "sf.hh"
 #include "sf_cb.hh"
 
@@ -20,16 +21,18 @@ using namespace aghui;
 
 
 void
-eSFADProfiles_changed_cb( GtkComboBox* b, gpointer userdata)
+eSFADProfiles_changed_cb( GtkComboBox* w, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& AD = SF.artifact_detection_dialog;
 
-	if ( gtk_combo_box_get_active( b) != -1 ) {
+	if ( gtk_combo_box_get_active( w) != -1 ) {
 		AD.P = SF._p.global_artifact_detection_profiles[
-			gtk_combo_box_get_active_id(b)];
+			gtk_combo_box_get_active_id(w)];
 		AD.W_V.up();
-	}
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADProfileDelete, TRUE);
+	} else
+		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADProfileDelete, FALSE);
 }
 
 void
@@ -70,7 +73,7 @@ bSFADProfileDelete_clicked_cb( GtkButton*, gpointer userdata)
 	     deleting > SF._p.global_artifact_detection_profiles.size()-1 )
 		gtk_combo_box_set_active( SF.eSFADProfiles, deleting-1);
 
-	g_signal_emit_by_name( SF.eSFADProfiles, "clocked");
+	g_signal_emit_by_name( SF.eSFADProfiles, "clicked");
 }
 
 
@@ -180,8 +183,21 @@ bSFADPreview_toggled_cb( GtkToggleButton *b, gpointer userdata)
 
 	SF.using_channel -> get_signal_filtered();
 
+	snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100);
+	gtk_label_set_markup( SF.lSFADDirtyPercent, __buf__);
+
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
 
+
+gboolean
+wSFArtifactDetection_delete_event_cb(GtkWidget*, GdkEvent*, gpointer userdata)
+{
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& AD = SF.artifact_detection_dialog;
+
+	return FALSE;
+}
+
 // eof
diff --git a/src/ui/sf-construct.cc b/src/ui/sf-construct.cc
index 6a960d9..0ed2c04 100644
--- a/src/ui/sf-construct.cc
+++ b/src/ui/sf-construct.cc
@@ -59,7 +59,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkToggleButton,	bSFShowPhaseDiffDialog)) ||
 	     !(AGH_GBGETOBJ (GtkToggleButton,	bSFDrawCrosshair)) ||
 	     !(AGH_GBGETOBJ (GtkButton,		bSFRunICA)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	g_signal_connect( wScoringFacility, "delete-event",
 			  (GCallback)wScoringFacility_delete_event_cb,
@@ -132,7 +132,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsNREMPercent)) ||
 	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsREMPercent)) ||
 	     !(AGH_GBGETOBJ (GtkLabel,		lScoreStatsWakePercent)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	g_signal_connect( bScoreClear, "clicked",
 			  (GCallback)bScoreClear_clicked_cb,
@@ -162,7 +162,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkMenu,		iiSFAccept)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,	iSFAcceptAndTakeNext)) ||
 	     !(AGH_GBGETOBJ (GtkStatusbar,	sbSF)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	sbSFContextIdGeneral = gtk_statusbar_get_context_id( sbSF, "General context");
 
@@ -238,7 +238,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkButton,		bSFICACancel)) ||
 	     !(AGH_GBGETOBJ (GtkDialog,		wSFICAMatrix)) ||
 	     !(AGH_GBGETOBJ (GtkTextView,	tSFICAMatrix)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	gtk_combo_box_set_model( eSFICANonlinearity,
 				 (GtkTreeModel*)mSFICANonlinearity);
@@ -391,7 +391,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreImport)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreExport)) ||
 	     !(AGH_GBGETOBJ (GtkMenuItem,		iSFScoreClear)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	gtk_menu_item_set_submenu( iSFPageHidden, (GtkWidget*)mSFPageHidden);
 
@@ -558,12 +558,13 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkTable,			cSFADWhenEstimateEOn)) ||
 	     !(AGH_GBGETOBJ (GtkTable,			cSFADWhenEstimateEOff)) ||
 	     !(AGH_GBGETOBJ (GtkLabel,			lSFADInfo)) ||
+	     !(AGH_GBGETOBJ (GtkLabel,			lSFADDirtyPercent)) ||
 	     !(AGH_GBGETOBJ (GtkToggleButton,		bSFADPreview)) ||
 	     !(AGH_GBGETOBJ (GtkButton,			bSFADApply)) ||
 	     !(AGH_GBGETOBJ (GtkButton,			bSFADCancel)) ||
 	     !(AGH_GBGETOBJ (GtkDialog,			wSFADSaveProfileName)) ||
 	     !(AGH_GBGETOBJ (GtkEntry,			eSFADSaveProfileNameName)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	mSFADProfiles = gtk_list_store_new( 1, G_TYPE_STRING);
 	// this GtkListStore is populated from the same source, but something
@@ -634,7 +635,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !AGH_GBGETOBJ (GtkDialog,		wPatternName) ||
 	     !AGH_GBGETOBJ (GtkEntry,		ePatternNameName) ||
 	     !AGH_GBGETOBJ (GtkCheckButton,	ePatternNameSaveGlobally) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	gtk_combo_box_set_model( ePatternList,
 				 (GtkTreeModel*)mPatterns);
@@ -730,7 +731,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkComboBox,	eFilterNotchFilter)) ||
 	     !(AGH_GBGETOBJ (GtkListStore,	mFilterNotchFilter)) ||
 	     !(AGH_GBGETOBJ (GtkButton,		bFilterOK)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	gtk_combo_box_set_model( eFilterNotchFilter,
 				 (GtkTreeModel*)mFilterNotchFilter);
@@ -756,7 +757,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFPDFreqFrom)) ||
 	     !(AGH_GBGETOBJ (GtkSpinButton,	eSFPDBandwidth)) ||
 	     !(AGH_GBGETOBJ (GtkScaleButton,	eSFPDSmooth)) )
-		throw runtime_error ("Failed to contruct SF widgets");
+		throw runtime_error ("Failed to construct SF widgets");
 
 	gtk_combo_box_set_model( eSFPDChannelA,
 				 (GtkTreeModel*)_p.mEEGChannels);
diff --git a/src/ui/sf-montage_cb.cc b/src/ui/sf-montage_cb.cc
index 3228b43..7d15551 100644
--- a/src/ui/sf-montage_cb.cc
+++ b/src/ui/sf-montage_cb.cc
@@ -637,6 +637,9 @@ iSFPageDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& AD = SF.artifact_detection_dialog;
 
+	AD.W_V.up();
+	SF.populate_mSFADProfiles();
+
 	g_signal_emit_by_name( SF.eSFADEstimateE, "toggled");
 	g_signal_emit_by_name( SF.eSFADEstimateE, "toggled");
 	g_signal_emit_by_name( SF.eSFADUseThisRange, "toggled");
diff --git a/src/ui/sf-widgets.hh b/src/ui/sf-widgets.hh
index ae804a6..da59ffd 100644
--- a/src/ui/sf-widgets.hh
+++ b/src/ui/sf-widgets.hh
@@ -271,7 +271,8 @@ struct SScoringFacilityWidgets {
 		*cSFADWhenEstimateEOn,
 		*cSFADWhenEstimateEOff;
 	GtkLabel
-		*lSFADInfo;
+		*lSFADInfo,
+		*lSFADDirtyPercent;
 	GtkToggleButton
 		*bSFADPreview;
 	GtkButton
diff --git a/src/ui/sf_cb.hh b/src/ui/sf_cb.hh
index 1838a61..6f388ca 100644
--- a/src/ui/sf_cb.hh
+++ b/src/ui/sf_cb.hh
@@ -109,6 +109,7 @@ void iSFPageSelectionDrawEnvelope_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageSelectionDrawDzxdf_toggled_cb( GtkCheckMenuItem*, gpointer);
 
 
+gboolean wSFArtifactDetection_delete_event_cb(GtkWidget*, GdkEvent*, gpointer);
 void eSFADProfiles_changed_cb( GtkComboBox*, gpointer);
 void bSFADProfileSave_clicked_cb( GtkButton*, gpointer);
 void bSFADProfileDelete_clicked_cb( GtkButton*, gpointer);

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list