mirror of
https://github.com/n5ac/smartsdr-dsp.git
synced 2026-03-17 09:24:37 +01:00
List Sorting, DR Mode Set RPT2
This commit is contained in:
parent
f8b5c17214
commit
4c70735140
|
|
@ -86,8 +86,11 @@ namespace CODEC2_GUI
|
|||
|
||||
API.RadioAdded += new API.RadioAddedEventHandler(API_RadioAdded);
|
||||
API.RadioRemoved += new API.RadioRemovedEventHandler(API_RadioRemoved);
|
||||
API.IsGUI = true;
|
||||
API.ProgramName = "ThumbDV_DSTAR";
|
||||
API.Init();
|
||||
|
||||
|
||||
LogQueue = new BindingList<string>();
|
||||
logList.DataSource = LogQueue;
|
||||
|
||||
|
|
|
|||
2
pc/CODEC2 GUI/CODEC2 GUI/SelectForm.Designer.cs
generated
2
pc/CODEC2 GUI/CODEC2 GUI/SelectForm.Designer.cs
generated
|
|
@ -76,9 +76,11 @@
|
|||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(653, 205);
|
||||
this.listView1.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.listView1.TabIndex = 0;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
this.listView1.View = System.Windows.Forms.View.Details;
|
||||
this.listView1.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listView1_ColumnClick);
|
||||
//
|
||||
// nameCol
|
||||
//
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
|
@ -200,5 +201,55 @@ namespace CODEC2_GUI
|
|||
setlistitems();
|
||||
}
|
||||
}
|
||||
|
||||
private int sortColumn;
|
||||
|
||||
private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
if (e.Column != sortColumn)
|
||||
{
|
||||
// Set the sort column to the new column.
|
||||
sortColumn = e.Column;
|
||||
// Set the sort order to ascending by default.
|
||||
listView1.Sorting = SortOrder.Ascending;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Determine what the last sort order was and change it.
|
||||
if (listView1.Sorting == SortOrder.Ascending)
|
||||
listView1.Sorting = SortOrder.Descending;
|
||||
else
|
||||
listView1.Sorting = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
ColumnHeader ch = listView1.Columns[e.Column];
|
||||
listView1.ListViewItemSorter = new ListViewSorter(e.Column, listView1.Sorting);
|
||||
listView1.Sort();
|
||||
}
|
||||
}
|
||||
|
||||
class ListViewSorter : IComparer
|
||||
{
|
||||
int col;
|
||||
SortOrder sortOrder;
|
||||
|
||||
public ListViewSorter()
|
||||
{
|
||||
col = 0;
|
||||
sortOrder = SortOrder.Ascending;
|
||||
}
|
||||
public ListViewSorter(int scol, SortOrder sorder)
|
||||
{
|
||||
col = scol;
|
||||
sortOrder = sorder;
|
||||
}
|
||||
public int Compare(object x, Object y)
|
||||
{
|
||||
int returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text,
|
||||
((ListViewItem)y).SubItems[col].Text, true);
|
||||
if (sortOrder == SortOrder.Descending)
|
||||
returnVal *= -1;
|
||||
return returnVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
pc/CODEC2 GUI/CODEC2 GUI/dstarctl.Designer.cs
generated
1
pc/CODEC2 GUI/CODEC2 GUI/dstarctl.Designer.cs
generated
|
|
@ -133,7 +133,6 @@
|
|||
//
|
||||
this.rpt1txt.Location = new System.Drawing.Point(387, 60);
|
||||
this.rpt1txt.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.rpt1txt.MaxLength = 8;
|
||||
this.rpt1txt.Name = "rpt1txt";
|
||||
this.rpt1txt.Size = new System.Drawing.Size(231, 28);
|
||||
this.rpt1txt.TabIndex = 10;
|
||||
|
|
|
|||
|
|
@ -395,7 +395,26 @@ namespace CODEC2_GUI
|
|||
{
|
||||
if (inreset)
|
||||
return;
|
||||
|
||||
string rtxt = rpt1txt.Text;
|
||||
if (!string.IsNullOrWhiteSpace(rtxt))
|
||||
{
|
||||
string[] srtxt = rtxt.Split('~');
|
||||
if (srtxt.Length > 0 && srtxt[0].Length > 0)
|
||||
{
|
||||
if (srtxt[0].Length > 8)
|
||||
{
|
||||
srtxt[0] = srtxt[0].Substring(0, 8);
|
||||
rtxt = string.Join("~", srtxt);
|
||||
rpt1txt.Text = rtxt;
|
||||
rpt1txt.SelectionStart = 7;
|
||||
rpt1txt.SelectionLength = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Modified = Modified | ModifyFlags.RPT1FLAG;
|
||||
updateRpt2();
|
||||
OnPropertyChanged("RPT1");
|
||||
OnPropertyChanged("Modified");
|
||||
}
|
||||
|
|
@ -424,6 +443,7 @@ namespace CODEC2_GUI
|
|||
if (inreset)
|
||||
return;
|
||||
Modified = Modified | ModifyFlags.RPT1FLAG;
|
||||
updateRpt2();
|
||||
OnPropertyChanged("RPT1");
|
||||
OnPropertyChanged("Modified");
|
||||
}
|
||||
|
|
@ -556,6 +576,7 @@ namespace CODEC2_GUI
|
|||
{
|
||||
rpt1txt.Text = rpm.SelectedRpt.RepeaterName;
|
||||
Modified = Modified | ModifyFlags.RPT1FLAG;
|
||||
updateRpt2();
|
||||
OnPropertyChanged("RPT1");
|
||||
OnPropertyChanged("Modified");
|
||||
}
|
||||
|
|
@ -574,5 +595,33 @@ namespace CODEC2_GUI
|
|||
}
|
||||
}
|
||||
|
||||
private void updateRpt2()
|
||||
{
|
||||
string[] srpt1 = rpt1txt.Text.Split('~');
|
||||
if (srpt1.Length > 0 && srpt1[0].Length > 0 && !srpt1[0].StartsWith("DIRECT"))
|
||||
{
|
||||
char last = 'G';
|
||||
if (rpt2txt.Text.Length > 0)
|
||||
last = rpt2txt.Text.Last();
|
||||
string rcs = srpt1[0].ToUpper().Trim();
|
||||
int idx = rcs.IndexOf(' ');
|
||||
if (idx > 0)
|
||||
rcs = rcs.Substring(0, idx);
|
||||
else if (rcs.Length > 7)
|
||||
rcs = rcs.Substring(0, 7);
|
||||
string rpts = string.Format("{0,-7}S", rcs);
|
||||
string rptg = string.Format("{0,-7}G", rcs);
|
||||
RPT2List = new List<string>() { rptg, rpts };
|
||||
if (rpt2txt.Text != rptg && rpt2txt.Text != rpts)
|
||||
{
|
||||
if (last == 'S')
|
||||
rpt2txt.SelectedIndex = 1;
|
||||
else
|
||||
rpt2txt.SelectedIndex = 0;
|
||||
}
|
||||
OnPropertyChanged("RPT2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,62 +334,72 @@ namespace CODEC2_GUI
|
|||
rpt2 = dstarctl1.RPT2;
|
||||
}
|
||||
|
||||
string ur = dstarctl1.UR;
|
||||
cmd = "set companion_call=" + ur.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
string my = dstarctl1.MY;
|
||||
cmd = "set own_call1=" + my.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
string note = dstarctl1.NOTE;
|
||||
cmd = "set own_call2=" + note.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
string message = dstarctl1.MESSAGE;
|
||||
cmd = "set message=" + message.Replace(" ", "\u007f");
|
||||
cmd = "set destination_rptr=" + rpt2.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
|
||||
string[] srpt1 = rpt1.Split('~');
|
||||
if (srpt1.Length > 0)
|
||||
{
|
||||
cmd = "set departure_rptr=" + srpt1[0].Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
if (srpt1.Length > 1)
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
}
|
||||
|
||||
string ur = dstarctl1.UR;
|
||||
cmd = "set companion_call=" + ur.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
|
||||
string my = dstarctl1.MY;
|
||||
cmd = "set own_call1=" + my.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
|
||||
string note = dstarctl1.NOTE;
|
||||
cmd = "set own_call2=" + note.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
|
||||
string message = dstarctl1.MESSAGE;
|
||||
cmd = "set message=" + message.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
//System.Diagnostics.Debug.WriteLine(cmd.Replace("\u007f", " "));
|
||||
|
||||
if (srpt1.Length > 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
_slice.Freq = Convert.ToDouble(srpt1[1]);
|
||||
if (srpt1.Length > 2)
|
||||
{
|
||||
_slice.Freq = Convert.ToDouble(srpt1[1]);
|
||||
if (srpt1.Length > 2)
|
||||
{
|
||||
double ofs = Convert.ToDouble(srpt1[2]);
|
||||
_slice.FMRepeaterOffsetFreq = Math.Abs(ofs);
|
||||
_slice.RepeaterOffsetDirection = ofs == 0 ? FMTXOffsetDirection.Simplex :
|
||||
(ofs < 0 ? FMTXOffsetDirection.Down : FMTXOffsetDirection.Up);
|
||||
}
|
||||
else
|
||||
{
|
||||
_slice.FMRepeaterOffsetFreq = 0;
|
||||
_slice.RepeaterOffsetDirection = FMTXOffsetDirection.Simplex;
|
||||
}
|
||||
double ofs = Convert.ToDouble(srpt1[2]);
|
||||
_slice.FMRepeaterOffsetFreq = Math.Abs(ofs);
|
||||
_slice.RepeaterOffsetDirection = ofs == 0 ? FMTXOffsetDirection.Simplex :
|
||||
(ofs < 0 ? FMTXOffsetDirection.Down : FMTXOffsetDirection.Up);
|
||||
}
|
||||
catch(Exception ex)
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Exception ex1 = ex;
|
||||
while (ex1 != null)
|
||||
{
|
||||
sb.AppendLine(ex1.Message);
|
||||
ex1 = ex1.InnerException;
|
||||
}
|
||||
MessageBox.Show(sb.ToString(), "Set Slice Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
_slice.FMRepeaterOffsetFreq = 0;
|
||||
_slice.RepeaterOffsetDirection = FMTXOffsetDirection.Simplex;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Exception ex1 = ex;
|
||||
while (ex1 != null)
|
||||
{
|
||||
sb.AppendLine(ex1.Message);
|
||||
ex1 = ex1.InnerException;
|
||||
}
|
||||
MessageBox.Show(sb.ToString(), "Set Slice Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
cmd = "set destination_rptr=" + rpt2.Replace(" ", "\u007f");
|
||||
_slice.SendWaveformCommand(cmd);
|
||||
|
||||
|
||||
dstarctl1.Modified = dstarctl.ModifyFlags.NOFLAGS;
|
||||
|
||||
btnCommit.Enabled = false;
|
||||
|
||||
dstarctl1.MY = my;
|
||||
dstarctl1.NOTE = note;
|
||||
dstarctl1.UR = ur;
|
||||
|
|
@ -397,6 +407,8 @@ namespace CODEC2_GUI
|
|||
dstarctl1.RPT2 = rpt2 == "DIRECT" ? string.Empty : rpt2;
|
||||
dstarctl1.DRMode = !string.IsNullOrEmpty(dstarctl1.RPT1);
|
||||
|
||||
btnCommit.Enabled = false;
|
||||
|
||||
// add new UR entry to dropdown list
|
||||
List<string> lst = new List<string>(dstarctl1.URList);
|
||||
ur = ur.ToUpper();
|
||||
|
|
|
|||
Loading…
Reference in a new issue