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

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


The following commit has been merged in the master branch:
commit b7872b7c7b757a65e63e75cccdf72b6db1030f95
Author: andrei zavada <johnhommer at gmail.com>
Date:   Fri Oct 19 18:36:53 2012 +0300

    WIP (binding widgets to global_artifact_profiles)

diff --git a/data/sf.glade b/data/sf.glade
index 49696a0..3abdf71 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -2328,6 +2328,7 @@ on individual parameters:</property>
                 <property name="can_focus">False</property>
                 <property name="receives_default">False</property>
                 <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -2344,6 +2345,7 @@ on individual parameters:</property>
                 <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
                 <accelerator key="Return" signal="activate"/>
               </object>
               <packing>
@@ -2367,6 +2369,96 @@ on individual parameters:</property>
       <action-widget response="-5">button3</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkDialog" id="wSFADSaveProfileName">
+    <property name="width_request">200</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">AD profile name</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="transient_for">wPattern</property>
+    <signal name="close" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <signal name="response" handler="gtk_widget_hide_on_delete" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox13">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkEntry" id="eSFADSaveProfileNameName">
+            <property name="width_request">130</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="invisible_char">•</property>
+            <property name="activates_default">True</property>
+            <property name="invisible_char_set">True</property>
+            <property name="primary_icon_activatable">False</property>
+            <property name="secondary_icon_activatable">False</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area13">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button8">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button9">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+                <accelerator key="Return" signal="activate"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button8</action-widget>
+      <action-widget response="-5">button9</action-widget>
+    </action-widgets>
+  </object>
   <object class="GtkWindow" id="wScoringFacility">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Aghermann Scoring Facility</property>
@@ -2832,15 +2924,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>
@@ -2849,15 +2941,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>
@@ -3092,18 +3184,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>
@@ -3113,17 +3204,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>
diff --git a/src/ui/ed-populate.cc b/src/ui/ed-populate.cc
index eac4d1a..3d85893 100644
--- a/src/ui/ed-populate.cc
+++ b/src/ui/ed-populate.cc
@@ -332,11 +332,12 @@ populate_mGlobalADProfiles()
 	gtk_list_store_clear( mGlobalADProfiles);
 	for ( auto &P : global_artifact_detection_profiles ) {
 		GtkTreeIter iter;
-		gtk_list_store_append( mEEGChannels, &iter);
-		gtk_list_store_set( mEEGChannels, &iter,
+		gtk_list_store_append( mGlobalADProfiles, &iter);
+		gtk_list_store_set( mGlobalADProfiles, &iter,
 				    0, P.first.c_str(),
 				    -1);
 	}
+	gtk_combo_box_set_model( eGlobalADProfiles, (GtkTreeModel*)mGlobalADProfiles);
 }
 
 
diff --git a/src/ui/ed-widgets.hh b/src/ui/ed-widgets.hh
index a77109b..8c7d824 100644
--- a/src/ui/ed-widgets.hh
+++ b/src/ui/ed-widgets.hh
@@ -154,7 +154,7 @@ struct SExpDesignUIWidgets {
 	GtkListStore
 		*mNotchFilter;
 	GtkEntry
-		*eScoreCode[(size_t)sigfile::SPage::TScore::_total];
+		*eScoreCode[sigfile::SPage::TScore::_total];
 	GtkSpinButton
 		*eArtifDampenFactor,
 
@@ -171,7 +171,7 @@ struct SExpDesignUIWidgets {
 		*jFreqFrom,
 		*jFreqWidth;
 	GtkSpinButton
-		*eBand[(size_t)sigfile::TBand::_total][2];
+		*eBand[sigfile::TBand::_total][2];
 	GtkEntry
 		*eBrowseCommand;
 
diff --git a/src/ui/ed.cc b/src/ui/ed.cc
index a3863ee..e96c911 100644
--- a/src/ui/ed.cc
+++ b/src/ui/ed.cc
@@ -261,21 +261,25 @@ load_artifact_detection_profiles()
 	if ( domien ) {
 		while ( !feof (domien) ) {
 			SDetectArtifactsParamPack P;
-			char *_ = NULL;
-			getline( &_, NULL, domien);
-			fscanf( domien, "%la  %la %la  %la %la %la  %la %la  %la %la %la "
-				"%zu %zu %d %d\n",
-				&P.scope,
-				&P.upper_thr, &P.lower_thr,
-				&P.f0, &P.fc, &P.bandwidth,
-				&P.mc_gain, &P.iir_backpolate,
-				&P.E, &P.dmin, &P.dmax,
-				&P.sssu_hist_size,
-				&P.smooth_side,
-				&P.estimate_E,
-				&P.use_range);
-			global_artifact_detection_profiles[_] = P;
-			free( _);
+			DEF_UNIQUE_CHARP (_);
+			int int_estimate_E, int_use_range;
+			if ( getline( &_, NULL, domien) > 0 &&
+			     fscanf( domien, "%la  %la %la  %la %la %la  %la %la  %la %la %la "
+				     "%zu %zu %d %d\n",
+				     &P.scope,
+				     &P.upper_thr, &P.lower_thr,
+				     &P.f0, &P.fc, &P.bandwidth,
+				     &P.mc_gain, &P.iir_backpolate,
+				     &P.E, &P.dmin, &P.dmax,
+				     &P.sssu_hist_size,
+				     &P.smooth_side,
+				     &int_estimate_E,
+				     &int_use_range) == 15 ) {
+				P.estimate_E = (bool)int_estimate_E;
+				P.use_range = (bool)int_use_range;
+				global_artifact_detection_profiles[_] = P;
+			} else
+				break;
 		}
 		fclose( domien);
 	} else
diff --git a/src/ui/libcommon.cc b/src/ui/libcommon.cc
index 69494f3..578e178 100644
--- a/src/ui/libcommon.cc
+++ b/src/ui/libcommon.cc
@@ -326,6 +326,7 @@ SUIVar_<GtkListStore, list<string>>::down() const
 	}
 }
 
+
 } // namespace aghui
 
 
diff --git a/src/ui/sf-artifacts.cc b/src/ui/sf-artifacts.cc
index 96030cc..f7a6033 100644
--- a/src/ui/sf-artifacts.cc
+++ b/src/ui/sf-artifacts.cc
@@ -48,4 +48,25 @@ aghui::SScoringFacility::SArtifactDetectionDialog::
 	gtk_widget_destroy( (GtkWidget*)_p.wSFArtifactDetection);
 }
 
+
+// maybe it's not needed in GTK+ 3?
+void
+aghui::SScoringFacility::
+populate_mSFADProfiles()
+{
+	g_signal_handler_block( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
+	gtk_list_store_clear( mSFADProfiles);
+	for ( auto &P : _p.global_artifact_detection_profiles ) {
+		GtkTreeIter iter;
+		gtk_list_store_append( mSFADProfiles, &iter);
+		gtk_list_store_set( mSFADProfiles, &iter,
+				    0, P.first.c_str(),
+				    -1);
+	}
+	gtk_combo_box_set_model( eSFADProfiles, (GtkTreeModel*)mSFADProfiles);
+	g_signal_handler_unblock( eSFADProfiles, eSFADProfiles_changed_cb_handler_id);
+}
+
+
+
 // eof
diff --git a/src/ui/sf-artifacts_cb.cc b/src/ui/sf-artifacts_cb.cc
index 4aeea4a..df6c195 100644
--- a/src/ui/sf-artifacts_cb.cc
+++ b/src/ui/sf-artifacts_cb.cc
@@ -25,7 +25,9 @@ eSFADProfiles_changed_cb( GtkComboBox* b, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& AD = SF.artifact_detection_dialog;
 
-	
+	AD.P = SF._p.global_artifact_detection_profiles[
+		gtk_combo_box_get_active_id(b)];
+	AD.W_V.up();
 }
 
 void
@@ -34,7 +36,14 @@ bSFADProfileSave_clicked_cb( GtkButton*, gpointer userdata)
 	auto& SF = *(SScoringFacility*)userdata;
 	auto& AD = SF.artifact_detection_dialog;
 
-	
+	if ( GTK_RESPONSE_OK ==
+	     gtk_dialog_run( SF.wSFADSaveProfileName) ) {
+		AD.W_V.down();
+		SF._p.global_artifact_detection_profiles[
+			gtk_entry_get_text( SF.eSFADSaveProfileNameName)] = AD.P;
+		SF._p.populate_mGlobalADProfiles();
+		SF.populate_mSFADProfiles(); // stupid
+	}
 }
 
 void
diff --git a/src/ui/sf-construct.cc b/src/ui/sf-construct.cc
index 70f63b0..6a960d9 100644
--- a/src/ui/sf-construct.cc
+++ b/src/ui/sf-construct.cc
@@ -560,7 +560,9 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkLabel,			lSFADInfo)) ||
 	     !(AGH_GBGETOBJ (GtkToggleButton,		bSFADPreview)) ||
 	     !(AGH_GBGETOBJ (GtkButton,			bSFADApply)) ||
-	     !(AGH_GBGETOBJ (GtkButton,			bSFADCancel)) )
+	     !(AGH_GBGETOBJ (GtkButton,			bSFADCancel)) ||
+	     !(AGH_GBGETOBJ (GtkDialog,			wSFADSaveProfileName)) ||
+	     !(AGH_GBGETOBJ (GtkEntry,			eSFADSaveProfileNameName)) )
 		throw runtime_error ("Failed to contruct SF widgets");
 
 	mSFADProfiles = gtk_list_store_new( 1, G_TYPE_STRING);
@@ -576,9 +578,10 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 					"text", 0,
 					NULL);
 
-	g_signal_connect( eSFADProfiles, "changed",
-			  (GCallback)eSFADProfiles_changed_cb,
-			  this);
+	eSFADProfiles_changed_cb_handler_id =
+		g_signal_connect( eSFADProfiles, "changed",
+				  (GCallback)eSFADProfiles_changed_cb,
+				  this);
 	g_signal_connect( bSFADProfileSave, "clicked",
 			  (GCallback)bSFADProfileSave_clicked_cb,
 			  this);
diff --git a/src/ui/sf-widgets.hh b/src/ui/sf-widgets.hh
index fa39072..ae804a6 100644
--- a/src/ui/sf-widgets.hh
+++ b/src/ui/sf-widgets.hh
@@ -243,6 +243,7 @@ struct SScoringFacilityWidgets {
 		*mSFADProfiles;
 	GtkComboBox
 		*eSFADProfiles;
+	gulong	eSFADProfiles_changed_cb_handler_id;
 	GtkButton
 		*bSFADProfileSave,
 		*bSFADProfileDelete;
@@ -276,6 +277,10 @@ struct SScoringFacilityWidgets {
 	GtkButton
 		*bSFADApply,
 		*bSFADCancel;
+	GtkDialog
+		*wSFADSaveProfileName;
+	GtkEntry
+		*eSFADSaveProfileNameName;
 
 	// less important dialogs
 	GtkDialog
diff --git a/src/ui/sf.hh b/src/ui/sf.hh
index 9d5e450..6cd8d7b 100644
--- a/src/ui/sf.hh
+++ b/src/ui/sf.hh
@@ -636,6 +636,7 @@ class SScoringFacility
 	};
 	SArtifactDetectionDialog
 		artifact_detection_dialog;
+	void populate_mSFADProfiles();
 
       // menu support
 	SChannel

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list