[med-svn] [SCM] aghermann branch, master, updated. f0d4c0fd35bf09e7dff56ddb9a2d798ae916c2ef
Andrei Zavada
johnhommer at gmail.com
Sun Feb 3 12:53:12 UTC 2013
The following commit has been merged in the master branch:
commit ce7bbf5e3947192ed61462fd1a4877be00c81c9b
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sun Feb 3 12:27:56 2013 +0200
show montage channel menu on Alt-1..9
diff --git a/src/ui/sf/construct.cc b/src/ui/sf/construct.cc
index 277d483..facb21a 100644
--- a/src/ui/sf/construct.cc
+++ b/src/ui/sf/construct.cc
@@ -58,6 +58,7 @@ SScoringFacilityWidgets ()
throw runtime_error ("Failed to construct SF widgets (1)");
G_CONNECT_2 (wSF, delete, event);
+ G_CONNECT_3 (wSF, key, press, event);
gtk_combo_box_set_model_properly(
eSFPageSize, mSFScoringPageSize);
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index e062717..d16d60e 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -714,6 +714,7 @@ const char* const
" / in-/decrement bin;\n"
" Wheel: in-/decrement scale;\n"
" Ctrl+Wheel: in-/decrement scale for all.\n"
+ " Alt+1..9: context menu for channels 1..9\n"
"\n"
"<b>Hypnogram:</b>\n"
" Click1: position cursor;\n"
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index a4e9522..f3e8e8f 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -834,6 +834,7 @@ void iSFScoreExport_activate_cb( GtkMenuItem*, gpointer);
void iSFScoreClear_activate_cb( GtkMenuItem*, gpointer);
gboolean wSF_delete_event_cb( GtkWidget*, GdkEvent*, gpointer);
+gboolean wSF_key_press_event_cb( GtkWidget*, GdkEventKey*, gpointer);
} // extern "C"
diff --git a/src/ui/sf/sf_cb.cc b/src/ui/sf/sf_cb.cc
index 46213a1..85e7400 100644
--- a/src/ui/sf/sf_cb.cc
+++ b/src/ui/sf/sf_cb.cc
@@ -251,6 +251,65 @@ iSFAcceptAndTakeNext_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
+inline namespace {
+
+#define EVENT_X 30
+
+size_t position_for_channel = -1;
+void channel_menu_position( GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer userdata)
+{
+ auto& SF = *(SScoringFacility*)userdata;
+ int mwx, mwy, rwx, rwy;
+ gtk_window_get_position( SF.wSF, &mwx, &mwy);
+ gdk_window_get_position( gtk_widget_get_window( (GtkWidget*)SF.daSFMontage), &rwx, &rwy);
+ if ( position_for_channel < SF.channels.size() ) {
+ *x = mwx + rwx + EVENT_X;
+ *y = mwy + rwx + SF[position_for_channel].zeroy-20;
+ } else
+ *x = *y = 0;
+}
+
+}
+
+gboolean
+wSF_key_press_event_cb( GtkWidget *wid, GdkEventKey *event, gpointer userdata)
+{
+ auto& SF = *(SScoringFacility*)userdata;
+
+ if ( event->type == GDK_KEY_RELEASE or
+ !(event->state & GDK_MOD1_MASK) )
+ return FALSE;
+
+#define KEKE(N) \
+ position_for_channel = N-1; \
+ if ( position_for_channel < SF.channels.size() ) { \
+ SF.using_channel = &SF[position_for_channel]; \
+ SF.using_channel->update_channel_menu_items( EVENT_X); \
+ gtk_menu_popup( SF.iiSFPage, NULL, NULL, channel_menu_position, userdata, 3, event->time); \
+ } else \
+ gdk_beep(); \
+ return TRUE;
+
+ switch ( event->keyval ) {
+ case GDK_KEY_1: KEKE(1);
+ case GDK_KEY_2: KEKE(2);
+ case GDK_KEY_3: KEKE(3);
+ case GDK_KEY_4: KEKE(4);
+ case GDK_KEY_5: KEKE(5);
+ case GDK_KEY_6: KEKE(6);
+ case GDK_KEY_7: KEKE(7);
+ case GDK_KEY_8: KEKE(8);
+ case GDK_KEY_9: KEKE(9);
+ case GDK_KEY_0: KEKE(10);
+ }
+#undef KEKE
+ return FALSE;
+}
+
gboolean
wSF_delete_event_cb( GtkWidget*, GdkEvent*, gpointer userdata)
--
Sleep experiment manager
More information about the debian-med-commit
mailing list