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

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


The following commit has been merged in the master branch:
commit 9836d5b9f0282cb83772fbd329f51ee9d3ef2ad7
Author: andrei zavada <johnhommer at gmail.com>
Date:   Fri Oct 12 15:49:59 2012 +0300

    SUIVar WIP over

diff --git a/src/model/achermann.cc b/src/model/achermann.cc
index 15bcba9..e40ba30 100644
--- a/src/model/achermann.cc
+++ b/src/model/achermann.cc
@@ -123,12 +123,12 @@ setup_modrun( const char* j, const char* d, const char* h,
 agh::ach::CModelRun::
 CModelRun (CSubject& subject, const string& session, const sigfile::SChannel& channel,
 	   sigfile::TMetricType metric_type,
-	   float freq_from, float freq_upto,
+	   double freq_from, double freq_upto,
 	   const SControlParamSet& _ctl_params,
 	   const STunableSetWithState& t0)
       : CSCourse (subject, session, channel,
 		  agh::SSCourseParamSet {metric_type,
-				  freq_from, freq_upto, (float)_ctl_params.req_percent_scored,
+				  freq_from, freq_upto, _ctl_params.req_percent_scored,
 				  _ctl_params.swa_laden_pages_before_SWA_0,
 				  _ctl_params.ScoreUnscoredAsWake}),
 	status (0),
diff --git a/src/model/achermann.hh b/src/model/achermann.hh
index 0e51e76..feff436 100644
--- a/src/model/achermann.hh
+++ b/src/model/achermann.hh
@@ -90,7 +90,7 @@ class CModelRun
 	CModelRun (CModelRun&&);
 	CModelRun (CSubject&, const string& session, const sigfile::SChannel&,
 		   sigfile::TMetricType,
-		   float freq_from, float freq_upto,
+		   double freq_from, double freq_upto,
 		   const SControlParamSet&, const STunableSetWithState&);
 
 	enum TModrunFlags { modrun_tried = 1 };
diff --git a/src/model/beersma.hh b/src/model/beersma.hh
index ec11e18..47bacc5 100644
--- a/src/model/beersma.hh
+++ b/src/model/beersma.hh
@@ -47,7 +47,7 @@ struct SClassicFit {
 struct SClassicFitCtl {
 	sigfile::TMetricType
 		metric;
-	float	freq_from,
+	double	freq_from,
 		freq_upto;
 	double	sigma;
 	size_t	iterations;
@@ -105,7 +105,7 @@ struct SUltradianCycleDetails {
 struct SUltradianCycleCtl {
 	sigfile::TMetricType
 		metric;
-	float	freq_from,
+	double	freq_from,
 		freq_upto;
 	double	sigma;
 
@@ -185,7 +185,7 @@ ultradian_cycles( agh::CRecording&,
 list<SUltradianCycleDetails>
 analyse_deeper( const SUltradianCycle&,
 		agh::CRecording&,
-		const agh::beersma::SUltradianCycleCtl&);
+		const SUltradianCycleCtl&);
 
 
 
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 2d11e80..c9b3087 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -8,6 +8,7 @@ noinst_LIBRARIES = libaghui.a
 libaghui_a_SOURCES = \
 	forward-decls.hh \
 	ui.hh \
+	ui++.hh \
 	misc.hh \
 	libcommon.cc \
 	globals.hh \
@@ -59,6 +60,7 @@ libaghui_a_SOURCES = \
 if DO_PCH
 BUILT_SOURCES = \
 	ui.hh.gch \
+	ui++.hh.gch \
 	misc.hh.gch \
 	globals.hh.gch \
 	forward-decls.hh.gch \
diff --git a/src/ui/expdesign.cc b/src/ui/expdesign.cc
index 028fa4f..e512284 100644
--- a/src/ui/expdesign.cc
+++ b/src/ui/expdesign.cc
@@ -194,9 +194,9 @@ SExpDesignUI (aghui::SSessionChooser *parent,
 	nodestroy_by_cb = false;
 
 	// bind fields to widgets
-	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( eUltradianCycleDetectionAccuracy, &uc_accuracy_factor);
+	W_V.reg( eArtifDampenWindowType, (int*)&ED->af_dampen_window_type);
+	W_V.reg( eArtifDampenFactor, &ED->af_dampen_factor);
 
 	fft_params_welch_window_type_saved	= ED->fft_params.welch_window_type;
 	af_dampen_window_type_saved		= ED->af_dampen_window_type;
diff --git a/src/ui/expdesign.hh b/src/ui/expdesign.hh
index 6dd558c..a57c4d1 100644
--- a/src/ui/expdesign.hh
+++ b/src/ui/expdesign.hh
@@ -26,6 +26,7 @@
 #include "../model/forward-decls.hh"
 #include "../expdesign/primaries.hh"
 #include "ui.hh"
+#include "ui++.hh"
 #include "forward-decls.hh"
 #include "expdesign-widgets.hh"
 
@@ -240,7 +241,7 @@ class SExpDesignUI
 
 	static const char
 		*const FreqBandNames[(size_t)sigfile::TBand::_total];
-	float	freq_bands[(size_t)sigfile::TBand::_total][2];
+	double	freq_bands[(size_t)sigfile::TBand::_total][2];
 
 	double	profile_scale_psd,
 		profile_scale_mc;
diff --git a/src/ui/scoring-facility.hh b/src/ui/scoring-facility.hh
index 2aa0968..182e05c 100644
--- a/src/ui/scoring-facility.hh
+++ b/src/ui/scoring-facility.hh
@@ -579,7 +579,6 @@ class SScoringFacility
 		SFiltersDialog (SScoringFacility& parent)
 		      : _p (parent)
 			{}
-	       ~SFiltersDialog ();
 
 		SScoringFacility&
 			_p;
diff --git a/src/ui/session-chooser_cb.cc b/src/ui/session-chooser_cb.cc
index dfeaebb..ca0383e 100644
--- a/src/ui/session-chooser_cb.cc
+++ b/src/ui/session-chooser_cb.cc
@@ -13,6 +13,7 @@
 
 #include "../common/string.hh"
 #include "ui.hh"
+#include "ui++.hh"
 #include "session-chooser.hh"
 #include "session-chooser_cb.hh"
 
diff --git a/src/ui/ui++.hh b/src/ui/ui++.hh
new file mode 100644
index 0000000..27b601c
--- /dev/null
+++ b/src/ui/ui++.hh
@@ -0,0 +1,185 @@
+// ;-*-C++-*-
+/*
+ *       File name:  ui/ui++.hh
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <johnhommer at gmail.com>
+ * Initial version:  2012-10-12
+ *
+ *         Purpose: more complex GTK+ things we do with C++
+ *
+ *         License:  GPL
+ */
+
+
+#ifndef _AGHUI_PLUSPLUS_UI_H
+#define _AGHUI_PLUSPLUS_UI_H
+
+#include <cstring>
+#include <string>
+#include <list>
+#include <gtk/gtk.h>
+#include "../common/lang.hh"
+
+#if HAVE_CONFIG_H && !defined(VERSION)
+#  include "config.h"
+#endif
+
+using namespace std;
+
+
+namespace aghui {
+
+class SBusyBlock {
+	DELETE_DEFAULT_METHODS (SBusyBlock);
+    public:
+	SBusyBlock (GtkWidget* w_)
+	      : w (w_)
+		{
+			lock();
+		}
+	// poor ubuntu people
+	// SBusyBlock (GtkWindow* w)
+	//       : SBusyBlock ((GtkWidget*)w)
+	// 	{}
+	// SBusyBlock (GtkDialog* w)
+	//       : SBusyBlock ((GtkWidget*)w)
+	// 	{}
+	SBusyBlock (GtkWindow* w_)
+	      : w ((GtkWidget*)w_)
+		{
+			lock();
+		}
+	SBusyBlock (GtkDialog* w_)
+	      : w ((GtkWidget*)w_)
+		{
+			lock();
+		}
+
+       ~SBusyBlock ()
+		{
+			set_cursor_busy( false, w);
+			gtk_widget_set_sensitive( w, TRUE);
+			gtk_flush();
+		}
+    private:
+	GtkWidget *w;
+	void lock()
+		{
+			gtk_widget_set_sensitive( w, FALSE);
+			set_cursor_busy( true, w);
+			gtk_flush();
+		}
+};
+
+
+
+class SUIVar_base {
+    public:
+	virtual ~SUIVar_base ()
+		{}
+	virtual void down() const = 0;
+	virtual void up() const = 0;
+};
+
+
+template <typename Tw, typename Tv>
+class SUIVar_ : public SUIVar_base {
+	DELETE_DEFAULT_METHODS (SUIVar_);
+
+	Tw	*w;
+	Tv	*v;
+
+    public:
+	SUIVar_ (Tw* w_, Tv* v_)
+	      : w (w_), v (v_)
+		{}
+	virtual ~SUIVar_ ()
+		{}
+
+	virtual void down() const;
+	virtual void up() const;
+};
+
+
+template <> inline void
+SUIVar_<GtkSpinButton, double>::up()	const { gtk_spin_button_set_value( w, *v); }
+template <> inline void
+SUIVar_<GtkSpinButton, double>::down()	const { *v = gtk_spin_button_get_value( w); }
+
+template <> inline void
+SUIVar_<GtkSpinButton, int>::up()	const { gtk_spin_button_set_value( w, (double)*v); }
+template <> inline void
+SUIVar_<GtkSpinButton, int>::down()	const { *v = (int)round(gtk_spin_button_get_value( w)); }
+
+template <> inline void
+SUIVar_<GtkComboBox, int>::up()		const { gtk_combo_box_set_active( w, *v); }
+template <> inline void
+SUIVar_<GtkComboBox, int>::down()	const { *v = gtk_combo_box_get_active( w); }
+
+template <> inline void
+SUIVar_<GtkCheckButton, bool>::up()	const { gtk_toggle_button_set_active( (GtkToggleButton*)w, *v); }
+template <> inline void
+SUIVar_<GtkCheckButton, bool>::down()	const { *v = gtk_toggle_button_get_active( (GtkToggleButton*)w); }
+
+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);
+}
+
+
+
+class SUICollection {
+    public:
+       ~SUICollection ()
+		{
+			for ( auto& A : c )
+				delete A;
+		}
+
+	void reg( GtkSpinButton *w, double* v)
+		{
+			c.push_back( new SUIVar_<GtkSpinButton, double> (w, v));
+		}
+	void reg( GtkSpinButton *w, int* v)
+		{
+			c.push_back( new SUIVar_<GtkSpinButton, int> (w, v));
+		}
+	void reg( GtkComboBox *w, int* v)
+		{
+			c.push_back( new SUIVar_<GtkComboBox, int> (w, v));
+		}
+	void reg( GtkCheckButton *w, bool* v)
+		{
+			c.push_back( new SUIVar_<GtkCheckButton, bool> (w, v));
+		}
+	void reg( GtkEntry *w, string* v)
+		{
+			c.push_back( new SUIVar_<GtkEntry, string> (w, v));
+		}
+
+	void up() const
+		{
+			for ( auto& A : c )
+				A->up();
+		}
+	void down() const
+		{
+			for ( auto& A : c )
+				A->down();
+		}
+
+    private:
+	list<SUIVar_base*> c;
+};
+
+
+} // namespace aghui
+
+#endif
+
+// eof
diff --git a/src/ui/ui.hh b/src/ui/ui.hh
index fe0e998..0f2cf28 100644
--- a/src/ui/ui.hh
+++ b/src/ui/ui.hh
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  ui/ui.h
+ *       File name:  ui/ui.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  * Initial version:  2008-04-28
@@ -18,7 +18,6 @@
 #include <cstdlib>
 #include <cstring>
 #include <string>
-#include <list>
 #include <valarray>
 #include <itpp/base/mat.h>
 #include <gtk/gtk.h>
@@ -159,180 +158,6 @@ gint pop_question( GtkWindow *parent, const gchar*, ...);
 void set_cursor_busy( bool busy, GtkWidget *wid);
 
 
-class SBusyBlock {
-	DELETE_DEFAULT_METHODS (SBusyBlock);
-    public:
-	SBusyBlock (GtkWidget* w_)
-	      : w (w_)
-		{
-			lock();
-		}
-	// poor ubuntu people
-	// SBusyBlock (GtkWindow* w)
-	//       : SBusyBlock ((GtkWidget*)w)
-	// 	{}
-	// SBusyBlock (GtkDialog* w)
-	//       : SBusyBlock ((GtkWidget*)w)
-	// 	{}
-	SBusyBlock (GtkWindow* w_)
-	      : w ((GtkWidget*)w_)
-		{
-			lock();
-		}
-	SBusyBlock (GtkDialog* w_)
-	      : w ((GtkWidget*)w_)
-		{
-			lock();
-		}
-
-       ~SBusyBlock ()
-		{
-			set_cursor_busy( false, w);
-			gtk_widget_set_sensitive( w, TRUE);
-			gtk_flush();
-		}
-    private:
-	GtkWidget *w;
-	void lock()
-		{
-			gtk_widget_set_sensitive( w, FALSE);
-			set_cursor_busy( true, w);
-			gtk_flush();
-		}
-};
-
-
-
-class SUIVar_base {
-    public:
-	virtual void down() const = 0;
-	virtual void up() const = 0;
-};
-
-
-template <typename Tw, typename Tv>
-class SUIVar_ : public SUIVar_base {
-	DELETE_DEFAULT_METHODS (SUIVar_);
-
-	Tw	*w;
-	Tv&	v;
-
-    public:
-	SUIVar_ (Tw* w_, Tv& v_)
-	      : w (w_), v (v_)
-		{}
-
-	virtual void down() const;
-	virtual void up() const;
-};
-
-
-template <>
-inline void
-SUIVar_<GtkSpinButton, double>::up() const
-{
-	gtk_spin_button_set_value( w, v);
-}
-
-template <>
-inline void
-SUIVar_<GtkSpinButton, double>::down() const
-{
-	v = gtk_spin_button_get_value( w);
-}
-
-template <>
-inline void
-SUIVar_<GtkSpinButton, int>::up() const
-{
-	gtk_spin_button_set_value( w, (double)v);
-}
-
-template <>
-inline void
-SUIVar_<GtkSpinButton, int>::down() const
-{
-	v = (int)round(gtk_spin_button_get_value( w));
-}
-
-
-template <>
-inline void
-SUIVar_<GtkCheckButton, bool>::up() const
-{
-	gtk_toggle_button_set_active( (GtkToggleButton*)w, v);
-}
-
-template <>
-inline void
-SUIVar_<GtkCheckButton, bool>::down() const
-{
-	v = gtk_toggle_button_get_active( (GtkToggleButton*)w);
-}
-
-
-template <>
-inline void
-SUIVar_<GtkEntry, string>::up() const
-{
-	gtk_entry_set_text( w, v.c_str());
-}
-
-template <>
-inline void
-SUIVar_<GtkEntry, string>::down() const
-{
-	const char *tmp = gtk_entry_get_text( w);
-	v.assign(tmp);
-	g_free( (void*)tmp);
-}
-
-
-
-class SUICollection {
-    public:
-       ~SUICollection ()
-		{
-			for ( auto& A : c )
-				delete A;
-		}
-
-	void reg( GtkSpinButton *w, double& v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, double> (w, v));
-		}
-	void reg( GtkSpinButton *w, int& v)
-		{
-			c.push_back( new SUIVar_<GtkSpinButton, int> (w, v));
-		}
-	void reg( GtkCheckButton *w, bool& v)
-		{
-			c.push_back( new SUIVar_<GtkCheckButton, bool> (w, v));
-		}
-	void reg( GtkEntry *w, string& v)
-		{
-			c.push_back( new SUIVar_<GtkEntry, string> (w, v));
-		}
-
-	void up() const
-		{
-			for ( auto& A : c )
-				A->up();
-		}
-	void down() const
-		{
-			for ( auto& A : c )
-				A->down();
-		}
-
-    private:
-	list<SUIVar_base*> c;
-};
-
-
-
-
-
 
 
 #define AGH_GBGETOBJ(Type, A)				\

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list