📄 sdlg.cpp
字号:
// Sdlg.cpp : implementation file
//
#include "stdafx.h"
#include "g.h"
#include "Sdlg.h"
#include "GDoc.h"
#include "var.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSdlg dialog
CSdlg::CSdlg(CGDoc* pDoc,CWnd* pParent /*=NULL*/)
: CDialog(CSdlg::IDD, pParent)
{
m_pDoc=pDoc;
//{{AFX_DATA_INIT(CSdlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CSdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSdlg)
DDX_Control(pDX, IDC_TREE1, m_tree);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSdlg, CDialog)
//{{AFX_MSG_MAP(CSdlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSdlg message handlers
BOOL CSdlg::OnInitDialog()
{
CDialog::OnInitDialog();
OnButton1();
return TRUE ;//unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSdlg::OnButton1()
{
m_tree.DeleteAllItems();
HTREEITEM it1=m_tree.InsertItem("变量");
HTREEITEM it2=m_tree.InsertItem("触发和条件");
HTREEITEM it3=m_tree.InsertItem("定义");
HTREEITEM it;
CString s;
POSITION pos=m_pDoc->m_listVar.GetHeadPosition();
CVar* pv;
while(pos)
{
pv=(CVar*)m_pDoc->m_listVar.GetNext(pos);
it=m_tree.InsertItem(pv->m_sName,it1);
m_tree.InsertItem("当前值: "+pv->m_var,it);
s.Format("定义: %s %s",pv->m_s1,pv->m_s2);
m_tree.InsertItem(s,it);
s.Format("状态: %s",(pv->m_bNew)?"有效":"过期");
m_tree.InsertItem(s,it);
}
pos=m_pDoc->m_listIf.GetHeadPosition();
CTriger* pt;
while(pos)
{
pt=(CTriger*)m_pDoc->m_listIf.GetNext(pos);
it=m_tree.InsertItem(pt->m_sID,it2);
if(!pt->m_sA.IsEmpty())
s.Format("定义: %s%s%s %s",
pt->m_sA,pt->m_sCond,pt->m_sB,pt->m_sC);
else
s.Format("定义: \"%s\" %s",pt->m_sB,pt->m_sC);
m_tree.InsertItem(s,it);
s.Format("状态: %s",(pt->m_bActive)?"活动":"休眠");
m_tree.InsertItem(s,it);
}
pos=m_pDoc->m_listDefine.GetHeadPosition();
while(pos)
{
s=m_pDoc->m_listDefine.GetNext(pos);
it=m_tree.InsertItem(s.SpanExcluding(" "),it3);
int n=s.Find(" ");
m_tree.InsertItem("值: "+s.Mid(n+1),it);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -