[med-svn] [SCM] aghermann branch, master, updated. 06bda7dfaa687aaf0708a024d192024e2cd58421
Andrei Zavada
johnhommer at gmail.com
Thu Jan 24 00:43:53 UTC 2013
The following commit has been merged in the master branch:
commit 314c9d187004aed02dc54debe00ab1cd9719834c
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sun Jan 20 03:23:08 2013 +0200
better handle SF page and selection context menu items
diff --git a/src/ui/sf/sf-channel.cc b/src/ui/sf/sf-channel.cc
index b19dc02..84f5ea5 100644
--- a/src/ui/sf/sf-channel.cc
+++ b/src/ui/sf/sf-channel.cc
@@ -510,6 +510,29 @@ update_power_check_menu_items()
void
aghui::SScoringFacility::SChannel::
+selectively_enable_page_menu_items( double x)
+{
+ double cpos = _p.time_at_click( x);
+
+ gtk_widget_set_visible( (GtkWidget*)_p.iSFPageHidden, _p.n_hidden > 0);
+ bool over_any =
+ not (_p.over_annotations = in_annotations( cpos)) . empty();
+ gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageAnnotation, over_any);
+ gtk_widget_set_visible( (GtkWidget*)_p.iSFPageAnnotationSeparator, over_any);
+}
+
+void
+aghui::SScoringFacility::SChannel::
+selectively_enable_selection_menu_items()
+{
+ bool findable =
+ (selection_end_time - selection_start_time > .5);
+ gtk_widget_set_sensitive( (GtkWidget*)_p.iSFPageSelectionFindPattern, findable);
+}
+
+
+void
+aghui::SScoringFacility::SChannel::
put_selection( size_t a, size_t e)
{
selection_start = a, selection_end = e;
diff --git a/src/ui/sf/sf-montage_cb.cc b/src/ui/sf/sf-montage_cb.cc
index 48a09be..2863bb3 100644
--- a/src/ui/sf/sf-montage_cb.cc
+++ b/src/ui/sf/sf-montage_cb.cc
@@ -157,15 +157,10 @@ daSFMontage_button_press_event_cb( GtkWidget *wid, GdkEventButton *event, gpoint
gtk_menu_popup( SF.iiSFPageHidden,
NULL, NULL, NULL, NULL, 3, event->time);
else {
+ Ch->selectively_enable_page_menu_items( event->x);
+ Ch->update_channel_check_menu_items();
+ Ch->update_power_check_menu_items();
double cpos = SF.time_at_click( event->x);
- // hide ineffective items
- SF.using_channel->update_channel_check_menu_items();
- SF.using_channel->update_power_check_menu_items();
- gtk_widget_set_visible( (GtkWidget*)SF.iSFPageHidden, SF.n_hidden > 0);
- bool over_any =
- not (SF.over_annotations = Ch->in_annotations( cpos)) . empty();
- gtk_widget_set_visible( (GtkWidget*)SF.iiSFPageAnnotation, over_any);
- gtk_widget_set_visible( (GtkWidget*)SF.iSFPageAnnotationSeparator, over_any);
gtk_menu_popup( agh::alg::overlap(
Ch->selection_start_time, Ch->selection_end_time,
cpos, cpos)
@@ -294,6 +289,7 @@ daSFMontage_button_release_event_cb( GtkWidget *wid, GdkEventButton *event, gpoi
SF.mode = aghui::SScoringFacility::TMode::scoring;
Ch->put_selection( Ch->selection_start, Ch->selection_end);
gtk_widget_queue_draw( wid);
+ Ch->selectively_enable_selection_menu_items();
if ( fabs(SF.using_channel->marquee_mstart - SF.using_channel->marquee_mend) > 5 ) {
gtk_menu_popup( SF.iiSFPageSelection,
NULL, NULL, NULL, NULL, 3, event->time);
@@ -874,8 +870,7 @@ iSFPageSelectionFindPattern_activate_cb( GtkMenuItem *menuitem, gpointer userdat
{
auto& SF = *(SScoringFacility*)userdata;
auto& H = SF.using_channel;
- if ( H->selection_end - H->selection_start > 5 )
- H->mark_region_as_pattern();
+ H->mark_region_as_pattern();
}
void
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 4c68b7d..9b0d62b 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -248,6 +248,8 @@ class SScoringFacility
forward_list<confval::SValidator<double>> config_keys_g;
void update_channel_check_menu_items();
void update_power_check_menu_items();
+ void selectively_enable_page_menu_items( double event_x);
+ void selectively_enable_selection_menu_items();
// selection and marquee
float marquee_mstart,
--
Sleep experiment manager
More information about the debian-med-commit
mailing list