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

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


The following commit has been merged in the master branch:
commit dea4151aab347ca337d77801a779ecd28a6e5330
Author: andrei zavada <johnhommer at gmail.com>
Date:   Fri Oct 12 18:48:43 2012 +0300

    making real use of SUICollection in main settings tab switch cb

diff --git a/src/ui/expdesign-settings_cb.cc b/src/ui/expdesign-settings_cb.cc
index a642ad2..85af44f 100644
--- a/src/ui/expdesign-settings_cb.cc
+++ b/src/ui/expdesign-settings_cb.cc
@@ -35,30 +35,19 @@ tDesign_switch_page_cb( GtkNotebook     *notebook,
 	if ( page_num == 0 ) {  // switching back from settings tab
 
 	      // collect values from widgets
+		ED.W_V.down();
+
 		// Profile tab
-		ED.uc_accuracy_factor =
-			gtk_spin_button_get_value( ED.eUltradianCycleDetectionAccuracy);
-
-		ED.ED->af_dampen_window_type =
-			(SFFTParamSet::TWinType)gtk_combo_box_get_active( ED.eArtifDampenWindowType);
-		ED.ED->af_dampen_factor =
-			gtk_spin_button_get_value( ED.eArtifDampenFactor);
-
-		ED.ED->fft_params.pagesize =
-			ED.FFTPageSizeValues[ ED.pagesize_item = gtk_combo_box_get_active( ED.eFFTParamsPageSize)];
-		ED.ED->fft_params.binsize =
-			ED.FFTBinSizeValues[ ED.binsize_item = gtk_combo_box_get_active( ED.eFFTParamsBinSize)];
-		ED.ED->fft_params.welch_window_type =
-			(SFFTParamSet::TWinType)gtk_combo_box_get_active( ED.eFFTParamsWindowType);
+
+		ED.ED->fft_params.pagesize = ED.FFTPageSizeValues[ED.pagesize_item];
+		ED.ED->fft_params.binsize =  ED.FFTBinSizeValues [ED.binsize_item];
+
 		try { ED.ED->fft_params.check(); }
 		catch (invalid_argument ex) {
 			pop_ok_message( ED.wMainWindow, "Invalid FFT parameters; resetting to defaults.");
 			ED.ED->fft_params.reset();
 		}
 
-		ED.ED->mc_params.bandwidth		=         gtk_spin_button_get_value( ED.eMCParamBandWidth);
-		ED.ED->mc_params.iir_backpolate		=         gtk_spin_button_get_value( ED.eMCParamIIRBackpolate);
-		ED.ED->mc_params.mc_gain		=         gtk_spin_button_get_value( ED.eMCParamMCGain);
 		try {
 			ED.ED->mc_params.check( ED.ED->fft_params.pagesize);
 		} catch (invalid_argument ex) {
@@ -68,29 +57,6 @@ tDesign_switch_page_cb( GtkNotebook     *notebook,
 
 		ED.__adjust_op_freq_spinbuttons();
 
-		// General tab
-		for ( gushort i = 0; i < (size_t)SPage::TScore::_total; ++i )
-			ED.ext_score_codes[i] = gtk_entry_get_text( ED.eScoreCode[i]);
-
-		ED.freq_bands[TBand::delta][0] = gtk_spin_button_get_value( ED.eBand[TBand::delta][0]);
-		ED.freq_bands[TBand::delta][1] = gtk_spin_button_get_value( ED.eBand[TBand::delta][1]);
-		ED.freq_bands[TBand::theta][0] = gtk_spin_button_get_value( ED.eBand[TBand::theta][0]);
-		ED.freq_bands[TBand::theta][1] = gtk_spin_button_get_value( ED.eBand[TBand::theta][1]);
-		ED.freq_bands[TBand::alpha][0] = gtk_spin_button_get_value( ED.eBand[TBand::alpha][0]);
-		ED.freq_bands[TBand::alpha][1] = gtk_spin_button_get_value( ED.eBand[TBand::alpha][1]);
-		ED.freq_bands[TBand::beta ][0] = gtk_spin_button_get_value( ED.eBand[TBand::beta ][0]);
-		ED.freq_bands[TBand::beta ][1] = gtk_spin_button_get_value( ED.eBand[TBand::beta ][1]);
-		ED.freq_bands[TBand::gamma][0] = gtk_spin_button_get_value( ED.eBand[TBand::gamma][0]);
-		ED.freq_bands[TBand::gamma][1] = gtk_spin_button_get_value( ED.eBand[TBand::gamma][1]);
-
-		ED.timeline_pph				= gtk_spin_button_get_value( ED.eDAMsmtPPH);
-		ED.timeline_height			= gtk_spin_button_get_value( ED.eDAMsmtTLHeight);
-		SScoringFacility::IntersignalSpace	= gtk_spin_button_get_value( ED.eDAPageHeight);
-		SScoringFacility::HypnogramHeight	= gtk_spin_button_get_value( ED.eDAHypnogramHeight);
-		SScoringFacility::EMGProfileHeight	= gtk_spin_button_get_value( ED.eDAEMGHeight);
-
-		ED.browse_command.assign( gtk_entry_get_text( ED.eBrowseCommand));
-
 	      // scan as necessary
 		if ( ED.pagesize_item_saved	  		!= ED.pagesize_item ||
 		     ED.binsize_item_saved	  		!= ED.binsize_item ||
@@ -114,50 +80,10 @@ tDesign_switch_page_cb( GtkNotebook     *notebook,
 		ED.af_dampen_factor_saved		= ED.ED->af_dampen_factor;
 		ED.mc_params_saved			= ED.ED->mc_params;
 
-	      // also assign values to widgets
-		// -- maybe not? None of them are changeable by user outside settings tab
-		// -- rather do: they are loaded at init
-		// Profile tab
-		gtk_spin_button_set_value( ED.eUltradianCycleDetectionAccuracy,
-					   ED.uc_accuracy_factor);
-
-		gtk_combo_box_set_active( ED.eFFTParamsPageSize,
-					  ED.pagesize_item = ED.figure_pagesize_item());
-		gtk_combo_box_set_active( ED.eFFTParamsBinSize,
-					  ED.binsize_item = ED.figure_binsize_item());
-		gtk_combo_box_set_active( ED.eFFTParamsWindowType, (int)ED.ED->fft_params.welch_window_type);
-
-		gtk_spin_button_set_value( ED.eMCParamIIRBackpolate,	ED.ED->mc_params.iir_backpolate);
-		gtk_spin_button_set_value( ED.eMCParamMCGain,		ED.ED->mc_params.mc_gain);
-		gtk_spin_button_set_value( ED.eMCParamBandWidth,	ED.ED->mc_params.bandwidth);
-
-		// artifacts
-		gtk_combo_box_set_active( ED.eArtifDampenWindowType, (int)ED.ED->af_dampen_window_type);
-		gtk_spin_button_set_value( ED.eArtifDampenFactor,	ED.ED->af_dampen_factor);
-
-		// custom score codes
-		for ( gushort i = 0; i < (size_t)SPage::TScore::_total; ++i )
-			gtk_entry_set_text( ED.eScoreCode[i], ED.ext_score_codes[i].c_str());
-
-		// misc
-		gtk_spin_button_set_value( ED.eBand[TBand::delta][0], ED.freq_bands[TBand::delta][0]);
-		gtk_spin_button_set_value( ED.eBand[TBand::delta][1], ED.freq_bands[TBand::delta][1]);
-		gtk_spin_button_set_value( ED.eBand[TBand::theta][0], ED.freq_bands[TBand::theta][0]);
-		gtk_spin_button_set_value( ED.eBand[TBand::theta][1], ED.freq_bands[TBand::theta][1]);
-		gtk_spin_button_set_value( ED.eBand[TBand::alpha][0], ED.freq_bands[TBand::alpha][0]);
-		gtk_spin_button_set_value( ED.eBand[TBand::alpha][1], ED.freq_bands[TBand::alpha][1]);
-		gtk_spin_button_set_value( ED.eBand[TBand::beta ][0], ED.freq_bands[TBand::beta ][0]);
-		gtk_spin_button_set_value( ED.eBand[TBand::beta ][1], ED.freq_bands[TBand::beta ][1]);
-		gtk_spin_button_set_value( ED.eBand[TBand::gamma][0], ED.freq_bands[TBand::gamma][0]);
-		gtk_spin_button_set_value( ED.eBand[TBand::gamma][1], ED.freq_bands[TBand::gamma][1]);
-
-		gtk_spin_button_set_value( ED.eDAMsmtPPH,		ED.timeline_pph);
-		gtk_spin_button_set_value( ED.eDAMsmtTLHeight,		ED.timeline_height);
-		gtk_spin_button_set_value( ED.eDAPageHeight,		SScoringFacility::IntersignalSpace);
-		gtk_spin_button_set_value( ED.eDAHypnogramHeight,	SScoringFacility::HypnogramHeight);
-		gtk_spin_button_set_value( ED.eDAEMGHeight,		SScoringFacility::EMGProfileHeight);
-
-		gtk_entry_set_text( ED.eBrowseCommand,		ED.browse_command.c_str());
+		ED.pagesize_item = ED.figure_pagesize_item();
+		ED.binsize_item = ED.figure_binsize_item();
+
+		ED.W_V.up();
 
 		// colours are served specially elsewhere
 	}
diff --git a/src/ui/expdesign.cc b/src/ui/expdesign.cc
index e512284..6796742 100644
--- a/src/ui/expdesign.cc
+++ b/src/ui/expdesign.cc
@@ -197,7 +197,28 @@ SExpDesignUI (aghui::SSessionChooser *parent,
 	W_V.reg( eUltradianCycleDetectionAccuracy, &uc_accuracy_factor);
 	W_V.reg( eArtifDampenWindowType, (int*)&ED->af_dampen_window_type);
 	W_V.reg( eArtifDampenFactor, &ED->af_dampen_factor);
+	W_V.reg( eFFTParamsPageSize, &pagesize_item);
+	W_V.reg( eFFTParamsBinSize, &binsize_item);
+	W_V.reg( eFFTParamsWindowType, (int*)&ED->fft_params.welch_window_type);
+	for ( size_t i = 0; i < sigfile::SPage::TScore::_total; ++i )
+		W_V.reg( eScoreCode[i], &ext_score_codes[i]);
+	W_V.reg( eMCParamIIRBackpolate, &ED->mc_params.iir_backpolate);
+	W_V.reg( eMCParamMCGain, &ED->mc_params.mc_gain);
+	W_V.reg( eMCParamBandWidth, &ED->mc_params.bandwidth);
+	for ( size_t i = 0; i < sigfile::TBand::_total; ++i ) {
+		W_V.reg( eBand[i][0], &freq_bands[i][0]);
+		W_V.reg( eBand[i][1], &freq_bands[i][1]);
+	}
+		// General tab
+	W_V.reg( eDAMsmtPPH, (int*)&timeline_pph);
+	W_V.reg( eDAMsmtTLHeight, (int*)&timeline_height);
+	W_V.reg( eDAPageHeight, (int*)&SScoringFacility::IntersignalSpace);
+	W_V.reg( eDAHypnogramHeight, (int*)&SScoringFacility::HypnogramHeight);
+	W_V.reg( eDAEMGHeight, (int*)&SScoringFacility::EMGProfileHeight);
+	W_V.reg( eBrowseCommand, &browse_command);
+
 
+	// set _saved, too
 	fft_params_welch_window_type_saved	= ED->fft_params.welch_window_type;
 	af_dampen_window_type_saved		= ED->af_dampen_window_type;
 	af_dampen_factor_saved			= ED->af_dampen_factor;
diff --git a/src/ui/expdesign.hh b/src/ui/expdesign.hh
index a57c4d1..11558e8 100644
--- a/src/ui/expdesign.hh
+++ b/src/ui/expdesign.hh
@@ -222,8 +222,7 @@ class SExpDesignUI
 		FFTPageSizeValues;
 	static const array<double, 3>
 		FFTBinSizeValues;
-	unsigned short
-		pagesize_item,
+	int	pagesize_item,
 		binsize_item;
 	size_t figure_pagesize_item(); // from corresponding ED->fft_params.* fields
 	size_t figure_binsize_item();
diff --git a/src/ui/ui++.hh b/src/ui/ui++.hh
index 27b601c..742f35b 100644
--- a/src/ui/ui++.hh
+++ b/src/ui/ui++.hh
@@ -124,12 +124,7 @@ SUIVar_<GtkCheckButton, bool>::down()	const { *v = gtk_toggle_button_get_active(
 template <> inline void
 SUIVar_<GtkEntry, string>::up()		const { gtk_entry_set_text( w, v->c_str()); }
 template <> inline void
-SUIVar_<GtkEntry, string>::down() const // agh!
-{
-	const char *tmp = gtk_entry_get_text( w);
-	v->assign(tmp);
-	g_free( (void*)tmp);
-}
+SUIVar_<GtkEntry, string>::down()	const { v->assign( gtk_entry_get_text( w)); }
 
 
 

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list