[med-svn] [SCM] aghermann branch, master, updated. 99b1d5a023eee9df74b0e0d6f894516fc79435ad
Andrei Zavada
johnhommer at gmail.com
Sun Jul 7 23:03:47 UTC 2013
The following commit has been merged in the master branch:
commit 8151411d09c2c9adbfc2a1334316278053b3869f
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Fri Jun 7 10:14:27 2013 +0300
make snprint_buf return __buf__
diff --git a/src/aghermann/ui/mf/mf.cc b/src/aghermann/ui/mf/mf.cc
index 6a9f9d8..bb993e2 100644
--- a/src/aghermann/ui/mf/mf.cc
+++ b/src/aghermann/ui/mf/mf.cc
@@ -62,12 +62,11 @@ SModelrunFacility (agh::ach::CModelRun& csim, SExpDesignUI& parent)
if ( csim[p].metric > SWA_max )
SWA_max = csim[p].metric;
- snprintf_buf( "Simulation: %s (%s) in %s (%s)",
- csim.subject(), csim.session(), csim.channel(),
- csim.P().display_name().c_str());
gtk_window_set_title(
wModelrunFacility,
- __buf__);
+ snprintf_buf( "Simulation: %s (%s) in %s (%s)",
+ csim.subject(), csim.session(), csim.channel(),
+ csim.P().display_name().c_str()));
gtk_window_set_default_size(
wModelrunFacility,
gdk_screen_get_width( gdk_screen_get_default()) * .80,
@@ -399,8 +398,9 @@ update_infobar()
* agh::ach::stock[t].display_scale_factor);
}
_suppress_Vx_value_changed = false;
- snprintf_buf( "CF = <b>%6g</b>\n", cf);
- gtk_label_set_markup( lMFCostFunction, __buf__);
+ gtk_label_set_markup(
+ lMFCostFunction,
+ snprintf_buf( "CF = <b>%6g</b>\n", cf));
}
diff --git a/src/aghermann/ui/mf/mf_cb.cc b/src/aghermann/ui/mf/mf_cb.cc
index 69018c6..449b166 100644
--- a/src/aghermann/ui/mf/mf_cb.cc
+++ b/src/aghermann/ui/mf/mf_cb.cc
@@ -205,7 +205,7 @@ bMFRun_clicked_cb(
t < MF.csimulation.tx.size()-1 ? "\t" : "\n");
gtk_text_buffer_insert(
MF.log_text_buffer,
- (gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
+ (gtk_text_buffer_get_end_iter( MF.log_text_buffer, &iter), &iter),
__buf__, -1);
}
gtk_text_view_scroll_to_iter(
@@ -229,8 +229,9 @@ eMFSmooth_value_changed_cb(
{
auto& MF = *(SModelrunFacility*)userdata;
MF.swa_smoothover = v;
- snprintf_buf( "Smooth: %zu", MF.swa_smoothover);
- gtk_button_set_label( (GtkButton*)b, __buf__);
+ gtk_button_set_label(
+ (GtkButton*)b,
+ snprintf_buf( "Smooth: %zu", MF.swa_smoothover));
if ( !MF._suppress_Vx_value_changed )
gtk_widget_queue_draw( (GtkWidget*)MF.daMFProfile);
}
diff --git a/src/aghermann/ui/misc.hh b/src/aghermann/ui/misc.hh
index e8ac046..c1492ae 100644
--- a/src/aghermann/ui/misc.hh
+++ b/src/aghermann/ui/misc.hh
@@ -1,5 +1,5 @@
/*
- * File name: ui/misc.hh
+ * File name: aghermann/ui/misc.hh
* Project: Aghermann
* Author: Andrei Zavada <johnhommer at gmail.com>
* Initial version: 2008-04-28
@@ -23,7 +23,7 @@ using namespace std;
namespace aghui {
-#define snprintf_buf(...) snprintf( __buf__, AGH_BUF_SIZE-1, __VA_ARGS__)
+#define snprintf_buf(...) (snprintf( __buf__, AGH_BUF_SIZE-1, __VA_ARGS__), __buf__)
void snprintf_buf_ts_d( double h);
void snprintf_buf_ts_h( double h);
diff --git a/src/aghermann/ui/mw/mainmenu_cb.cc b/src/aghermann/ui/mw/mainmenu_cb.cc
index 0fe4deb..5ae3296 100644
--- a/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -192,10 +192,11 @@ iExpBasicSADetectUltradianCycles_activate_cb(
[&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::CSubject::SEpisode& E,
size_t i, size_t n)
{
- snprintf_buf(
- "Detect ultradian cycle %s/%s/%s",
- ED.ED->group_of(J), J.id.c_str(), E.name());
- ED.sb_main_progress_indicator( __buf__, n, i, TGtkRefreshMode::gtk);
+ ED.sb_main_progress_indicator(
+ snprintf_buf(
+ "Detect ultradian cycle %s/%s/%s",
+ ED.ED->group_of(J), J.id.c_str(), E.name()),
+ n, i, TGtkRefreshMode::gtk);
gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
};
@@ -251,10 +252,11 @@ iExpGloballyDetectArtifacts_activate_cb(
[&]( const CJGroup&, const CSubject& J, const string& D, const CSubject::SEpisode& E, const CRecording& R,
size_t i, size_t total)
{
- snprintf_buf(
- "Detect artifacts in %s/%s/%s/%s:%s",
- ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()).name());
- ED.sb_main_progress_indicator( __buf__, total, i, TGtkRefreshMode::gtk);
+ ED.sb_main_progress_indicator(
+ snprintf_buf(
+ "Detect artifacts in %s/%s/%s/%s:%s",
+ ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()).name()),
+ total, i, TGtkRefreshMode::gtk);
};
switch ( response ) {
case GTK_RESPONSE_OK:
@@ -394,7 +396,9 @@ bGlobalMontageResetAll_clicked_cb(
snprintf_buf( "find '%s' -name '.*.montage' -delete",
ED.ED->session_dir().c_str());
if ( system( __buf__) )
- pop_ok_message( ED.wMainWindow, "How strange!", "Command '%s' returned a non-zero status. This is weird.", __buf__);
+ pop_ok_message(
+ ED.wMainWindow,
+ "How strange!", "Command '%s' returned a non-zero status. This is weird.", __buf__);
}
diff --git a/src/aghermann/ui/mw/measurements.cc b/src/aghermann/ui/mw/measurements.cc
index 45ef5de..abf5e3f 100644
--- a/src/aghermann/ui/mw/measurements.cc
+++ b/src/aghermann/ui/mw/measurements.cc
@@ -43,11 +43,11 @@ get_episode_from_timeline_click( unsigned along)
void
aghui::SExpDesignUI::SSubjectPresentation::
-draw_timeline( const char *fname) const
+draw_timeline( const string& fname) const
{
cairo_surface_t *cs =
cairo_svg_surface_create(
- fname,
+ fname.c_str(),
tl_width() + tl_left_margin() + tl_right_margin(),
tl_height());
cairo_t *cr = cairo_create( cs);
@@ -221,10 +221,9 @@ draw_timeline( cairo_t *cr) const
auto& M = E.recordings.at(*_p._p._AghTi);
if ( M.have_uc_determined() ) {
agh::beersma::FUltradianCycle F (*M.uc_params);
- snprintf_buf( "T: %g r: %g", F.T, F.r);
_p._p.CwB[TColour::mw_profile].set_source_rgba_contrasting( cr);
cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height() - 22);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "T: %g r: %g", F.T, F.r));
cairo_stroke( cr);
_p._p.CwB[TColour::mw_ticks /* bounds? */].set_source_rgba( cr, .7);
@@ -293,11 +292,10 @@ draw_timeline( cairo_t *cr) const
cairo_move_to( cr, 2, 35);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size( cr, 9);
- snprintf_buf( "%c %d y.o.",
- csubject.gender_sign(),
- (int)csubject.age( *_p._p._AghDi));
cairo_set_source_rgb( cr, .1, .1, .1);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%c %d y.o.",
+ csubject.gender_sign(),
+ (int)csubject.age( *_p._p._AghDi)));
}
diff --git a/src/aghermann/ui/mw/measurements_cb.cc b/src/aghermann/ui/mw/measurements_cb.cc
index 8045e06..47f7b95 100644
--- a/src/aghermann/ui/mw/measurements_cb.cc
+++ b/src/aghermann/ui/mw/measurements_cb.cc
@@ -195,10 +195,12 @@ iSubjectTimelineEDFInfo_activate_cb(
auto J = ED.using_subject;
const auto& F = J->using_episode->sources.front();
- gtk_text_buffer_set_text( ED.tEDFFileDetailsReport, F().details( 0|sigfile::CEDFFile::with_channels).c_str(), -1);
- snprintf_buf( "%s header", F().filename());
- gtk_window_set_title( (GtkWindow*)ED.wEDFFileDetails,
- __buf__);
+ gtk_text_buffer_set_text(
+ ED.tEDFFileDetailsReport,
+ F().details( 0|sigfile::CEDFFile::with_channels).c_str(), -1);
+ gtk_window_set_title(
+ (GtkWindow*)ED.wEDFFileDetails,
+ snprintf_buf( "%s header", F().filename()));
gtk_widget_show_all( (GtkWidget*)ED.wEDFFileDetails);
}
@@ -211,15 +213,15 @@ iSubjectTimelineSaveAsSVG_activate_cb(
auto& ED = *(SExpDesignUI*)userdata;
auto J = ED.using_subject;
- snprintf_buf( "%s/%s/%s/%s/%s.svg",
- ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
- ED.AghD(), ED.AghT());
- string tmp (__buf__);
+ string tmp (snprintf_buf(
+ "%s/%s/%s/%s/%s.svg",
+ ED.ED->session_dir().c_str(), ED.ED->group_of( J->csubject.id), J->csubject.id.c_str(),
+ ED.AghD(), ED.AghT()));
J->is_focused = true;
- J->draw_timeline( __buf__);
+ J->draw_timeline( tmp);
- snprintf_buf( "Wrote \"%s\"", agh::str::homedir2tilda(tmp).c_str());
- ED.sb_message( __buf__);
+ ED.sb_message(
+ snprintf_buf( "Wrote \"%s\"", agh::str::homedir2tilda(tmp).c_str()));
}
diff --git a/src/aghermann/ui/mw/mw.hh b/src/aghermann/ui/mw/mw.hh
index 542ca1d..0e3b2ac 100644
--- a/src/aghermann/ui/mw/mw.hh
+++ b/src/aghermann/ui/mw/mw.hh
@@ -90,7 +90,7 @@ class SExpDesignUI
size_t tl_right_margin() const { return _p._p.tl_right_margin; }
void draw_timeline( cairo_t*) const;
- void draw_timeline( const char *fname) const;
+ void draw_timeline( const string& fname) const;
SGroupPresentation& _p;
SSubjectPresentation (agh::CSubject&, SGroupPresentation& parent);
diff --git a/src/aghermann/ui/mw/mw_cb.cc b/src/aghermann/ui/mw/mw_cb.cc
index 14d7fbb..2e176f9 100644
--- a/src/aghermann/ui/mw/mw_cb.cc
+++ b/src/aghermann/ui/mw/mw_cb.cc
@@ -112,12 +112,15 @@ tTaskSelector_switch_page_cb(
auto& ED = *(SExpDesignUI*)userdata;
if ( page_num == 1 ) {
//ED.populate( false);
- snprintf_buf( "Session: <b>%s</b>", ED.AghD());
- gtk_label_set_markup( ED.lSimulationsSession, __buf__);
- snprintf_buf( "Channel: <b>%s</b>", ED.AghT());
- gtk_label_set_markup( ED.lSimulationsChannel, __buf__);
- snprintf_buf( "Metric: <b>%s</b>", metrics::name( ED.display_profile_type));
- gtk_label_set_markup( ED.lSimulationsProfile, __buf__);
+ gtk_label_set_markup(
+ ED.lSimulationsSession,
+ snprintf_buf( "Session: <b>%s</b>", ED.AghD()));
+ gtk_label_set_markup(
+ ED.lSimulationsChannel,
+ snprintf_buf( "Channel: <b>%s</b>", ED.AghT()));
+ gtk_label_set_markup(
+ ED.lSimulationsProfile,
+ snprintf_buf( "Metric: <b>%s</b>", metrics::name( ED.display_profile_type)));
gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, FALSE);
ED.populate_2();
} else if ( page_num == 0 ) {
@@ -151,9 +154,11 @@ eMsmtProfileSmooth_value_changed_cb(
{
auto& ED = *(SExpDesignUI*)userdata;
ED.smooth_profile = v;
- snprintf_buf( "Smooth: %zu", ED.smooth_profile);
- gtk_button_set_label( (GtkButton*)b, __buf__);
- gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
+ gtk_button_set_label(
+ (GtkButton*)b,
+ snprintf_buf( "Smooth: %zu", ED.smooth_profile));
+ gtk_widget_queue_draw(
+ (GtkWidget*)ED.cMeasurements);
}
diff --git a/src/aghermann/ui/mw/populate.cc b/src/aghermann/ui/mw/populate.cc
index 09a9895..b239754 100644
--- a/src/aghermann/ui/mw/populate.cc
+++ b/src/aghermann/ui/mw/populate.cc
@@ -80,7 +80,7 @@ populate( bool do_load)
gtk_button_set_label(
(GtkButton*)eMsmtProfileSmooth,
- (snprintf_buf( "Smooth: %zu", smooth_profile), __buf__));
+ snprintf_buf( "Smooth: %zu", smooth_profile));
if ( AghTT.empty() )
aghui::pop_ok_message( wMainWindow,
@@ -546,17 +546,19 @@ populate_1()
"width-request", tl_width + tl_left_margin + tl_right_margin,
NULL);
- snprintf_buf( "<small>%zusec/%gHz/%s</small>",
- ED->fft_params.pagesize,
- ED->fft_params.binsize,
- sigproc::welch_window_type_names[ED->fft_params.welch_window_type]);
- gtk_label_set_markup( lMsmtProfilePSDExtra, __buf__);
-
- snprintf_buf( "<small>%gHz/%g/%g</small>",
- ED->mc_params.bandwidth,
- ED->mc_params.iir_backpolate,
- ED->mc_params.mc_gain);
- gtk_label_set_markup( lMsmtProfileMCExtra, __buf__);
+ gtk_label_set_markup(
+ lMsmtProfilePSDExtra,
+ snprintf_buf( "<small>%zusec/%gHz/%s</small>",
+ ED->fft_params.pagesize,
+ ED->fft_params.binsize,
+ sigproc::welch_window_type_names[ED->fft_params.welch_window_type]));
+
+ gtk_label_set_markup(
+ lMsmtProfileMCExtra,
+ snprintf_buf( "<small>%gHz/%g/%g</small>",
+ ED->mc_params.bandwidth,
+ ED->mc_params.iir_backpolate,
+ ED->mc_params.mc_gain));
suppress_redraw = false;
// set_cursor_busy( false, (GtkWidget*)wMainWindow);
diff --git a/src/aghermann/ui/mw/simulations_cb.cc b/src/aghermann/ui/mw/simulations_cb.cc
index 2193973..bc324af 100644
--- a/src/aghermann/ui/mw/simulations_cb.cc
+++ b/src/aghermann/ui/mw/simulations_cb.cc
@@ -140,10 +140,10 @@ iSimulationsRunBatch_activate_cb(
const ach::CModelRun&,
size_t i, size_t n)
{
- snprintf_buf( "(%zu of %zu) Running simulation in channel %s (%s) for %s (session %s) ...",
- i, n, H.c_str(), T.display_name().c_str(),
- J.id.c_str(), D.c_str());
- ED.sb_message( __buf__);
+ ED.sb_message(
+ snprintf_buf( "(%zu of %zu) Running simulation in channel %s (%s) for %s (session %s) ...",
+ i, n, H.c_str(), T.display_name().c_str(),
+ J.id.c_str(), D.c_str()));
gtk_flush();
};
CExpDesign::TModelRunFilterFun filter =
@@ -155,8 +155,7 @@ iSimulationsRunBatch_activate_cb(
ED.populate_2();
- snprintf_buf( "Done");
- ED.sb_message( __buf__);
+ ED.sb_message( "Done");
}
}
diff --git a/src/aghermann/ui/sf/d/artifacts_cb.cc b/src/aghermann/ui/sf/d/artifacts_cb.cc
index 759e228..34badd3 100644
--- a/src/aghermann/ui/sf/d/artifacts_cb.cc
+++ b/src/aghermann/ui/sf/d/artifacts_cb.cc
@@ -203,8 +203,9 @@ bSFADPreview_toggled_cb(
SF.using_channel -> get_signal_filtered();
- snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100);
- gtk_label_set_markup( AD.lSFADDirtyPercent, __buf__);
+ gtk_label_set_markup(
+ AD.lSFADDirtyPercent,
+ snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100));
gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
@@ -234,10 +235,12 @@ wSFAD_show_cb(
gtk_toggle_button_set_active( AD.bSFADPreview, FALSE);
AD.suppress_preview_handler = false;
- snprintf_buf( "Artifact detection in channel %s", SF.using_channel->name());
- gtk_label_set_text( AD.lSFADInfo, __buf__);
- snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100);
- gtk_label_set_text( AD.lSFADDirtyPercent, __buf__);
+ gtk_label_set_text(
+ AD.lSFADInfo,
+ snprintf_buf( "Artifact detection in channel %s", SF.using_channel->name()));
+ gtk_label_set_text(
+ AD.lSFADDirtyPercent,
+ snprintf_buf( "%4.2f%% marked", SF.using_channel->calculate_dirty_percent() * 100));
}
diff --git a/src/aghermann/ui/sf/d/patterns-draw.cc b/src/aghermann/ui/sf/d/patterns-draw.cc
index de471fe..46f9309 100644
--- a/src/aghermann/ui/sf/d/patterns-draw.cc
+++ b/src/aghermann/ui/sf/d/patterns-draw.cc
@@ -64,8 +64,7 @@ draw_thing( cairo_t *cr)
if ( i8 % 8 == 0 ) {
_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
cairo_move_to( cr, x + 5, da_thing_ht-2);
- snprintf_buf( "%g", (float)i8/8);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g", (float)i8/8));
cairo_stroke( cr);
}
}
diff --git a/src/aghermann/ui/sf/d/patterns-profiles.cc b/src/aghermann/ui/sf/d/patterns-profiles.cc
index 7d2036d..101847a 100644
--- a/src/aghermann/ui/sf/d/patterns-profiles.cc
+++ b/src/aghermann/ui/sf/d/patterns-profiles.cc
@@ -157,10 +157,9 @@ populate_combo()
if ( not patterns.empty() ) {
GtkTreeIter iter, current_pattern_iter;
for ( auto I = patterns.begin(); I != patterns.end(); ++I ) {
- snprintf_buf( "%s %s", origin_markers[I->origin], I->name.c_str());
gtk_list_store_append( mSFFDPatterns, &iter);
gtk_list_store_set( mSFFDPatterns, &iter,
- 0, __buf__,
+ 0, snprintf_buf( "%s %s", origin_markers[I->origin], I->name.c_str()),
-1);
if ( I == current_pattern )
current_pattern_iter = iter;
diff --git a/src/aghermann/ui/sf/d/patterns.cc b/src/aghermann/ui/sf/d/patterns.cc
index 139a9b4..4ce7d22 100644
--- a/src/aghermann/ui/sf/d/patterns.cc
+++ b/src/aghermann/ui/sf/d/patterns.cc
@@ -140,7 +140,7 @@ occurrences_to_annotations( sigfile::SAnnotation::TType t)
field_channel->annotations,
((double)occurrences[o]) / field_channel->samplerate(),
((double)occurrences[o] + current_pattern->pattern_size_essential()) / field_channel->samplerate(),
- (snprintf_buf("%s (%zu)", current_pattern->name.c_str(), o+1), __buf__),
+ snprintf_buf("%s (%zu)", current_pattern->name.c_str(), o+1),
t);
}
diff --git a/src/aghermann/ui/sf/d/patterns_cb.cc b/src/aghermann/ui/sf/d/patterns_cb.cc
index e8cd6ba..7f51849 100644
--- a/src/aghermann/ui/sf/d/patterns_cb.cc
+++ b/src/aghermann/ui/sf/d/patterns_cb.cc
@@ -261,13 +261,14 @@ bSFFDSearch_clicked_cb(
FD.da_field_ht);
FD.setup_controls_for_tune();
- snprintf_buf( "A: <b>%g</b> "
- "B: <b>%g</b>/<b>%g</b>/<b>%d</b> "
- "C: <b>%g</b>/<b>%g</b>/<b>%d</b>",
- FD.Pp2.env_scope,
- FD.Pp2.bwf_ffrom, FD.Pp2.bwf_fupto, FD.Pp2.bwf_order,
- FD.Pp2.dzcdf_step, FD.Pp2.dzcdf_sigma, FD.Pp2.dzcdf_smooth);
- gtk_label_set_markup( FD.lSFFDParametersBrief, __buf__);
+ gtk_label_set_markup(
+ FD.lSFFDParametersBrief,
+ snprintf_buf( "A: <b>%g</b> "
+ "B: <b>%g</b>/<b>%g</b>/<b>%d</b> "
+ "C: <b>%g</b>/<b>%g</b>/<b>%d</b>",
+ FD.Pp2.env_scope,
+ FD.Pp2.bwf_ffrom, FD.Pp2.bwf_fupto, FD.Pp2.bwf_order,
+ FD.Pp2.dzcdf_step, FD.Pp2.dzcdf_sigma, FD.Pp2.dzcdf_smooth));
gtk_widget_queue_draw( (GtkWidget*)FD.daSFFDField);
@@ -397,11 +398,12 @@ eSFFD_any_criteria_value_changed_cb(
FD.W_V.down();
FD.find_occurrences();
- snprintf_buf(
- "%zu match%s in <b>%s</b>",
- FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es",
- FD.field_channel->name());
- gtk_label_set_markup( FD.lSFFDFoundInfo, __buf__);
+ gtk_label_set_markup(
+ FD.lSFFDFoundInfo,
+ snprintf_buf(
+ "%zu match%s in <b>%s</b>",
+ FD.occurrences.size(), (FD.occurrences.size() == 1) ? "" : "es",
+ FD.field_channel->name()));
FD.set_profile_manage_buttons_visibility();
diff --git a/src/aghermann/ui/sf/d/phasediff.cc b/src/aghermann/ui/sf/d/phasediff.cc
index e2a8b5f..fd6b6b0 100644
--- a/src/aghermann/ui/sf/d/phasediff.cc
+++ b/src/aghermann/ui/sf/d/phasediff.cc
@@ -191,9 +191,8 @@ draw( cairo_t* cr, const int wd, const int ht)
cairo_set_line_width( cr, .25);
cairo_line_to( cr, tick_pos, ht);
if ( i % 4 == 0 ) {
- snprintf_buf( "%2zuh", i / 4);
cairo_move_to( cr, tick_pos+5, 12);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%2zuh", i / 4));
}
cairo_stroke( cr);
}
@@ -231,8 +230,7 @@ draw( cairo_t* cr, const int wd, const int ht)
cairo_set_font_size( cr, 9);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_move_to( cr, x + 5, 10);
- snprintf_buf( "%g ms", dpuf);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g ms", dpuf));
cairo_stroke( cr);
}
}
diff --git a/src/aghermann/ui/sf/d/phasediff_cb.cc b/src/aghermann/ui/sf/d/phasediff_cb.cc
index bf03f05..7094719 100644
--- a/src/aghermann/ui/sf/d/phasediff_cb.cc
+++ b/src/aghermann/ui/sf/d/phasediff_cb.cc
@@ -142,9 +142,10 @@ eSFPDSmooth_value_changed_cb(
{
auto& PD = *(SScoringFacility::SPhasediffDialog*)userdata;
- snprintf_buf( "Smooth: %zu",
- PD.smooth_side = v);
- gtk_button_set_label( (GtkButton*)b, __buf__);
+ PD.smooth_side = v;
+ gtk_button_set_label(
+ (GtkButton*)b,
+ snprintf_buf( "Smooth: %zu", v));
if ( PD.suspend_draw )
return;
@@ -176,8 +177,9 @@ wSFPD_show_cb(
gtk_spin_button_set_value( PD.eSFPDFreqFrom, PD.from);
gtk_spin_button_set_value( PD.eSFPDBandwidth, PD.upto - PD.from);
- snprintf_buf( "Smooth: %zu", PD.smooth_side);
- gtk_button_set_label( (GtkButton*)PD.eSFPDSmooth, __buf__);
+ gtk_button_set_label(
+ (GtkButton*)PD.eSFPDSmooth,
+ snprintf_buf( "Smooth: %zu", PD.smooth_side));
PD.update_course();
PD.suspend_draw = false;
diff --git a/src/aghermann/ui/sf/ica_cb.cc b/src/aghermann/ui/sf/ica_cb.cc
index 0a1b3b3..9acc8b5 100644
--- a/src/aghermann/ui/sf/ica_cb.cc
+++ b/src/aghermann/ui/sf/ica_cb.cc
@@ -253,11 +253,11 @@ mat2text_buffer( GtkTextBuffer *buffer, const itpp::mat& mx)
{
gtk_text_buffer_set_text( buffer, "", -1);
for ( int r = 0; r < mx.rows(); ++r ) {
- for ( int c = 0; c < mx.cols(); ++c ) {
- snprintf_buf( "\t% #6.3f", mx(r, c));
+ for ( int c = 0; c < mx.cols(); ++c )
gtk_text_buffer_insert_at_cursor(
- buffer, __buf__, -1);
- }
+ buffer,
+ snprintf_buf( "\t% #6.3f", mx(r, c)),
+ -1);
if ( r + 1 < mx.rows() )
gtk_text_buffer_insert_at_cursor( buffer, "\n", -1);
}
diff --git a/src/aghermann/ui/sf/montage-overlays.cc b/src/aghermann/ui/sf/montage-overlays.cc
index 6c61305..49cc968 100644
--- a/src/aghermann/ui/sf/montage-overlays.cc
+++ b/src/aghermann/ui/sf/montage-overlays.cc
@@ -86,9 +86,8 @@ draw_overlays( cairo_t* cr,
cairo_stroke( cr);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- snprintf_buf( "%g–%g Hz", psd.from, psd.upto);
cairo_move_to( cr, _p.da_wd - 170, pbot - 15);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g–%g Hz", psd.from, psd.upto));
cairo_stroke( cr);
}
@@ -107,8 +106,7 @@ draw_overlays( cairo_t* cr,
cairo_set_font_size( cr, 9);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_move_to( cr, x + 5, pbot - 20);
- snprintf_buf( "%g uV2", dpuf);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g uV2", dpuf));
cairo_stroke( cr);
}
@@ -198,9 +196,8 @@ draw_overlays( cairo_t* cr,
cairo_stroke( cr);
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- snprintf_buf( "f0:%g", mc.f0);
cairo_move_to( cr, _p.da_wd - 70, pbot - 30);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "f0:%g", mc.f0));
cairo_stroke( cr);
// scale
@@ -218,8 +215,7 @@ draw_overlays( cairo_t* cr,
cairo_set_font_size( cr, 9);
//cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_move_to( cr, x + 5, pbot - 20);
- snprintf_buf( "%g a.u.", dpuf);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
cairo_stroke( cr);
}
@@ -259,8 +255,7 @@ draw_overlays( cairo_t* cr,
cairo_set_font_size( cr, 9);
//cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_move_to( cr, x + 5, pbot - 20);
- snprintf_buf( "%g a.u.", dpuf);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g a.u.", dpuf));
cairo_stroke( cr);
}
@@ -348,8 +343,7 @@ draw_overlays( cairo_t* cr,
cairo_select_font_face( cr, "sans", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size( cr, 8);
cairo_move_to( cr, _p.da_wd-40, ptop + 11);
- snprintf_buf( "%4.2f spp", spp());
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%4.2f spp", spp()));
cairo_stroke( cr);
}
}
@@ -374,10 +368,9 @@ _draw_hour_ticks( cairo_t *cr,
cairo_move_to( cr, tick_pos, hbot);
cairo_rel_line_to( cr, 0, -((i%4 == 0) ? 20 : (i%2 == 0) ? 12 : 5));
if ( i % 4 == 0 ) {
- snprintf_buf( "%2zuh", i/4);
_p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgba( cr);
cairo_move_to( cr, tick_pos+5, hbot - 2);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%2zuh", i/4));
}
}
cairo_stroke( cr);
diff --git a/src/aghermann/ui/sf/montage.cc b/src/aghermann/ui/sf/montage.cc
index ec20e6a..3b115cf 100644
--- a/src/aghermann/ui/sf/montage.cc
+++ b/src/aghermann/ui/sf/montage.cc
@@ -388,8 +388,7 @@ draw_page( cairo_t *cr,
_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
cairo_move_to( cr, wd-88, y0 - 15);
cairo_set_font_size( cr, 10);
- snprintf_buf( "filt");
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, "filt");
one_signal_drawn = true;
cairo_stroke( cr);
}
@@ -411,8 +410,7 @@ draw_page( cairo_t *cr,
_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
cairo_move_to( cr, wd-88, y0 - 25);
cairo_set_font_size( cr, 10);
- snprintf_buf( "orig");
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, "orig");
cairo_stroke( cr);
}
}
@@ -472,8 +470,7 @@ draw_page( cairo_t *cr,
_p._p.CwB[SExpDesignUI::TColour::sf_labels].set_source_rgb( cr);
cairo_move_to( cr, wd-70, y0 + 15);
cairo_set_font_size( cr, 8);
- snprintf_buf( "%4.2f %% dirty", percent_dirty);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%4.2f %% dirty", percent_dirty));
cairo_stroke( cr);
}
}
@@ -606,8 +603,7 @@ draw_page( cairo_t *cr,
cairo_set_font_size( cr, 9);
cairo_move_to( cr, x + 5, ptop + 20);
- snprintf_buf( "%g mV", dpuf);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "%g mV", dpuf));
cairo_stroke( cr);
}
@@ -620,15 +616,15 @@ draw_page( cairo_t *cr,
cairo_show_text( cr, __buf__);
}
if ( have_high_pass() ) {
- snprintf_buf( "HP: %6.2f/%u", filters.high_pass_cutoff, filters.high_pass_order);
cairo_move_to( cr, wd-100, y0 + 24);
- cairo_show_text( cr, __buf__);
+ cairo_show_text(
+ cr,
+ snprintf_buf( "HP: %6.2f/%u", filters.high_pass_cutoff, filters.high_pass_order));
}
if ( have_notch_filter() ) {
static const char *nfs[] = { "", "50 Hz", "60 Hz" };
- snprintf_buf( "-v-: %s", nfs[(int)filters.notch_filter]);
cairo_move_to( cr, wd-100, y0 + 33);
- cairo_show_text( cr, __buf__);
+ cairo_show_text( cr, snprintf_buf( "-v-: %s", nfs[(int)filters.notch_filter]));
}
cairo_stroke( cr);
}
diff --git a/src/aghermann/ui/sf/montage_cb.cc b/src/aghermann/ui/sf/montage_cb.cc
index 019b1d2..99e602d 100644
--- a/src/aghermann/ui/sf/montage_cb.cc
+++ b/src/aghermann/ui/sf/montage_cb.cc
@@ -719,9 +719,9 @@ iSFPageFilter_activate_cb(
FD.P = H.filters;
FD.W_V.up();
- snprintf_buf( "<big>Filters for channel <b>%s</b></big>", SF.using_channel->name());
- gtk_label_set_markup( FD.lSFFilterCaption,
- __buf__);
+ gtk_label_set_markup(
+ FD.lSFFilterCaption,
+ snprintf_buf( "<big>Filters for channel <b>%s</b></big>", SF.using_channel->name()));
if ( gtk_dialog_run( FD.wSFFilters) == GTK_RESPONSE_OK ) {
FD.W_V.down();
@@ -766,9 +766,9 @@ iSFPageArtifactsMarkFlat_activate_cb(
auto marked = SF.using_channel->mark_flat_regions_as_artifacts( AS.min_size, AS.pad);
- snprintf_buf( "Detected %.2g sec of flat regions, adding %.2g sec to already marked",
- marked.first, marked.second);
- SF.sb_message( __buf__);
+ SF.sb_message(
+ snprintf_buf( "Detected %.2g sec of flat regions, adding %.2g sec to already marked",
+ marked.first, marked.second));
gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
@@ -820,13 +820,14 @@ iSFPageSaveChannelAsSVG_activate_cb(
auto& SF = *(SScoringFacility*)userdata;
auto& ED = SF._p;
string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
- snprintf_buf( "%s/%s/%s-p%zu@%zu.svg", j_dir.c_str(), ED.AghD(), ED.AghT(), SF.cur_vpage(), SF.vpagesize());
- string fname {__buf__};
+ string fname { snprintf_buf(
+ "%s/%s/%s-p%zu@%zu.svg",
+ j_dir.c_str(), ED.AghD(), ED.AghT(), SF.cur_vpage(), SF.vpagesize()) };
SF.using_channel->draw_for_montage( fname.c_str(), SF.da_wd, SF.interchannel_gap);
- snprintf_buf( "Wrote \"%s\"",
- agh::str::homedir2tilda(fname).c_str());
- ED.sb_message( __buf__);
+ ED.sb_message(
+ snprintf_buf( "Wrote \"%s\"",
+ agh::str::homedir2tilda(fname).c_str()));
}
@@ -838,13 +839,15 @@ iSFPageSaveMontageAsSVG_activate_cb(
auto& SF = *(SScoringFacility*)userdata;
auto& ED = SF._p;
string j_dir = ED.ED->subject_dir( SF.using_channel->crecording.subject());
- snprintf_buf( "%s/%s/montage-p%zu@%zu.svg", j_dir.c_str(), ED.AghD(), SF.cur_vpage(), SF.vpagesize());
- string fname {__buf__};
+ string fname { snprintf_buf(
+ "%s/%s/montage-p%zu@%zu.svg",
+ j_dir.c_str(), ED.AghD(), SF.cur_vpage(), SF.vpagesize())};
SF.draw_montage( fname.c_str());
- snprintf_buf( "Wrote \"%s\"",
- agh::str::homedir2tilda(fname).c_str());
- ED.sb_message( __buf__);
+ ED.sb_message(
+ snprintf_buf(
+ "Wrote \"%s\"",
+ agh::str::homedir2tilda(fname).c_str()));
}
@@ -856,13 +859,16 @@ iSFPageExportSignal_activate_cb(
auto& SF = *(SScoringFacility*)userdata;
auto& r = SF.using_channel->crecording;
string fname_base = r.F().filename();
- snprintf_buf( "%s-filt.tsv", fname_base.c_str());
- r.F().export_filtered( SF.using_channel->h(), __buf__);
+ r.F().export_filtered(
+ SF.using_channel->h(),
+ snprintf_buf( "%s-filt.tsv", fname_base.c_str()));
snprintf_buf( "%s-orig.tsv", fname_base.c_str());
- r.F().export_original( SF.using_channel->h(), __buf__);
- snprintf_buf( "Wrote \"%s-{filt,orig}.tsv\"",
- fname_base.c_str());
- SF._p.sb_message( __buf__);
+ r.F().export_original(
+ SF.using_channel->h(),
+ snprintf_buf( "%s-filt.tsv", fname_base.c_str()));
+ SF._p.sb_message(
+ snprintf_buf( "Wrote \"%s-{filt,orig}.tsv\"",
+ fname_base.c_str()));
}
@@ -1218,8 +1224,7 @@ iSFPowerExportRange_activate_cb(
// fname_base = __buf__;
// }
- snprintf_buf( "Wrote %s", agh::str::homedir2tilda(fname_base).c_str());
- SF._p.sb_message( __buf__);
+ SF._p.sb_message( snprintf_buf( "Wrote %s", agh::str::homedir2tilda(fname_base).c_str()));
}
void
diff --git a/src/aghermann/ui/sf/sf.cc b/src/aghermann/ui/sf/sf.cc
index fda00b1..71c9257 100644
--- a/src/aghermann/ui/sf/sf.cc
+++ b/src/aghermann/ui/sf/sf.cc
@@ -108,22 +108,19 @@ SScoringFacility (agh::CSubject& J,
int seq = 1;
for ( auto &H : _sepisode.recordings )
if ( H.second.signal_type() == sigfile::SChannel::TType::eeg ) {
- snprintf_buf( "Reading and processing EEG channel %s ...", H.first.c_str());
- _p.sb_message( __buf__);
+ _p.sb_message( snprintf_buf( "Reading and processing EEG channel %s ...", H.first.c_str()));
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
for ( auto &H : _sepisode.recordings )
if ( H.second.signal_type() == sigfile::SChannel::TType::eog ) {
- snprintf_buf( "Reading and processing EOG channel %s ...", H.first.c_str());
- _p.sb_message( __buf__);
+ _p.sb_message( snprintf_buf( "Reading and processing EOG channel %s ...", H.first.c_str()));
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
for ( auto &H : _sepisode.recordings )
if ( H.second.signal_type() == sigfile::SChannel::TType::emg ) {
- snprintf_buf( "Reading and processing EMG channel %s ...", H.first.c_str());
- _p.sb_message( __buf__);
+ _p.sb_message( snprintf_buf( "Reading and processing EMG channel %s ...", H.first.c_str()));
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
@@ -133,8 +130,7 @@ SScoringFacility (agh::CSubject& J,
type != sigfile::SChannel::TType::eog &&
type != sigfile::SChannel::TType::emg &&
type != sigfile::SChannel::TType::embedded_annotation ) {
- snprintf_buf( "Reading and processing channel %s ...", H.first.c_str());
- _p.sb_message( __buf__);
+ _p.sb_message( snprintf_buf( "Reading and processing channel %s ...", H.first.c_str()));
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
@@ -212,8 +208,7 @@ SScoringFacility (agh::CSubject& J,
// set window title
gtk_window_set_title(
(GtkWindow*)wSF,
- (snprintf_buf( "Scoring: %s’s %s in %s", J.name.c_str(), E.c_str(), D.c_str()),
- __buf__));
+ snprintf_buf( "Scoring: %s’s %s in %s", J.name.c_str(), E.c_str(), D.c_str()));
// align empty area next to EMG profile with spectrum panes vertically
// g_object_set( (GObject*)cSFSleepStageStats,
@@ -507,8 +502,7 @@ set_vpagesize_item( int item, const bool touch_self)
bSFGotoPrevUnscored, bSFGotoNextUnscored} )
gtk_widget_set_sensitive( (GtkWidget*)(B), sensitive_indeed);
- snprintf_buf( "of %zu", total_vpages());
- gtk_label_set_markup( lSFTotalPages, __buf__);
+ gtk_label_set_markup( lSFTotalPages, snprintf_buf( "of %zu", total_vpages()));
if ( touch_self )
gtk_combo_box_set_active( eSFPageSize, pagesize_item);
@@ -603,17 +597,18 @@ void
aghui::SScoringFacility::
draw_score_stats() const
{
- snprintf_buf( "<b>%3.1f</b> %% scored", scored_percent);
- gtk_label_set_markup( lSFPercentScored, __buf__);
-
- snprintf_buf( "<small>%3.1f</small> %%", scored_percent_nrem);
- gtk_label_set_markup( lScoreStatsNREMPercent, __buf__);
-
- snprintf_buf( "<small>%3.1f</small> %%", scored_percent_rem);
- gtk_label_set_markup( lScoreStatsREMPercent, __buf__);
-
- snprintf_buf( "<small>%3.1f</small> %%", scored_percent_wake);
- gtk_label_set_markup( lScoreStatsWakePercent, __buf__);
+ gtk_label_set_markup(
+ lSFPercentScored,
+ snprintf_buf( "<b>%3.1f</b> %% scored", scored_percent));
+ gtk_label_set_markup(
+ lScoreStatsNREMPercent,
+ snprintf_buf( "<small>%3.1f</small> %%", scored_percent_nrem));
+ gtk_label_set_markup(
+ lScoreStatsREMPercent,
+ snprintf_buf( "<small>%3.1f</small> %%", scored_percent_rem));
+ gtk_label_set_markup(
+ lScoreStatsWakePercent,
+ snprintf_buf( "<small>%3.1f</small> %%", scored_percent_wake));
}
--
Sleep experiment manager
More information about the debian-med-commit
mailing list