コード例 #1
0
 // Zoom in or out (ie. change the visible time span): give a scale < 1.0
 // and it zooms in, > 1.0 and it zooms out.
 public void Zoom(double scale)
 {
     if (scale <= 0.0)
     {
         return;
     }
     grid.BeginDraw();
     if (VisibleTimeSpan.Scale(scale) > TotalTime)
     {
         var t = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
         if (t.Ticks > 2000)
         {
             TimePerPixel     = t;
             VisibleTimeStart = TimeSpan.Zero;
         }
     }
     else
     {
         var t = TimePerPixel.Scale(scale);
         if (t.Ticks > 2000)
         {
             TimePerPixel = t;
             if (VisibleTimeEnd >= TotalTime)
             {
                 VisibleTimeStart = TotalTime - VisibleTimeSpan;
             }
         }
     }
     grid.EndDraw();
 }
コード例 #2
0
        protected override void OnMouseHWheel(MouseEventArgs args)
        {
            //Debug.WriteLine("Grid OnMouseHWheel: delta={0}", args.Delta);

            double scale;

            if (args.Delta > 0)
            {
                scale = 0.10;
            }
            else
            {
                scale = -0.10;
            }
            VisibleTimeStart += VisibleTimeSpan.Scale(scale);
        }
コード例 #3
0
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     base.OnMouseWheel(e);
     if (ModifierKeys.HasFlag(Keys.Control) & ModifierKeys.HasFlag(Keys.Alt))
     {
         //holding the control and alt keys while scrolling adjusts the row height under the cursor.
         Point gridLocation = e.Location;
         int   delta        = e.Delta;
         zoomRowHeight(gridLocation, delta);
     }
     else if (ModifierKeys.HasFlag(Keys.Control) & ModifierKeys.HasFlag(Keys.Shift))
     {
         //holding the control and shift while scrolling adjusts all row heights
         double zoomScale = e.Delta < 0.0 ? 0.8 : 1.25;
         ZoomRows(zoomScale);
     }
     else if (ModifierKeys.HasFlag(Keys.Control))
     {
         // holding the control key zooms the horizontal axis, by 10% per mouse wheel tick
         if (ZoomToMousePosition)
         {
             // holding the control key zooms the horizontal axis under the cursor, by 10% per mouse wheel tick
             ZoomTime(1.0 - ((double)e.Delta / 1200.0), e.Location);
             //			waveform.Invalidate();
         }
         else
         {
             // holding the control key zooms the horizontal axis, by 10% per mouse wheel tick
             Zoom(1.0 - ((double)e.Delta / 1200.0));
         }
     }
     else if (ModifierKeys.HasFlag(Keys.Shift))
     {
         // holding the skift key moves the horizontal axis, by 10% of the visible time span per mouse wheel tick
         // wheel towards user   --> negative delta --> VisibleTimeStart increases
         // wheel away from user --> positive delta --> VisibleTimeStart decreases
         VisibleTimeStart += VisibleTimeSpan.Scale(-((double)e.Delta / 1200.0));
         //			waveform.Invalidate();
     }
     else
     {
         // moving the mouse wheel with no modifiers moves the display vertically, 40 pixels per mouse wheel tick
         VerticalOffset += -(e.Delta / 3);
     }
 }
コード例 #4
0
        protected override void OnPlaybackCurrentTimeChanged(object sender, EventArgs e)
        {
            // check if the playback cursor position would be over 90% of the grid width: if so, scroll the grid so it would be at 10%
            if (PlaybackCurrentTime.HasValue)
            {
                if (PlaybackCurrentTime.Value > VisibleTimeStart + VisibleTimeSpan.Scale(0.9))
                {
                    VisibleTimeStart = PlaybackCurrentTime.Value - VisibleTimeSpan.Scale(0.1);
                }

                if (PlaybackCurrentTime.Value < VisibleTimeStart)
                {
                    VisibleTimeStart = PlaybackCurrentTime.Value - VisibleTimeSpan.Scale(0.1);
                }
            }

            base.OnPlaybackCurrentTimeChanged(sender, e);
        }
コード例 #5
0
ファイル: TimelineControl.cs プロジェクト: thorhs/vixen
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     base.OnMouseWheel(e);
     if (Form.ModifierKeys.HasFlag(Keys.Control))
     {
         // holding the control key zooms the horizontal axis, by 10% per mouse wheel tick
         Zoom(1.0 - ((double)e.Delta / 1200.0));
     }
     else if (Form.ModifierKeys.HasFlag(Keys.Shift))
     {
         // holding the skift key moves the horizontal axis, by 10% of the visible time span per mouse wheel tick
         // wheel towards user   --> negative delta --> VisibleTimeStart increases
         // wheel away from user --> positive delta --> VisibleTimeStart decreases
         VisibleTimeStart += VisibleTimeSpan.Scale(-((double)e.Delta / 1200.0));
     }
     else
     {
         // moving the mouse wheel with no modifiers moves the display vertically, 40 pixels per mouse wheel tick
         VerticalOffset += -(e.Delta / 3);
     }
 }
コード例 #6
0
ファイル: TimelineControl.cs プロジェクト: ctmal/vixen
        // Zoom in or out (ie. change the visible time span): give a scale < 1.0
        // and it zooms in, > 1.0 and it zooms out.
        public void Zoom(double scale)
        {
            if (scale <= 0.0)
            {
                return;
            }

            if (VisibleTimeSpan.Scale(scale) > TotalTime)
            {
                TimePerPixel     = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
                VisibleTimeStart = TimeSpan.Zero;
            }
            else
            {
                TimePerPixel = TimePerPixel.Scale(scale);
                if (VisibleTimeEnd > TotalTime)
                {
                    VisibleTimeStart = TotalTime - VisibleTimeSpan;
                }
            }
        }
コード例 #7
0
 // Zoom in or out (ie. change the visible time span): give a scale < 1.0
 // and it zooms in, > 1.0 and it zooms out.
 public void Zoom(double scale)
 {
     if (scale <= 0.0)
     {
         return;
     }
     grid.BeginDraw();
     if (VisibleTimeSpan.Scale(scale) > TotalTime)
     {
         TimePerPixel     = TimeSpan.FromTicks(TotalTime.Ticks / grid.Width);
         VisibleTimeStart = TimeSpan.Zero;
     }
     else
     {
         TimePerPixel = TimePerPixel.Scale(scale);
         if (VisibleTimeEnd > TotalTime)
         {
             VisibleTimeStart = TotalTime - VisibleTimeSpan;
         }
     }
     grid.EndDraw();
     grid.ResetAllElements();
 }