提交 | 用户 | age
|
418cb3
|
1 |
#pragma once
|
Q |
2 |
#include <memory>
|
|
3 |
#include <functional>
|
|
4 |
|
|
5 |
// LCDDisplay1 对话框
|
|
6 |
|
|
7 |
class LCDDisplay1 : public CStatic
|
|
8 |
{
|
|
9 |
DECLARE_DYNAMIC(LCDDisplay1)
|
|
10 |
//typedef int (* pMenuCallBack)(void * pParam);
|
|
11 |
public:
|
|
12 |
typedef std::function<int(void * pParam)> pMenuCallBack;
|
|
13 |
enum HvResult
|
|
14 |
{
|
|
15 |
HvOk = 0,
|
|
16 |
HvErr = 1,
|
|
17 |
};
|
|
18 |
enum enMouseMode
|
|
19 |
{
|
|
20 |
MouseModeNone = 0,
|
|
21 |
MouseModeCursor = 1,
|
|
22 |
MouseModeHand = 2,
|
|
23 |
MouseModeZoomIn = 3,
|
|
24 |
MouseModeZoomOut = 4,
|
|
25 |
};
|
|
26 |
enum enMenuItemId
|
|
27 |
{
|
|
28 |
ID_Point,
|
|
29 |
ID_Move,
|
|
30 |
ID_ZoomIn,
|
|
31 |
ID_ZoomOut,
|
|
32 |
ID_PixelGrid,
|
|
33 |
ID_SubPixelGrid,
|
|
34 |
ID_ZoomFit,
|
|
35 |
ID_OrgScale,
|
|
36 |
ID_Seprate_Window,
|
|
37 |
ID_Restore_Window,
|
|
38 |
ID_LoadImage,
|
|
39 |
ID_SaveImageAs,
|
|
40 |
ID_MenuItemCustom,
|
|
41 |
};
|
|
42 |
enum enTextMode
|
|
43 |
{
|
|
44 |
TextModeDefault=0,
|
|
45 |
TextMode3_5,
|
|
46 |
TextMode5_7,
|
|
47 |
TextMode5_11,
|
|
48 |
TextMode7_11,
|
|
49 |
TextMode7_12,
|
|
50 |
TextMode7_15
|
|
51 |
};
|
|
52 |
public:
|
|
53 |
LCDDisplay1(); // 标准构造函数
|
|
54 |
virtual ~LCDDisplay1();
|
|
55 |
int m_nBkColor;
|
|
56 |
int m_nHideColor;
|
|
57 |
int m_nFntColor;
|
|
58 |
|
|
59 |
int left_margin, top_margin;
|
|
60 |
int pixelsizex, pixelsizey;
|
|
61 |
int pixelgapx, pixelgapy;
|
|
62 |
//int xspace, yspace;
|
|
63 |
int m_TextMode=0;
|
|
64 |
int text_cols, text_rows;
|
|
65 |
int char_width, char_height;
|
|
66 |
|
|
67 |
int m_cursor_x, m_cursor_y;
|
|
68 |
|
|
69 |
unsigned char displayarray[64][128] = { 0 };
|
|
70 |
|
|
71 |
CToolTipCtrl m_tooltip;
|
|
72 |
int m_nMouseMode;
|
|
73 |
|
|
74 |
protected:
|
|
75 |
DECLARE_MESSAGE_MAP()
|
|
76 |
public:
|
|
77 |
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
|
78 |
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
79 |
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
80 |
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
81 |
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
|
82 |
virtual void PreSubclassWindow();
|
|
83 |
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
|
|
84 |
afx_msg void OnMouseLeave();
|
|
85 |
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
|
86 |
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
|
87 |
|
|
88 |
LONG m_nMouseWndX, m_nMouseWndY;
|
|
89 |
float m_MousePicX, m_MousePicY;
|
|
90 |
|
|
91 |
int m_nClientW, m_nClientH;
|
|
92 |
float m_fScaleX, m_fScaleY;
|
|
93 |
|
|
94 |
float m_fZoom; //缩放系数,等于1表示100%比例显示
|
|
95 |
int m_nOffsetXMax, m_nOffsetYMax;
|
|
96 |
|
|
97 |
int m_fDispOffsetX, m_fDispOffsetY; //偏移值,以中心对齐为0偏移;
|
|
98 |
int m_nLastMouseX, m_nLastMouseY;
|
|
99 |
|
|
100 |
int nOldMenuSel;
|
|
101 |
int bHasChanged;
|
|
102 |
int bViewMoving;
|
|
103 |
|
|
104 |
long nTargetPoint;
|
|
105 |
float fDragStartx;
|
|
106 |
float fDragStarty;
|
|
107 |
|
|
108 |
short FreqBuf1[8192];
|
|
109 |
|
|
110 |
BYTE pullBuf1[1024][256] = { 0 };
|
|
111 |
|
|
112 |
int nDataSize = 0;
|
|
113 |
|
|
114 |
afx_msg void OnStnClicked();
|
|
115 |
afx_msg void OnStnDblclick();
|
|
116 |
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
|
117 |
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
|
118 |
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
|
|
119 |
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
|
120 |
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
|
121 |
afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
|
|
122 |
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|
123 |
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
|
124 |
CMenu m_menu1;
|
|
125 |
afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
|
|
126 |
afx_msg void OnMenuS1(UINT nId);
|
|
127 |
afx_msg void OnMenuS(UINT nId);
|
|
128 |
|
|
129 |
typedef struct tagCallBacks
|
|
130 |
{
|
|
131 |
int bIsSet;
|
|
132 |
pMenuCallBack pFunc;
|
|
133 |
void * pParam;
|
|
134 |
}stCallBacks;
|
|
135 |
int nExtMenuCount;
|
|
136 |
stCallBacks myCallBack[10];
|
|
137 |
|
|
138 |
int AddMenuItem(CString sMenuStr, pMenuCallBack pFunc, void * pParam);
|
|
139 |
|
|
140 |
int SetZoom(float fZoom);
|
|
141 |
|
|
142 |
// int SetBestFitZoom();
|
|
143 |
|
|
144 |
//显示到像素坐标
|
|
145 |
//像素到尺寸坐标
|
|
146 |
// PointF anchor;
|
|
147 |
|
|
148 |
// std::vector<pHvShape> MyGraphics;
|
|
149 |
// std::vector<pHvShapeCollection> MyShapeCollections;
|
|
150 |
int Clear(int bRedraw = 1);
|
|
151 |
int AddData(short * pData, int nSize, int bRedraw = 1);
|
|
152 |
// int UpdateData(short * pData, int nSize, int bRedraw = 1);
|
|
153 |
|
|
154 |
int FFT(float *pBuf1, int nSize, float *pBufOut);
|
|
155 |
|
|
156 |
// int Add(pHvShape theshape, int bRedraw = 1);
|
|
157 |
// int AddList(pHvShapeCollection theShapeColletion, int bRedraw = 1);
|
|
158 |
// int Remove(pHvShape theshape, int bRedraw = 1);
|
|
159 |
// int RemoveList(pHvShapeCollection theShapeColletion, int bRedraw = 1);
|
|
160 |
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
|
161 |
// int QLoadImage();
|
|
162 |
// int QSaveImage();
|
|
163 |
int SetTextMode(int nMode);
|
|
164 |
int putText(const char * text);
|
|
165 |
int putTextXY(int x, int y, const char * text);
|
|
166 |
int TranslatePTtoColRow(int x, int y, int& nCol, int& nRow);
|
|
167 |
|
|
168 |
int SetBkColor(COLORREF bkcolor);
|
|
169 |
int SetFontColor(COLORREF fntColor);
|
|
170 |
int SetHideColor(COLORREF hideColor);
|
|
171 |
|
|
172 |
};
|