mirror of
https://github.com/SDRSharpR/SDRSharp.git
synced 2026-04-05 22:35:41 +00:00
SDRSharp Build 1632 Full Source (VS2017)
This commit is contained in:
parent
c0fc5d4af0
commit
bce56796eb
246 changed files with 31983 additions and 0 deletions
22
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit.sln
Normal file
22
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit.sln
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.4
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDRSharp.FrequencyEdit", "SDRSharp.FrequencyEdit\SDRSharp.FrequencyEdit.csproj", "{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
11
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/EntryMode.cs
Normal file
11
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/EntryMode.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
public enum EntryMode
|
||||
{
|
||||
None,
|
||||
Direct,
|
||||
Arrow
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
public class FrequencyChangingEventArgs : EventArgs
|
||||
{
|
||||
public long Frequency { get; set; }
|
||||
|
||||
public bool Accept { get; set; }
|
||||
|
||||
public FrequencyChangingEventArgs()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
749
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/FrequencyEdit.cs
Normal file
749
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/FrequencyEdit.cs
Normal file
|
|
@ -0,0 +1,749 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using SDRSharp.FrequencyEdit.Properties;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
public sealed class FrequencyEdit : UserControl
|
||||
{
|
||||
public event EventHandler FrequencyChanged;
|
||||
|
||||
public event EventHandler<FrequencyChangingEventArgs> FrequencyChanging;
|
||||
|
||||
public int StepSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._stepSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._stepSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisableFrequencyEvents
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._disableFrequencyEvents;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._disableFrequencyEvents = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool EntryModeActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._currentEntryMode > EntryMode.None;
|
||||
}
|
||||
}
|
||||
|
||||
public long Frequency
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._frequency;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._frequencyChangingEventArgs.Accept = true;
|
||||
this._frequencyChangingEventArgs.Frequency = value;
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanging != null)
|
||||
{
|
||||
this.FrequencyChanging(this, this._frequencyChangingEventArgs);
|
||||
}
|
||||
if (this._frequencyChangingEventArgs.Accept)
|
||||
{
|
||||
this._frequency = this._frequencyChangingEventArgs.Frequency;
|
||||
this.UpdateDigitsValues();
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanged != null)
|
||||
{
|
||||
this.FrequencyChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FrequencyEdit()
|
||||
{
|
||||
this.DoubleBuffered = true;
|
||||
this.AutoSize = true;
|
||||
base.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
this._digitImages = Resources.Numbers;
|
||||
this._renderTimer.Interval = 30;
|
||||
this._renderTimer.Tick += this.renderTimer_Tick;
|
||||
this._renderTimer.Enabled = true;
|
||||
this.ConfigureComponent();
|
||||
}
|
||||
|
||||
private void renderTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < base.Controls.Count; i++)
|
||||
{
|
||||
if (base.Controls[i] is IRenderable)
|
||||
{
|
||||
((IRenderable)base.Controls[i]).Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureComponent()
|
||||
{
|
||||
this.BackColor = Color.Transparent;
|
||||
if (this._digitImages != null)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
if (this._digitControls[i] != null && base.Controls.Contains(this._digitControls[i]))
|
||||
{
|
||||
base.Controls.Remove(this._digitControls[i]);
|
||||
this._digitControls[i] = null;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 12; j++)
|
||||
{
|
||||
if (this._separatorControls[j] != null && base.Controls.Contains(this._separatorControls[j]))
|
||||
{
|
||||
base.Controls.Remove(this._separatorControls[j]);
|
||||
this._separatorControls[j] = null;
|
||||
}
|
||||
}
|
||||
this.SplitDigitImages();
|
||||
}
|
||||
if (this._imageList.Images.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num = 0;
|
||||
int y = 0;
|
||||
int width = this._imageList.ImageSize.Width;
|
||||
int height = this._imageList.ImageSize.Height;
|
||||
for (int k = 11; k >= 0; k--)
|
||||
{
|
||||
if ((k + 1) % 3 == 0 && k != 11)
|
||||
{
|
||||
FrequencyEditSeparator frequencyEditSeparator = new FrequencyEditSeparator();
|
||||
int num2 = width / 2;
|
||||
int num3 = k / 3;
|
||||
frequencyEditSeparator.Image = this._imageList.Images[11];
|
||||
frequencyEditSeparator.Width = num2;
|
||||
frequencyEditSeparator.Height = height;
|
||||
frequencyEditSeparator.Location = new Point(num, y);
|
||||
base.Controls.Add(frequencyEditSeparator);
|
||||
this._separatorControls[num3] = frequencyEditSeparator;
|
||||
num += num2 + 2;
|
||||
}
|
||||
FrequencyEditDigit frequencyEditDigit = new FrequencyEditDigit(k);
|
||||
frequencyEditDigit.Location = new Point(num, y);
|
||||
frequencyEditDigit.OnDigitClick += this.DigitClickHandler;
|
||||
frequencyEditDigit.MouseLeave += this.DigitMouseLeave;
|
||||
frequencyEditDigit.Width = width;
|
||||
frequencyEditDigit.Height = height;
|
||||
frequencyEditDigit.ImageList = this._imageList;
|
||||
base.Controls.Add(frequencyEditDigit);
|
||||
this._digitControls[k] = frequencyEditDigit;
|
||||
num += width + 2;
|
||||
}
|
||||
long num4 = 1L;
|
||||
for (int l = 0; l < 12; l++)
|
||||
{
|
||||
this._digitControls[l].Weight = num4;
|
||||
num4 *= 10L;
|
||||
}
|
||||
base.Height = height;
|
||||
this.UpdateDigitMask();
|
||||
}
|
||||
|
||||
private void SplitDigitImages()
|
||||
{
|
||||
int height = this._digitImages.Height;
|
||||
int num = (int)Math.Round((double)((float)this._digitImages.Width / 11.5f));
|
||||
this._imageList.Images.Clear();
|
||||
this._imageList.ImageSize = new Size(num, height);
|
||||
int num2 = 0;
|
||||
Bitmap bitmap;
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
bitmap = new Bitmap(num, height);
|
||||
using (Graphics graphics = Graphics.FromImage(bitmap))
|
||||
{
|
||||
graphics.DrawImage(this._digitImages, new Rectangle(0, 0, num, height), new Rectangle(num2, 0, num, height), GraphicsUnit.Pixel);
|
||||
}
|
||||
num2 += num;
|
||||
this._imageList.Images.Add(bitmap);
|
||||
}
|
||||
bitmap = new Bitmap(num, height);
|
||||
using (Graphics graphics2 = Graphics.FromImage(bitmap))
|
||||
{
|
||||
graphics2.DrawImage(this._digitImages, new Rectangle(0, 0, num, height), new Rectangle(num2, 0, num / 2, height), GraphicsUnit.Pixel);
|
||||
}
|
||||
this._imageList.Images.Add(bitmap);
|
||||
}
|
||||
|
||||
private void DigitClickHandler(object sender, FrequencyEditDigitClickEventArgs args)
|
||||
{
|
||||
if (this._currentEntryMode != EntryMode.None)
|
||||
{
|
||||
this.LeaveEntryMode();
|
||||
return;
|
||||
}
|
||||
FrequencyEditDigit frequencyEditDigit = (FrequencyEditDigit)sender;
|
||||
if (frequencyEditDigit != null)
|
||||
{
|
||||
this._newFrequency = this._frequency;
|
||||
if (args.Button == MouseButtons.Right)
|
||||
{
|
||||
this.ZeroDigits(frequencyEditDigit.DigitIndex);
|
||||
}
|
||||
else if (args.IsUpperHalf && this._frequency >= 0L)
|
||||
{
|
||||
this.IncrementDigit(frequencyEditDigit.DigitIndex, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DecrementDigit(frequencyEditDigit.DigitIndex, true);
|
||||
}
|
||||
if (this._newFrequency != this._frequency)
|
||||
{
|
||||
this._frequencyChangingEventArgs.Accept = true;
|
||||
this._frequencyChangingEventArgs.Frequency = this._newFrequency;
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanging != null)
|
||||
{
|
||||
this.FrequencyChanging(this, this._frequencyChangingEventArgs);
|
||||
}
|
||||
if (this._frequencyChangingEventArgs.Accept)
|
||||
{
|
||||
this._frequency = this._frequencyChangingEventArgs.Frequency;
|
||||
this.UpdateDigitsValues();
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanged != null)
|
||||
{
|
||||
this.FrequencyChanged(this, EventArgs.Empty);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.UpdateDigitsValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void IncrementDigit(int index, bool updateDigit)
|
||||
{
|
||||
FrequencyEditDigit frequencyEditDigit = this._digitControls[index];
|
||||
if (frequencyEditDigit != null)
|
||||
{
|
||||
int displayedDigit = frequencyEditDigit.DisplayedDigit;
|
||||
int num = (frequencyEditDigit.DisplayedDigit == 9) ? 0 : (frequencyEditDigit.DisplayedDigit + 1);
|
||||
long newFrequency = this._newFrequency - (long)displayedDigit * frequencyEditDigit.Weight + (long)num * frequencyEditDigit.Weight;
|
||||
if (updateDigit)
|
||||
{
|
||||
frequencyEditDigit.DisplayedDigit = num;
|
||||
}
|
||||
this._newFrequency = newFrequency;
|
||||
if (displayedDigit == 9 && index < 11)
|
||||
{
|
||||
this.IncrementDigit(index + 1, updateDigit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DecrementDigit(int index, bool updateDigit)
|
||||
{
|
||||
FrequencyEditDigit frequencyEditDigit = this._digitControls[index];
|
||||
if (frequencyEditDigit != null)
|
||||
{
|
||||
int displayedDigit = frequencyEditDigit.DisplayedDigit;
|
||||
int num = (frequencyEditDigit.DisplayedDigit == 0) ? 9 : (frequencyEditDigit.DisplayedDigit - 1);
|
||||
long newFrequency = this._newFrequency - (long)displayedDigit * frequencyEditDigit.Weight + (long)num * frequencyEditDigit.Weight;
|
||||
if (updateDigit)
|
||||
{
|
||||
frequencyEditDigit.DisplayedDigit = num;
|
||||
}
|
||||
this._newFrequency = newFrequency;
|
||||
if (displayedDigit == 0 && index < 11 && (double)this._newFrequency > Math.Pow(10.0, (double)(index + 1)))
|
||||
{
|
||||
this.DecrementDigit(index + 1, updateDigit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ZeroDigits(int index)
|
||||
{
|
||||
for (int i = 0; i <= index; i++)
|
||||
{
|
||||
this._digitControls[i].DisplayedDigit = 0;
|
||||
}
|
||||
long num = (long)Math.Pow(10.0, (double)(index + 1));
|
||||
this._newFrequency = this._newFrequency / num * num;
|
||||
}
|
||||
|
||||
private void UpdateDigitsValues()
|
||||
{
|
||||
if (this._digitControls[0] == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
long num = this._frequency;
|
||||
for (int i = 11; i >= 0; i--)
|
||||
{
|
||||
long num2 = num / this._digitControls[i].Weight;
|
||||
this._digitControls[i].DisplayedDigit = (int)num2;
|
||||
num -= (long)this._digitControls[i].DisplayedDigit * this._digitControls[i].Weight;
|
||||
}
|
||||
this.UpdateDigitMask();
|
||||
}
|
||||
|
||||
private void UpdateDigitMask()
|
||||
{
|
||||
long frequency = this._frequency;
|
||||
if (frequency >= 0L)
|
||||
{
|
||||
for (int i = 1; i < 12; i++)
|
||||
{
|
||||
if ((i + 1) % 3 == 0 && i != 11)
|
||||
{
|
||||
int num = i / 3;
|
||||
if (this._separatorControls[num] != null)
|
||||
{
|
||||
this._separatorControls[num].Masked = (this._digitControls[i + 1].Weight > frequency);
|
||||
}
|
||||
}
|
||||
if (this._digitControls[i] != null)
|
||||
{
|
||||
this._digitControls[i].Masked = (this._digitControls[i].Weight > frequency);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DigitMouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
if (!base.ClientRectangle.Contains(base.PointToClient(Control.MousePosition)) && this._currentEntryMode != EntryMode.None)
|
||||
{
|
||||
this.AbortEntryMode();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
if (!base.ClientRectangle.Contains(base.PointToClient(Control.MousePosition)) && this._currentEntryMode != EntryMode.None)
|
||||
{
|
||||
this.AbortEntryMode();
|
||||
}
|
||||
}
|
||||
|
||||
private long GetFrequencyValue()
|
||||
{
|
||||
long num = 0L;
|
||||
for (int i = 0; i < this._digitControls.Length; i++)
|
||||
{
|
||||
num += this._digitControls[i].Weight * (long)this._digitControls[i].DisplayedDigit;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private void SetFrequencyValue(long newFrequency)
|
||||
{
|
||||
if (newFrequency != this._frequency)
|
||||
{
|
||||
this._frequencyChangingEventArgs.Accept = true;
|
||||
this._frequencyChangingEventArgs.Frequency = newFrequency;
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanging != null)
|
||||
{
|
||||
this.FrequencyChanging(this, this._frequencyChangingEventArgs);
|
||||
}
|
||||
if (this._frequencyChangingEventArgs.Accept)
|
||||
{
|
||||
this._frequency = this._frequencyChangingEventArgs.Frequency;
|
||||
this.UpdateDigitsValues();
|
||||
if (!this._disableFrequencyEvents && this.FrequencyChanged != null)
|
||||
{
|
||||
this.FrequencyChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnterDirectMode()
|
||||
{
|
||||
if (this._changingEntryMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._changingEntryMode = true;
|
||||
for (int i = 0; i < this._digitControls.Length; i++)
|
||||
{
|
||||
if (this._digitControls[i] != null)
|
||||
{
|
||||
this._digitControls[i].Masked = false;
|
||||
if (this._digitControls[i].CursorInside)
|
||||
{
|
||||
this._editModePosition = i;
|
||||
this._digitControls[i].Highlight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ZeroDigits(this._digitControls.Length - 1);
|
||||
this._currentEntryMode = EntryMode.Direct;
|
||||
this._changingEntryMode = false;
|
||||
}
|
||||
|
||||
private void DirectModeHandler(KeyEventArgs args)
|
||||
{
|
||||
Keys keyCode = args.KeyCode;
|
||||
if (keyCode <= Keys.Return)
|
||||
{
|
||||
if (keyCode != Keys.Back)
|
||||
{
|
||||
if (keyCode != Keys.Tab)
|
||||
{
|
||||
if (keyCode != Keys.Return)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.LeaveEntryMode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._digitControls[this._editModePosition].DisplayedDigit = 0;
|
||||
if (this._editModePosition < this._digitControls.Length - 1)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition++;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyCode <= Keys.D9)
|
||||
{
|
||||
if (keyCode == Keys.Escape)
|
||||
{
|
||||
this.AbortEntryMode();
|
||||
return;
|
||||
}
|
||||
switch (keyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
if (this._editModePosition < this._digitControls.Length - 1)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition++;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
case Keys.Select:
|
||||
case Keys.Print:
|
||||
case Keys.Execute:
|
||||
case Keys.Snapshot:
|
||||
case Keys.Insert:
|
||||
case Keys.Delete:
|
||||
case Keys.Help:
|
||||
return;
|
||||
case Keys.Right:
|
||||
if (this._editModePosition > 0)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition--;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
case Keys.D0:
|
||||
case Keys.D1:
|
||||
case Keys.D2:
|
||||
case Keys.D3:
|
||||
case Keys.D4:
|
||||
case Keys.D5:
|
||||
case Keys.D6:
|
||||
case Keys.D7:
|
||||
case Keys.D8:
|
||||
case Keys.D9:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (keyCode)
|
||||
{
|
||||
case Keys.NumPad0:
|
||||
case Keys.NumPad1:
|
||||
case Keys.NumPad2:
|
||||
case Keys.NumPad3:
|
||||
case Keys.NumPad4:
|
||||
case Keys.NumPad5:
|
||||
case Keys.NumPad6:
|
||||
case Keys.NumPad7:
|
||||
case Keys.NumPad8:
|
||||
case Keys.NumPad9:
|
||||
break;
|
||||
case Keys.Multiply:
|
||||
case Keys.Add:
|
||||
case Keys.Separator:
|
||||
case Keys.Subtract:
|
||||
return;
|
||||
case Keys.Decimal:
|
||||
goto IL_249;
|
||||
default:
|
||||
if (keyCode != Keys.OemPeriod)
|
||||
{
|
||||
return;
|
||||
}
|
||||
goto IL_249;
|
||||
}
|
||||
}
|
||||
int displayedDigit = (args.KeyCode >= Keys.D0 && args.KeyCode <= Keys.D9) ? (args.KeyCode - Keys.D0) : (args.KeyCode - Keys.NumPad0);
|
||||
this._digitControls[this._editModePosition].DisplayedDigit = displayedDigit;
|
||||
if (this._editModePosition > 0)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition--;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
this.LeaveEntryMode();
|
||||
return;
|
||||
}
|
||||
IL_249:
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition -= this._editModePosition % 3 + 1;
|
||||
if (this._editModePosition < 2)
|
||||
{
|
||||
if (args.KeyCode != Keys.Tab)
|
||||
{
|
||||
this._editModePosition = 0;
|
||||
this.LeaveEntryMode();
|
||||
return;
|
||||
}
|
||||
this._editModePosition = this._digitControls.Length - 1;
|
||||
}
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
}
|
||||
|
||||
private void EnterArrowMode()
|
||||
{
|
||||
if (this._changingEntryMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._changingEntryMode = true;
|
||||
for (int i = 0; i < this._digitControls.Length; i++)
|
||||
{
|
||||
if (this._digitControls[i] != null)
|
||||
{
|
||||
this._digitControls[i].Masked = false;
|
||||
if (this._digitControls[i].CursorInside)
|
||||
{
|
||||
this._editModePosition = i;
|
||||
this._digitControls[i].Highlight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._currentEntryMode = EntryMode.Arrow;
|
||||
this._changingEntryMode = false;
|
||||
}
|
||||
|
||||
private void ArrowModeHandler(KeyEventArgs args)
|
||||
{
|
||||
Keys keyCode = args.KeyCode;
|
||||
if (keyCode <= Keys.Return)
|
||||
{
|
||||
if (keyCode == Keys.Tab)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition -= this._editModePosition % 3 + 1;
|
||||
if (this._editModePosition < 2)
|
||||
{
|
||||
this._editModePosition = this._digitControls.Length - 1;
|
||||
}
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
if (keyCode != Keys.Return)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (keyCode != Keys.Escape)
|
||||
{
|
||||
switch (keyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
if (this._editModePosition < this._digitControls.Length - 1)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition++;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
case Keys.Up:
|
||||
this._newFrequency = this._frequency;
|
||||
this.IncrementDigit(this._editModePosition, false);
|
||||
this.SetFrequencyValue(this._newFrequency);
|
||||
return;
|
||||
case Keys.Right:
|
||||
if (this._editModePosition > 0)
|
||||
{
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this._editModePosition--;
|
||||
this._digitControls[this._editModePosition].Highlight = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
case Keys.Down:
|
||||
this._newFrequency = this._frequency;
|
||||
this.DecrementDigit(this._editModePosition, false);
|
||||
this.SetFrequencyValue(this._newFrequency);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.AbortEntryMode();
|
||||
}
|
||||
|
||||
private void AbortEntryMode()
|
||||
{
|
||||
if (this._changingEntryMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._changingEntryMode = true;
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
this.UpdateDigitsValues();
|
||||
this._currentEntryMode = EntryMode.None;
|
||||
this._changingEntryMode = false;
|
||||
}
|
||||
|
||||
private void LeaveEntryMode()
|
||||
{
|
||||
if (this._changingEntryMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._changingEntryMode = true;
|
||||
this._digitControls[this._editModePosition].Highlight = false;
|
||||
if (this._currentEntryMode == EntryMode.Direct)
|
||||
{
|
||||
long frequencyValue = this.GetFrequencyValue();
|
||||
this.SetFrequencyValue(frequencyValue);
|
||||
}
|
||||
this._currentEntryMode = EntryMode.None;
|
||||
this._changingEntryMode = false;
|
||||
}
|
||||
|
||||
private bool DigitKeyHandler(KeyEventArgs args)
|
||||
{
|
||||
if (!base.ClientRectangle.Contains(base.PointToClient(Control.MousePosition)) || this._changingEntryMode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this._currentEntryMode != EntryMode.None)
|
||||
{
|
||||
EntryMode currentEntryMode = this._currentEntryMode;
|
||||
if (currentEntryMode != EntryMode.Direct)
|
||||
{
|
||||
if (currentEntryMode == EntryMode.Arrow)
|
||||
{
|
||||
this.ArrowModeHandler(args);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DirectModeHandler(args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if ((args.KeyCode >= Keys.D0 && args.KeyCode <= Keys.D9) || (args.KeyCode >= Keys.NumPad0 && args.KeyCode <= Keys.NumPad9))
|
||||
{
|
||||
this.EnterDirectMode();
|
||||
this.DirectModeHandler(args);
|
||||
return true;
|
||||
}
|
||||
if (args.KeyCode == Keys.Up || args.KeyCode == Keys.Down || args.KeyCode == Keys.Left || args.KeyCode == Keys.Right)
|
||||
{
|
||||
this.EnterArrowMode();
|
||||
this.ArrowModeHandler(args);
|
||||
return true;
|
||||
}
|
||||
if (args.Modifiers == Keys.Control)
|
||||
{
|
||||
if (args.KeyCode == Keys.C)
|
||||
{
|
||||
Clipboard.SetText(string.Format("{0}", this.GetFrequencyValue()), TextDataFormat.Text);
|
||||
return true;
|
||||
}
|
||||
if (args.KeyCode == Keys.V)
|
||||
{
|
||||
long frequencyValue = 0L;
|
||||
if (long.TryParse(Clipboard.GetText(), out frequencyValue))
|
||||
{
|
||||
this.SetFrequencyValue(frequencyValue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (msg.Msg == 256 || msg.Msg == 260)
|
||||
{
|
||||
return this.DigitKeyHandler(new KeyEventArgs(keyData));
|
||||
}
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
private const int DigitCount = 12;
|
||||
|
||||
private const int DigitImageSplitCount = 12;
|
||||
|
||||
private const int DigitSeperatorCount = 12;
|
||||
|
||||
private readonly FrequencyEditDigit[] _digitControls = new FrequencyEditDigit[12];
|
||||
|
||||
private readonly FrequencyEditSeparator[] _separatorControls = new FrequencyEditSeparator[12];
|
||||
|
||||
private readonly ImageList _imageList = new ImageList();
|
||||
|
||||
private readonly Image _digitImages;
|
||||
|
||||
private readonly Timer _renderTimer = new Timer();
|
||||
|
||||
private readonly FrequencyChangingEventArgs _frequencyChangingEventArgs = new FrequencyChangingEventArgs();
|
||||
|
||||
private long _frequency;
|
||||
|
||||
private long _newFrequency;
|
||||
|
||||
private int _stepSize;
|
||||
|
||||
private int _editModePosition;
|
||||
|
||||
private bool _changingEntryMode;
|
||||
|
||||
private bool _disableFrequencyEvents;
|
||||
|
||||
private EntryMode _currentEntryMode;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
internal sealed class FrequencyEditDigit : UserControl, IRenderable
|
||||
{
|
||||
public event OnDigitClickDelegate OnDigitClick;
|
||||
|
||||
public ImageList ImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._imageList;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._imageList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Highlight
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._highlight;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._highlight = value;
|
||||
this._renderNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CursorInside
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._cursorInside;
|
||||
}
|
||||
}
|
||||
|
||||
public int DisplayedDigit
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._displayedDigit;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value >= 0 && value <= 9 && this._displayedDigit != value)
|
||||
{
|
||||
this._displayedDigit = value;
|
||||
this._renderNeeded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int DigitIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._digitIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Masked
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._masked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._masked != value)
|
||||
{
|
||||
this._masked = value;
|
||||
this._renderNeeded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long Weight
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._weight;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._weight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public FrequencyEditDigit(int digitIndex)
|
||||
{
|
||||
this.DoubleBuffered = true;
|
||||
this.BackColor = Color.Transparent;
|
||||
this._tickTimer.Tick += this.timer_Tick;
|
||||
base.UpdateStyles();
|
||||
this._digitIndex = digitIndex;
|
||||
ColorMatrix colorMatrix = new ColorMatrix();
|
||||
colorMatrix.Matrix33 = 0.3f;
|
||||
this._maskedAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (this._imageList != null && this._displayedDigit < this._imageList.Images.Count)
|
||||
{
|
||||
Image image = this._imageList.Images[this._displayedDigit];
|
||||
ImageAttributes imageAttrs = ((this._masked && !this._cursorInside) || !base.Parent.Enabled) ? this._maskedAttributes : null;
|
||||
e.Graphics.DrawImage(image, new Rectangle(0, 0, base.Width, base.Height), 0f, 0f, (float)image.Width, (float)image.Height, GraphicsUnit.Pixel, imageAttrs);
|
||||
}
|
||||
if (this._cursorInside && !((FrequencyEdit)base.Parent).EntryModeActive)
|
||||
{
|
||||
bool flag = this._lastMouseY <= base.ClientRectangle.Height / 2;
|
||||
using (SolidBrush solidBrush = new SolidBrush(Color.FromArgb(100, flag ? Color.Red : Color.Blue)))
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
e.Graphics.FillRectangle(solidBrush, new Rectangle(0, 0, base.ClientRectangle.Width, base.ClientRectangle.Height / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.FillRectangle(solidBrush, new Rectangle(0, base.ClientRectangle.Height / 2, base.ClientRectangle.Width, base.ClientRectangle.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this._highlight)
|
||||
{
|
||||
SolidBrush brush = new SolidBrush(Color.FromArgb(25, Color.Red));
|
||||
e.Graphics.FillRectangle(brush, new Rectangle(0, 0, base.ClientRectangle.Width, base.ClientRectangle.Height));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
this._isUpperHalf = (e.Y <= base.ClientRectangle.Height / 2);
|
||||
this._lastMouseY = e.Y;
|
||||
if (this._isUpperHalf != this._lastIsUpperHalf)
|
||||
{
|
||||
this._renderNeeded = true;
|
||||
this._tickCount = 0;
|
||||
}
|
||||
this._lastIsUpperHalf = this._isUpperHalf;
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
this._cursorInside = true;
|
||||
this._renderNeeded = true;
|
||||
base.Focus();
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
this._cursorInside = false;
|
||||
this._renderNeeded = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
this._isUpperHalf = (e.Y <= base.ClientRectangle.Height / 2);
|
||||
if (this.OnDigitClick != null)
|
||||
{
|
||||
this.OnDigitClick(this, new FrequencyEditDigitClickEventArgs(this._isUpperHalf, e.Button));
|
||||
}
|
||||
this._tickCount = 1;
|
||||
this._tickTimer.Interval = 300;
|
||||
this._tickTimer.Enabled = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
this._tickTimer.Enabled = false;
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
if (this.OnDigitClick != null)
|
||||
{
|
||||
this.OnDigitClick(this, new FrequencyEditDigitClickEventArgs(e.Delta > 0, e.Button));
|
||||
}
|
||||
}
|
||||
|
||||
public void Render()
|
||||
{
|
||||
if (this._renderNeeded)
|
||||
{
|
||||
base.Invalidate();
|
||||
this._renderNeeded = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.OnDigitClick != null)
|
||||
{
|
||||
this.OnDigitClick(this, new FrequencyEditDigitClickEventArgs(this._isUpperHalf, MouseButtons.Left));
|
||||
}
|
||||
this._tickCount++;
|
||||
int tickCount = this._tickCount;
|
||||
if (tickCount <= 20)
|
||||
{
|
||||
if (tickCount == 10)
|
||||
{
|
||||
this._tickTimer.Interval = 200;
|
||||
return;
|
||||
}
|
||||
if (tickCount != 20)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._tickTimer.Interval = 100;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tickCount == 50)
|
||||
{
|
||||
this._tickTimer.Interval = 50;
|
||||
return;
|
||||
}
|
||||
if (tickCount != 100)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._tickTimer.Interval = 20;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private const float MaskedDigitTransparency = 0.3f;
|
||||
|
||||
private bool _masked;
|
||||
|
||||
private int _displayedDigit;
|
||||
|
||||
private long _weight;
|
||||
|
||||
private bool _renderNeeded;
|
||||
|
||||
private bool _cursorInside;
|
||||
|
||||
private bool _highlight;
|
||||
|
||||
private int _lastMouseY;
|
||||
|
||||
private bool _lastIsUpperHalf;
|
||||
|
||||
private bool _isUpperHalf;
|
||||
|
||||
private int _tickCount;
|
||||
|
||||
private ImageList _imageList;
|
||||
|
||||
private readonly int _digitIndex;
|
||||
|
||||
private readonly Timer _tickTimer = new Timer();
|
||||
|
||||
private readonly ImageAttributes _maskedAttributes = new ImageAttributes();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
public class FrequencyEditDigitClickEventArgs
|
||||
{
|
||||
public FrequencyEditDigitClickEventArgs(bool isUpperHalf, MouseButtons button)
|
||||
{
|
||||
this.IsUpperHalf = isUpperHalf;
|
||||
this.Button = button;
|
||||
}
|
||||
|
||||
public bool IsUpperHalf;
|
||||
|
||||
public MouseButtons Button;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
internal sealed class FrequencyEditSeparator : UserControl, IRenderable
|
||||
{
|
||||
public Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._image;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._image = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Masked
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._masked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._masked != value)
|
||||
{
|
||||
this._masked = value;
|
||||
this._renderNeeded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FrequencyEditSeparator()
|
||||
{
|
||||
this.DoubleBuffered = true;
|
||||
base.UpdateStyles();
|
||||
ColorMatrix colorMatrix = new ColorMatrix();
|
||||
colorMatrix.Matrix33 = 0.3f;
|
||||
this._maskedAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||
}
|
||||
|
||||
public void Render()
|
||||
{
|
||||
if (this._renderNeeded)
|
||||
{
|
||||
base.Invalidate();
|
||||
this._renderNeeded = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (this._image != null)
|
||||
{
|
||||
ImageAttributes imageAttrs = (this._masked || !base.Parent.Enabled) ? this._maskedAttributes : null;
|
||||
e.Graphics.DrawImage(this._image, new Rectangle(0, 0, base.Width, base.Height), 0f, 0f, (float)this._image.Width, (float)this._image.Height, GraphicsUnit.Pixel, imageAttrs);
|
||||
}
|
||||
}
|
||||
|
||||
private const float MaskedDigitTransparency = 0.3f;
|
||||
|
||||
private Image _image;
|
||||
|
||||
private bool _masked;
|
||||
|
||||
private bool _renderNeeded;
|
||||
|
||||
private readonly ImageAttributes _maskedAttributes = new ImageAttributes();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
internal interface IRenderable
|
||||
{
|
||||
void Render();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit
|
||||
{
|
||||
public delegate void OnDigitClickDelegate(object sender, FrequencyEditDigitClickEventArgs args);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: CompilationRelaxations(8)]
|
||||
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
|
||||
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
|
||||
[assembly: AssemblyTitle("Frequency Edit Control")]
|
||||
[assembly: AssemblyDescription("Frequency Edit Control")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SDR#")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012 Youssef Touil, Ian Gilmour")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("300880ef-fb6f-41ec-b607-d468751fe0ad")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
|
||||
59
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/Properties/Resources.Designer.cs
generated
Normal file
59
SDRSharp.FrequencyEdit/SDRSharp.FrequencyEdit/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace SDRSharp.FrequencyEdit.Properties
|
||||
{
|
||||
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[DebuggerNonUserCode]
|
||||
[CompilerGenerated]
|
||||
internal class Resources
|
||||
{
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
internal static ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Resources.resourceMan == null)
|
||||
{
|
||||
Resources.resourceMan = new ResourceManager("SDRSharp.FrequencyEdit.Properties.Resources", typeof(Resources).Assembly);
|
||||
}
|
||||
return Resources.resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
internal static CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return Resources.resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
Resources.resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Bitmap Numbers
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Bitmap)Resources.ResourceManager.GetObject("Numbers", Resources.resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
private static ResourceManager resourceMan;
|
||||
|
||||
private static CultureInfo resourceCulture;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="Numbers" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAM8AAAAWCAYAAABnsMi4AAAABGdBTUEAALGPC/xhBQAAABp0RVh0U29m
|
||||
dHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAALqklEQVR4XtXcBawluRGF4QkzMzMzKszMzMykMEeh
|
||||
DSqkMDMzMyjMzMzMzDA532pKcloN7vvenVWO9Gtn+7rdbttll8vut2dExwnXD08O7w179/GF8Oxwy3DK
|
||||
cPDQq8OEk4Q7hEeG04Qeue884d7Bsz8Wqjz+7drdw+nDVHkOFy4V7hm80xvDH0Ll877wtOC9ThTW6B5B
|
||||
Hj8Op3ahQ8cO9exenhF6dKrwqfD9cEUXFnSk8KYw9swlLhnGVP1HnarbSv+b8OLw4HDBcOgwp6OGq4dH
|
||||
hdeGX4XK5/lBnzhDWNMPt6ZDhWuHj4a/h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oUFSLs+SShtNZ4PF+YtfYqGI59jCWX
|
||||
YyiL16VPEvzGZWsPyBqB16jXeLgoGtwzpzqN0dUAZb0hP65qG1Xzu91+vwmd2x+aai+GVsEC78eFmZL0
|
||||
lda6bxgJm5LoYwVbrGG071RdG6ztW9UzuOK9EjWrqOdO15Oz2rt374HsEzdREAPq/n+kIWsqhA+NHM/n
|
||||
HhglRHSMXkYVha50PR/DldYYj8Kajus5sDZrP2KbYvhhmg7gmWMfw/mvTcr2Iz/rlbkONqVe47FAFejw
|
||||
TLOAIIVoYZXHiQL7UUsfjTFuLk+l0V6CJ9oK6lhebXtpY209JXVXaUVS18jso+7cq+zquu0/9mZsAfAc
|
||||
ai9Im/QOUu0m96Zt1K2B8SyeudM4w8+whQI1NIxadRDUmqP3M+zSGuMZi5C0n07PYWOu1dxn2P5bp5K9
|
||||
s3fnKk2NmnPqNR6zZ7tHoU51hmF5lJNrM1fPXEvrk7H2EjqWB6xzzE5DA2zF9fORm3zUl5PPa6TOfOlr
|
||||
H2ysPFytuu5dhfZ7v2cyW9dnICJsQuebtFG31hpPiYVLPPUHQJyInfuDG1PaqfH0IuLVSsfr+QMgDpfu
|
||||
5MvOXuPhRvmGRTROZx2Wp/6wSe8fWvHdkPbyDu0fSGn/sMnwHN6YuOo127WRvbVSh+rSs+f+AEhPYKrE
|
||||
eGo96m9VzA0Cu6Jl49mz578LaXeu1eI/rQAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A50690CF-7A7A-4B31-9A03-B3A2AF0AF0E0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SDRSharp.FrequencyEdit</RootNamespace>
|
||||
<AssemblyName>SDRSharp.FrequencyEdit</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EntryMode.cs" />
|
||||
<Compile Include="FrequencyChangingEventArgs.cs" />
|
||||
<Compile Include="FrequencyEdit.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrequencyEditDigit.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FrequencyEditDigitClickEventArgs.cs" />
|
||||
<Compile Include="FrequencyEditSeparator.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IRenderable.cs" />
|
||||
<Compile Include="OnDigitClickDelegate.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue