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

📄 mydlgbar.cpp

📁 正规(则)表达式转化为NFA
💻 CPP
字号:
// MyDlgBar.cpp : implementation file
//

#include "stdafx.h"
#include "TONFA.h"
#include "MyDlgBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyDlgBar dialog


CMyDlgBar::CMyDlgBar(CWnd* pParent /*=NULL*/)
//	: CDialogBar(CMyDlgBar::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMyDlgBar)
	m_CmdValue = _T("");
	//}}AFX_DATA_INIT
}


void CMyDlgBar::DoDataExchange(CDataExchange* pDX)
{
	CDialogBar::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMyDlgBar)
	DDX_Text(pDX, IDC_EDIT1, m_CmdValue);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMyDlgBar, CDialogBar)
	//{{AFX_MSG_MAP(CMyDlgBar)
	ON_BN_CLICKED(IDC_RUN, OnRun)
	ON_BN_CLICKED(IDC_DFA, OnDfa)
	ON_BN_CLICKED(IDC_MIN, OnMin)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyDlgBar message handlers

void CMyDlgBar::OnRun() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CTONFAApp *pApp=(CTONFAApp *)AfxGetApp();
	pApp->pView->GetDocument()->m_Title=m_CmdValue;
	pApp->pView->m_TBarNFA=true;
	pApp->pView->SetNFAPos.num=pApp->pView->GetDocument()->ExpToNfa();
	if(pApp->pView->SetNFAPos.num==0)
		return;
	pApp->pView->flag=0;
	pApp->pView->GetDocument()->m_flag=0;
	pApp->pView->Invalidate(TRUE);	
//	AfxMessageBox(m_CmdValue);
}

void CMyDlgBar::OnDfa() 
{
	// TODO: Add your control notification handler code here
	CTONFAApp *pApp=(CTONFAApp *)AfxGetApp();
	if(pApp->pView->flag>=0)
	{
		pApp->pView->GetDocument()->m_flag=1;
		pApp->pView->SetDFAPos.num=pApp->pView->GetDocument()->NfaToDfa();
		pApp->pView->flag=1;
		pApp->pView->m_TBarNFA=true;
		pApp->pView->m_TBarTABLE=true;
		pApp->pView->m_TBarDFA=true;
		pApp->pView->Invalidate(TRUE);
	}
	else
	{
		AfxMessageBox(_T("请先进行NFA转换"));
	}
}

void CMyDlgBar::OnMin() 
{
	// TODO: Add your control notification handler code here
	CTONFAApp *pApp=(CTONFAApp *)AfxGetApp();
	if(pApp->pView->flag>=1)
	{
		pApp->pView->GetDocument()->m_flag=2;
		pApp->pView->SetMINPos.num=pApp->pView->GetDocument()->DfaToMin();
		pApp->pView->flag=2;//	
		pApp->pView->m_TBarNFA=true;
		pApp->pView->m_TBarMINTABLE=true;
		pApp->pView->m_TBarMINDFA=true;
		pApp->pView->m_TBarTABLE=false;
		pApp->pView->m_TBarDFA=false;
		pApp->pView->Invalidate(TRUE);
	}
	else if(pApp->pView->flag==0)
	{
		AfxMessageBox(_T("请先进行DFA转换"));
	}
	else
	{
		AfxMessageBox(_T("请先进行NFA转换"));
	}
}

⌨️ 快捷键说明

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