2022-03-20 15:14:44 +08:00
|
|
|
|
// DetailView.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
|
|
#include "MCA.h"
|
|
|
|
|
#include "MCADoc.h"
|
|
|
|
|
#include "DetailView.h"
|
2022-05-31 22:21:20 +08:00
|
|
|
|
#include "ControlView.h"
|
2022-03-20 15:14:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNCREATE(CDetailView, CView)
|
|
|
|
|
|
|
|
|
|
CDetailView::CDetailView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDetailView::~CDetailView()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDetailView, CView)
|
2022-05-31 22:21:20 +08:00
|
|
|
|
ON_WM_PAINT()
|
|
|
|
|
ON_WM_ERASEBKGND()
|
|
|
|
|
ON_WM_LBUTTONDOWN()
|
|
|
|
|
ON_WM_RBUTTONDOWN()
|
2022-03-20 15:14:44 +08:00
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><>ͼ
|
2022-05-31 22:21:20 +08:00
|
|
|
|
void CDetailView::OnDraw(CDC* pDc)
|
2022-03-20 15:14:44 +08:00
|
|
|
|
{
|
2022-05-31 22:21:20 +08:00
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
int L, R;
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
|
|
|
|
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
|
|
|
|
L = pView->m_nCursor1;
|
|
|
|
|
R = pView->m_nCursor2;
|
2022-06-02 10:08:38 +08:00
|
|
|
|
|
2022-05-31 22:21:20 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
ZF = rect.Width() / (R - L + 1.);
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CDC MemDC;
|
2022-06-02 10:08:38 +08:00
|
|
|
|
MemDC.CreateCompatibleDC(pDc);
|
|
|
|
|
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CBitmap Bitmap, * OldBitmap;
|
2022-06-02 10:08:38 +08:00
|
|
|
|
CPen pen(PS_SOLID, 3, RGB(255, 255, 255));
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CPen* oldpen = MemDC.SelectObject(&pen);
|
|
|
|
|
|
|
|
|
|
Bitmap.CreateCompatibleBitmap(pDc, rect.Width(), rect.Height());
|
|
|
|
|
OldBitmap = MemDC.SelectObject(&Bitmap);
|
|
|
|
|
MemDC.FillSolidRect(0, 0, rect.Width(), rect.Height(), RGB(119, 7, 243));
|
|
|
|
|
|
|
|
|
|
// <20><>ͼ
|
2022-06-02 10:08:38 +08:00
|
|
|
|
int nMaxCount = pDoc->GetMax(L, R) ? pDoc->GetMax(L, R) * 5 / 4 : 1;
|
|
|
|
|
int nX = (pView->m_nCursorROI - pView->m_nCursor1) * ZF;
|
|
|
|
|
if (pView->m_sAxisMode == "Linear") {
|
|
|
|
|
MemDC.MoveTo(1, rect.Height() - pDoc->m_nChannelSmooth[L] * rect.Height() / nMaxCount);
|
|
|
|
|
for (int i = L; i <= R; i++)
|
|
|
|
|
MemDC.LineTo((i - L) * ZF, rect.Height() - pDoc->m_nChannelSmooth[i] * rect.Height() / nMaxCount);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
MemDC.MoveTo(1, rect.Height() - log10(max(pDoc->m_nChannelSmooth[L], 1)) * rect.Height() / log10(nMaxCount));
|
|
|
|
|
for (int i = L; i <= R; i++)
|
|
|
|
|
MemDC.LineTo((i - L) * ZF, rect.Height() - log10(max(pDoc->m_nChannelSmooth[i], 1)) * rect.Height() / log10(nMaxCount));
|
|
|
|
|
}
|
|
|
|
|
// <20><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pen.CreatePen(PS_SOLID, 5, RGB(0, 255, 0));
|
|
|
|
|
MemDC.SelectObject(&pen);
|
|
|
|
|
MemDC.MoveTo(nX, 0);
|
|
|
|
|
MemDC.LineTo(nX, rect.Height());
|
2022-05-31 22:21:20 +08:00
|
|
|
|
|
|
|
|
|
//<2F>ͷ<EFBFBD><CDB7><EFBFBD>Դ
|
|
|
|
|
pDc->BitBlt(0, 0, rect.Width(), rect.Width(), &MemDC, 0, 0, SRCCOPY);
|
|
|
|
|
MemDC.SelectObject(oldpen);
|
|
|
|
|
MemDC.SelectObject(OldBitmap);
|
|
|
|
|
pen.DeleteObject();
|
|
|
|
|
Bitmap.DeleteObject();
|
|
|
|
|
MemDC.DeleteDC();
|
2022-03-20 15:14:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
void CDetailView::AssertValid() const
|
|
|
|
|
{
|
|
|
|
|
CView::AssertValid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32_WCE
|
|
|
|
|
void CDetailView::Dump(CDumpContext& dc) const
|
|
|
|
|
{
|
|
|
|
|
CView::Dump(dc);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif //_DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDetailView <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-05-31 22:21:20 +08:00
|
|
|
|
void CDetailView::OnPaint()
|
|
|
|
|
{
|
|
|
|
|
if (pDoc == NULL) pDoc = (CMCADoc*)GetDocument();
|
2022-06-02 10:08:38 +08:00
|
|
|
|
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
|
OnPrepareDC(&dc);
|
|
|
|
|
OnDraw(&dc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CDetailView::OnEraseBkgnd(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
pView->m_nCursorROI = nX;
|
2022-06-03 01:26:26 +08:00
|
|
|
|
pView->m_nCursorROICount = pDoc->m_nChannelCount[nX];
|
2022-06-02 18:01:18 +08:00
|
|
|
|
pView->UpdateData(FALSE);
|
2022-06-02 10:08:38 +08:00
|
|
|
|
pDoc->UpdateAllViews(NULL);
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CView::OnLButtonDown(nFlags, 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;
|
|
|
|
|
pView->m_nCursor2 = 1023;
|
2022-06-03 01:47:52 +08:00
|
|
|
|
pView->m_nWidth = 1024;
|
2022-06-02 18:01:18 +08:00
|
|
|
|
pView->UpdateData(FALSE);
|
2022-06-02 10:08:38 +08:00
|
|
|
|
pDoc->UpdateAllViews(NULL);
|
2022-05-31 22:21:20 +08:00
|
|
|
|
CView::OnRButtonDown(nFlags, point);
|
|
|
|
|
}
|