The following commit has been merged in the master branch:
commit e0d187be90cade1ae5c62f840cde58c968497548
Author: Andrei Zavada <[email protected]>
Date:   Tue Jun 18 02:47:15 2013 +0300

    Alt+Move1 on selection moves selection

diff --git a/src/aghermann/ui/sf/montage_cb.cc 
b/src/aghermann/ui/sf/montage_cb.cc
index cbb3c0f..df183af 100644
--- a/src/aghermann/ui/sf/montage_cb.cc
+++ b/src/aghermann/ui/sf/montage_cb.cc
@@ -194,9 +194,15 @@ daSFMontage_button_press_event_cb(
 
                case 1:
                        if ( event->state & GDK_MOD1_MASK ) {
-                               SF.event_y_when_shuffling = event->y;
-                               SF.zeroy_before_shuffling = Ch->zeroy;
-                               SF.mode = 
SScoringFacility::TMode::shuffling_channels;
+                               if ( in_selection ) {
+                                       SF.moving_selection_handle_offset =
+                                               cpos - Ch->selection_start_time;
+                                       SF.mode = 
SScoringFacility::TMode::moving_selection;
+                               } else {
+                                       SF.event_y_when_shuffling = event->y;
+                                       SF.zeroy_before_shuffling = Ch->zeroy;
+                                       SF.mode = 
SScoringFacility::TMode::shuffling_channels;
+                               }
                        } else {
                                SF.mode = SScoringFacility::TMode::marking;
                                Ch->marquee_mstart = Ch->marquee_mend = 
event->x;
@@ -274,7 +280,29 @@ daSFMontage_motion_notify_event_cb(
                                        H.marquee_to_selection();
                                }
                gtk_widget_queue_draw( wid);
+       }
+       break;
+
+       case SScoringFacility::TMode::moving_selection:
+       {
+               auto    new_start_time = SF.time_at_click( event->x) - 
SF.moving_selection_handle_offset,
+                       new_end_time = new_start_time + 
(SF.using_channel->selection_end_time - SF.using_channel->selection_start_time);
+               auto& H = *SF.using_channel;
+               // reposition marquee
+               H.marquee_mstart =
+                       (new_start_time - SF.cur_xvpage_start()) / 
SF.xvpagesize() * SF.da_wd;
+               H.marquee_mend =
+                       (new_end_time - SF.cur_xvpage_start()) / 
SF.xvpagesize() * SF.da_wd;
+
+               H.marquee_to_selection(); // to be sure, also do it on 
button_release
+               H.put_selection( H.selection_start, H.selection_end);
+
+               gtk_widget_queue_draw( wid);
+       }
+       break;
 
+       default:
+       break;
        }
 
        if ( SF.draw_crosshair ) {
diff --git a/src/aghermann/ui/sf/sf.hh b/src/aghermann/ui/sf/sf.hh
index f1409ab..6baf103 100644
--- a/src/aghermann/ui/sf/sf.hh
+++ b/src/aghermann/ui/sf/sf.hh
@@ -350,7 +350,9 @@ class SScoringFacility
                hypnogram_button_down:1;
        enum TMode {
                scoring,
-               marking, shuffling_channels,
+               marking,
+               shuffling_channels,
+               moving_selection,
                separating,
                showing_ics,
                showing_remixed
@@ -460,9 +462,11 @@ class SScoringFacility
        void expand_by_factor( double);
 
        int     n_hidden;
-      // shuffling manually
+
+       // 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;
 
     public:
       // montage

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to