[med-svn] [SCM] aghermann branch, master, updated. 06bda7dfaa687aaf0708a024d192024e2cd58421
Andrei Zavada
johnhommer at gmail.com
Thu Jan 24 00:43:29 UTC 2013
The following commit has been merged in the master branch:
commit 49d801b49a27192151c31c02e44c458c6897de0d
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Tue Jan 8 15:28:19 2013 +0200
some statusbar convenience functions for mw and sf
diff --git a/src/ui/mw/mw-mainmenu_cb.cc b/src/ui/mw/mw-mainmenu_cb.cc
index 9de8772..aa0a689 100644
--- a/src/ui/mw/mw-mainmenu_cb.cc
+++ b/src/ui/mw/mw-mainmenu_cb.cc
@@ -110,7 +110,7 @@ iExpBasicSADetectUltradianCycles_activate_cb( GtkMenuItem*, gpointer userdata)
snprintf_buf(
"(%zu of %zu) %s/%s/%s", i, n,
ED.ED->group_of(J), J.name(), E.name());
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
gtk_widget_queue_draw( (GtkWidget*)ED.cMeasurements);
gdk_window_process_updates(
gtk_widget_get_parent_window( (GtkWidget*)ED.cMeasurements),
@@ -168,7 +168,7 @@ iExpGloballyDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
snprintf_buf(
"(%zu of %zu) Detect artifacts in %s/%s/%s/%s:%s", i, total,
ED.ED->group_of(J), J.name(), D.c_str(), E.name(), R.F().channel_by_id(R.h()));
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
gtk_flush();
};
switch ( response ) {
diff --git a/src/ui/mw/mw-measurements_cb.cc b/src/ui/mw/mw-measurements_cb.cc
index fa8d9ab..c2a5762 100644
--- a/src/ui/mw/mw-measurements_cb.cc
+++ b/src/ui/mw/mw-measurements_cb.cc
@@ -191,7 +191,7 @@ iSubjectTimelineSaveAsSVG_activate_cb( GtkMenuItem *checkmenuitem, gpointer user
J->draw_timeline( __buf__);
snprintf_buf( "Wrote \"%s\"", agh::str::homedir2tilda(tmp).c_str());
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
}
diff --git a/src/ui/mw/mw-simulations_cb.cc b/src/ui/mw/mw-simulations_cb.cc
index 1083933..1c558bc 100644
--- a/src/ui/mw/mw-simulations_cb.cc
+++ b/src/ui/mw/mw-simulations_cb.cc
@@ -143,7 +143,7 @@ iSimulationsRunBatch_activate_cb( GtkMenuItem*, gpointer userdata)
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.name(), D.c_str());
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
gtk_flush();
};
CExpDesign::TModelRunFilterFun filter =
@@ -156,7 +156,7 @@ iSimulationsRunBatch_activate_cb( GtkMenuItem*, gpointer userdata)
ED.populate_2();
snprintf_buf( "Done");
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
}
}
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index 40b01bf..86f7bed 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -426,14 +426,10 @@ do_purge_computed()
if ( ED->purge_cached_profiles() ) {
fprintf( stderr, "Command '%s' returned a non-zero status. This is suspicious.\n", __buf__);
- gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
- gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral,
- "Failed to purge cache files. This is odd.");
+ sb_message( "Failed to purge cache files. This is odd.");
}
- gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
- gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral,
- "Purged computed files cache");
+ sb_message( "Purged computed files cache");
}
@@ -532,18 +528,27 @@ show_changelog()
void
aghui::SExpDesignUI::
-buf_on_main_status_bar()
+sb_message( const char* msg) const
{
gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
- gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral, __buf__);
+ gtk_statusbar_push( sbMainStatusBar, sbMainContextIdGeneral, msg);
}
void
aghui::SExpDesignUI::
+sb_clear() const
+{
+ gtk_statusbar_pop( sbMainStatusBar, sbMainContextIdGeneral);
+}
+
+
+
+void
+aghui::SExpDesignUI::
sb_main_progress_indicator( const char* current, size_t n, size_t i, aghui::TGtkRefreshMode mode)
{
snprintf_buf( "(%zu of %zu) %s", i, n, current);
- buf_on_main_status_bar();
+ sb_message( __buf__);
switch ( mode ) {
case TGtkRefreshMode::gtk:
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 5ade1c2..290cf15 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -311,9 +311,10 @@ class SExpDesignUI
int ctl_params0_siman_params_t_initial_exponent;
// status bar bits
+ void sb_message( const char*) const;
+ void sb_clear() const;
void sb_main_progress_indicator( const char*, size_t n, size_t i,
aghui::TGtkRefreshMode);
- void buf_on_main_status_bar();
// dnd
struct SDndIface {
diff --git a/src/ui/sf/sf-montage_cb.cc b/src/ui/sf/sf-montage_cb.cc
index 572b1b5..0ed7201 100644
--- a/src/ui/sf/sf-montage_cb.cc
+++ b/src/ui/sf/sf-montage_cb.cc
@@ -560,8 +560,7 @@ iSFPageLocateSelection_activate_cb( GtkMenuItem*, gpointer userdata)
{
auto& SF = *(SScoringFacility*)userdata;
if ( SF.using_channel->selection_start == SF.using_channel->selection_end ) {
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, "There is no selection in this channel");
+ SF.sb_message( "There is no selection in this channel");
} else
SF.set_cur_vpage(
SF.using_channel->selection_start / SF.using_channel->samplerate() / SF.vpagesize());
@@ -660,7 +659,7 @@ iSFPageArtifactsMarkFlat_activate_cb( GtkMenuItem*, gpointer userdata)
snprintf_buf( "Detected %.2g sec of flat regions, adding %.2g sec to already marked",
marked.first, marked.second);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, __buf__);
+ SF.sb_message( __buf__);
gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
@@ -710,7 +709,7 @@ iSFPageSaveChannelAsSVG_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
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.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
}
@@ -726,7 +725,7 @@ iSFPageSaveMontageAsSVG_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
SF.draw_montage( fname.c_str());
snprintf_buf( "Wrote \"%s\"",
agh::str::homedir2tilda(fname).c_str());
- ED.buf_on_main_status_bar();
+ ED.sb_message( __buf__);
}
@@ -742,7 +741,7 @@ iSFPageExportSignal_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
r.F().export_original( SF.using_channel->h(), __buf__);
snprintf_buf( "Wrote \"%s-{filt,orig}.tsv\"",
fname_base.c_str());
- SF._p.buf_on_main_status_bar();
+ SF._p.sb_message( __buf__);
}
@@ -962,7 +961,7 @@ iSFPowerExportRange_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
// }
snprintf_buf( "Wrote %s", agh::str::homedir2tilda(fname_base).c_str());
- SF._p.buf_on_main_status_bar();
+ SF._p.sb_message( __buf__);
}
void
@@ -992,7 +991,7 @@ iSFPowerExportAll_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
}
snprintf_buf( "Wrote %s", agh::str::homedir2tilda(fname_base).c_str());
- SF._p.buf_on_main_status_bar();
+ SF._p.sb_message( __buf__);
}
void
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 9556f8b..186a146 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -101,21 +101,21 @@ SScoringFacility (agh::CSubject& J,
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.buf_on_main_status_bar();
+ _p.sb_message( __buf__);
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.buf_on_main_status_bar();
+ _p.sb_message( __buf__);
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.buf_on_main_status_bar();
+ _p.sb_message( __buf__);
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
@@ -125,7 +125,7 @@ SScoringFacility (agh::CSubject& J,
type != sigfile::SChannel::TType::eog &&
type != sigfile::SChannel::TType::emg ) {
snprintf_buf( "Reading and processing channel %s ...", H.first.c_str());
- _p.buf_on_main_status_bar();
+ _p.sb_message( __buf__);
channels.emplace_back( H.second, *this, y, seq++);
y += interchannel_gap;
}
@@ -255,12 +255,12 @@ SScoringFacility (agh::CSubject& J,
gtk_widget_set_visible( (GtkWidget*)_p.tSettings, false);
// tell main window we are done (so it can start another instance of scoring facility)
- gtk_statusbar_pop( _p.sbMainStatusBar, _p.sbMainContextIdGeneral);
+ _p.sb_clear();
}
aghui::SScoringFacility::
-~SScoringFacility()
+~SScoringFacility ()
{
if ( ica )
delete ica;
@@ -677,6 +677,22 @@ reset_montage()
+void
+aghui::SScoringFacility::
+sb_message( const char* msg) const
+{
+ gtk_statusbar_pop( sbSF, sbSFContextIdGeneral);
+ gtk_statusbar_push( sbSF, sbSFContextIdGeneral, msg);
+}
+
+void
+aghui::SScoringFacility::
+sb_clear() const
+{
+ gtk_statusbar_pop( sbSF, sbSFContextIdGeneral);
+}
+
+
const char* const
aghui::SScoringFacility::tooltips[2] = {
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 92d4085..c16b03f 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -471,7 +471,6 @@ class SScoringFacility
// draw
void draw_montage( cairo_t*);
void draw_montage( const char *fname); // to a file (uses da_wd and da_ht
-
private:
template <class T>
void _draw_matrix_to_montage( cairo_t*, const itpp::Mat<T>&);
@@ -485,6 +484,10 @@ class SScoringFacility
void do_score_forward( char score_ch);
void do_score_back( char score_ch);
+ // status bar
+ void sb_message( const char*) const;
+ void sb_clear() const;
+
// tips
enum TTipIdx : size_t {
scoring_mode,
diff --git a/src/ui/sf/sf_cb.cc b/src/ui/sf/sf_cb.cc
index 41a68de..847996e 100644
--- a/src/ui/sf/sf_cb.cc
+++ b/src/ui/sf/sf_cb.cc
@@ -81,7 +81,7 @@ bSFForward_clicked_cb( GtkButton *button, gpointer userdata)
auto current = SF.cur_vpage();
if ( current < SF.total_vpages() - 1 )
SF.set_cur_vpage( current+1);
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
}
void
@@ -91,7 +91,7 @@ bSFBack_clicked_cb( GtkButton *button, gpointer userdata)
auto current = SF.cur_vpage();
if ( current > 0 )
SF.set_cur_vpage( current-1);
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
}
@@ -114,12 +114,11 @@ bScoreGotoPrevUnscored_clicked_cb( GtkButton *button, gpointer userdata)
size_t p = SF.cur_page();
while ( --p != (size_t)-1 )
if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
SF.set_cur_vpage( SF.p2ap(p));
return;
}
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, "No more unscored pages before this");
+ SF.sb_message( "No more unscored pages before this");
}
void
@@ -131,12 +130,11 @@ bScoreGotoNextUnscored_clicked_cb( GtkButton *button, gpointer userdata)
size_t p = SF.cur_page();
while ( ++p < SF.total_pages() )
if ( SF.hypnogram[p] == sigfile::SPage::score_code(sigfile::SPage::TScore::none) ) {
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
SF.set_cur_vpage( SF.p2ap(p));
return;
}
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, "No more unscored pages after this");
+ SF.sb_message( "No more unscored pages after this");
}
@@ -151,12 +149,11 @@ bScoreGotoPrevArtifact_clicked_cb( GtkButton *button, gpointer userdata)
size_t p = SF.cur_vpage();
while ( --p != (size_t)-1 )
if ( SF.page_has_artifacts( p, false)) {
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
SF.set_cur_vpage( p);
return;
}
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, "No more dirty pages before this");
+ SF.sb_message( "No more dirty pages before this");
}
void
@@ -168,12 +165,11 @@ bScoreGotoNextArtifact_clicked_cb( GtkButton *button, gpointer userdata)
size_t p = SF.cur_vpage();
while ( ++p < SF.total_vpages() )
if ( SF.page_has_artifacts( p)) {
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
+ SF.sb_clear();
SF.set_cur_vpage( p);
return;
}
- gtk_statusbar_pop( SF.sbSF, SF.sbSFContextIdGeneral);
- gtk_statusbar_push( SF.sbSF, SF.sbSFContextIdGeneral, "No more dirty pages after this");
+ SF.sb_message( "No more dirty pages after this");
}
--
Sleep experiment manager
More information about the debian-med-commit
mailing list