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

📄 tmguidlg.cpp

📁 wince host 和 target PCI驱动程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// TmgmonDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Tmgui.h"
//#include "tracewin.h"
#include "Tmguidlg.h"
#include "tmman32.h"

extern BOOL ctc_main (CTmgmonDlg*, char *verstr);
extern void ctc_loadfile(char *filename,char *arguments);
extern void ctc_go(char *filename,char *arguments);
extern void ctc_stop(void);
extern ctc_mem(HWND hwnd,DWORD PhyAddress,int memtype,BOOL start);
extern void ctc_debug(char *);
extern void ctc_redirect(char *);
extern void ctc_trace(CEdit*,char *);
extern void ctc_newcard();
extern void ctc_exit(void);

int tracefull=0;
DWORD dwDSPCount;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

char infostr[100],verstr[100];

CString	g_sFileName;

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	virtual BOOL OnInitDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTmgmonDlg dialog

CTmgmonDlg::CTmgmonDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTmgmonDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTmgmonDlg)
	m_taskFile = _T("");
	m_taskArguments = _T("");
	m_phymem = _T("");
	m_memoption = -1;
	m_debugsdram = FALSE;
	m_debugmono = FALSE;
	m_debugpcmem = FALSE;
	m_stdinfile = _T("");
	m_stdoutfile = _T("");
	m_stderrfile = _T("");
	m_stdin = FALSE;
	m_stdout = FALSE;
	m_stderr = FALSE;
	m_trace = FALSE;
	m_tracefile = _T("");
	m_taskloaded=FALSE;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CTmgmonDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTmgmonDlg)
	DDX_Text(pDX, IDC_EDIT1, m_taskFile);
	DDX_Text(pDX, IDC_EDIT7, m_taskArguments);
	DDX_Text(pDX, IDC_EDIT2, m_phymem);
	DDV_MaxChars(pDX, m_phymem, 8);
	DDX_Radio(pDX, IDC_RADIO1, m_memoption);
	DDX_Check(pDX, IDC_CHECK7, m_debugsdram);
	DDX_Check(pDX, IDC_CHECK8, m_debugmono);
	DDX_Check(pDX, IDC_CHECK9, m_debugpcmem);
	DDX_Text(pDX, IDC_EDIT3, m_stdinfile);
	DDX_Text(pDX, IDC_EDIT4, m_stdoutfile);
	DDX_Text(pDX, IDC_EDIT5, m_stderrfile);
	DDX_Check(pDX, IDC_CHECK4, m_stdin);
	DDX_Check(pDX, IDC_CHECK5, m_stdout);
	DDX_Check(pDX, IDC_CHECK6, m_stderr);
	DDX_Check(pDX, IDC_CHECK1, m_trace);
	DDX_Text(pDX, IDC_EDIT8, m_tracefile);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CTmgmonDlg, CDialog)
	//{{AFX_MSG_MAP(CTmgmonDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
	ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_CHECK7, OnCheck7)
	ON_BN_CLICKED(IDC_CHECK8, OnCheck8)
	ON_BN_CLICKED(IDC_CHECK9, OnCheck9)
	ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
	ON_BN_CLICKED(IDC_CHECK5, OnCheck5)
	ON_BN_CLICKED(IDC_CHECK6, OnCheck6)
	ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
	ON_EN_ERRSPACE(IDC_EDIT6, OnErrspaceEdit6)
	ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
	ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
	ON_EN_MAXTEXT(IDC_EDIT6, OnMaxtextEdit6)
	ON_NOTIFY(UDN_DELTAPOS, IDC_SPINNUM, OnDeltaposSpinnum)
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTmgmonDlg message handlers

BOOL CTmgmonDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	if(ctc_main(this,verstr))			// Successful
	{
	tmDSPGetNum(&dwDSPCount);
	((CSpinButtonCtrl *)GetDlgItem(IDC_SPINNUM))->SetBuddy(GetDlgItem(IDC_NUM));
	((CSpinButtonCtrl *)GetDlgItem(IDC_SPINNUM))->SetRange(0,dwDSPCount-1);
	m_tracewin.SubclassDlgItem(IDC_EDIT6,this);
	// Set the font of edit window
	CFont font;
	CFont* pFont;
//	CEdit* pEdit=(CEdit*)GetDlgItem(IDC_EDIT6);
	pFont=font.FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT));

//	pEdit->SetFont(pFont);
	m_tracewin.SetFont(pFont);

	((CEdit*)GetDlgItem(IDC_EDIT1))->SetFocus();
	}
	else
		PostQuitMessage(0);
	
	return FALSE;  // return TRUE  unless you set the focus to a control
	
//	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CTmgmonDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CTmgmonDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CTmgmonDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CTmgmonDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
//	char currentDir[200];

//	static CString	sFileName;
	char	*pFileName;
	if(g_sFileName.IsEmpty())
		pFileName = NULL;
	else
		pFileName = (char*)(const char*)g_sFileName;;

//	GetCurrentDirectory(200,currentDir);
	CFileDialog dlg(
		TRUE,										// Open File Dialog
		NULL,									// Default extension
		pFileName,								// No default filename
		OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,		// OPENFILENAME flags
		"Task Files (*.out) |*.out|App Files (*.app) |*.app|All Files|*.*||");	// Filter strings
	
	dlg.m_ofn.Flags |= OFN_NOCHANGEDIR;
	if (dlg.DoModal() == IDOK)
	{
		g_sFileName = dlg.GetPathName();
		SetDlgItemText(IDC_EDIT1,(char*)(const char*)g_sFileName);
	}
//	SetCurrentDirectory(currentDir);
    return;
	
}

void CTmgmonDlg::OnButton6() 
{
	// TODO: Add your control notification handler code here
//	char currentDir[200];

	static CString	sFileName;
	char	*pFileName;
	if(sFileName.IsEmpty())
		pFileName = NULL;
	else
		pFileName = (char*)(const char*)sFileName;

//	GetCurrentDirectory(200,currentDir);
	CFileDialog dlg(
		TRUE,										// Open File Dialog
		NULL,									// Default extension
		pFileName,								// No default filename
		OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,		// OPENFILENAME flags
		"All Files|*.*||");	// Filter strings
	
	dlg.m_ofn.Flags |= OFN_NOCHANGEDIR;
	if (dlg.DoModal() == IDOK)
	{
		SetDlgItemText(IDC_EDIT3,dlg.GetPathName());
		sFileName = dlg.GetPathName();
	}
//	SetCurrentDirectory(currentDir);

	
}

void CTmgmonDlg::OnButton7() 
{
	// TODO: Add your control notification handler code here
//	char currentDir[200];

	static CString	sFileName;
	char	*pFileName;
	if(sFileName.IsEmpty())
		pFileName = NULL;
	else
		pFileName = (char*)(const char*)sFileName;

//	GetCurrentDirectory(200,currentDir);
		CFileDialog dlg(
		TRUE,										// Open File Dialog
		NULL,									// Default extension
		pFileName,								// No default filename
		OFN_HIDEREADONLY,		// OPENFILENAME flags
		"All Files|*.*||");	// Filter strings
	
	dlg.m_ofn.Flags |= OFN_NOCHANGEDIR;
	if (dlg.DoModal() == IDOK)
	{
		SetDlgItemText(IDC_EDIT4,dlg.GetPathName());
		sFileName = dlg.GetPathName();
	}
//	SetCurrentDirectory(currentDir);

	
}

void CTmgmonDlg::OnButton8() 

⌨️ 快捷键说明

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