[med-svn] [aghermann] 10/85: ICM
andrei zavada
hmmr-guest at alioth.debian.org
Thu Sep 26 23:46:23 UTC 2013
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to branch master
in repository aghermann.
commit 6475f07d292f27504fdda7f9a7f5f24937e7871d
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sat Sep 7 00:31:06 2013 +0300
ICM
---
upstream/src/aghermann/main.cc | 2 +-
upstream/src/aghermann/ui/globals.cc | 63 ++++++++++--
upstream/src/aghermann/ui/globals.hh | 5 +
upstream/src/aghermann/ui/sf/sf.cc | 17 ++++
upstream/src/aghermann/ui/sf/sf.hh | 184 +++++++++++++++++-----------------
upstream/src/aghermann/ui/sm/sm.cc | 7 +-
upstream/src/aghermann/ui/ui.cc | 55 ----------
upstream/src/aghermann/ui/ui.hh | 4 -
8 files changed, 173 insertions(+), 164 deletions(-)
diff --git a/upstream/src/aghermann/main.cc b/upstream/src/aghermann/main.cc
index 685f78e..21b60e8 100644
--- a/upstream/src/aghermann/main.cc
+++ b/upstream/src/aghermann/main.cc
@@ -83,7 +83,7 @@ main( int argc, char **argv)
agh::global::init();
- if ( ui::prepare_for_expdesign() ) {
+ if ( agh::ui::global::prepare_for_expdesign() ) {
ui::pop_ok_message(
NULL,
"UI failed to initialize",
diff --git a/upstream/src/aghermann/ui/globals.cc b/upstream/src/aghermann/ui/globals.cc
index d66e205..e847213 100644
--- a/upstream/src/aghermann/ui/globals.cc
+++ b/upstream/src/aghermann/ui/globals.cc
@@ -13,21 +13,70 @@
#include "globals.hh"
using namespace std;
-using namespace agh::ui;
+using namespace agh::ui::global;
-char global::buf[AGH_BUF_SIZE];
+char agh::ui::global::buf[AGH_BUF_SIZE];
GdkDevice
- *global::client_pointer;
+ *agh::ui::global::client_pointer;
UniqueApp
- *global::unique_app;
+ *agh::ui::global::unique_app;
GtkWindow
- *global::main_window;
+ *agh::ui::global::main_window;
+
+double agh::ui::global::hdpmm,
+ agh::ui::global::vdpmm;
+
+
+// unique
+
+void
+agh::ui::global::
+set_unique_app_window( GtkWindow* w)
+{
+ unique_app_watch_window(
+ unique_app,
+ main_window = w);
+}
+
+// own init
+
+#define AGH_UI_GRESOURCE_FILE "aghermann.gresource"
+
+int
+agh::ui::global::
+prepare_for_expdesign()
+{
+ // tell me what they are
+ client_pointer =
+ gdk_device_manager_get_client_pointer(
+ gdk_display_get_device_manager( gdk_display_get_default()));
+
+ {
+ auto scr = gdk_screen_get_default();
+
+ hdpmm = (double)gdk_screen_get_width ( scr) / gdk_screen_get_width_mm ( scr);
+ vdpmm = (double)gdk_screen_get_height( scr) / gdk_screen_get_height_mm( scr);
+ gdk_screen_set_resolution( scr, (hdpmm + vdpmm)/2);
+ }
+
+ GResource
+ *gresource
+ = g_resource_load(
+ PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE,
+ NULL);
+ if ( !gresource ) {
+ fprintf( stderr, "Bad or missing " PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE);
+ return -1;
+ }
+ g_resources_register( gresource);
+
+ return 0;
+}
+
-double global::hdpmm,
- global::vdpmm;
// Local Variables:
diff --git a/upstream/src/aghermann/ui/globals.hh b/upstream/src/aghermann/ui/globals.hh
index 3f47729..2cd9b61 100644
--- a/upstream/src/aghermann/ui/globals.hh
+++ b/upstream/src/aghermann/ui/globals.hh
@@ -46,6 +46,11 @@ extern double
extern char
buf[AGH_BUF_SIZE];
+
+void set_unique_app_window( GtkWindow*);
+
+int prepare_for_expdesign();
+
}
}
} // namespace agh::ui::global
diff --git a/upstream/src/aghermann/ui/sf/sf.cc b/upstream/src/aghermann/ui/sf/sf.cc
index 4d3c59a..c5021a3 100644
--- a/upstream/src/aghermann/ui/sf/sf.cc
+++ b/upstream/src/aghermann/ui/sf/sf.cc
@@ -337,6 +337,23 @@ SScoringFacility::
delete _filters_d;
}
+
+
+int
+SScoringFacility::
+channel_idx( SChannel* h) const
+{
+ int i = 0;
+ for ( auto& H : channels )
+ if ( &H == h )
+ return i;
+ else ++i;
+ return -1;
+}
+
+
+
+
void
SScoringFacility::
redraw_ssubject_timeline() const
diff --git a/upstream/src/aghermann/ui/sf/sf.hh b/upstream/src/aghermann/ui/sf/sf.hh
index fa907ed..519d560 100644
--- a/upstream/src/aghermann/ui/sf/sf.hh
+++ b/upstream/src/aghermann/ui/sf/sf.hh
@@ -61,13 +61,13 @@ class SScoringFacility
private:
agh::CSubject&
_csubject;
- string _session;
+ string _session;
agh::SEpisode&
_sepisode;
public:
- agh::CSubject& csubject() const { return _csubject; }
- agh::SEpisode& sepisode() const { return _sepisode; }
- const string& session() const { return _session; }
+ agh::CSubject& csubject() const { return _csubject; }
+ agh::SEpisode& sepisode() const { return _sepisode; }
+ const string& session() const { return _session; }
// channels
struct SChannel {
@@ -117,7 +117,7 @@ class SScoringFacility
size_t samplerate() const;
// artifacts
- float percent_dirty;
+ float percent_dirty;
float calculate_dirty_percent();
void detect_artifacts( const metrics::mc::SArtifactDetectionPP&);
pair<double, double>
@@ -128,7 +128,7 @@ class SScoringFacility
in_annotations( double time) const;
// signal metrics
- static pattern::SPatternPPack<TFloat>
+ static pattern::SPatternPPack<TFloat>
pattern_params;
sigproc::SCachedLowPassCourse<TFloat>
signal_lowpass;
@@ -152,11 +152,11 @@ class SScoringFacility
struct SProfilePSD {
valarray<TFloat>
course;
- double from, upto;
- double display_scale; // saved via libconfig, requiring it to be double
+ double from, upto;
+ double display_scale; // saved via libconfig, requiring it to be double
array<valarray<TFloat>, metrics::TBand::TBand_total>
course_in_bands;
- size_t focused_band,
+ size_t focused_band,
uppermost_band;
};
void get_psd_course();
@@ -167,8 +167,8 @@ class SScoringFacility
struct SProfileSWU {
valarray<TFloat>
course;
- double f0;
- double display_scale;
+ double f0;
+ double display_scale;
};
void get_swu_course();
SProfileSWU
@@ -177,8 +177,8 @@ class SScoringFacility
struct SProfileMC {
valarray<TFloat>
course;
- double display_scale;
- double f0;
+ double display_scale;
+ double f0;
};
SProfileMC
mc;
@@ -192,7 +192,7 @@ class SScoringFacility
// spectrum
valarray<TFloat>
spectrum; // per page, is volatile
- float spectrum_upper_freq;
+ float spectrum_upper_freq;
unsigned
spectrum_bins,
last_spectrum_bin;
@@ -212,13 +212,13 @@ class SScoringFacility
// ctor, dtor
SChannel( agh::CRecording& r, SScoringFacility&, size_t y, int seq);
- double zeroy;
+ double zeroy;
bool operator<( const SChannel&) const;
- double signal_display_scale;
+ double signal_display_scale;
// saved flags
- bool hidden,
+ bool hidden,
draw_zeroline,
draw_original_signal,
draw_filtered_signal,
@@ -239,27 +239,27 @@ class SScoringFacility
draw_phasic_spindle,
draw_phasic_Kcomplex,
draw_phasic_eyeblink;
- bool discard_marked,
+ bool discard_marked,
apply_reconstituted;
- forward_list<agh::confval::SValidator<bool>> config_keys_b;
- forward_list<agh::confval::SValidator<int>> config_keys_d;
- forward_list<agh::confval::SValidator<double>> config_keys_g;
+ forward_list<agh::confval::SValidator<bool>> config_keys_b;
+ forward_list<agh::confval::SValidator<int>> config_keys_d;
+ forward_list<agh::confval::SValidator<double>> config_keys_g;
void update_channel_menu_items( double x);
void update_power_menu_items();
void selectively_enable_selection_menu_items();
// selection and marquee
- float marquee_mstart,
+ float marquee_mstart,
marquee_mend, // in terms of event->x
marquee_start,
marquee_end; // set on button_release
- double selection_start_time,
+ double selection_start_time,
selection_end_time; // in seconds
- size_t selection_start,
+ size_t selection_start,
selection_end; // in samples
- TFloat selection_SS,
+ TFloat selection_SS,
selection_SU;
size_t marquee_to_selection();
void put_selection( size_t a, size_t e);
@@ -305,13 +305,17 @@ class SScoringFacility
};
list<SChannel>
channels;
- size_t n_eeg_channels;
- SChannel& operator[]( const string&);
- SChannel& operator[]( size_t i)
- {
- return channel_by_idx(i);
- }
- SChannel& channel_by_idx( size_t i);
+ size_t n_eeg_channels;
+
+ SChannel&
+ operator[]( const string&);
+
+ SChannel&
+ operator[]( size_t i)
+ { return channel_by_idx(i); }
+
+ SChannel&
+ channel_by_idx( size_t);
void
update_all_channels_profile_display_scale();
@@ -321,25 +325,24 @@ class SScoringFacility
common_annotations;
// timeline
- time_t start_time() const
- {
- return channels.front().crecording.F().start_time();
- }
+ time_t
+ start_time() const
+ { return channels.front().crecording.F().start_time(); }
vector<char>
hypnogram;
- size_t total_pages() const
- {
- return hypnogram.size();
- }
- size_t total_vpages() const
- {
- return p2ap( total_pages());
- }
+ size_t
+ total_pages() const
+ { return hypnogram.size(); }
+
+ size_t
+ total_vpages() const
+ { return p2ap( total_pages()); }
+
void get_hypnogram();
void put_hypnogram();
- float scored_percent,
+ float scored_percent,
scored_percent_nrem,
scored_percent_rem,
scored_percent_wake;
@@ -348,7 +351,7 @@ class SScoringFacility
// state and flags
// volatile
- bool suppress_redraw:1,
+ bool suppress_redraw:1,
hypnogram_button_down:1,
artifacts_dialog_shown:1;
enum class TMode {
@@ -360,47 +363,45 @@ class SScoringFacility
showing_ics,
showing_remixed
};
- TMode mode;
- size_t crosshair_at;
- double crosshair_at_time;
+ TMode mode;
+ size_t crosshair_at;
+ double crosshair_at_time;
// persistent
- bool show_cur_pos_time_relative,
+ bool show_cur_pos_time_relative,
draw_crosshair,
alt_hypnogram;
// page and vpage index
- size_t cur_page() const { return _cur_page; }
+ size_t cur_page() const { return _cur_page; }
size_t cur_vpage() const { return _cur_vpage; }
void set_cur_vpage( size_t p, bool touch_self = true);
- size_t cur_page_start() const // in seconds
- {
- return _cur_page * pagesize();
- }
- size_t cur_page_end() const // in seconds
- {
- return (_cur_page + 1) * pagesize();
- }
+ size_t
+ cur_page_start() const // in seconds
+ { return _cur_page * pagesize(); }
+
+ size_t
+ cur_page_end() const // in seconds
+ { return (_cur_page + 1) * pagesize(); }
sigfile::SPage::TScore
cur_page_score() const
- {
- return sigfile::SPage::char2score( hypnogram[_cur_page]);
- }
+ { return sigfile::SPage::char2score( hypnogram[_cur_page]); }
+
bool page_has_artifacts( size_t, bool check_all_channels = true) const;
bool page_has_annotations( size_t, const SChannel&) const;
// pagesize
- size_t pagesize() const
- {
- return _p.pagesize();
- }
+ size_t
+ pagesize() const
+ { return _p.pagesize(); }
+
static const array<unsigned, 9>
DisplayPageSizeValues;
static size_t
figure_display_pagesize_item( size_t seconds);
private:
- int pagesize_item;
+ int pagesize_item;
public:
size_t vpagesize() const;
@@ -410,12 +411,12 @@ class SScoringFacility
size_t p2ap( size_t p) const; // page to visible_page
size_t ap2p( size_t p) const;
private:
- size_t _cur_page,
+ size_t _cur_page,
_cur_vpage;
public:
// page location adjusted for pre- and post margins
- float skirting_run_per1;
+ float skirting_run_per1;
float xvpagesize() const;
double cur_xvpage_start() const;
double cur_xvpage_end() const;
@@ -458,25 +459,25 @@ class SScoringFacility
SChannel*
channel_near( int y);
- float interchannel_gap;
+ float interchannel_gap;
void estimate_montage_height();
int find_free_space();
void space_evenly();
void expand_by_factor( double);
- int n_hidden;
+ int n_hidden;
// things to remember bwtween button_press_event_cb and motion_cb
- double event_y_when_shuffling;
- float zeroy_before_shuffling;
- float moving_selection_handle_offset;
+ double event_y_when_shuffling;
+ float zeroy_before_shuffling;
+ float moving_selection_handle_offset;
// montage
// load/save/reset
public:
- forward_list<agh::confval::SValidator<bool>> config_keys_b;
- forward_list<agh::confval::SValidator<int>> config_keys_d;
- forward_list<agh::confval::SValidator<float>> config_keys_g;
+ forward_list<agh::confval::SValidator<bool>> config_keys_b;
+ forward_list<agh::confval::SValidator<int>> config_keys_d;
+ forward_list<agh::confval::SValidator<float>> config_keys_g;
void load_montage();
void save_montage(); // using libconfig
void reset_montage();
@@ -554,19 +555,12 @@ class SScoringFacility
// menu support
SChannel
*using_channel;
- int using_channel_idx() const
- {
- return channel_idx( using_channel);
- }
- int channel_idx( SChannel* h) const
- {
- int i = 0;
- for ( auto& H : channels )
- if ( &H == h )
- return i;
- else ++i;
- return -1;
- }
+ int
+ channel_idx( SChannel* h) const;
+ int
+ using_channel_idx() const
+ { return channel_idx( using_channel); }
+
list<sigfile::SAnnotation*>
over_annotations;
sigfile::SAnnotation*
@@ -577,7 +571,7 @@ class SScoringFacility
public:
// SGeometry
- // geometry;
+ // geometry;
static size_t
IntersignalSpace,
@@ -586,8 +580,8 @@ class SScoringFacility
public:
// here's hoping configure-event comes before expose-event
- gint da_wd;
- float da_ht; // not subject to window resize, this, but should withstand / 3 * 3
+ gint da_wd;
+ float da_ht; // not subject to window resize, this, but should withstand / 3 * 3
};
@@ -725,18 +719,21 @@ xvpagesize() const
{
return (1. + 2*skirting_run_per1) * vpagesize();
}
+
inline double
SScoringFacility::
cur_xvpage_start() const
{
return cur_vpage_start() - skirting_run_per1 * vpagesize();
}
+
inline double
SScoringFacility::
cur_xvpage_end() const
{
return cur_vpage_end() + skirting_run_per1 * vpagesize();
}
+
inline double
SScoringFacility::
time_at_click( double x) const
@@ -764,7 +761,6 @@ n_ics() const
template <class T>
float
-__attribute__ ((pure))
SScoringFacility::
channel_y0( const T& h) const
{
diff --git a/upstream/src/aghermann/ui/sm/sm.cc b/upstream/src/aghermann/ui/sm/sm.cc
index c07e24f..3803979 100644
--- a/upstream/src/aghermann/ui/sm/sm.cc
+++ b/upstream/src/aghermann/ui/sm/sm.cc
@@ -18,6 +18,7 @@
#include "common/fs.hh"
#include "aghermann/expdesign/forward-decls.hh" // for edf_file_counter
#include "aghermann/ui/misc.hh"
+#include "aghermann/ui/globals.hh"
#include "aghermann/ui/mw/mw.hh"
#include "sm.hh"
@@ -63,7 +64,7 @@ SSessionChooser (const char* explicit_session)
char* canonicalized = canonicalize_file_name( explicit_session);
ed = new SExpDesignUI(
this, canonicalized);
- set_unique_app_window( ed->wMainWindow);
+ global::set_unique_app_window( ed->wMainWindow);
free( canonicalized);
} else if ( last_dir_no == -1 ) {
@@ -73,7 +74,7 @@ SSessionChooser (const char* explicit_session)
} else {
ed = new SExpDesignUI(
this, get_dir());
- set_unique_app_window( ed->wMainWindow);
+ global::set_unique_app_window( ed->wMainWindow);
}
} catch (runtime_error ex) {
pop_ok_message( nullptr, "Huh", "%s", ex.what());
@@ -114,7 +115,7 @@ open_selected_session()
try {
ed = new SExpDesignUI(
this, selected);
- set_unique_app_window( ed->wMainWindow);
+ global::set_unique_app_window( ed->wMainWindow);
return 0;
diff --git a/upstream/src/aghermann/ui/ui.cc b/upstream/src/aghermann/ui/ui.cc
index f94f83e..c0f74cb 100644
--- a/upstream/src/aghermann/ui/ui.cc
+++ b/upstream/src/aghermann/ui/ui.cc
@@ -18,61 +18,6 @@
using namespace std;
using namespace agh::ui;
-#define AGH_UI_GRESOURCE_FILE "aghermann.gresource"
-
-// unique
-
-void
-agh::ui::
-set_unique_app_window( GtkWindow* w)
-{
- unique_app_watch_window(
- global::unique_app,
- global::main_window = w);
-}
-
-// own init
-
-int
-agh::ui::
-prepare_for_expdesign()
-{
- // tell me what they are
- global::client_pointer =
- gdk_device_manager_get_client_pointer(
- gdk_display_get_device_manager( gdk_display_get_default()));
-
- {
- auto scr = gdk_screen_get_default();
-
- using global::hdpmm;
- using global::vdpmm;
-
- hdpmm = (double)gdk_screen_get_width ( scr) / gdk_screen_get_width_mm ( scr);
- vdpmm = (double)gdk_screen_get_height( scr) / gdk_screen_get_height_mm( scr);
- printf( "Screen xdpmm is %g v, %g h\n", hdpmm, vdpmm);
- gdk_screen_set_resolution( scr, (hdpmm + vdpmm)/2);
- }
-
- GResource
- *gresource
- = g_resource_load(
- PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE,
- NULL);
- if ( !gresource ) {
- fprintf( stderr, "Bad or missing " PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE);
- return -1;
- }
- g_resources_register( gresource);
-
- return 0;
-}
-
-
-
-
-
-
// cairo
diff --git a/upstream/src/aghermann/ui/ui.hh b/upstream/src/aghermann/ui/ui.hh
index 3c7b6a8..8f36a70 100644
--- a/upstream/src/aghermann/ui/ui.hh
+++ b/upstream/src/aghermann/ui/ui.hh
@@ -34,10 +34,6 @@ namespace agh {
namespace ui {
-int prepare_for_expdesign();
-
-void set_unique_app_window( GtkWindow*);
-
inline void
gtk_flush()
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git
More information about the debian-med-commit
mailing list