// QSO end private void LOGbtn6_Click(object sender, EventArgs e) { if (sender != null) { rtty_message_repeat = false; rtty_message_event.Set(); } if (!MOX) { Mode new_mode = op_mode_vfoA; if (tx_split) new_mode = op_mode_vfoB; switch (new_mode) { case Mode.CW: string msg = ""; msg = SetupForm.txtCWMsg6.Text.ToString(); msg = MacroHandler(msg); if (keyboard.Visible) keyboard.Start(msg); else cwEncoder.Start(msg); break; case Mode.RTTY: msg = ""; msg = SetupForm.txtRTTYMsg6.Text.ToString(); msg = MacroHandler(msg); if (keyboard.Visible) keyboard.Start(msg); else rtty.Start(msg); break; case Mode.BPSK31: case Mode.BPSK63: case Mode.BPSK125: case Mode.BPSK250: case Mode.QPSK31: case Mode.QPSK63: case Mode.QPSK125: case Mode.QPSK250: msg = ""; msg = SetupForm.txtPSKMsg6.Text.ToString(); msg = MacroHandler(msg); if (keyboard.Visible) keyboard.Start(msg); else psk.Start(msg); break; } } else { Mode new_mode = op_mode_vfoA; if (tx_split) new_mode = op_mode_vfoB; switch (new_mode) { case Mode.CW: cwEncoder.Stop(); break; case Mode.RTTY: rtty.Stop(); break; case Mode.BPSK31: case Mode.BPSK63: case Mode.BPSK125: case Mode.BPSK250: case Mode.QPSK31: case Mode.QPSK63: case Mode.QPSK125: case Mode.QPSK250: psk.Stop(); break; } } }
private string MacroHandler(string msg) { try { System.DateTime date = DateTime.UtcNow; string freq = vfoa.ToString(); string mode = op_mode_vfoA.ToString(); string name = txtLogName.Text.ToString(); if (name == "") name = "OM"; if (tx_split) { freq = vfob.ToString(); mode = op_mode_vfoB.ToString(); } msg = msg.Replace("<CALL>", txtLogCall.Text.ToUpper()); msg = msg.Replace("<My CALL>", SetupForm.txtStnCALL.Text.ToString()); msg = msg.Replace("<My RST>", txtLogMyRST.Text.ToString()); msg = msg.Replace("<My NR>", udLOGMyNR.Text.ToString()); msg = msg.Replace("<My QTH>", SetupForm.txtStnQTH.Text.ToString()); msg = msg.Replace("<My LOC>", SetupForm.txtStnLOC.Text.ToString()); msg = msg.Replace("<My Name>", SetupForm.txtStnName.Text.ToString()); msg = msg.Replace("<Name>", name); msg = msg.Replace("<My Info>", SetupForm.txtStnInfoTxt.Text.ToString()); msg = msg.Replace("<My Zone>", SetupForm.txtStnZone.Text.ToString()); msg = msg.Replace("<Freq>", freq); msg = msg.Replace("<Mode>", mode); msg = msg.Replace("<Date>", date.Date.ToShortDateString()); msg = msg.Replace("<Time>", date.ToUniversalTime().ToShortTimeString()); msg = msg.Replace("<Band>", CurrentBand.ToString().Replace("B", "")); if (msg.Contains("<No>")) { Mode opmode = op_mode_vfoA; int cnt = 1; if (tx_split) opmode = op_mode_vfoB; switch (opmode) { case Mode.CW: cnt = int.Parse(log_book.txtCW.Text.ToString()); cnt++; break; case Mode.RTTY: cnt = int.Parse(log_book.txtRTTY.Text.ToString()); cnt++; break; case Mode.BPSK31: cnt = int.Parse(log_book.txtPSK31.Text.ToString()); cnt++; break; case Mode.BPSK63: cnt = int.Parse(log_book.txtPSK63.Text.ToString()); cnt++; break; case Mode.BPSK125: cnt = int.Parse(log_book.txtPSK125.Text.ToString()); cnt++; break; case Mode.BPSK250: cnt = int.Parse(log_book.txtPSK250.Text.ToString()); cnt++; break; case Mode.QPSK31: cnt = int.Parse(log_book.txtQPSK31.Text.ToString()); cnt++; break; case Mode.QPSK63: cnt = int.Parse(log_book.txtQPSK63.Text.ToString()); cnt++; break; case Mode.QPSK125: cnt = int.Parse(log_book.txtQPSK125.Text.ToString()); cnt++; break; case Mode.QPSK250: cnt = int.Parse(log_book.txtQPSK250.Text.ToString()); cnt++; break; } msg = msg.Replace("<No>", cnt.ToString()); } return msg; } catch (Exception ex) { Debug.Write(ex.ToString()); return ""; } }
public CWExpert() { booting = true; InitializeComponent(); float dpi = this.CreateGraphics().DpiX; this.AutoScaleMode = AutoScaleMode.Dpi; SizeF d = this.AutoScaleDimensions; d.Height = dpi; d.Width = dpi; this.AutoScaleDimensions = d; float ratio = dpi / 96.0f; string font_name = this.Font.Name; float size = (float)(8.25 / ratio); System.Drawing.Font new_font = new System.Drawing.Font(font_name, size); this.Font = new_font; font_name = txtVFOA.Font.Name; size = 14.25f / ratio; new_font = new System.Drawing.Font(font_name, size); txtVFOA.Font = new_font; size = 9.75f / ratio; new_font = new System.Drawing.Font(font_name, size); txtVFOB.Font = new_font; txtLosc.Font = new_font; font_name = this.menuStrip1.Font.Name; this.menuStrip1.Font = new System.Drawing.Font(font_name, size); this.menuStrip1.Size = new Size(this.menuStrip1.Width, (int)(25 / ratio)); this.PerformAutoScale(); this.PerformLayout(); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); UpdateStyles(); this.Text = programVersion; tx_image_phase_table = new float[(int)Band.LAST]; tx_image_gain_table = new float[(int)Band.LAST]; rx_image_phase_table = new float[(int)Band.LAST]; rx_image_gain_table = new float[(int)Band.LAST]; msg = new MessageHelper(); edits = new TextEdit[3]; DB.AppDataPath = Application.StartupPath; DB.Init(); Audio.MainForm = this; PA19.PA_Initialize(); #if DirectX DX.MainForm = this; #endif Display_GDI.MainForm = this; SetupForm = new Setup(this); booting = false; DXClusterForm = new DXClusterClient(this, SetupForm.txtTelnetHostAddress.Text.ToString(), SetupForm.txtStnCALL.Text.ToString(), SetupForm.txtStnName.Text.ToString(), SetupForm.txtStnQTH.Text.ToString()); SetupForm.chkIPV6_CheckedChanged(this, EventArgs.Empty); display_event = new AutoResetEvent(false); output_ring_buf = new RingBuffer(32768); mon_ring_buf = new RingBuffer(32768); tbFilterWidth.Visible = false; picMonitor_bmp = new Bitmap(picMonitor.Width, picMonitor.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); #if(DirectX) if (VideoDriver == DisplayDriver.DIRECTX) { DirectXInit(); } else #endif { SMeter.displayEngine = AnalogGAuge.AGauge.DisplayDriver.GDI; Display_GDI.Target = picPanadapter; Display_GDI.Init(this); if (File.Exists(".\\picDisplay.png")) { picPanadapter.BackgroundImage = Image.FromFile(".\\picDisplay.png"); picWaterfall.BackgroundImage = Image.FromFile(".\\picDisplay.png"); } } display_buffer = new float[4096]; AlwaysOnTop = always_on_top; txtFilterWidth.Visible = false; tbFilterWidth.Visible = false; lblFilterwidth.Visible = false; menuStrip1.BackColor = Color.Black; menuStrip1.ForeColor = Color.White; tbAFGain_Scroll(this, EventArgs.Empty); genesis = new G59(this.Handle); btnCH1.BackColor = Color.LimeGreen; btnCH2.BackColor = Color.WhiteSmoke; if (Audio.SDRmode) { genesis.booting = false; G59Init(); genesis.si570_i2c_address = 170; genesis.si570_fxtal = 114272200.0; genesis.HSDiv = 11; bool conn = genesis.Connected; if (conn) { lblUSB.BackColor = Color.Green; } else { lblUSB.BackColor = Color.Red; } } cwDecoder = new CWDecode(this); cwEncoder = new CWEncode(this); rtty = new RTTY(this); psk = new PSK(this); cwEncoder.CWSpedd = (int)SetupForm.udCWSpeed.Value; cwDecoder.rx_only = SetupForm.chkRXOnly.Checked; cwEncoder.TXPhase = (float)SetupForm.udTXPhase.Value; cwEncoder.TXGain = (float)SetupForm.udTXGain.Value; cwEncoder.TXIfShift = (float)SetupForm.udTXIfShift.Value; cwEncoder.TXOffDelay = (int)SetupForm.udTXOffDelay.Value; cwEncoder.SetKeyerSpeed((float)SetupForm.udCWSpeed.Value); cwEncoder.SetKeyerWeight((int)SetupForm.udCWWeight.Value); cwEncoder.SetKeyerIambic(SetupForm.chkG59Iambic.Checked); chkAFC_CheckedChanged(this, EventArgs.Empty); psk.TXPreamble = psk_preamble; if (SetupForm.chkG59IambicBmode.Checked) cwEncoder.SetKeyerMode(1); else cwEncoder.SetKeyerMode(0); rtty.TXPhase = (float)SetupForm.udTXPhase.Value; rtty.TXGain = (float)SetupForm.udTXGain.Value; if (!once) { SetupSDR(Application.StartupPath.ToString() + "\\wisdom"); ReleaseUpdate(); SetSampleRate(Audio.SampleRate); ResizeSDR(0, 4096); SetAGC(agc_mode); ProcessSampleThreadController[] pstc = new ProcessSampleThreadController[1]; audio_process_thread = new Thread[1]; for (uint proc_thread = 0; proc_thread < 1; proc_thread++) { pstc[proc_thread] = new ProcessSampleThreadController(proc_thread); audio_process_thread[proc_thread] = new Thread(new ThreadStart(pstc[proc_thread].ProcessSampleThread)); audio_process_thread[proc_thread].Name = "Audio Process Thread " + proc_thread.ToString(); audio_process_thread[proc_thread].Priority = ThreadPriority.Highest; audio_process_thread[proc_thread].IsBackground = true; audio_process_thread[proc_thread].Start(); } once = true; } get_state = true; GetState(); get_state = false; DB.LOGFilePath = log_file_path; DB.LOG_Init(); InitLOG(); keyboard = new Keyboard(this); recorder = new Recorder(this); double vfoa_freq, vfob_freq, losc_freq; int filter_vfoA, filter_vfoB, zoom, pan; DB.GetBandStack(current_band.ToString(), out vfoa_freq, out vfob_freq, out losc_freq, out filter_vfoA, out filter_vfoB, out zoom, out pan); LOSC = losc_freq; VFOA = vfoa_freq; VFOB = vfob_freq; FilterWidthVFOA = filter_vfoA; FilterWidthVFOB = filter_vfoB; tbZoom.Value = zoom; tbPan.Value = pan; lblPan_Click(null, null); switch (op_mode_vfoA) { case Mode.BPSK31: case Mode.BPSK63: case Mode.BPSK125: case Mode.BPSK250: case Mode.QPSK31: case Mode.QPSK63: case Mode.QPSK125: case Mode.QPSK250: this.grpChannels.Text = "VFOA " + op_mode_vfoA.ToString() + " VFOB " + op_mode_vfoB.ToString() + " "; grpMonitor.Text = "Mode PSK"; break; } if (iq_correction == IQ_correction.FIXED) { SetRXIQGainPhase(1, rx_image_gain_table[(int)current_band], rx_image_phase_table[(int)current_band]); RX_phase_gain(); } else if (iq_correction == IQ_correction.WBIR) { SetRXIQGainPhase(2, 0.0f, 0.0f); RX_phase_gain(); } dxcc = new DXCC(); dxcc.Init(SetupForm.txtStnLOC.Text.ToString()); try { if (use_telnet) telnet_server = new TelnetServer(SetupForm.txtTelnetHostAddress.Text.ToString(), (int)SetupForm.udTelnetServerPort.Value, SetupForm.chkIPV6.Checked); SetupForm.chkIPV6_CheckedChanged(this, EventArgs.Empty); } catch (Exception ex) { Debug.Write(ex.ToString()); } }