change: code style;

This commit is contained in:
liuyihui 2022-06-03 13:36:34 +08:00
parent 05dce90378
commit 6fe4578c15
6 changed files with 52 additions and 98 deletions

View File

@ -13,12 +13,10 @@
IMPLEMENT_DYNCREATE(CDetailView, CView)
CDetailView::CDetailView()
{
CDetailView::CDetailView() {
}
CDetailView::~CDetailView()
{
CDetailView::~CDetailView() {
}
BEGIN_MESSAGE_MAP(CDetailView, CView)
@ -30,8 +28,7 @@ END_MESSAGE_MAP()
// CDetailView 绘图
void CDetailView::OnDraw(CDC* pDc)
{
void CDetailView::OnDraw(CDC* pDc) {
// 获取区域
int L, R;
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
@ -88,14 +85,12 @@ void CDetailView::OnDraw(CDC* pDc)
// CDetailView 诊断
#ifdef _DEBUG
void CDetailView::AssertValid() const
{
void CDetailView::AssertValid() const {
CView::AssertValid();
}
#ifndef _WIN32_WCE
void CDetailView::Dump(CDumpContext& dc) const
{
void CDetailView::Dump(CDumpContext& dc) const {
CView::Dump(dc);
}
#endif
@ -103,8 +98,7 @@ void CDetailView::Dump(CDumpContext& dc) const
// CDetailView 消息处理程序
void CDetailView::OnPaint()
{
void CDetailView::OnPaint() {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
CPaintDC dc(this); // device context for painting
@ -112,13 +106,11 @@ void CDetailView::OnPaint()
OnDraw(&dc);
}
BOOL CDetailView::OnEraseBkgnd(CDC* pDC)
{
BOOL CDetailView::OnEraseBkgnd(CDC* pDC) {
return TRUE;
}
void CDetailView::OnLButtonDown(UINT nFlags, CPoint point)
{
void CDetailView::OnLButtonDown(UINT nFlags, CPoint point) {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
int nX = point.x / ZF + pView->m_nCursor1;
@ -129,8 +121,7 @@ void CDetailView::OnLButtonDown(UINT nFlags, CPoint point)
CView::OnLButtonDown(nFlags, point);
}
void CDetailView::OnRButtonDown(UINT nFlags, CPoint point)
{
void CDetailView::OnRButtonDown(UINT nFlags, CPoint point) {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_nCursor1 = 0;

View File

@ -21,13 +21,13 @@
BEGIN_MESSAGE_MAP(CMCAApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, &CMCAApp::OnAppAbout)
END_MESSAGE_MAP()
// CMCAApp 构造
CMCAApp::CMCAApp() noexcept
{
CMCAApp::CMCAApp() noexcept {
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;
@ -52,8 +52,7 @@ CMCAApp theApp;
// CMCAApp 初始化
BOOL CMCAApp::InitInstance()
{
BOOL CMCAApp::InitInstance() {
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
@ -118,8 +117,7 @@ BOOL CMCAApp::InitInstance()
return TRUE;
}
int CMCAApp::ExitInstance()
{
int CMCAApp::ExitInstance() {
//TODO: 处理可能已添加的附加资源
AfxOleTerm(FALSE);
@ -131,8 +129,7 @@ int CMCAApp::ExitInstance()
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
class CAboutDlg : public CDialogEx {
public:
CAboutDlg() noexcept;
@ -149,12 +146,10 @@ protected:
DECLARE_MESSAGE_MAP();
};
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
{
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX) {
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
void CAboutDlg::DoDataExchange(CDataExchange* pDX) {
CDialogEx::DoDataExchange(pDX);
}
@ -162,8 +157,7 @@ BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// 用于运行对话框的应用程序命令
void CMCAApp::OnAppAbout()
{
void CMCAApp::OnAppAbout() {
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}

View File

@ -32,8 +32,7 @@ END_MESSAGE_MAP()
// CMCADoc 构造/析构
CMCADoc::CMCADoc() noexcept
{
CMCADoc::CMCADoc() noexcept {
FILE *stream_tmp;
int channel_id, channel_count;
@ -74,12 +73,10 @@ CMCADoc::CMCADoc() noexcept
}
}
CMCADoc::~CMCADoc()
{
CMCADoc::~CMCADoc() {
}
BOOL CMCADoc::OnNewDocument()
{
BOOL CMCADoc::OnNewDocument() {
if (!CDocument::OnNewDocument())
return FALSE;
@ -91,8 +88,7 @@ BOOL CMCADoc::OnNewDocument()
}
// CMCADoc 序列化
void CMCADoc::Serialize(CArchive& ar)
{
void CMCADoc::Serialize(CArchive& ar) {
if (ar.IsStoring())
{
// TODO: 在此添加存储代码
@ -105,8 +101,7 @@ void CMCADoc::Serialize(CArchive& ar)
#ifdef SHARED_HANDLERS
// 缩略图的支持
void CMCADoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
void CMCADoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds) {
// 修改此代码以绘制文档数据
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
@ -126,8 +121,7 @@ void CMCADoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
}
// 搜索处理程序的支持
void CMCADoc::InitializeSearchContent()
{
void CMCADoc::InitializeSearchContent() {
CString strSearchContent;
// 从文档数据设置搜索内容。
// 内容部分应由“;”分隔
@ -136,8 +130,7 @@ void CMCADoc::InitializeSearchContent()
SetSearchContent(strSearchContent);
}
void CMCADoc::SetSearchContent(const CString& value)
{
void CMCADoc::SetSearchContent(const CString& value) {
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
@ -158,27 +151,23 @@ void CMCADoc::SetSearchContent(const CString& value)
// CMCADoc 诊断
#ifdef _DEBUG
void CMCADoc::AssertValid() const
{
void CMCADoc::AssertValid() const {
CDocument::AssertValid();
}
void CMCADoc::Dump(CDumpContext& dc) const
{
void CMCADoc::Dump(CDumpContext& dc) const {
CDocument::Dump(dc);
}
#endif //_DEBUG
// CMCADoc 命令
double CMCADoc::Uniform()
{
double CMCADoc::Uniform() {
int x = rand();
double y = (x % 10000) / 10000.0;
return y;
}
void CMCADoc::RandomPeak(CString name, int n)
{
void CMCADoc::RandomPeak(CString name, int n) {
__int64 K;
double eps;
@ -193,15 +182,13 @@ void CMCADoc::RandomPeak(CString name, int n)
}
}
int CMCADoc::GetTotal(int L, int R)
{
int CMCADoc::GetTotal(int L, int R) {
int cSum = 0;
for (int i = L; i <= min(1023, R); i++) cSum += m_nChannelCount[i];
return cSum;
}
int CMCADoc::GetMax(int L, int R)
{
int CMCADoc::GetMax(int L, int R) {
int cMax = 0;
for (int i = L; i <= min(1023, R); i++)
if (m_nChannelCount[i] > cMax)
@ -209,8 +196,7 @@ int CMCADoc::GetMax(int L, int R)
return cMax;
}
CView* CMCADoc::GetView(CRuntimeClass* pClass)
{
CView* CMCADoc::GetView(CRuntimeClass* pClass) {
CView* pView{};
POSITION pos = GetFirstViewPosition();
while (pos != NULL) {

View File

@ -31,18 +31,15 @@ END_MESSAGE_MAP()
// CMCAView 构造/析构
CMCAView::CMCAView() noexcept
{
CMCAView::CMCAView() noexcept {
// TODO: 在此处添加构造代码
}
CMCAView::~CMCAView()
{
CMCAView::~CMCAView() {
}
BOOL CMCAView::PreCreateWindow(CREATESTRUCT& cs)
{
BOOL CMCAView::PreCreateWindow(CREATESTRUCT& cs) {
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
@ -51,8 +48,7 @@ BOOL CMCAView::PreCreateWindow(CREATESTRUCT& cs)
// CMCAView 绘图
void CMCAView::OnDraw(CDC* /*pDC*/)
{
void CMCAView::OnDraw(CDC* /*pDC*/) {
CMCADoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
@ -64,19 +60,16 @@ void CMCAView::OnDraw(CDC* /*pDC*/)
// CMCAView 打印
BOOL CMCAView::OnPreparePrinting(CPrintInfo* pInfo)
{
BOOL CMCAView::OnPreparePrinting(CPrintInfo* pInfo) {
// 默认准备
return DoPreparePrinting(pInfo);
}
void CMCAView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
void CMCAView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) {
// TODO: 添加额外的打印前进行的初始化过程
}
void CMCAView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
void CMCAView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) {
// TODO: 添加打印后进行的清理过程
}
@ -84,18 +77,15 @@ void CMCAView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
// CMCAView 诊断
#ifdef _DEBUG
void CMCAView::AssertValid() const
{
void CMCAView::AssertValid() const {
CView::AssertValid();
}
void CMCAView::Dump(CDumpContext& dc) const
{
void CMCAView::Dump(CDumpContext& dc) const {
CView::Dump(dc);
}
CMCADoc* CMCAView::GetDocument() const // 非调试版本是内联的
{
CMCADoc* CMCAView::GetDocument() const // 非调试版本是内联的 {
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMCADoc)));
return (CMCADoc*)m_pDocument;
}

View File

@ -1,3 +1,5 @@
#pragma once
#ifndef DESCSS_Matrix_h
#define DESCSS_Matrix_h

View File

@ -13,13 +13,11 @@
IMPLEMENT_DYNCREATE(CTotalView, CView)
CTotalView::CTotalView()
{
CTotalView::CTotalView() {
}
CTotalView::~CTotalView()
{
CTotalView::~CTotalView() {
}
BEGIN_MESSAGE_MAP(CTotalView, CView)
@ -31,8 +29,7 @@ END_MESSAGE_MAP()
// CTotalView 绘图
void CTotalView::OnDraw(CDC* pDc)
{
void CTotalView::OnDraw(CDC* pDc) {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
@ -85,14 +82,12 @@ void CTotalView::OnDraw(CDC* pDc)
// CTotalView 诊断
#ifdef _DEBUG
void CTotalView::AssertValid() const
{
void CTotalView::AssertValid() const {
CView::AssertValid();
}
#ifndef _WIN32_WCE
void CTotalView::Dump(CDumpContext& dc) const
{
void CTotalView::Dump(CDumpContext& dc) const {
CView::Dump(dc);
}
#endif
@ -100,21 +95,18 @@ void CTotalView::Dump(CDumpContext& dc) const
// CTotalView 消息处理程序
void CTotalView::OnPaint()
{
void CTotalView::OnPaint() {
CPaintDC dc(this); // device context for painting
OnPrepareDC(&dc);
OnDraw(&dc);
}
BOOL CTotalView::OnEraseBkgnd(CDC* pDC)
{
BOOL CTotalView::OnEraseBkgnd(CDC* pDC) {
return TRUE;
}
void CTotalView::OnLButtonDown(UINT nFlags, CPoint point)
{
void CTotalView::OnLButtonDown(UINT nFlags, CPoint point) {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
int nX = (point.x - 1) / 2;
@ -128,8 +120,7 @@ void CTotalView::OnLButtonDown(UINT nFlags, CPoint point)
CView::OnLButtonDown(nFlags, point);
}
void CTotalView::OnRButtonDown(UINT nFlags, CPoint point)
{
void CTotalView::OnRButtonDown(UINT nFlags, CPoint point) {
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
int nX = (point.x - 1) / 2;