Exemplo n.º 1
0
        private void UpdateCenterFrequency(long f)
        {
            if (f < 0)
            {
                f = 0;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _centerFrequency)
            {
                var args = new FrequencyEventArgs(f, FrequencyChangeSource.Scroll);
                OnCenterFrequencyChanged(args);
                if (!args.Cancel)
                {
                    var delta = args.Frequency - _centerFrequency;
                    _displayCenterFrequency += delta;
                    _centerFrequency         = args.Frequency;
                    _performNeeded           = true;
                }
            }
        }
Exemplo n.º 2
0
 protected virtual void OnCenterFrequencyChanged(FrequencyEventArgs e)
 {
     if (CenterFrequencyChanged != null)
     {
         CenterFrequencyChanged(this, e);
     }
 }
Exemplo n.º 3
0
 private bool UpdateCenterFrequency(long f, FrequencyChangeSource source)
 {
     if (f < 0)
     {
         f = 0L;
     }
     if (this._useSnap)
     {
         f = (long)((float)f + (float)(Math.Sign(f) * this._stepSize) * 0.5f) / this._stepSize * this._stepSize;
     }
     if (f != this._centerFrequency)
     {
         FrequencyEventArgs frequencyEventArgs = new FrequencyEventArgs(f, source);
         this.OnCenterFrequencyChanged(frequencyEventArgs);
         if (!frequencyEventArgs.Cancel)
         {
             long num = frequencyEventArgs.Frequency - this._centerFrequency;
             this._displayCenterFrequency += num;
             this._centerFrequency         = frequencyEventArgs.Frequency;
             this._performNeeded           = true;
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        private void UpdateFrequency(long f, FrequencyChangeSource source)
        {
            var min = (long)(_displayCenterFrequency - _spectrumWidth / _scale / 2);

            if (f < min)
            {
                f = min;
            }
            var max = (long)(_displayCenterFrequency + _spectrumWidth / _scale / 2);

            if (f > max)
            {
                f = max;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _frequency)
            {
                var args = new FrequencyEventArgs(f, source);
                OnFrequencyChanged(args);
                if (!args.Cancel)
                {
                    _frequency     = args.Frequency;
                    _performNeeded = true;
                }
            }
        }
Exemplo n.º 5
0
        protected virtual void OnFrequencyChanged(FrequencyEventArgs e)
        {
            ManualFrequencyChangeEventHandler frequencyChanged = this.FrequencyChanged;

            if (frequencyChanged != null)
            {
                frequencyChanged(this, e);
            }
        }
Exemplo n.º 6
0
        protected virtual void OnCenterFrequencyChanged(FrequencyEventArgs e)
        {
            ManualFrequencyChangeEventHandler centerFrequencyChanged = this.CenterFrequencyChanged;

            if (centerFrequencyChanged != null)
            {
                centerFrequencyChanged(this, e);
            }
        }
Exemplo n.º 7
0
        private bool UpdateFrequency(long f, FrequencyChangeSource source)
        {
            if (this._useSnap)
            {
                f = (long)((float)f + (float)(Math.Sign(f) * this._stepSize) * 0.5f) / this._stepSize * this._stepSize;
            }
            long num  = (long)((float)this._displayCenterFrequency - (float)this._spectrumWidth / this._scale * 0.5f);
            long num2 = (long)((float)this._displayCenterFrequency + (float)this._spectrumWidth / this._scale * 0.5f);

            if (source == FrequencyChangeSource.Scroll)
            {
                long num3 = 0L;
                if (f < num)
                {
                    num3 = f - num;
                }
                else if (f > num2)
                {
                    num3 = f - num2;
                }
                if (num3 != 0L && !this.UpdateCenterFrequency(this._centerFrequency + num3, source))
                {
                    return(false);
                }
            }
            else if (f < num)
            {
                f = num;
            }
            else if (f > num2)
            {
                f = num2;
            }
            if (f != this._frequency)
            {
                FrequencyEventArgs frequencyEventArgs = new FrequencyEventArgs(f, source);
                this.OnFrequencyChanged(frequencyEventArgs);
                if (!frequencyEventArgs.Cancel)
                {
                    this._frequency     = frequencyEventArgs.Frequency;
                    this._performNeeded = true;
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 8
0
 private void panview_CenterFrequencyChanged(object sender, FrequencyEventArgs e)
 {
     if (SourceIsWaveFile || SourceIsSoundCard)
     {
         e.Cancel = true;
     }
     else
     {
         var f = e.Frequency - _frequencyShift;
         if (f < 0)
         {
             f = 0;
             e.Cancel = true;
         }
         SetCenterFrequency(f);
     }
 }
Exemplo n.º 9
0
 private void panview_FrequencyChanged(object sender, FrequencyEventArgs e)
 {
     _changingFrequencyByScroll = e.Source == FrequencyChangeSource.Scroll;
     _changingFrequencyByDirectSelection = true;
     vfoFrequencyEdit.Frequency = e.Frequency;
     if (vfoFrequencyEdit.Frequency != e.Frequency)
     {
         e.Cancel = true;
     }
     _changingFrequencyByDirectSelection = false;
     _changingFrequencyByScroll = false;
 }
        private void UpdateCenterFrequency(long f, FrequencyChangeSource source)
        {
            if (f < 0)
            {
                f = 0;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _centerFrequency)
            {
                var args = new FrequencyEventArgs(f, source);
                OnCenterFrequencyChanged(args);
                if (!args.Cancel)
                {
                    var delta = args.Frequency - _centerFrequency;
                    _displayCenterFrequency += delta;

                    _centerFrequency = args.Frequency;
                    _drawBackgroundNeeded = true;
                }
            }
        }
 protected virtual void OnFrequencyChanged(FrequencyEventArgs e)
 {
     if (FrequencyChanged != null)
     {
         FrequencyChanged(this, e);
     }
 }
        private void UpdateFrequency(long f, FrequencyChangeSource source)
        {
            var min = (long) (_displayCenterFrequency - _spectrumWidth / _scale / 2);
            if (f < min)
            {
                f = min;
            }
            var max = (long) (_displayCenterFrequency + _spectrumWidth / _scale / 2);
            if (f > max)
            {
                f = max;
            }

            if (_useSnap)
            {
                f = (f + Math.Sign(f) * _stepSize / 2) / _stepSize * _stepSize;
            }

            if (f != _frequency)
            {
                var args = new FrequencyEventArgs(f, source);
                OnFrequencyChanged(args);
                if (!args.Cancel)
                {
                    _frequency = args.Frequency;
                    _performNeeded = true;
                }
            }
        }
Exemplo n.º 13
0
 private void spectrumAnalyzer_FrequencyChanged(object sender, FrequencyEventArgs e)
 {
     e.Cancel = true;
 }
Exemplo n.º 14
0
 private void spectrumAnalyzer_FrequencyChanged(object sender, FrequencyEventArgs e)
 {
     e.Cancel = true;
     _control.Frequency += e.Frequency - _spectrumAnalyzer.Frequency;
 }
Exemplo n.º 15
0
 private void spectrumAnalyzer_CenterFrequencyChanged(object sender, FrequencyEventArgs e)
 {
     e.Cancel = true;
     _control.Frequency = e.Frequency - GetFrequencyOffset();
 }
Exemplo n.º 16
0
 private void panview_CenterFrequencyChanged(object sender, FrequencyEventArgs e)
 {
     if (!this.SourceIsTunable)
       {
     e.Cancel = true;
       }
       else
       {
     long newCenterFreq = e.Frequency - this._frequencyShift;
     if (newCenterFreq < 0L)
     {
       newCenterFreq = 0L;
       e.Cancel = true;
     }
     this.SetCenterFrequency(newCenterFreq);
       }
 }
Exemplo n.º 17
0
 private void panview_FrequencyChanged(object sender, FrequencyEventArgs e)
 {
     if (this.SourceIsTunable && e.Source == FrequencyChangeSource.Click && this._tuningStyle == MainForm.TuningStyle.Center)
       {
     this.SetCenterFrequency(e.Frequency + this._frequencyShift);
     this.Frequency = e.Frequency;
     e.Cancel = true;
       }
       else
       {
     this._changingFrequencyByScroll = e.Source == FrequencyChangeSource.Scroll;
     this._changingFrequencyByDirectSelection = true;
     this.vfoFrequencyEdit.Frequency = e.Frequency;
     if (this.vfoFrequencyEdit.Frequency != e.Frequency)
       e.Cancel = true;
     this._changingFrequencyByDirectSelection = false;
     this._changingFrequencyByScroll = false;
       }
 }
Exemplo n.º 18
0
 protected virtual void OnFrequencyChanged(FrequencyEventArgs e)
 {
     ManualFrequencyChangeEventHandler changeEventHandler = this.FrequencyChanged;
       if (changeEventHandler == null)
     return;
       changeEventHandler((object) this, e);
 }
Exemplo n.º 19
0
 private void UpdateFrequency(long f, FrequencyChangeSource source)
 {
     long num1 = (long) ((double) this._displayCenterFrequency - (double) this._spectrumWidth / (double) this._scale / 2.0);
       if (f < num1)
     f = num1;
       long num2 = (long) ((double) this._displayCenterFrequency + (double) this._spectrumWidth / (double) this._scale / 2.0);
       if (f > num2)
     f = num2;
       if (this._useSnap)
     f = (f + (long) (Math.Sign(f) * this._stepSize / 2)) / (long) this._stepSize * (long) this._stepSize;
       if (f == this._frequency)
     return;
       FrequencyEventArgs e = new FrequencyEventArgs(f, source);
       this.OnFrequencyChanged(e);
       if (e.Cancel)
     return;
       this._frequency = e.Frequency;
       this._performNeeded = true;
 }
Exemplo n.º 20
0
 private void UpdateCenterFrequency(long f, FrequencyChangeSource source)
 {
     if (f < 0L)
     f = 0L;
       if (this._useSnap)
     f = (f + (long) (Math.Sign(f) * this._stepSize / 2)) / (long) this._stepSize * (long) this._stepSize;
       if (f == this._centerFrequency)
     return;
       FrequencyEventArgs e = new FrequencyEventArgs(f, source);
       this.OnCenterFrequencyChanged(e);
       if (e.Cancel)
     return;
       this._displayCenterFrequency += e.Frequency - this._centerFrequency;
       this._centerFrequency = e.Frequency;
       this._drawBackgroundNeeded = true;
 }