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

Andrei Zavada johnhommer at gmail.com
Sun Jul 21 19:56:38 UTC 2013


The following commit has been merged in the master branch:
commit 08931fb928d1a3242e4d5c5c3ab8f85a24188744
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Jul 21 01:22:32 2013 +0300

    fix SF:AD dialog wrt using_channel

diff --git a/src/aghermann/ui/sf/channel.cc b/src/aghermann/ui/sf/channel.cc
index 0abb326..e7bfb35 100644
--- a/src/aghermann/ui/sf/channel.cc
+++ b/src/aghermann/ui/sf/channel.cc
@@ -539,7 +539,7 @@ update_channel_menu_items( const double x)
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDSpectrum, is_eeg);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawSWUProfile,  is_eeg);
 
-	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg);
+	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg and not _p.artifacts_dialog_shown);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawMCProfile,   is_eeg);
 	gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGProfile,  is_emg);
 
diff --git a/src/aghermann/ui/sf/d/artifacts.cc b/src/aghermann/ui/sf/d/artifacts.cc
index 2d232ad..db9677e 100644
--- a/src/aghermann/ui/sf/d/artifacts.cc
+++ b/src/aghermann/ui/sf/d/artifacts.cc
@@ -25,7 +25,8 @@ artifacts_d()
 
 aghui::SScoringFacility::SArtifactsDialog::
 SArtifactsDialog (aghui::SScoringFacility& p_)
-      : _p (p_)
+      : using_channel (nullptr),
+	_p (p_)
 {
 	W_V.reg( eSFADScope,		&P.scope);
 	W_V.reg( eSFADUpperThr,		&P.upper_thr);
diff --git a/src/aghermann/ui/sf/d/artifacts.hh b/src/aghermann/ui/sf/d/artifacts.hh
index b14df5f..4591160 100644
--- a/src/aghermann/ui/sf/d/artifacts.hh
+++ b/src/aghermann/ui/sf/d/artifacts.hh
@@ -90,6 +90,8 @@ struct SScoringFacility::SArtifactsDialog
 
 	SArtifactsDialog (SScoringFacility&);
 
+	SScoringFacility::SChannel
+		*using_channel;
 	metrics::mc::SArtifactDetectionPP
 		P;
 	sigfile::SArtifacts
diff --git a/src/aghermann/ui/sf/d/artifacts_cb.cc b/src/aghermann/ui/sf/d/artifacts_cb.cc
index 4d6181f..5b0c6b4 100644
--- a/src/aghermann/ui/sf/d/artifacts_cb.cc
+++ b/src/aghermann/ui/sf/d/artifacts_cb.cc
@@ -146,12 +146,13 @@ bSFADCancel_clicked_cb(
 {
 	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
 	auto& SF = AD._p;
+	SF.artifacts_dialog_shown = false;
 
 	gtk_widget_hide( (GtkWidget*)AD.wSFAD);
 
 	if ( gtk_toggle_button_get_active(AD.bSFADPreview) ) {
-		SF.using_channel -> artifacts = AD.artifacts_backup;
-		SF.using_channel -> get_signal_filtered();
+		AD.using_channel->artifacts = AD.artifacts_backup;
+		AD.using_channel->get_signal_filtered();
 
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
@@ -177,11 +178,11 @@ bSFADPreview_toggled_cb(
 	if ( gtk_toggle_button_get_active(b) ) {
 		SBusyBlock bb (AD.wSFAD);
 
-		AD.orig_signal_visible_backup = SF.using_channel->draw_original_signal;
-		AD.artifacts_backup = SF.using_channel->artifacts;
+		AD.orig_signal_visible_backup = AD.using_channel->draw_original_signal;
+		AD.artifacts_backup = AD.using_channel->artifacts;
 
-		SF.using_channel -> detect_artifacts( (AD.W_V.down(), AD.P));
-		SF.using_channel -> draw_original_signal = true;
+		AD.using_channel->detect_artifacts( (AD.W_V.down(), AD.P));
+		AD.using_channel->draw_original_signal = true;
 		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, TRUE);
 
 		AD.channels_visible_backup.clear();
@@ -189,15 +190,15 @@ bSFADPreview_toggled_cb(
 			for ( auto& H : SF.channels ) {
 				AD.channels_visible_backup.emplace_back(
 					&H, H.hidden);
-				if ( &H != SF.using_channel )
+				if ( &H != AD.using_channel )
 					H.hidden = true;
 			}
 
 	} else {
-		SF.using_channel->artifacts = AD.artifacts_backup;
+		AD.using_channel->artifacts = AD.artifacts_backup;
 		for ( auto& H : AD.channels_visible_backup )
 			H.first->hidden = H.second;
-		SF.using_channel->draw_original_signal = AD.orig_signal_visible_backup;
+		AD.using_channel->draw_original_signal = AD.orig_signal_visible_backup;
 		gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE);
 	}
 
@@ -205,7 +206,7 @@ bSFADPreview_toggled_cb(
 
 	gtk_label_set_markup(
 		AD.lSFADDirtyPercent,
-		snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100));
+		snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
 
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
@@ -220,6 +221,9 @@ wSFAD_show_cb(
 {
 	auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata;
 	auto& SF = AD._p;
+	SF.artifacts_dialog_shown = true;
+
+	AD.using_channel = AD._p.using_channel;  // because the latter is mutable, and AD isn't modal
 
 	AD.W_V.up();
 	AD.populate_mSFADProfiles();
@@ -237,10 +241,10 @@ wSFAD_show_cb(
 
 	gtk_label_set_text(
 		AD.lSFADInfo,
-		snprintf_buf( "Artifact detection in channel %s", SF.using_channel->name()));
+		snprintf_buf( "Artifact detection in channel %s", AD.using_channel->name()));
 	gtk_label_set_text(
 		AD.lSFADDirtyPercent,
-		snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100));
+		snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100));
 }
 
 
diff --git a/src/aghermann/ui/sf/sf.cc b/src/aghermann/ui/sf/sf.cc
index 2848a37..df281df 100644
--- a/src/aghermann/ui/sf/sf.cc
+++ b/src/aghermann/ui/sf/sf.cc
@@ -61,6 +61,7 @@ SScoringFacility (agh::CSubject& J,
 	_session (D),
 	_sepisode (J.measurements.at(D)[E]),
 	hypnogram_button_down (false),
+	artifacts_dialog_shown (false),
 	mode (TMode::scoring),
 	crosshair_at (10),
 	show_cur_pos_time_relative (false),
diff --git a/src/aghermann/ui/sf/sf.hh b/src/aghermann/ui/sf/sf.hh
index 519a9bf..9ec1606 100644
--- a/src/aghermann/ui/sf/sf.hh
+++ b/src/aghermann/ui/sf/sf.hh
@@ -347,7 +347,8 @@ class SScoringFacility
       // state and flags
 	// volatile
 	bool	suppress_redraw:1,
-		hypnogram_button_down:1;
+		hypnogram_button_down:1,
+		artifacts_dialog_shown:1;
 	enum TMode {
 		scoring,
 		marking,

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list