#pragma once
|
#include <memory>
|
#include <functional>
|
|
// LCDDisplay1 对话框
|
|
class LCDDisplay1 : public CStatic
|
{
|
DECLARE_DYNAMIC(LCDDisplay1)
|
//typedef int (* pMenuCallBack)(void * pParam);
|
public:
|
typedef std::function<int(void * pParam)> pMenuCallBack;
|
enum HvResult
|
{
|
HvOk = 0,
|
HvErr = 1,
|
};
|
enum enMouseMode
|
{
|
MouseModeNone = 0,
|
MouseModeCursor = 1,
|
MouseModeHand = 2,
|
MouseModeZoomIn = 3,
|
MouseModeZoomOut = 4,
|
};
|
enum enMenuItemId
|
{
|
ID_Point,
|
ID_Move,
|
ID_ZoomIn,
|
ID_ZoomOut,
|
ID_PixelGrid,
|
ID_SubPixelGrid,
|
ID_ZoomFit,
|
ID_OrgScale,
|
ID_Seprate_Window,
|
ID_Restore_Window,
|
ID_LoadImage,
|
ID_SaveImageAs,
|
ID_MenuItemCustom,
|
};
|
enum enTextMode
|
{
|
TextModeDefault=0,
|
TextMode3_5,
|
TextMode5_7,
|
TextMode5_11,
|
TextMode7_11,
|
TextMode7_12,
|
TextMode7_15
|
};
|
public:
|
LCDDisplay1(); // 标准构造函数
|
virtual ~LCDDisplay1();
|
int m_nBkColor;
|
int m_nHideColor;
|
int m_nFntColor;
|
|
int left_margin, top_margin;
|
int pixelsizex, pixelsizey;
|
int pixelgapx, pixelgapy;
|
//int xspace, yspace;
|
int m_TextMode=0;
|
int text_cols, text_rows;
|
int char_width, char_height;
|
|
int m_cursor_x, m_cursor_y;
|
|
unsigned char displayarray[64][128] = { 0 };
|
|
CToolTipCtrl m_tooltip;
|
int m_nMouseMode;
|
|
protected:
|
DECLARE_MESSAGE_MAP()
|
public:
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
virtual void PreSubclassWindow();
|
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
|
afx_msg void OnMouseLeave();
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
|
LONG m_nMouseWndX, m_nMouseWndY;
|
float m_MousePicX, m_MousePicY;
|
|
int m_nClientW, m_nClientH;
|
float m_fScaleX, m_fScaleY;
|
|
float m_fZoom; //缩放系数,等于1表示100%比例显示
|
int m_nOffsetXMax, m_nOffsetYMax;
|
|
int m_fDispOffsetX, m_fDispOffsetY; //偏移值,以中心对齐为0偏移;
|
int m_nLastMouseX, m_nLastMouseY;
|
|
int nOldMenuSel;
|
int bHasChanged;
|
int bViewMoving;
|
|
long nTargetPoint;
|
float fDragStartx;
|
float fDragStarty;
|
|
short FreqBuf1[8192];
|
|
BYTE pullBuf1[1024][256] = { 0 };
|
|
int nDataSize = 0;
|
|
afx_msg void OnStnClicked();
|
afx_msg void OnStnDblclick();
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
CMenu m_menu1;
|
afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
|
afx_msg void OnMenuS1(UINT nId);
|
afx_msg void OnMenuS(UINT nId);
|
|
typedef struct tagCallBacks
|
{
|
int bIsSet;
|
pMenuCallBack pFunc;
|
void * pParam;
|
}stCallBacks;
|
int nExtMenuCount;
|
stCallBacks myCallBack[10];
|
|
int AddMenuItem(CString sMenuStr, pMenuCallBack pFunc, void * pParam);
|
|
int SetZoom(float fZoom);
|
|
// int SetBestFitZoom();
|
|
//显示到像素坐标
|
//像素到尺寸坐标
|
// PointF anchor;
|
|
// std::vector<pHvShape> MyGraphics;
|
// std::vector<pHvShapeCollection> MyShapeCollections;
|
int Clear(int bRedraw = 1);
|
int AddData(short * pData, int nSize, int bRedraw = 1);
|
// int UpdateData(short * pData, int nSize, int bRedraw = 1);
|
|
int FFT(float *pBuf1, int nSize, float *pBufOut);
|
|
// int Add(pHvShape theshape, int bRedraw = 1);
|
// int AddList(pHvShapeCollection theShapeColletion, int bRedraw = 1);
|
// int Remove(pHvShape theshape, int bRedraw = 1);
|
// int RemoveList(pHvShapeCollection theShapeColletion, int bRedraw = 1);
|
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
// int QLoadImage();
|
// int QSaveImage();
|
int SetTextMode(int nMode);
|
int putText(const char * text);
|
int putTextXY(int x, int y, const char * text);
|
int TranslatePTtoColRow(int x, int y, int& nCol, int& nRow);
|
|
int SetBkColor(COLORREF bkcolor);
|
int SetFontColor(COLORREF fntColor);
|
int SetHideColor(COLORREF hideColor);
|
|
};
|