⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.h

📁 USB 上位机程序 VNA使用,网络分析仪原理使用仪器
💻 H
📖 第 1 页 / 共 5 页
字号:
//
//    Copyright 2004-2007 Thomas C. McDermott, N5EG
//    This file is part of VNAR - the Vector Network Analyzer program.
//
//    VNAR is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    VNAR is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with VNAR, if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
/// \author Thomas C. McDermott, N5EG

/** \mainpage VNAR3
!!!Vector Network Analyzer Software Documentation \n
---
\n This document package describes the Vector Network Analyzer host (PC) development
software.\n The entry point is Form1.cpp, which creates an object Form1,
and then runs it.\n Form1 creates the main menu and hooks the windows message loop
using the .NET style of Event Delegates.
*/

#pragma once

#include "NumEntBox.h"
#include "USB_EZ_interface.h"
#include "DisplayRoutines.h"
#include "Calibration.h"
#include "DataDisplay.h"
#include "InstrumentCal.h"
#include "MarkerEntry.h"
#include "About.h"
#include "CursorStatus.h"
#include "TextEntry.h"
#include "Fourier.h"
#include "TDRSetupDialog.h"
#include "Constants.h"

#include <complex>

//#define	DEBUGRAWREFL		// enable raw reflection detector ADC counts to be displayed in rectangular mode
//#define	DEBUGRAWTRAN		// enable raw transmission detector ADC counts to be displayed in rectangular mode

namespace VNAR3
{
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::Drawing::Drawing2D;
	using namespace System::Drawing::Printing;
	using namespace System::IO;
	using namespace System::Reflection;
	using namespace System::Threading;
	using namespace System::Text;

	/// <summary> 
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:
		Form1(char * lpCmdLine)
		{
			CommandLine = Convert::ToString(lpCmdLine);	// Save command line we were invoked with
			InitializeComponent();
			VNA_Initialize();
      	}
 
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}

	private:
		Point p1,p2;					///< saved mouse coordinates
		int MarkerMousePick;			///< marker number picked by mouse (-1 = not picked)
		int txLevel;					///< transmit level
		int refLevel;					///< display reference level

		Rectangle rect;					///< client size for render (given to us by Paint & Redraw)
		Rectangle scopeDisp;			///< rectangular scope display area
		Rectangle polarBox;				///< box holding the polar display
		int RectVertScaledB;			///< Rectangular Vertical Scale in db/division
		int polarRadius;				///< radius of the polar display
		int scalefactorGD;				///< Group delay scale factor.   1 means 100 psec/division
		int RectSWRScale;				///< SWR selection scale
		float PolarZoom;				///< Zoom factor for Polar display (1.0 to 3.0)

		float PixelsPerGrid;			///< display pixels per grid point (freq or time)
		int	StartIndex, StopIndex;		///< Start and stop times converted to array index

		unsigned int Marker __gc[];		///< Frequency Markers
		float MarkerT __gc[];			///< Time Markers
		CursorStatus* cs;				///< cursor text display
		bool ShowMarkerNumbers;			///< Marker Number Display control
		bool ShowMarkerParameters;		///< Marker Parameter Display control
		float TDRStartTime, TDRStopTime; ///< TDR Display start and stop times, in nanoseconds
		float TDRvf;					///< TDR display estimated cable velocity factor
		bool TDRMetricMode;				///< TDR Display distance mode

		String*	plotTitle;				///< Plot Title (allowed to be empty)
		String* FixtureCalFileName;		///< Name of Fixture Calibration File loaded (empty if none)

		bool WorkerCollect;				///< Work for VNA Thread to do

		bool PreCharge;					///< True when Integration factor changed. Worker should
										//	 set false after first sweep.

		unsigned short trace1 __gc[], trace2 __gc[];		///< traces on scope display
		unsigned short trace3 __gc[], trace4 __gc[];		///< traces on scope display
		unsigned short trace5 __gc[], trace6 __gc[];		///< traces on scope display
		unsigned short trace7 __gc[], trace8 __gc[];		///< traces on scope display
		unsigned short trace9 __gc[], trace10 __gc[];		///< traces on scope display
		unsigned short trace11 __gc[], trace12 __gc [];		///< traces on scope display

		unsigned short trace1s __gc[], trace2s __gc[];		///< storage for traces
		unsigned short trace3s __gc[], trace4s __gc[];		///< storage for traces
		unsigned short trace5s __gc[], trace6s __gc[];		///< storage for traces
		unsigned short trace7s __gc[], trace8s __gc[];		///< storage for traces
		unsigned short trace9s __gc[], trace10s __gc[];		///< storage for traces
		unsigned short trace11s __gc[], trace12s __gc [];	///< storage for traces


		double stS11Mag __gc[], stS11Phs __gc[];				///< storage for S11
		double stS21Mag __gc[], stS21Phs __gc[];				///< storage for S21
		double stS12Mag __gc[], stS12Phs __gc[];				///< storage for S12
		double stS22Mag __gc[], stS22Phs __gc[];				///< storage for S22

		PrintDocument* pdoc;            ///< Printer document
		VNADevice* VNA;					///< Vector Network Analyzer hardware object
		FrequencyGrid* FG;				///< Frequency Grid for display
		CalDataSet* CalData;			///< Calibration Data Set
		String* StartUpPath;			///< Directory path we started execution in

		// Mutex*	DataBufMut;				// Control access to VNA return data buffer
		Thread* VNAWorkerThread;				///< Thread for VNA data gathering
		ThreadStart* VNAWorkerThreadDelegate;	///< Threadstart points to method

		// Holds string that underlines the digit at position[FrequencyDigitIndex]
		static String * FrequencyDigitText[] = {S"-", S"-_", S"-__", S"-____", S"-_____",
			S"-______", S"-________", S"-_________", S"-__________" };
		int FrequencyDigitIndex;		///< Which Digit is being used for increment/decrement Frequency value

		String * CommandLine;

		// hold colors for the traces - and populate with default colors

		static Color s21MagColor = Color::Green;		// pen5
		static Color s21PhsColor = Color::Blue;			// pen4
		static Color s11MagColor = Color::Red;			// pen3
		static Color s11PhsColor = Color::Purple;		// pen6
		static Color s21GroupDelayColor = Color::Aqua;	// pen7
		static Color s11VSWRColor = Color::DeepPink;	// pen10

//		Pen* pen3 = new Pen(Color::Red, 2);
//		Pen* pen4 = new Pen(Color::Blue, 2);
//		Pen* pen5 = new Pen(Color::Green, 2);
//		Pen* pen6 = new Pen(Color::Purple, 2);
//		Pen* pen7 = new Pen(Color::Aqua, 2);
//		Pen* pen8 = new Pen(Color::Brown, 2);
//		Pen* pen9 = new Pen(Color::DarkCyan, 2);
//		Pen* pen10 = new Pen(Color::DeepPink, 2);
//		Pen* pen11 = new Pen(Color::Fuchsia, 2);
//		Pen* pen12 = new Pen(Color::DarkGoldenrod, 2);



	private: System::Windows::Forms::Label *  startF;
	private: System::Windows::Forms::Label *  stopF;
	private: System::Windows::Forms::Label *  txL;
	private: System::Windows::Forms::Label *  refL;
	private: System::Windows::Forms::Button *  stopFdown;
	private: System::Windows::Forms::Button *  stopFup;
	private: System::Windows::Forms::Button *  startFdown;
	private: System::Windows::Forms::Button *  startFup;
	private: System::Windows::Forms::Label *  label1;
	private: System::Windows::Forms::Label *  label2;
	private: System::Windows::Forms::Label *  label3;
	private: System::Windows::Forms::Label *  label4;
	private: System::Windows::Forms::Button *  txLup;
	private: System::Windows::Forms::Button *  txLdown;
	private: System::Windows::Forms::Button *  refLup;
	private: System::Windows::Forms::Button *  refLdown;





















	private: System::Windows::Forms::ToolTip *  toolTip1;

	private: System::Windows::Forms::CheckBox *  calCheckBox;







	private: System::Windows::Forms::Label *  label5;




































private: System::Windows::Forms::Button *  SingleSweep;
private: System::Windows::Forms::Button *  RecurrentSweep;
private: System::Windows::Forms::Button *  SweepSpd;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -