1
|
// ehrevtView.cpp : implementation of the CehrevtView class
|
2
|
//
|
3
|
|
4
|
#include "stdafx.h"
|
5
|
#include "in_revt.h"
|
6
|
|
7
|
#include "ehrevtView.h"
|
8
|
#include "MainFrm.h"
|
9
|
#include "CfgSheet.h"
|
10
|
|
11
|
#include "FilterDlg.h"
|
12
|
|
13
|
#ifdef _DEBUG
|
14
|
#define new DEBUG_NEW
|
15
|
#undef THIS_FILE
|
16
|
static char THIS_FILE[] = __FILE__;
|
17
|
#endif
|
18
|
|
19
|
const int NumsPerSend = DEF_PIPE_MAXLEN / sizeof(CSI_D_BBD);
|
20
|
TCHAR ViewMessageDispName[][16] = {"????", "ˢ??"};
|
21
|
|
22
|
/////////////////////////////////////////////////////////////////////////////
|
23
|
// CehrevtView
|
24
|
|
25
|
IMPLEMENT_DYNCREATE(CehrevtView, CView)
|
26
|
|
27
|
BEGIN_MESSAGE_MAP(CehrevtView, CView)
|
28
|
//{{AFX_MSG_MAP(CehrevtView)
|
29
|
ON_WM_SIZE()
|
30
|
//ON_COMMAND(ID_DEL, OnDel)
|
31
|
//ON_COMMAND(ID_CONFIRM, OnConfirm)
|
32
|
//ON_COMMAND(ID_CONFIRM_PAGE, OnConfirmPage)
|
33
|
ON_COMMAND(ID_CONFIG, OnConfig)
|
34
|
ON_WM_ERASEBKGND()
|
35
|
//ON_COMMAND(ID_SEQUENCE, OnSequence)
|
36
|
//ON_UPDATE_COMMAND_UI(ID_SEQUENCE, OnUpdateSequence)
|
37
|
//ON_COMMAND(ID_SCROLL, OnScroll)
|
38
|
//ON_UPDATE_COMMAND_UI(ID_SCROLL, OnUpdateScroll)
|
39
|
ON_UPDATE_COMMAND_UI(ID_FILTER, OnUpdateFilter)
|
40
|
ON_COMMAND(ID_BTN_ALARM1, OnSelAlarm1)
|
41
|
ON_COMMAND(ID_BTN_ALARM2, OnSelAlarm2)
|
42
|
ON_COMMAND(ID_BTN_ALARM3, OnSelAlarm3)
|
43
|
ON_UPDATE_COMMAND_UI(ID_BTN_ALARM1, OnUpdateAlarm1)
|
44
|
ON_UPDATE_COMMAND_UI(ID_BTN_ALARM2, OnUpdateAlarm2)
|
45
|
ON_UPDATE_COMMAND_UI(ID_BTN_ALARM3, OnUpdateAlarm3)
|
46
|
ON_WM_TIMER()
|
47
|
ON_WM_DESTROY()
|
48
|
//ON_UPDATE_COMMAND_UI(ID_CONFIRM, OnUpdateConfirm)
|
49
|
//ON_UPDATE_COMMAND_UI(ID_CONFIRM_PAGE, OnUpdateConfirmPage)
|
50
|
//ON_UPDATE_COMMAND_UI(ID_DEL, OnUpdateDel)
|
51
|
//}}AFX_MSG_MAP
|
52
|
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
|
53
|
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
|
54
|
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
|
55
|
ON_COMMAND(MAKELONG(IDC_GRID, BN_CLICKED), OnGridSizingCol)
|
56
|
//ON_COMMAND(IDC_BTN_PRINT, CView::OnFilePrint)
|
57
|
ON_COMMAND(IDC_BTN_PRINT, OnBtnFilePrint)
|
58
|
ON_COMMAND(IDC_BTN_PRINT_E, OnBtnFilePrint)
|
59
|
//ON_COMMAND(IDC_BTN_PRINT, CView::OnFilePrintPreview)
|
60
|
ON_COMMAND(IDC_BTN_REFRESH, OnScroll)
|
61
|
//ON_UPDATE_COMMAND_UI(IDC_BTN_REFRESH, OnUpdateScroll)
|
62
|
ON_COMMAND(IDC_BTN_DELETE, OnDel)
|
63
|
//ON_UPDATE_COMMAND_UI(IDC_BTN_DELETE, OnUpdateDel)
|
64
|
ON_COMMAND(IDC_BTN_SETSORT, OnSequence)
|
65
|
//ON_UPDATE_COMMAND_UI(IDC_BTN_SETSORT, OnUpdateSequence)
|
66
|
ON_COMMAND(IDC_BTN_CONFIRM, OnConfirm)
|
67
|
//ON_UPDATE_COMMAND_UI(IDC_BTN_CONFIRM, OnUpdateConfirm)
|
68
|
ON_COMMAND(IDC_BTN_ALLCONFIRM, OnConfirmPage)
|
69
|
//ON_UPDATE_COMMAND_UI(IDC_BTN_ALLCONFIRM, OnUpdateConfirmPage)
|
70
|
END_MESSAGE_MAP()
|
71
|
|
72
|
/////////////////////////////////////////////////////////////////////////////
|
73
|
// CehrevtView construction/destruction
|
74
|
|
75
|
void IdleTheCpu(DWORD dwMilliSeconds)
|
76
|
{
|
77
|
MSG msg;
|
78
|
if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
|
79
|
{
|
80
|
TranslateMessage(&msg);
|
81
|
DispatchMessage(&msg);
|
82
|
}
|
83
|
Sleep(dwMilliSeconds);
|
84
|
}
|
85
|
|
86
|
CehrevtView::CehrevtView()
|
87
|
{
|
88
|
// TODO: add construction code here
|
89
|
m_pGridCtrl = NULL;
|
90
|
|
91
|
m_nFixCols = 1;
|
92
|
m_nFixRows = 1;
|
93
|
|
94
|
m_nSelectedCol = 0;
|
95
|
|
96
|
m_bSeq = FALSE;
|
97
|
m_bScroll = TRUE;
|
98
|
m_bFilter = FALSE;
|
99
|
|
100
|
m_bFlash = FALSE;
|
101
|
m_btnRefreshFlag = FALSE;
|
102
|
m_confirmBtnFlag = FALSE;
|
103
|
m_fontNum = 15;
|
104
|
m_stopEvtThreadFlag = FALSE;
|
105
|
m_evtThread = NULL;
|
106
|
m_almOrderNumFlag = FALSE;
|
107
|
memset(m_sDiv,0,3);//Added by WYF 20200605
|
108
|
}
|
109
|
|
110
|
CehrevtView::~CehrevtView()
|
111
|
{
|
112
|
if (m_evtThread != NULL)
|
113
|
{
|
114
|
while (m_evtThread != NULL)
|
115
|
{
|
116
|
m_stopEvtThreadFlag = TRUE;
|
117
|
}
|
118
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_WARNING, "in_revt allConfirm is stoped! ");
|
119
|
}
|
120
|
if (m_pGridCtrl)
|
121
|
{
|
122
|
delete m_pGridCtrl;
|
123
|
m_pGridCtrl = NULL;
|
124
|
}
|
125
|
}
|
126
|
|
127
|
BOOL CehrevtView::PreCreateWindow(CREATESTRUCT& cs)
|
128
|
{
|
129
|
// TODO: Modify the Window class or styles here by modifying
|
130
|
// the CREATESTRUCT cs
|
131
|
// cs.style &= ~FWS_ADDTOTITLE;
|
132
|
// cs.dwExStyle &= WS_EX_CLIENTEDGE;
|
133
|
// cs.dwExStyle &= WS_BORDER;
|
134
|
//cs.dwExStyle &= ~(WS_EX_CLIENTEDGE|WS_EX_WINDOWEDGE|WS_EX_STATICEDGE);
|
135
|
return CView::PreCreateWindow(cs);
|
136
|
}
|
137
|
|
138
|
/////////////////////////////////////////////////////////////////////////////
|
139
|
// CehrevtView drawing
|
140
|
|
141
|
void CehrevtView::OnDraw(CDC* pDC)
|
142
|
{
|
143
|
// TODO: add draw code for native data here
|
144
|
}
|
145
|
|
146
|
/////////////////////////////////////////////////////////////////////////////
|
147
|
// CehrevtView printing
|
148
|
|
149
|
BOOL CehrevtView::OnPreparePrinting(CPrintInfo* pInfo)
|
150
|
{
|
151
|
// default preparation
|
152
|
return DoPreparePrinting(pInfo);
|
153
|
}
|
154
|
|
155
|
void CehrevtView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
|
156
|
{
|
157
|
if (m_pGridCtrl)
|
158
|
m_pGridCtrl->OnBeginPrinting(pDC, pInfo);
|
159
|
}
|
160
|
|
161
|
void CehrevtView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
|
162
|
{
|
163
|
if (m_pGridCtrl)
|
164
|
m_pGridCtrl->OnPrint(pDC, pInfo);
|
165
|
}
|
166
|
|
167
|
void CehrevtView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
|
168
|
{
|
169
|
if (m_pGridCtrl)
|
170
|
m_pGridCtrl->OnEndPrinting(pDC, pInfo);
|
171
|
}
|
172
|
|
173
|
/////////////////////////////////////////////////////////////////////////////
|
174
|
// CehrevtView diagnostics
|
175
|
|
176
|
#ifdef _DEBUG
|
177
|
void CehrevtView::AssertValid() const
|
178
|
{
|
179
|
CView::AssertValid();
|
180
|
}
|
181
|
|
182
|
void CehrevtView::Dump(CDumpContext& dc) const
|
183
|
{
|
184
|
CView::Dump(dc);
|
185
|
}
|
186
|
#endif //_DEBUG
|
187
|
|
188
|
/////////////////////////////////////////////////////////////////////////////
|
189
|
// CehrevtView message handlers
|
190
|
|
191
|
void CehrevtView::OnInitialUpdate()
|
192
|
{
|
193
|
CView::OnInitialUpdate();
|
194
|
|
195
|
// Grid
|
196
|
if(m_pGridCtrl == NULL)
|
197
|
{
|
198
|
|
199
|
// Create the Gridctrl object
|
200
|
m_pGridCtrl = new CGridCtrl;
|
201
|
if(!m_pGridCtrl) return;
|
202
|
|
203
|
// Create the Gridctrl window
|
204
|
CRect rect;
|
205
|
GetClientRect(rect);
|
206
|
m_pGridCtrl->Create(rect, this, IDC_GRID, WS_CHILD | WS_TABSTOP | WS_VISIBLE);
|
207
|
|
208
|
// Set the grid attribute
|
209
|
m_pGridCtrl->SetEditable(FALSE);
|
210
|
m_pGridCtrl->SetRowResize(FALSE);
|
211
|
m_pGridCtrl->SetHeaderSort(FALSE);
|
212
|
m_pGridCtrl->SetVirtualMode(TRUE);
|
213
|
m_pGridCtrl->SetFixedColumnSelection(FALSE); //ȥ????ͷ???ѡ??,????????????ʱ?????ͷѡ?????л??????????Ῠ??
|
214
|
m_pGridCtrl->SetFixedRowSelection(FALSE);
|
215
|
m_pGridCtrl->SetListMode(TRUE);
|
216
|
m_pGridCtrl->EnableHiddenColUnhide(FALSE);
|
217
|
m_pGridCtrl->SetFrameFocusCell(FALSE);
|
218
|
m_pGridCtrl->SetTrackFocusCell(FALSE);
|
219
|
m_pGridCtrl->SetImageList(&m_pFrame->m_ImageList);
|
220
|
GetViewSetting(); //Ĭ??ʱ?䵹??
|
221
|
int nColumnCount = m_pFrame->m_colType.GetSize();
|
222
|
if (m_almOrderNumFlag) nColumnCount += 1;
|
223
|
// fill it up with stuff
|
224
|
try
|
225
|
{
|
226
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
227
|
m_pGridCtrl->SetColumnCount(nColumnCount);
|
228
|
m_pGridCtrl->SetFixedRowCount(m_nFixRows);
|
229
|
if (m_almOrderNumFlag)
|
230
|
m_pGridCtrl->SetFixedColumnCount(m_nFixCols);
|
231
|
}
|
232
|
catch (CMemoryException* e)
|
233
|
{
|
234
|
e->ReportError();
|
235
|
e->Delete();
|
236
|
return;
|
237
|
}
|
238
|
// m_pGridCtrl->GetDefaultCell(FALSE,FALSE)->SetFormat(DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
|
239
|
// m_pGridCtrl->GetDefaultCell(TRUE, FALSE)->SetFormat(DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
|
240
|
m_pGridCtrl->GetDefaultCell(TRUE, TRUE)->SetFormat(DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
|
241
|
m_pGridCtrl->GetDefaultCell(FALSE, TRUE)->SetFormat(DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX|DT_END_ELLIPSIS);
|
242
|
//?????С
|
243
|
if (!m_pFrame->m_pProp->summary)
|
244
|
{
|
245
|
HDC hDC = ::GetDC(HWND(NULL));
|
246
|
CFont * editFont = m_pGridCtrl->GetFont();
|
247
|
LOGFONT lf;
|
248
|
editFont->GetLogFont(&lf);
|
249
|
//lf.lfHeight = -20;
|
250
|
lf.lfHeight = -MulDiv(m_fontNum, GetDeviceCaps(hDC, LOGPIXELSY), 72);
|
251
|
strcpy(lf.lfFaceName, "???ź?");
|
252
|
m_editFont.CreateFontIndirect(&lf);
|
253
|
m_pGridCtrl->SetFont(&m_editFont);
|
254
|
//m_editFont.CreatePointFont(110, _T("???ź?"));
|
255
|
//m_pGridCtrl->SetFont(&m_editFont);
|
256
|
m_pGridCtrl->AutoSizeRows();
|
257
|
::ReleaseDC(HWND(NULL),hDC);
|
258
|
}
|
259
|
SetGridColor();
|
260
|
GetFlashSetting();
|
261
|
if ((!m_pFrame->m_pProp->summary) && (!m_pFrame->m_pProp->alarm))
|
262
|
{
|
263
|
m_noEventFlag = FALSE;
|
264
|
}
|
265
|
else
|
266
|
m_noEventFlag = TRUE;
|
267
|
}
|
268
|
else
|
269
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
270
|
|
271
|
SetAllColWidth();
|
272
|
|
273
|
RefreshGrid();
|
274
|
}
|
275
|
|
276
|
void CehrevtView::OnSize(UINT nType, int cx, int cy)
|
277
|
{
|
278
|
CView::OnSize(nType, cx, cy);
|
279
|
|
280
|
if (::IsWindow(m_pGridCtrl->GetSafeHwnd()))
|
281
|
{
|
282
|
CRect rect;
|
283
|
GetClientRect(rect);
|
284
|
m_pGridCtrl->MoveWindow(rect);
|
285
|
|
286
|
if (m_pFrame->m_pProp->summary)
|
287
|
m_pGridCtrl->ExpandColumnsToFitEx(FALSE);
|
288
|
else
|
289
|
m_pGridCtrl->ExpandLastColumn();
|
290
|
}
|
291
|
//ȥ???߿?
|
292
|
if (!m_pFrame->m_pProp->summary)
|
293
|
{
|
294
|
CRect wrc;
|
295
|
GetWindowRect(&wrc);
|
296
|
wrc.OffsetRect(-wrc.left, -wrc.top);
|
297
|
wrc.DeflateRect(5,5,2,2);
|
298
|
CRgn rgn;
|
299
|
BOOL bl = rgn.CreateRectRgnIndirect(&wrc);
|
300
|
if (bl)
|
301
|
{
|
302
|
SetWindowRgn(rgn, TRUE);
|
303
|
}
|
304
|
rgn.Detach();
|
305
|
}
|
306
|
}
|
307
|
|
308
|
BOOL CehrevtView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
|
309
|
{
|
310
|
if (::IsWindow(m_pGridCtrl->GetSafeHwnd()))
|
311
|
{
|
312
|
if (m_pGridCtrl->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
|
313
|
return TRUE;
|
314
|
}
|
315
|
|
316
|
return CView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
317
|
}
|
318
|
|
319
|
BOOL CehrevtView::OnEraseBkgnd(CDC* pDC)
|
320
|
{
|
321
|
return TRUE;
|
322
|
// return CView::OnEraseBkgnd(pDC);
|
323
|
}
|
324
|
|
325
|
void CehrevtView::SetGridColor()
|
326
|
{
|
327
|
// Get fix row/col color
|
328
|
char color[16];
|
329
|
int r, g, b;
|
330
|
|
331
|
CReadConf cfg;
|
332
|
char AppName[] = "??????ɫ????";
|
333
|
char *pKeyName[] = { "?̶???ɫ", "?̶???ɫ", "???ӱ???", "??????ɫ" };
|
334
|
COLORREF clr[] = { -1, -1, -1, -1 };
|
335
|
|
336
|
const int nums = sizeof(pKeyName) / sizeof(char *);
|
337
|
|
338
|
for (int i=0; i < nums; i++)
|
339
|
{
|
340
|
cfg.ReadString(AppName, pKeyName[i], color, m_pFrame->m_szCfgPath, "");
|
341
|
if (strcmp(color, "") && sscanf(color, "%d,%d,%d", &r, &g, &b) == 3)
|
342
|
{
|
343
|
clr[i] = RGB(r, g, b);
|
344
|
}
|
345
|
}
|
346
|
|
347
|
m_FixRowColor = clr[0];
|
348
|
m_FixColColor = clr[1];
|
349
|
|
350
|
if (clr[2] != -1)
|
351
|
m_pGridCtrl->SetGridBkColor(clr[2]);
|
352
|
|
353
|
if (clr[3] != -1)
|
354
|
{
|
355
|
m_pGridCtrl->SetGridLineColor(clr[3]);
|
356
|
m_GridLineColor = clr[3];
|
357
|
}
|
358
|
else
|
359
|
m_GridLineColor = RGB(255, 255, 255);
|
360
|
}
|
361
|
|
362
|
void CehrevtView::SetAllColWidth()
|
363
|
{
|
364
|
int nCol = m_pFrame->m_colType.GetSize();
|
365
|
int nVisibleCol = 0;
|
366
|
int i = 0,j=0;
|
367
|
if (m_almOrderNumFlag)
|
368
|
{
|
369
|
i = 1;
|
370
|
nCol += 1;
|
371
|
m_pGridCtrl->SetColumnWidth(0, 64);
|
372
|
}
|
373
|
for (; i < nCol; i++,j++)
|
374
|
{
|
375
|
int n = m_pFrame->m_colSeq[j];
|
376
|
COLTYPE &ct = m_pFrame->m_colType[n];
|
377
|
|
378
|
long lWidth = ct.lWidth;
|
379
|
if (ct.bSet)
|
380
|
{
|
381
|
m_nSelectedCol = i;
|
382
|
|
383
|
nVisibleCol++;
|
384
|
m_pGridCtrl->SetColumnWidth(i, lWidth);
|
385
|
}
|
386
|
else
|
387
|
m_pGridCtrl->SetColumnWidth(i, 0);
|
388
|
}
|
389
|
|
390
|
m_nVisibleCol = nVisibleCol;
|
391
|
|
392
|
if (m_pFrame->m_pProp->summary)
|
393
|
m_pGridCtrl->ExpandColumnsToFitEx(FALSE);
|
394
|
else
|
395
|
m_pGridCtrl->Refresh();
|
396
|
}
|
397
|
|
398
|
void CehrevtView::FillInternal()
|
399
|
{
|
400
|
m_InternalList.RemoveAllLock();
|
401
|
|
402
|
SBBD sn;
|
403
|
POSITION pos = m_EvList.GetHeadPositionLock();
|
404
|
for (int i = 0; i < m_EvList.GetCountLock(); i++)
|
405
|
{
|
406
|
sn = m_EvList.GetNextLock(pos);
|
407
|
|
408
|
if (m_pFrame->FilterBbd(sn))
|
409
|
m_InternalList.AddTailLock(sn);
|
410
|
}
|
411
|
}
|
412
|
|
413
|
BOOL CehrevtView::GetColText(int nRow, int nCol, int &idx, int &ack, CString *str/* = NULL*/)
|
414
|
{
|
415
|
CEventList &evtList = !m_bFilter ? m_EvList : m_InternalList;
|
416
|
|
417
|
if (nRow > evtList.GetCountLock())
|
418
|
{
|
419
|
return FALSE;
|
420
|
}
|
421
|
|
422
|
POSITION pos = evtList.FindIndexLock(nRow-1, m_bSeq);
|
423
|
if (pos == NULL)
|
424
|
{
|
425
|
return FALSE;
|
426
|
}
|
427
|
|
428
|
SBBD sn = evtList.GetAtLock(pos);
|
429
|
|
430
|
int nIndex = -1;
|
431
|
m_pFrame->m_classMap.Lookup(sn.classname, nIndex);
|
432
|
|
433
|
idx = nIndex;
|
434
|
ack = sn.AlmStatus;
|
435
|
// if (sn.rsttime < 1)
|
436
|
// {
|
437
|
// ack = ack&(0xfb);
|
438
|
// }
|
439
|
|
440
|
// idx is index of almclass
|
441
|
if (nCol < 0)
|
442
|
{
|
443
|
return idx >= 0 && idx < m_pFrame->m_almClass.GetSize();
|
444
|
}
|
445
|
|
446
|
// idx is priority
|
447
|
idx = sn.priority;
|
448
|
|
449
|
// Notice! nCol from column hard-code to struct SBBD.
|
450
|
|
451
|
if (str)
|
452
|
*str = almColMatch(nCol, nIndex, sn);
|
453
|
//*str = (m_pFrame->m_pProp->summary || m_pFrame->m_pProp->alarm) ? almColMatch(nCol, nIndex, sn) : eventColMatch(nCol, nIndex, sn);
|
454
|
|
455
|
return TRUE;
|
456
|
}
|
457
|
|
458
|
// /*???湦??Ҳʹ??????????????*/---ֻʹ?????????:almColMatch add by sjw 2020.1.14
|
459
|
CString CehrevtView::almColMatch(int nCol, int nIndex, SBBD &sn)
|
460
|
{
|
461
|
CString sz;
|
462
|
switch(nCol)
|
463
|
{
|
464
|
case 0:
|
465
|
{
|
466
|
CSeTime SE_T;
|
467
|
SSE_CLOCK clock;
|
468
|
SE_T.CovertTime((unsigned int)sn.occurtime, &clock);
|
469
|
// sz.Format("%04d-%02d-%02d", clock.year, clock.month, clock.day);
|
470
|
sz.Format("%04d%s%02d%s%02d", clock.year,m_sDiv, clock.month,m_sDiv, clock.day);
|
471
|
}
|
472
|
break;
|
473
|
case 1:
|
474
|
{
|
475
|
CSeTime SE_T;
|
476
|
SSE_CLOCK clock;
|
477
|
SE_T.CovertTime((unsigned int)sn.occurtime, &clock);
|
478
|
// sz.Format("%04d-%02d-%02d %02d:%02d:%02d.%03d", clock.year, clock.month, clock.day,
|
479
|
sz.Format("%04d%s%02d%s%02d %02d:%02d:%02d.%03d", clock.year,m_sDiv, clock.month,m_sDiv, clock.day,
|
480
|
clock.hour, clock.minute, clock.second, (unsigned short)sn.occurms);
|
481
|
}
|
482
|
break;
|
483
|
case 2:
|
484
|
{
|
485
|
sz.Format("%s", sn.devicekey);
|
486
|
}
|
487
|
break;
|
488
|
case 3:
|
489
|
{
|
490
|
if (nIndex >= 0 && nIndex < m_pFrame->m_almClass.GetSize())
|
491
|
sz.Format("%s", m_pFrame->m_almClass[nIndex].szDesc);
|
492
|
else
|
493
|
sz = "δ????";
|
494
|
}
|
495
|
break;
|
496
|
case 4:
|
497
|
{
|
498
|
sz.Format("%d", (unsigned char)sn.opt);
|
499
|
}
|
500
|
break;
|
501
|
case 5:
|
502
|
{
|
503
|
sz.Format("%d", (unsigned char)sn.messageid);
|
504
|
}
|
505
|
break;
|
506
|
case 6:
|
507
|
{
|
508
|
if (m_pFrame->GetPriorNo(sn.priority))
|
509
|
sz.Format("%s", m_pFrame->m_almPri[sn.priority].desc);
|
510
|
else
|
511
|
sz.Format("%d", (unsigned char)sn.priority);
|
512
|
}
|
513
|
break;
|
514
|
case 7:
|
515
|
{
|
516
|
int idx;
|
517
|
if (m_pFrame->m_appsysMap.Lookup(sn.appsysid, idx))
|
518
|
sz = m_pFrame->m_appsys[idx].desc;
|
519
|
else
|
520
|
sz.Format("%d", (unsigned char)sn.appsysid);
|
521
|
}
|
522
|
break;
|
523
|
case 8:
|
524
|
{
|
525
|
char aojDesc[SE_K_DESC*AOJ_K_ROLE_AOJS] = "δ֪Ȩ??????";
|
526
|
AOJ_D_ASSIGNMENT aoj = { (uint32)sn.aoj };
|
527
|
AOJ_GetDescription(aoj, aojDesc);
|
528
|
sz = aojDesc;
|
529
|
}
|
530
|
break;
|
531
|
case 9:
|
532
|
{
|
533
|
sz.Format("%d", (unsigned short)sn.mode);
|
534
|
}
|
535
|
break;
|
536
|
|
537
|
case 10:
|
538
|
{
|
539
|
int idx;
|
540
|
if (m_pFrame->m_devtypeMap.Lookup(sn.devicetype, idx))
|
541
|
sz = m_pFrame->m_devtype[idx].desc;
|
542
|
else
|
543
|
sz.Format("%d", (unsigned short)sn.devicetype);
|
544
|
}
|
545
|
break;
|
546
|
case 11:
|
547
|
{
|
548
|
if ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) && (sn.acktime>0))
|
549
|
{
|
550
|
CSeTime SE_T;
|
551
|
SSE_CLOCK clockT;
|
552
|
SE_T.CovertTime((unsigned int)sn.acktime, &clockT);
|
553
|
// sz.Format("%04d-%02d-%02d %02d:%02d:%02d.%03d", clockT.year, clockT.month, clockT.day,
|
554
|
sz.Format("%04d%s%02d%s%02d %02d:%02d:%02d.%03d", clockT.year,m_sDiv, clockT.month,m_sDiv, clockT.day,
|
555
|
clockT.hour, clockT.minute, clockT.second, (unsigned short)sn.ackms);
|
556
|
}
|
557
|
else
|
558
|
{
|
559
|
sz = _T("");
|
560
|
}
|
561
|
}
|
562
|
break;
|
563
|
case 13:
|
564
|
{
|
565
|
sz.Format(_T("%03d"), (unsigned short)sn.ackms); //ȷ??ʱ?????
|
566
|
}
|
567
|
break;
|
568
|
case 12:
|
569
|
{ //?ָ?ʱ??
|
570
|
if ((sn.AlmStatus & ALM_M_RETURNED) && (sn.rsttime>0))
|
571
|
{
|
572
|
CSeTime SE_T;
|
573
|
SSE_CLOCK clockT;
|
574
|
SE_T.CovertTime((unsigned int)sn.rsttime, &clockT);
|
575
|
// sz.Format("%04d-%02d-%02d %02d:%02d:%02d.%03d", clockT.year, clockT.month, clockT.day,
|
576
|
sz.Format("%04d%s%02d%s%02d %02d:%02d:%02d.%03d", clockT.year,m_sDiv, clockT.month,m_sDiv, clockT.day,
|
577
|
clockT.hour, clockT.minute, clockT.second, (unsigned short)sn.rstms);
|
578
|
}
|
579
|
else
|
580
|
{
|
581
|
sz = _T("");
|
582
|
}
|
583
|
}
|
584
|
break;
|
585
|
case 14:
|
586
|
{
|
587
|
sz.Format(_T("%03d"), (unsigned short)sn.rstms); //?ָ?ʱ?????
|
588
|
}
|
589
|
break;
|
590
|
case 15:
|
591
|
{
|
592
|
if ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) && (sn.acktime>0))
|
593
|
{
|
594
|
sz.Format(_T("%s"), sn.acker); //ȷ????
|
595
|
}
|
596
|
else
|
597
|
{
|
598
|
sz = _T("");
|
599
|
}
|
600
|
|
601
|
}
|
602
|
break;
|
603
|
case 16:
|
604
|
{
|
605
|
int idx;
|
606
|
if (m_pFrame->m_groupMap.Lookup(sn.groupname, idx))
|
607
|
sz = m_pFrame->m_group[idx].desc;
|
608
|
else
|
609
|
sz = sn.groupname;
|
610
|
}
|
611
|
break;
|
612
|
case 17:
|
613
|
{
|
614
|
sz.Format("%s", sn.graph);
|
615
|
}
|
616
|
break;
|
617
|
case 18:
|
618
|
{
|
619
|
sz.Format("%s", sn.userattr[0]);
|
620
|
}
|
621
|
break;
|
622
|
case 19:
|
623
|
{
|
624
|
sz.Format("%s", sn.userattr[1]);
|
625
|
}
|
626
|
break;
|
627
|
case 20:
|
628
|
{
|
629
|
sz.Format("%s", sn.userattr[2]);
|
630
|
}
|
631
|
break;
|
632
|
case 21:
|
633
|
{
|
634
|
sz.Format("%s", sn.userattr[3]);
|
635
|
}
|
636
|
break;
|
637
|
case 22:
|
638
|
{
|
639
|
sz.Format("%s", sn.chardesc);
|
640
|
}
|
641
|
break;
|
642
|
case 23:
|
643
|
{
|
644
|
sz.Format("%s", sn.audiodesc);
|
645
|
}
|
646
|
break;
|
647
|
case 24:
|
648
|
{
|
649
|
sz.Format("%d", sn.serial);
|
650
|
}
|
651
|
break;
|
652
|
case 25:
|
653
|
{
|
654
|
if ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) && (sn.acktime>0))
|
655
|
{
|
656
|
sz.Format("%s", _T("??ȷ??"));
|
657
|
}
|
658
|
else
|
659
|
{
|
660
|
sz.Format("%s", _T("δȷ??"));
|
661
|
}
|
662
|
}
|
663
|
break;
|
664
|
case 26:
|
665
|
{
|
666
|
if (sn.AlmStatus & ALM_M_RETURNED) // && (sn.rsttime>0)
|
667
|
{
|
668
|
sz.Format("%s", _T("?ѻָ?"));
|
669
|
}
|
670
|
else
|
671
|
{
|
672
|
sz.Format("%s", _T("δ?ָ?"));
|
673
|
}
|
674
|
}
|
675
|
break;
|
676
|
default:
|
677
|
{
|
678
|
sz = _T("");
|
679
|
}
|
680
|
break;
|
681
|
}
|
682
|
return sz;
|
683
|
}
|
684
|
|
685
|
//?˺??????? add by sjw 2020.1.14
|
686
|
CString CehrevtView::eventColMatch(int nCol, int nIndex, SBBD &sn)
|
687
|
{
|
688
|
int ack = (sn.mode & DEF_BBD_CONFIRM) != 0;
|
689
|
CString sz;
|
690
|
switch(nCol)
|
691
|
{
|
692
|
case 0:
|
693
|
{
|
694
|
sz.Format("%s", sn.devicekey);
|
695
|
}
|
696
|
break;
|
697
|
case 1:
|
698
|
{
|
699
|
if (nIndex >= 0 && nIndex < m_pFrame->m_almClass.GetSize())
|
700
|
sz.Format("%s", m_pFrame->m_almClass[nIndex].szDesc);
|
701
|
else
|
702
|
sz = "δ????";
|
703
|
}
|
704
|
break;
|
705
|
case 2:
|
706
|
{
|
707
|
sz.Format("%d", (unsigned char)sn.opt);
|
708
|
}
|
709
|
break;
|
710
|
case 3:
|
711
|
{
|
712
|
sz.Format("%d", (unsigned char)sn.messageid);
|
713
|
}
|
714
|
break;
|
715
|
case 4:
|
716
|
{
|
717
|
if (m_pFrame->GetPriorNo(sn.priority))
|
718
|
sz.Format("%s", m_pFrame->m_almPri[sn.priority].desc);
|
719
|
else
|
720
|
sz.Format("%d", (unsigned char)sn.priority);
|
721
|
}
|
722
|
break;
|
723
|
case 5:
|
724
|
{
|
725
|
int idx;
|
726
|
if (m_pFrame->m_appsysMap.Lookup(sn.appsysid, idx))
|
727
|
sz = m_pFrame->m_appsys[idx].desc;
|
728
|
else
|
729
|
sz.Format("%d", (unsigned char)sn.appsysid);
|
730
|
}
|
731
|
break;
|
732
|
case 6:
|
733
|
{
|
734
|
char aojDesc[SE_K_DESC*AOJ_K_ROLE_AOJS] = "δ֪Ȩ??????";
|
735
|
AOJ_D_ASSIGNMENT aoj = { (uint32)sn.aoj };
|
736
|
AOJ_GetDescription(aoj, aojDesc);
|
737
|
sz = aojDesc;
|
738
|
}
|
739
|
break;
|
740
|
case 7:
|
741
|
{
|
742
|
sz.Format("%d", (unsigned short)sn.mode);
|
743
|
}
|
744
|
break;
|
745
|
case 8:
|
746
|
{
|
747
|
CSeTime SE_T;
|
748
|
SSE_CLOCK clock;
|
749
|
SE_T.CovertTime((unsigned int)sn.occurtime, &clock);
|
750
|
// sz.Format("%04d-%02d-%02d", clock.year, clock.month, clock.day);
|
751
|
sz.Format("%04d%s%02d%s%02d", clock.year,m_sDiv, clock.month,m_sDiv, clock.day);
|
752
|
}
|
753
|
break;
|
754
|
case 9:
|
755
|
{
|
756
|
CSeTime SE_T;
|
757
|
SSE_CLOCK clock;
|
758
|
SE_T.CovertTime((unsigned int)sn.occurtime, &clock);
|
759
|
sz.Format("%02d:%02d:%02d %03d", clock.hour,
|
760
|
clock.minute, clock.second, (unsigned short)sn.occurms);
|
761
|
}
|
762
|
break;
|
763
|
case 10:
|
764
|
{
|
765
|
int idx;
|
766
|
if (m_pFrame->m_devtypeMap.Lookup(sn.devicetype, idx))
|
767
|
sz = m_pFrame->m_devtype[idx].desc;
|
768
|
else
|
769
|
sz.Format("%d", (unsigned short)sn.devicetype);
|
770
|
}
|
771
|
break;
|
772
|
case 11:
|
773
|
{
|
774
|
if ((unsigned int)sn.acktime > 0)
|
775
|
{
|
776
|
CSeTime SE_T;
|
777
|
SSE_CLOCK clockT;
|
778
|
SE_T.CovertTime((unsigned int)sn.acktime, &clockT);
|
779
|
// sz.Format("%04d-%02d-%02d %02d:%02d:%02d %03d", clockT.year, clockT.month, clockT.day,
|
780
|
sz.Format("%04d%s%02d%s%02d %02d:%02d:%02d %03d", clockT.year,m_sDiv, clockT.month,m_sDiv, clockT.day,
|
781
|
clockT.hour, clockT.minute, clockT.second, (unsigned short)sn.ackms);
|
782
|
}
|
783
|
else
|
784
|
{
|
785
|
sz = _T("");
|
786
|
}
|
787
|
}
|
788
|
break;
|
789
|
case 12:
|
790
|
{
|
791
|
sz.Format(_T("%03d"), (unsigned short)sn.ackms); //ȷ??ʱ?????
|
792
|
}
|
793
|
break;
|
794
|
case 13:
|
795
|
{ //?ָ?ʱ??
|
796
|
if ((unsigned int)sn.rsttime > 0)
|
797
|
{
|
798
|
CSeTime SE_T;
|
799
|
SSE_CLOCK clockT;
|
800
|
SE_T.CovertTime((unsigned int)sn.rsttime, &clockT);
|
801
|
// sz.Format("%04d-%02d-%02d %02d:%02d:%02d %03d", clockT.year, clockT.month, clockT.day,
|
802
|
sz.Format("%04d%s%02d%s%02d %02d:%02d:%02d %03d", clockT.year,m_sDiv, clockT.month,m_sDiv, clockT.day,
|
803
|
clockT.hour, clockT.minute, clockT.second, (unsigned short)sn.rstms);
|
804
|
}
|
805
|
else
|
806
|
{
|
807
|
sz = _T("");
|
808
|
}
|
809
|
}
|
810
|
break;
|
811
|
case 14:
|
812
|
{
|
813
|
sz.Format(_T("%03d"), (unsigned short)sn.rstms); //?ָ?ʱ?????
|
814
|
}
|
815
|
break;
|
816
|
case 15:
|
817
|
{
|
818
|
sz.Format(_T("%s"), sn.acker); //ȷ????
|
819
|
}
|
820
|
break;
|
821
|
case 16:
|
822
|
{
|
823
|
int idx;
|
824
|
if (m_pFrame->m_groupMap.Lookup(sn.groupname, idx))
|
825
|
sz = m_pFrame->m_group[idx].desc;
|
826
|
else
|
827
|
sz = sn.groupname;
|
828
|
}
|
829
|
break;
|
830
|
case 17:
|
831
|
{
|
832
|
sz.Format("%s", sn.graph);
|
833
|
}
|
834
|
break;
|
835
|
case 18:
|
836
|
{
|
837
|
sz.Format("%s", sn.userattr[0]);
|
838
|
}
|
839
|
break;
|
840
|
case 19:
|
841
|
{
|
842
|
sz.Format("%s", sn.userattr[1]);
|
843
|
}
|
844
|
break;
|
845
|
case 20:
|
846
|
{
|
847
|
sz.Format("%s", sn.userattr[2]);
|
848
|
}
|
849
|
break;
|
850
|
case 21:
|
851
|
{
|
852
|
sz.Format("%s", sn.userattr[3]);
|
853
|
}
|
854
|
break;
|
855
|
case 22:
|
856
|
{
|
857
|
sz.Format("%s", sn.chardesc);
|
858
|
}
|
859
|
break;
|
860
|
case 23:
|
861
|
{
|
862
|
sz.Format("%s", sn.audiodesc);
|
863
|
}
|
864
|
break;
|
865
|
case 24:
|
866
|
{
|
867
|
sz.Format("%d", sn.serial);
|
868
|
}
|
869
|
break;
|
870
|
default:
|
871
|
{
|
872
|
sz.Format("%d%d", 0, 0);
|
873
|
}
|
874
|
break;
|
875
|
}
|
876
|
return sz;
|
877
|
}
|
878
|
|
879
|
BOOL CehrevtView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
880
|
{
|
881
|
if (wParam == (WPARAM)m_pGridCtrl->GetDlgCtrlID())
|
882
|
{
|
883
|
*pResult = 1;
|
884
|
GV_DISPINFO *pDispInfo = (GV_DISPINFO*)lParam;
|
885
|
if(GVN_GETDISPINFO == pDispInfo->hdr.code)
|
886
|
{
|
887
|
// ??һ??
|
888
|
if (pDispInfo->item.row == 0)
|
889
|
{
|
890
|
if (m_FixRowColor != -1)
|
891
|
{
|
892
|
pDispInfo->item.mask |= GVIF_BKCLR;
|
893
|
if (m_pFrame->m_pProp->summary)
|
894
|
{
|
895
|
pDispInfo->item.crBkClr = m_FixRowColor;
|
896
|
pDispInfo->item.crFgClr = 0xffffff;//WYF20180508.crFgClr
|
897
|
}
|
898
|
else
|
899
|
{
|
900
|
pDispInfo->item.crBkClr = 0xffffff;
|
901
|
pDispInfo->item.crFgClr = RGB(0,0,0);
|
902
|
}
|
903
|
}
|
904
|
int n = 0;
|
905
|
if (m_almOrderNumFlag)
|
906
|
{
|
907
|
if (pDispInfo->item.col == 0)
|
908
|
{
|
909
|
pDispInfo->item.strText.Empty();
|
910
|
return TRUE;
|
911
|
}
|
912
|
|
913
|
n = m_pFrame->m_colSeq[pDispInfo->item.col - 1];
|
914
|
}
|
915
|
else
|
916
|
n = m_pFrame->m_colSeq[pDispInfo->item.col];
|
917
|
pDispInfo->item.strText.Format("%s", m_pFrame->m_colType[n].szDesc);
|
918
|
return TRUE;
|
919
|
}
|
920
|
else
|
921
|
{
|
922
|
// ??????
|
923
|
int iCol = pDispInfo->item.col;
|
924
|
if (m_almOrderNumFlag)
|
925
|
{
|
926
|
if (pDispInfo->item.col == 0) // ??һ??
|
927
|
{
|
928
|
pDispInfo->item.strText.Format("%d", pDispInfo->item.row);
|
929
|
if (m_FixColColor != -1)
|
930
|
{
|
931
|
pDispInfo->item.mask |= GVIF_BKCLR;
|
932
|
pDispInfo->item.crBkClr = m_FixColColor;
|
933
|
pDispInfo->item.crFgClr = 0xffffff;//WYF20180508.crFgClr
|
934
|
}
|
935
|
|
936
|
return TRUE;
|
937
|
}
|
938
|
iCol -= 1;
|
939
|
}
|
940
|
// ??????
|
941
|
pDispInfo->item.mask |= GVIF_BKCLR;
|
942
|
|
943
|
int n = m_pFrame->m_colSeq[iCol];
|
944
|
int pri,ack;
|
945
|
if (GetColText(pDispInfo->item.row, n, pri, ack, &pDispInfo->item.strText))
|
946
|
{ //δȷ??δ?ָ???˸
|
947
|
if (m_bFlash && ((ack&ALM_M_ACKNOWLEDGED)==0) && ((ack&ALM_M_RETURNED) == 0))
|
948
|
{
|
949
|
pDispInfo->item.crFgClr = m_FlashColor;
|
950
|
pDispInfo->item.crBkClr = 0x503607;
|
951
|
}
|
952
|
else if (m_noEventFlag && (ack&ALM_M_RETURNED))
|
953
|
{
|
954
|
pDispInfo->item.crFgClr = m_rstColor; //?ѻָ?
|
955
|
pDispInfo->item.crBkClr = 0x503607;//0x8c7b73;
|
956
|
}
|
957
|
else if (m_pFrame->GetPriorNo(pri)) //??ͨ?澯??ɫ
|
958
|
{
|
959
|
pDispInfo->item.crFgClr = m_pFrame->m_almPri[pri].color;//WYF20170709.crFgClr
|
960
|
pDispInfo->item.crBkClr = 0x503607;//0x8c7b73;
|
961
|
}
|
962
|
else
|
963
|
pDispInfo->item.crBkClr = ::GetSysColor(COLOR_WINDOW);
|
964
|
}
|
965
|
return TRUE;
|
966
|
}
|
967
|
}
|
968
|
else if (GVN_ODCACHEHINT == pDispInfo->hdr.code)
|
969
|
{
|
970
|
GV_CACHEHINT *pCacheHint = (GV_CACHEHINT*)pDispInfo;
|
971
|
// TRACE(_T("Cache hint received for cell range %d,%d <---> %d,%d\n"),
|
972
|
// pCacheHint->range.GetMinRow(), pCacheHint->range.GetMinCol(),
|
973
|
// pCacheHint->range.GetMaxRow(), pCacheHint->range.GetMaxCol());
|
974
|
}
|
975
|
else if (NM_DBLCLK == pDispInfo->hdr.code)
|
976
|
{
|
977
|
if (pDispInfo->item.row >= m_pGridCtrl->GetFixedRowCount() &&
|
978
|
pDispInfo->item.col >= m_pGridCtrl->GetFixedColumnCount())
|
979
|
{ //OnConfirm();
|
980
|
OnConfirmDblClk(pDispInfo->item.row);
|
981
|
}
|
982
|
}
|
983
|
else if (NM_CLICK == pDispInfo->hdr.code)
|
984
|
{
|
985
|
if (!m_pGridCtrl->IsValid(pDispInfo->item.row, pDispInfo->item.col))
|
986
|
m_pGridCtrl->ResetSelectedRange();
|
987
|
}
|
988
|
}
|
989
|
|
990
|
return CView::OnNotify(wParam, lParam, pResult);
|
991
|
}
|
992
|
|
993
|
void CehrevtView::OnDel()
|
994
|
{
|
995
|
CCellID begin(0, m_nSelectedCol);
|
996
|
|
997
|
CCellID end = m_pGridCtrl->GetNextItem(begin, GVNI_SELECTED|GVNI_BELOW);
|
998
|
if (end.row == -1)
|
999
|
{
|
1000
|
AfxMessageBox("??ѡ????¼!");
|
1001
|
return;
|
1002
|
}
|
1003
|
|
1004
|
AOJ_D_ASSIGNMENT aoj;
|
1005
|
if (AOJ_GetAssignment(NULL, aoj, DEF_RIGHT_DEVICE_A) <= 0)
|
1006
|
{
|
1007
|
AfxMessageBox("??ǰ?û????????κο?ɾ????????Ȩ??????!");
|
1008
|
return;
|
1009
|
}
|
1010
|
|
1011
|
CEventList &evtList = !m_bFilter ? m_EvList : m_InternalList;
|
1012
|
|
1013
|
POSITION pos;
|
1014
|
SBBD sn;
|
1015
|
CSI_D_BBD csn;
|
1016
|
|
1017
|
CArray<CSI_D_BBD, CSI_D_BBD&> bbdAry;
|
1018
|
CUIntArray rowAry;
|
1019
|
CStringArray descAry;
|
1020
|
|
1021
|
bool unConfirm = false;
|
1022
|
while (end.row != -1)
|
1023
|
{
|
1024
|
pos = evtList.FindIndexLock(end.row-1, m_bSeq);
|
1025
|
if (end.row > evtList.GetCountLock() || pos == NULL)
|
1026
|
{
|
1027
|
kprintf(ALARM_MOD, ALARM_SUBMOD_DELSEND, ALARM_LOG_ERROR,
|
1028
|
"??ɾ??????: ??%d??????, %s??????¼????: %d",
|
1029
|
end.row, !m_bFilter ? "" : "????", evtList.GetCountLock());
|
1030
|
return;
|
1031
|
}
|
1032
|
|
1033
|
sn = evtList.GetAtLock(pos);
|
1034
|
|
1035
|
if (AOJ_Validate(sn.aoj, aoj))
|
1036
|
{
|
1037
|
//if (sn.mode & DEF_BBD_CONFIRM)
|
1038
|
if ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) == 0)
|
1039
|
unConfirm = true;
|
1040
|
|
1041
|
memcpy(&csn, &sn, sizeof(CSI_D_BBD));
|
1042
|
csn.opt = ALM_K_OPR_DEL;
|
1043
|
bbdAry.Add(csn);
|
1044
|
rowAry.Add(end.row);
|
1045
|
descAry.Add(sn.chardesc);
|
1046
|
}
|
1047
|
|
1048
|
end = m_pGridCtrl->GetNextItem(end, GVNI_SELECTED|GVNI_BELOW);
|
1049
|
}
|
1050
|
|
1051
|
if (bbdAry.GetSize() > 0 &&
|
1052
|
MessageBox(unConfirm ? "??δȷ?ϱ??????Ƿ?ɾ????????" : "?Ƿ?ɾ????????",
|
1053
|
"ȷ??ɾ??????", MB_ICONWARNING | MB_OKCANCEL) == IDOK)
|
1054
|
{
|
1055
|
SendConfAndDel(bbdAry, rowAry, descAry);
|
1056
|
}
|
1057
|
|
1058
|
m_pGridCtrl->ResetSelectedRange();
|
1059
|
}
|
1060
|
|
1061
|
void CehrevtView::OnConfirmDblClk(int row)
|
1062
|
{
|
1063
|
if (m_confirmBtnFlag)
|
1064
|
{
|
1065
|
return;
|
1066
|
}
|
1067
|
if (row == -1)
|
1068
|
{
|
1069
|
AfxMessageBox("??ѡ????¼!");
|
1070
|
return;
|
1071
|
}
|
1072
|
AOJ_D_ASSIGNMENT aoj;
|
1073
|
if (AOJ_GetAssignment(NULL, aoj, DEF_RIGHT_DEVICE_A) <= 0)
|
1074
|
{
|
1075
|
AfxMessageBox("??ǰ?û????????κο?ȷ?ϱ?????Ȩ??????!");
|
1076
|
return;
|
1077
|
}
|
1078
|
|
1079
|
CEventList &evtList = !m_bFilter ? m_EvList : m_InternalList;
|
1080
|
|
1081
|
POSITION pos;
|
1082
|
SBBD sn;
|
1083
|
CSI_D_BBD csn;
|
1084
|
|
1085
|
CArray<CSI_D_BBD, CSI_D_BBD&> bbdAry;
|
1086
|
CUIntArray rowAry;
|
1087
|
CStringArray descAry;
|
1088
|
|
1089
|
pos = evtList.FindIndexLock(row-1, m_bSeq);
|
1090
|
if (row > evtList.GetCountLock() || pos == NULL)
|
1091
|
{
|
1092
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_ERROR,
|
1093
|
"??ȷ??????: ??%d??????, %s??????¼????: %d",
|
1094
|
row, !m_bFilter ? "" : "????", evtList.GetCountLock());
|
1095
|
return;
|
1096
|
}
|
1097
|
sn = evtList.GetAtLock(pos);
|
1098
|
if (AOJ_Validate(sn.aoj, aoj) && ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) == 0))
|
1099
|
{
|
1100
|
memcpy(&csn, &sn, sizeof(CSI_D_BBD));
|
1101
|
csn.opt = ALM_K_OPR_ACK;
|
1102
|
bbdAry.Add(csn);
|
1103
|
rowAry.Add(row);
|
1104
|
descAry.Add(sn.chardesc);
|
1105
|
}
|
1106
|
if (bbdAry.GetSize() > 0)
|
1107
|
{
|
1108
|
SendConfAndDel(bbdAry, rowAry, descAry);
|
1109
|
}
|
1110
|
m_pGridCtrl->ResetSelectedRange();
|
1111
|
}
|
1112
|
|
1113
|
void CehrevtView::OnConfirm()
|
1114
|
{
|
1115
|
CCellID begin(0, m_nSelectedCol);
|
1116
|
|
1117
|
CCellID end = m_pGridCtrl->GetNextItem(begin, GVNI_SELECTED|GVNI_BELOW);
|
1118
|
if (end.row == -1)
|
1119
|
{
|
1120
|
AfxMessageBox("??ѡ????¼!");
|
1121
|
return;
|
1122
|
}
|
1123
|
|
1124
|
AOJ_D_ASSIGNMENT aoj;
|
1125
|
if (AOJ_GetAssignment(NULL, aoj, DEF_RIGHT_DEVICE_A) <= 0)
|
1126
|
{
|
1127
|
AfxMessageBox("??ǰ?û????????κο?ȷ?ϱ?????Ȩ??????!");
|
1128
|
return;
|
1129
|
}
|
1130
|
|
1131
|
CEventList &evtList = !m_bFilter ? m_EvList : m_InternalList;
|
1132
|
|
1133
|
POSITION pos;
|
1134
|
SBBD sn;
|
1135
|
CSI_D_BBD csn;
|
1136
|
|
1137
|
CArray<CSI_D_BBD, CSI_D_BBD&> bbdAry;
|
1138
|
CUIntArray rowAry;
|
1139
|
CStringArray descAry;
|
1140
|
int i = 0;
|
1141
|
while (end.row != -1)
|
1142
|
{
|
1143
|
i++;
|
1144
|
pos = evtList.FindIndexLock(end.row-1, m_bSeq);
|
1145
|
if (end.row > evtList.GetCountLock() || pos == NULL)
|
1146
|
{
|
1147
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_ERROR,
|
1148
|
"??ȷ??????: ??%d??????, %s??????¼????: %d",
|
1149
|
end.row, !m_bFilter ? "" : "????", evtList.GetCountLock());
|
1150
|
return;
|
1151
|
}
|
1152
|
|
1153
|
sn = evtList.GetAtLock(pos);
|
1154
|
|
1155
|
if (AOJ_Validate(sn.aoj, aoj) && ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) == 0))
|
1156
|
{
|
1157
|
memcpy(&csn, &sn, sizeof(CSI_D_BBD));
|
1158
|
csn.opt = ALM_K_OPR_ACK;
|
1159
|
bbdAry.Add(csn);
|
1160
|
rowAry.Add(end.row);
|
1161
|
descAry.Add(sn.chardesc);
|
1162
|
}
|
1163
|
if (i%100 == 0)
|
1164
|
{
|
1165
|
IdleTheCpu(50);
|
1166
|
}
|
1167
|
end = m_pGridCtrl->GetNextItem(end, GVNI_SELECTED|GVNI_BELOW);
|
1168
|
}
|
1169
|
|
1170
|
if (bbdAry.GetSize() > 0)
|
1171
|
{
|
1172
|
SendConfAndDel(bbdAry, rowAry, descAry);
|
1173
|
}
|
1174
|
|
1175
|
m_pGridCtrl->ResetSelectedRange();
|
1176
|
}
|
1177
|
|
1178
|
void CehrevtView::OnConfirmPage()
|
1179
|
{
|
1180
|
if (m_confirmBtnFlag)
|
1181
|
{
|
1182
|
return;
|
1183
|
}
|
1184
|
if (m_EvList.GetAckedNums() > 0)
|
1185
|
{
|
1186
|
m_confirmBtnFlag = TRUE;
|
1187
|
// m_pGridCtrl->SetSelectedRange(
|
1188
|
// m_nFixRows, m_nSelectedCol, m_pGridCtrl->GetRowCount()-1, m_nSelectedCol);
|
1189
|
// OnConfirm();
|
1190
|
// m_pGridCtrl->ResetSelectedRange();
|
1191
|
// m_confirmBtnFlag = FALSE;
|
1192
|
m_evtList = &(!m_bFilter ? m_EvList : m_InternalList);
|
1193
|
m_evtSeq = m_bSeq;
|
1194
|
m_evtThread = AfxBeginThread(RunConfirmAllPro, this, THREAD_PRIORITY_NORMAL, 0, 0, NULL);
|
1195
|
}
|
1196
|
}
|
1197
|
|
1198
|
UINT CehrevtView::RunConfirmAllPro(LPVOID lParam)
|
1199
|
{
|
1200
|
CehrevtView *pView = (CehrevtView*)lParam;
|
1201
|
if (pView == NULL ||pView->m_evtList == NULL)
|
1202
|
{
|
1203
|
pView->m_evtThread = NULL;
|
1204
|
pView->m_confirmBtnFlag = FALSE;
|
1205
|
return 0;
|
1206
|
}
|
1207
|
pView->m_stopEvtThreadFlag = FALSE;
|
1208
|
AOJ_D_ASSIGNMENT aoj;
|
1209
|
if (AOJ_GetAssignment(NULL, aoj, DEF_RIGHT_DEVICE_A) <= 0)
|
1210
|
{
|
1211
|
AfxMessageBox("??ǰ?û????????κο?ȷ?ϱ?????Ȩ??????!");
|
1212
|
pView->m_evtThread = NULL;
|
1213
|
pView->m_confirmBtnFlag = FALSE;
|
1214
|
return 0;
|
1215
|
}
|
1216
|
int evtNum = pView->m_evtList->GetCountLock();
|
1217
|
POSITION pos;
|
1218
|
SBBD sn;
|
1219
|
CSI_D_BBD csn;
|
1220
|
|
1221
|
CArray<CSI_D_BBD, CSI_D_BBD&> bbdAry;
|
1222
|
CUIntArray rowAry;
|
1223
|
//CStringArray descAry;
|
1224
|
int i = 0;
|
1225
|
for (i = 0; i < evtNum; i++)
|
1226
|
{
|
1227
|
if (pView->m_stopEvtThreadFlag)
|
1228
|
{
|
1229
|
pView->m_evtThread = NULL;
|
1230
|
pView->m_confirmBtnFlag = FALSE;
|
1231
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_WARNING, "in_revt allConfirm thread is stoped! ");
|
1232
|
return 0;
|
1233
|
}
|
1234
|
if (bbdAry.GetSize()>=2000) break;
|
1235
|
pos = pView->m_evtList->FindIndexLock(i, pView->m_evtSeq);
|
1236
|
if (pos == NULL)
|
1237
|
{
|
1238
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_ERROR,"??ȷ??????: ??%d??????, %s??????¼????: %d",
|
1239
|
i+1, !pView->m_evtSeq ? "" : "????", pView->m_evtList->GetCountLock());
|
1240
|
pView->m_evtThread = NULL;
|
1241
|
pView->m_confirmBtnFlag = FALSE;
|
1242
|
return 0;
|
1243
|
}
|
1244
|
sn = pView->m_evtList->GetAtLock(pos);
|
1245
|
if (AOJ_Validate(sn.aoj, aoj) && ((sn.AlmStatus & ALM_M_ACKNOWLEDGED) == 0))
|
1246
|
{
|
1247
|
memcpy(&csn, &sn, sizeof(CSI_D_BBD));
|
1248
|
csn.opt = ALM_K_OPR_ACK;
|
1249
|
bbdAry.Add(csn);
|
1250
|
rowAry.Add(i+1);
|
1251
|
//descAry.Add(sn.chardesc);
|
1252
|
}
|
1253
|
}
|
1254
|
if (bbdAry.GetSize() <= 0)
|
1255
|
{
|
1256
|
pView->m_evtThread = NULL;
|
1257
|
pView->m_confirmBtnFlag = FALSE;
|
1258
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_WARNING, "in_revt allConfirmList is NULL! ");
|
1259
|
return 0;
|
1260
|
}
|
1261
|
CScdCsi csi;
|
1262
|
char opt[16] = "ȷ??";
|
1263
|
char user[RBAC_K_USER_NAME_LEN] = "";
|
1264
|
RBAC_GetUserRoleDescription(user, NULL, NULL);
|
1265
|
int count = (bbdAry.GetSize() + NumsPerSend - 1) / NumsPerSend; //???????
|
1266
|
for (i = 0; i < count; i++)
|
1267
|
{
|
1268
|
if (pView->m_stopEvtThreadFlag)
|
1269
|
{
|
1270
|
pView->m_evtThread = NULL;
|
1271
|
pView->m_confirmBtnFlag = FALSE;
|
1272
|
kprintf(ALARM_MOD, ALARM_SUBMOD_CONFIRMSEND, ALARM_LOG_WARNING, "in_revt allConfirm thread is stoped! ");
|
1273
|
return 0;
|
1274
|
}
|
1275
|
uint8 num = i == count - 1 ? bbdAry.GetSize() % NumsPerSend : NumsPerSend;
|
1276
|
csi.AlmSignal(user, num, bbdAry.GetData() + i * NumsPerSend);
|
1277
|
int startRow = i * NumsPerSend;
|
1278
|
int endRow = min((i + 1) * NumsPerSend, bbdAry.GetSize()) - 1;
|
1279
|
kprintf(ALARM_MOD, ALARM_SUBMOD_DELSEND, ALARM_LOG_INFORMATION,
|
1280
|
"????ȷ??????ӵ?%d??????????%d??????",rowAry[startRow], rowAry[endRow]);
|
1281
|
//????һ??????ȥ????
|
1282
|
if (count > 1)
|
1283
|
{
|
1284
|
IdleTheCpu(50);
|
1285
|
}
|
1286
|
}
|
1287
|
pView->m_evtThread = NULL;
|
1288
|
pView->m_confirmBtnFlag = FALSE;
|
1289
|
return 0;
|
1290
|
}
|
1291
|
|
1292
|
void CehrevtView::OnConfig()
|
1293
|
{
|
1294
|
CCfgSheet cfgSheet("ϵͳ????", m_pFrame);
|
1295
|
if (cfgSheet.DoModal() == IDOK)
|
1296
|
{
|
1297
|
SetAllColWidth();
|
1298
|
}
|
1299
|
}
|
1300
|
|
1301
|
void CehrevtView::SendConfAndDel(CArray<CSI_D_BBD, CSI_D_BBD&> &bbdAry, CUIntArray &rowAry, CStringArray &descAry)
|
1302
|
{
|
1303
|
CScdCsi csi;
|
1304
|
|
1305
|
char opt[16] = "";
|
1306
|
if (bbdAry.GetSize() > 0)
|
1307
|
{
|
1308
|
if (bbdAry[0].opt == ALM_K_OPR_ACK)
|
1309
|
strcpy(opt, "ȷ??");
|
1310
|
else if (bbdAry[0].opt == ALM_K_OPR_DEL)
|
1311
|
strcpy(opt, "ɾ??");
|
1312
|
}
|
1313
|
|
1314
|
char user[RBAC_K_USER_NAME_LEN] = "";
|
1315
|
RBAC_GetUserRoleDescription(user, NULL, NULL);
|
1316
|
int count = (bbdAry.GetSize() + NumsPerSend - 1) / NumsPerSend; //???????
|
1317
|
for (int i = 0; i < count; i++)
|
1318
|
{
|
1319
|
uint8 num = i == count - 1 ? bbdAry.GetSize() % NumsPerSend : NumsPerSend;
|
1320
|
csi.AlmSignal(user, num, bbdAry.GetData() + i * NumsPerSend);
|
1321
|
int startRow = i * NumsPerSend;
|
1322
|
int endRow = min((i + 1) * NumsPerSend, bbdAry.GetSize()) - 1;
|
1323
|
kprintf(ALARM_MOD, ALARM_SUBMOD_DELSEND, ALARM_LOG_INFORMATION,
|
1324
|
"??%s????: ?ӵ?%d?????? [%s] ?? ??%d?????? [%s], ??ǰ??¼????: %d",
|
1325
|
opt, rowAry[startRow], descAry[startRow], rowAry[endRow], descAry[endRow],
|
1326
|
m_pGridCtrl->GetRowCount()-1);
|
1327
|
//????һ??????ȥ????
|
1328
|
if (count > 1)
|
1329
|
{
|
1330
|
//Sleep(200);
|
1331
|
IdleTheCpu(50);
|
1332
|
}
|
1333
|
}
|
1334
|
}
|
1335
|
|
1336
|
void CehrevtView::AddEvent(SBBD &sn)
|
1337
|
{
|
1338
|
LONG lEventSort = 0;
|
1339
|
SBBD snTemp;
|
1340
|
BOOL bChanged;
|
1341
|
m_EvList.AddItem(sn, m_bFilter, m_pFrame, lEventSort, snTemp, bChanged);
|
1342
|
bool refresh = true;
|
1343
|
// ˢ??Grid
|
1344
|
if (!m_bFilter)
|
1345
|
{
|
1346
|
if (bChanged)
|
1347
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
1348
|
}
|
1349
|
else
|
1350
|
{
|
1351
|
if (lEventSort == SN_DEL)
|
1352
|
{
|
1353
|
m_InternalList.Refresh(snTemp, OPER_DEL);
|
1354
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1355
|
}
|
1356
|
else if (lEventSort == SN_DEL_ADD) // ɾ????????
|
1357
|
{
|
1358
|
m_InternalList.Refresh(snTemp, OPER_DEL);
|
1359
|
m_InternalList.AddTailLock(sn);
|
1360
|
}
|
1361
|
else
|
1362
|
{
|
1363
|
if (m_pFrame->FilterBbd(sn))
|
1364
|
{
|
1365
|
m_InternalList.AddTailLock(sn);
|
1366
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1367
|
}
|
1368
|
else
|
1369
|
refresh = false;
|
1370
|
}
|
1371
|
}
|
1372
|
|
1373
|
if (refresh)
|
1374
|
{
|
1375
|
if (m_pFrame->m_pProp->summary)
|
1376
|
m_pGridCtrl->ExpandColumnsToFitEx(FALSE);
|
1377
|
|
1378
|
RefreshGrid();
|
1379
|
}
|
1380
|
}
|
1381
|
|
1382
|
void CehrevtView::ConfAndDelEvent(SBBD &sn)
|
1383
|
{
|
1384
|
LONG lEventSort = 0;
|
1385
|
m_EvList.OperConfAndDel(sn, m_bFilter, m_pFrame, lEventSort);
|
1386
|
|
1387
|
// ˢ??Grid
|
1388
|
if (!m_bFilter)
|
1389
|
{
|
1390
|
// ȷ??????????
|
1391
|
if (m_pGridCtrl->GetRowCount() != m_EvList.GetCountLock()+1)
|
1392
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
1393
|
}
|
1394
|
else
|
1395
|
{
|
1396
|
if (lEventSort == SN_CONF || lEventSort == SN_DEL)
|
1397
|
m_InternalList.Refresh(sn, OPER_ALL);
|
1398
|
|
1399
|
if (lEventSort == SN_DEL)
|
1400
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1401
|
}
|
1402
|
|
1403
|
m_pGridCtrl->Refresh();
|
1404
|
}
|
1405
|
|
1406
|
void CehrevtView::OnGridSizingCol()
|
1407
|
{
|
1408
|
long lWidth;
|
1409
|
char szKey[MAX_PATH];
|
1410
|
char szWidth[MAX_PATH];
|
1411
|
char szAppName[50] = { 0 };
|
1412
|
if (m_pFrame->m_pProp->summary)
|
1413
|
{
|
1414
|
strcpy(szAppName, "SummaryColumn");
|
1415
|
}
|
1416
|
else if (m_pFrame->m_pProp->alarm && !m_pFrame->m_pProp->summary)
|
1417
|
{
|
1418
|
strcpy(szAppName, "Column");
|
1419
|
}
|
1420
|
else
|
1421
|
strcpy(szAppName, "ʵʱ??????");
|
1422
|
int nCol = m_pFrame->m_colType.GetSize();
|
1423
|
int i = 0, j = 0;
|
1424
|
if (m_almOrderNumFlag)
|
1425
|
{
|
1426
|
i = 1;
|
1427
|
nCol += 1;
|
1428
|
}
|
1429
|
for (; i < nCol; i++,j++)
|
1430
|
{
|
1431
|
int n = m_pFrame->m_colSeq[j];
|
1432
|
COLTYPE &ct = m_pFrame->m_colType[n];
|
1433
|
|
1434
|
if (!ct.bSet)
|
1435
|
continue;
|
1436
|
|
1437
|
lWidth = m_pGridCtrl->GetColumnWidth(i);
|
1438
|
if (ct.lWidth == lWidth)
|
1439
|
continue;
|
1440
|
|
1441
|
ct.lWidth = lWidth;
|
1442
|
|
1443
|
sprintf(szKey, "%s????", ct.szName);
|
1444
|
sprintf(szWidth, "%d", lWidth);
|
1445
|
::WritePrivateProfileString(szAppName, szKey, szWidth, m_pFrame->m_szCfgPath);
|
1446
|
}
|
1447
|
}
|
1448
|
|
1449
|
void CehrevtView::ResizingCol()
|
1450
|
{
|
1451
|
if (m_pGridCtrl && IsWindow(m_pGridCtrl->m_hWnd))
|
1452
|
{
|
1453
|
SetAllColWidth();
|
1454
|
}
|
1455
|
}
|
1456
|
|
1457
|
void CehrevtView::AddEventToList(SBBD &s)
|
1458
|
{
|
1459
|
//m_EvList.AddTailLock(s);
|
1460
|
LONG lEventSort = 0;
|
1461
|
SBBD snTemp;
|
1462
|
BOOL bChanged;
|
1463
|
m_EvList.AddItem(s, FALSE, m_pFrame, lEventSort, snTemp, bChanged);
|
1464
|
}
|
1465
|
|
1466
|
int CehrevtView::GetEventCount(BOOL bAll /*= TRUE*/)
|
1467
|
{
|
1468
|
return bAll ? m_EvList.GetCountLock() : m_EvList.GetAckedNums();
|
1469
|
}
|
1470
|
|
1471
|
void CehrevtView::OnSequence()
|
1472
|
{
|
1473
|
m_bSeq = !m_bSeq;
|
1474
|
RefreshGrid();
|
1475
|
}
|
1476
|
|
1477
|
void CehrevtView::OnUpdateSequence(CCmdUI* pCmdUI)
|
1478
|
{
|
1479
|
pCmdUI->SetCheck(m_bSeq);
|
1480
|
}
|
1481
|
|
1482
|
void CehrevtView::OnScroll()
|
1483
|
{
|
1484
|
if (m_confirmBtnFlag)
|
1485
|
{
|
1486
|
return;
|
1487
|
}
|
1488
|
m_bScroll = !m_bScroll;
|
1489
|
m_pFrame->m_bViewScroll = m_bScroll;
|
1490
|
/* if (m_btnRefreshFlag)
|
1491
|
{
|
1492
|
m_btnRefreshFlag = FALSE; //??????????ť????
|
1493
|
}
|
1494
|
else
|
1495
|
{
|
1496
|
m_btnRefreshFlag = TRUE;
|
1497
|
}*/
|
1498
|
}
|
1499
|
|
1500
|
void CehrevtView::OnUpdateScroll(CCmdUI* pCmdUI)
|
1501
|
{
|
1502
|
pCmdUI->SetCheck(m_bScroll);
|
1503
|
/* if (m_btnRefreshFlag)
|
1504
|
{
|
1505
|
pCmdUI->SetText(ViewMessageDispName[1]);
|
1506
|
}
|
1507
|
else
|
1508
|
{
|
1509
|
pCmdUI->SetText(ViewMessageDispName[0]);
|
1510
|
}*/
|
1511
|
}
|
1512
|
|
1513
|
void CehrevtView::RefreshGrid()
|
1514
|
{
|
1515
|
m_pGridCtrl->Refresh();
|
1516
|
|
1517
|
if (m_bScroll)
|
1518
|
::PostMessage(m_pGridCtrl->GetSafeHwnd(), WM_VSCROLL, m_bSeq ? SB_BOTTOM : SB_TOP, 0);
|
1519
|
}
|
1520
|
|
1521
|
void CehrevtView::OnFilter(BOOL m_filter)
|
1522
|
{
|
1523
|
/* CFilterDlg dlg(m_pFrame);
|
1524
|
|
1525
|
int ret = 1;
|
1526
|
if (ret == IDOK)
|
1527
|
{
|
1528
|
m_bFilter = dlg.m_bFilter;
|
1529
|
|
1530
|
if (m_bFilter)
|
1531
|
{
|
1532
|
FillInternal();
|
1533
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1534
|
}
|
1535
|
else
|
1536
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
1537
|
|
1538
|
RefreshGrid();
|
1539
|
}*/
|
1540
|
|
1541
|
m_bFilter = m_filter;
|
1542
|
|
1543
|
if (m_bFilter)
|
1544
|
{
|
1545
|
FillInternal();
|
1546
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1547
|
}
|
1548
|
else
|
1549
|
m_pGridCtrl->SetRowCount(m_EvList.GetCountLock()+1);
|
1550
|
|
1551
|
RefreshGrid();
|
1552
|
|
1553
|
}
|
1554
|
|
1555
|
void CehrevtView::OnUpdateFilter(CCmdUI* pCmdUI)
|
1556
|
{
|
1557
|
pCmdUI->SetCheck(m_bFilter);
|
1558
|
}
|
1559
|
|
1560
|
void CehrevtView::OnTimer(UINT nIDEvent)
|
1561
|
{
|
1562
|
if (nIDEvent == 1)
|
1563
|
{
|
1564
|
if (GetEventCount(FALSE) > 0)
|
1565
|
{
|
1566
|
m_bFlash = !m_bFlash;
|
1567
|
|
1568
|
m_pGridCtrl->Refresh();
|
1569
|
}
|
1570
|
}
|
1571
|
|
1572
|
CView::OnTimer(nIDEvent);
|
1573
|
}
|
1574
|
|
1575
|
void CehrevtView::OnDestroy()
|
1576
|
{
|
1577
|
CView::OnDestroy();
|
1578
|
|
1579
|
KillTimer(1);
|
1580
|
}
|
1581
|
|
1582
|
void CehrevtView::GetViewSetting()
|
1583
|
{
|
1584
|
CReadConf cfg;
|
1585
|
if (m_pFrame->m_pProp->summary)
|
1586
|
{
|
1587
|
cfg.ReadString("SummaryColumn", "???ڼ????", m_sDiv, m_pFrame->m_szCfgPath, "-");//Added by WYF 20200605
|
1588
|
m_bSeq = GetPrivateProfileInt("SummaryColumn", "ʱ??????????", 0, m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1589
|
m_almOrderNumFlag = GetPrivateProfileInt("SummaryColumn","?????ʾ??־",0,m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1590
|
}
|
1591
|
else
|
1592
|
{
|
1593
|
if (m_pFrame->m_pProp->alarm)
|
1594
|
{
|
1595
|
cfg.ReadString("Column", "???ڼ????", m_sDiv, m_pFrame->m_szCfgPath, "-");//Added by WYF 20200605
|
1596
|
m_bSeq = GetPrivateProfileInt("Column", "ʱ??????????", 0, m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1597
|
m_fontNum = GetPrivateProfileInt("Column", "?????ֺ?", 15, m_pFrame->m_szCfgPath);
|
1598
|
m_almOrderNumFlag = GetPrivateProfileInt("Column","?????ʾ??־",0,m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1599
|
}
|
1600
|
else
|
1601
|
{
|
1602
|
cfg.ReadString("ʵʱ??????", "???ڼ????", m_sDiv, m_pFrame->m_szCfgPath, "-");//Added by WYF 20200605
|
1603
|
m_bSeq = GetPrivateProfileInt("ʵʱ??????", "ʱ??????????", 0, m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1604
|
m_fontNum = GetPrivateProfileInt("ʵʱ??????", "?????ֺ?", 15, m_pFrame->m_szCfgPath);
|
1605
|
m_almOrderNumFlag = GetPrivateProfileInt("ʵʱ??????","?????ʾ??־",0,m_pFrame->m_szCfgPath) == 0 ? FALSE : TRUE;
|
1606
|
}
|
1607
|
}
|
1608
|
|
1609
|
}
|
1610
|
|
1611
|
void CehrevtView::GetFlashSetting()
|
1612
|
{
|
1613
|
CReadConf cfg;
|
1614
|
BOOL bFlash = cfg.ReadLong("??????˸????", m_pFrame->m_pProp->summary ?
|
1615
|
"??Ҫ?Ƿ???˸" : "?????Ƿ???˸", m_pFrame->m_szCfgPath, "0");
|
1616
|
char color[16] = {0};
|
1617
|
int r, g, b;
|
1618
|
COLORREF clr = -1;
|
1619
|
cfg.ReadString("??????˸????", "?ָ???ɫ", color, m_pFrame->m_szCfgPath, "0,153,10");
|
1620
|
if (strcmp(color, "") && sscanf(color, "%d,%d,%d", &r, &g, &b) == 3)
|
1621
|
{
|
1622
|
clr = RGB(r, g, b);
|
1623
|
}
|
1624
|
m_rstColor = clr;
|
1625
|
if (bFlash)
|
1626
|
{
|
1627
|
memset(color, 0, sizeof(color));
|
1628
|
cfg.ReadString("??????˸????", "??˸??ɫ", color, m_pFrame->m_szCfgPath, "170,170,255");
|
1629
|
if (strcmp(color, "") && sscanf(color, "%d,%d,%d", &r, &g, &b) == 3)
|
1630
|
{
|
1631
|
clr = RGB(r, g, b);
|
1632
|
}
|
1633
|
|
1634
|
m_FlashColor = clr;
|
1635
|
|
1636
|
int time = cfg.ReadLong("??????˸????", "??˸???", m_pFrame->m_szCfgPath, "1000");
|
1637
|
SetTimer(1, time, NULL);
|
1638
|
}
|
1639
|
}
|
1640
|
|
1641
|
void CehrevtView::OnUpdateConfirm(CCmdUI* pCmdUI)
|
1642
|
{
|
1643
|
pCmdUI->Enable(m_pGridCtrl->GetSelectedCellRange().IsValid());
|
1644
|
}
|
1645
|
|
1646
|
void CehrevtView::OnUpdateConfirmPage(CCmdUI* pCmdUI)
|
1647
|
{
|
1648
|
pCmdUI->Enable(m_EvList.GetAckedNums() > 0);
|
1649
|
}
|
1650
|
|
1651
|
void CehrevtView::OnUpdateDel(CCmdUI* pCmdUI)
|
1652
|
{
|
1653
|
pCmdUI->Enable(m_pGridCtrl->GetSelectedCellRange().IsValid());
|
1654
|
}
|
1655
|
|
1656
|
|
1657
|
void CehrevtView::OnSelAlarm1()
|
1658
|
{
|
1659
|
filterByAlarmPrior(1);
|
1660
|
}
|
1661
|
|
1662
|
void CehrevtView::OnUpdateAlarm1(CCmdUI* pCmdUI)
|
1663
|
{
|
1664
|
updateAlarm(pCmdUI, 1);
|
1665
|
}
|
1666
|
|
1667
|
void CehrevtView::OnSelAlarm2()
|
1668
|
{
|
1669
|
filterByAlarmPrior(2);
|
1670
|
}
|
1671
|
|
1672
|
void CehrevtView::OnUpdateAlarm2(CCmdUI* pCmdUI)
|
1673
|
{
|
1674
|
updateAlarm(pCmdUI, 2);
|
1675
|
}
|
1676
|
|
1677
|
void CehrevtView::OnSelAlarm3()
|
1678
|
{
|
1679
|
filterByAlarmPrior(3);
|
1680
|
}
|
1681
|
|
1682
|
void CehrevtView::OnUpdateAlarm3(CCmdUI* pCmdUI)
|
1683
|
{
|
1684
|
updateAlarm(pCmdUI, 3);
|
1685
|
}
|
1686
|
|
1687
|
void CehrevtView::filterByAlarmPrior(int nPrior)
|
1688
|
{
|
1689
|
int nCheck[3] = {0};
|
1690
|
nCheck[0] = m_pFrame->m_wndOther.GetToolBarCtrl().GetState(ID_BTN_ALARM1) & 0x01;
|
1691
|
nCheck[1] = m_pFrame->m_wndOther.GetToolBarCtrl().GetState(ID_BTN_ALARM2) & 0x01;
|
1692
|
nCheck[2] = m_pFrame->m_wndOther.GetToolBarCtrl().GetState(ID_BTN_ALARM3) & 0x01;
|
1693
|
|
1694
|
|
1695
|
BOOL bSelectedAll = TRUE;
|
1696
|
for (int i=0; i<3; i++)
|
1697
|
{
|
1698
|
m_pFrame->m_almPri[i+1].sel = nCheck[i];
|
1699
|
if (nCheck[i] == 1)
|
1700
|
bSelectedAll = FALSE;
|
1701
|
}
|
1702
|
|
1703
|
if (!bSelectedAll) {
|
1704
|
for (int i = 4; i <= ALM_K_PRI_LOW; i++)
|
1705
|
{
|
1706
|
if (m_pFrame->m_almPri[i].priNo > 0)
|
1707
|
m_pFrame->m_almPri[i].sel = 0;
|
1708
|
}
|
1709
|
m_bFilter = TRUE;
|
1710
|
}
|
1711
|
else {
|
1712
|
for (int i = 1; i <= ALM_K_PRI_LOW; i++)
|
1713
|
{
|
1714
|
if (m_pFrame->m_almPri[i].priNo > 0)
|
1715
|
m_pFrame->m_almPri[i].sel = 1;
|
1716
|
}
|
1717
|
m_bFilter = FALSE;
|
1718
|
}
|
1719
|
|
1720
|
FillInternal();
|
1721
|
m_pGridCtrl->SetRowCount(m_InternalList.GetCountLock()+1);
|
1722
|
RefreshGrid();
|
1723
|
}
|
1724
|
|
1725
|
void CehrevtView::updateAlarm(CCmdUI* pCmdUI, int nPrior)
|
1726
|
{
|
1727
|
BOOL bNoFilter = TRUE;
|
1728
|
for (int i=1; i<=ALM_K_PRI_LOW; i++)
|
1729
|
{
|
1730
|
if ( (m_pFrame->m_almPri[i].priNo > 0) && (m_pFrame->m_almPri[i].sel == 0) )
|
1731
|
{
|
1732
|
bNoFilter = FALSE;
|
1733
|
break;
|
1734
|
}
|
1735
|
}
|
1736
|
if (bNoFilter)
|
1737
|
pCmdUI->SetCheck(0);
|
1738
|
else
|
1739
|
pCmdUI->SetCheck(m_pFrame->m_almPri[nPrior].sel);
|
1740
|
}
|
1741
|
|
1742
|
int CehrevtView::GetFilterEventCount(BOOL bAll /*= TRUE*/)
|
1743
|
{
|
1744
|
return bAll ? m_InternalList.GetCountLock() : m_InternalList.GetAckedNums();
|
1745
|
}
|
1746
|
|
1747
|
BOOL CehrevtView::WriteToExcel(CString strFile)
|
1748
|
{
|
1749
|
BOOL bRet = FALSE;
|
1750
|
CDatabase database;
|
1751
|
CString strDriver = "MICROSOFT EXCEL DRIVER (*.xls)"; //excel??װ????
|
1752
|
CString strSql;
|
1753
|
|
1754
|
int len = strFile.GetLength();
|
1755
|
int num = strFile.ReverseFind('\\');
|
1756
|
CString dir = strFile.Left(num + 1);
|
1757
|
CString dimap = dir + "ʵʱ??????.xls";
|
1758
|
|
1759
|
TRY
|
1760
|
{
|
1761
|
//???????д?ȡ???ַ???
|
1762
|
strSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;\
|
1763
|
CREATE_DB=\"%s\";DBQ=%s", strDriver, strFile, strFile);
|
1764
|
//???????ݿ?---excel?????ļ?
|
1765
|
if (database.OpenEx(strSql, CDatabase::noOdbcDialog))
|
1766
|
{
|
1767
|
//???????ṹ
|
1768
|
CString strTemp, strTempField;
|
1769
|
CString strInsertField = _T(""), strFields = _T("");
|
1770
|
if (m_nVisibleCol == 0)
|
1771
|
{
|
1772
|
return FALSE;
|
1773
|
}
|
1774
|
if (m_almOrderNumFlag)
|
1775
|
{
|
1776
|
strTemp.Format("%s TEXT,", "???");
|
1777
|
strTempField.Format("%s,", "???");
|
1778
|
strFields += strTemp;
|
1779
|
strInsertField += strTempField;
|
1780
|
}
|
1781
|
int nColNumber[50] = {0}; //
|
1782
|
int nColFlag = 0;
|
1783
|
int visibleColNum = m_nVisibleCol;
|
1784
|
int nCol = m_pFrame->m_colType.GetSize();
|
1785
|
int i = 0;
|
1786
|
for (i = 1; i <= nCol; i++)
|
1787
|
{
|
1788
|
int cn = m_pFrame->m_colSeq[i-1];
|
1789
|
COLTYPE &ct = m_pFrame->m_colType[cn];
|
1790
|
if (ct.bSet)
|
1791
|
{
|
1792
|
if (nColFlag != visibleColNum-1)
|
1793
|
{
|
1794
|
strTemp.Format("%s TEXT,", ct.szDesc);
|
1795
|
strTempField.Format("%s,", ct.szDesc);
|
1796
|
}
|
1797
|
else
|
1798
|
{
|
1799
|
strTemp.Format("%s TEXT", ct.szDesc);
|
1800
|
strTempField.Format("%s", ct.szDesc);
|
1801
|
}
|
1802
|
strFields += strTemp;
|
1803
|
strInsertField += strTempField;
|
1804
|
nColNumber[nColFlag] = cn;
|
1805
|
nColFlag++;
|
1806
|
}
|
1807
|
}
|
1808
|
strSql.Format("CREATE TABLE [ʵʱ??????] (%s)", strFields);
|
1809
|
database.ExecuteSQL(strSql);
|
1810
|
//??????ֵ
|
1811
|
CEventList &evtList = !m_bFilter ? m_EvList : m_InternalList;
|
1812
|
int nSize = evtList.GetCountLock();
|
1813
|
BOOL seqSort = m_bSeq;
|
1814
|
for(i = 0; i < nSize; i++)
|
1815
|
{
|
1816
|
POSITION pos = evtList.FindIndexLock(i, seqSort);
|
1817
|
if (pos == NULL)
|
1818
|
{
|
1819
|
continue;
|
1820
|
}
|
1821
|
SBBD sn = evtList.GetAtLock(pos);
|
1822
|
int nIndex = -1;
|
1823
|
m_pFrame->m_classMap.Lookup(sn.classname, nIndex);
|
1824
|
CString strText, strValue = _T("");
|
1825
|
if (m_almOrderNumFlag)
|
1826
|
{
|
1827
|
if (visibleColNum > 0)
|
1828
|
{
|
1829
|
strTemp.Format("\'%d\',", i + 1); //???к?
|
1830
|
}
|
1831
|
else
|
1832
|
strTemp.Format("\'%d\'", i + 1);
|
1833
|
strValue += strTemp;
|
1834
|
}
|
1835
|
for (int j = 0; j < visibleColNum; j++)
|
1836
|
{
|
1837
|
CString strCol;
|
1838
|
if(!saveBtnToText(nColNumber[j], nIndex, sn, &strCol))
|
1839
|
continue;
|
1840
|
if (j != visibleColNum-1)
|
1841
|
{
|
1842
|
strTemp.Format("\'%s\',", strCol);
|
1843
|
}
|
1844
|
else
|
1845
|
{
|
1846
|
strTemp.Format("\'%s\'", strCol);
|
1847
|
}
|
1848
|
strValue += strTemp;
|
1849
|
}
|
1850
|
strSql.Format("INSERT INTO [ʵʱ??????] (%s) VALUES (%s)", strInsertField, strValue);
|
1851
|
database.ExecuteSQL(strSql);
|
1852
|
}
|
1853
|
bRet = TRUE;
|
1854
|
}
|
1855
|
//?ر????ݿ?---excel??
|
1856
|
database.Close();
|
1857
|
}
|
1858
|
CATCH (CMemoryException, e)
|
1859
|
{
|
1860
|
//???ݿ?????????쳣ʱ
|
1861
|
printf("???ݿ?excel????\n");
|
1862
|
}
|
1863
|
|
1864
|
END_CATCH
|
1865
|
return bRet;
|
1866
|
}
|
1867
|
|
1868
|
BOOL CehrevtView::saveBtnToText(int nCol, int nIndex, SBBD &sn /* = NULL */, CString *sz /* = NULL */)
|
1869
|
{
|
1870
|
if (sz == NULL)
|
1871
|
{
|
1872
|
return FALSE;
|
1873
|
}
|
1874
|
*sz = almColMatch(nCol, nIndex, sn);
|
1875
|
return TRUE;
|
1876
|
}
|
1877
|
|
1878
|
//BOOL CehrevtView::saveBtnToText(int nCol, int nIndex, SBBD *sn /* = NULL */, CString *sz /* = NULL */)
|
1879
|
/*{
|
1880
|
if (sn == NULL || sz == NULL)
|
1881
|
{
|
1882
|
return FALSE;
|
1883
|
}
|
1884
|
|
1885
|
switch(nCol)
|
1886
|
{
|
1887
|
case 0:
|
1888
|
{
|
1889
|
sz->Format("%s", sn->devicekey);
|
1890
|
}
|
1891
|
break;
|
1892
|
case 1:
|
1893
|
{
|
1894
|
if (nIndex >= 0 && nIndex < m_pFrame->m_almClass.GetSize())
|
1895
|
sz->Format("%s", m_pFrame->m_almClass[nIndex].szDesc);
|
1896
|
else
|
1897
|
*sz = "δ????";
|
1898
|
}
|
1899
|
break;
|
1900
|
case 2:
|
1901
|
{
|
1902
|
sz->Format("%d", (unsigned char)(sn->opt));
|
1903
|
}
|
1904
|
break;
|
1905
|
case 3:
|
1906
|
{
|
1907
|
sz->Format("%d", (unsigned char)(sn->messageid));
|
1908
|
}
|
1909
|
break;
|
1910
|
case 4:
|
1911
|
{
|
1912
|
if (m_pFrame->GetPriorNo(sn->priority))
|
1913
|
sz->Format("%s", m_pFrame->m_almPri[sn->priority].desc);
|
1914
|
else
|
1915
|
sz->Format("%d", (unsigned char)(sn->priority));
|
1916
|
}
|
1917
|
break;
|
1918
|
case 5:
|
1919
|
{
|
1920
|
int idx;
|
1921
|
if (m_pFrame->m_appsysMap.Lookup(sn->appsysid, idx))
|
1922
|
*sz = m_pFrame->m_appsys[idx].desc;
|
1923
|
else
|
1924
|
sz->Format("%d", (unsigned char)(sn->appsysid));
|
1925
|
}
|
1926
|
break;
|
1927
|
case 6:
|
1928
|
{
|
1929
|
char aojDesc[SE_K_DESC*AOJ_K_ROLE_AOJS] = "δ֪Ȩ??????";
|
1930
|
AOJ_D_ASSIGNMENT aoj = { (uint32)(sn->aoj) };
|
1931
|
AOJ_GetDescription(aoj, aojDesc);
|
1932
|
*sz = aojDesc;
|
1933
|
}
|
1934
|
break;
|
1935
|
case 7:
|
1936
|
{
|
1937
|
sz->Format("%d", (unsigned short)(sn->mode));
|
1938
|
}
|
1939
|
break;
|
1940
|
case 8:
|
1941
|
{
|
1942
|
CSeTime SE_T;
|
1943
|
SSE_CLOCK clock;
|
1944
|
SE_T.CovertTime((unsigned int)(sn->occurtime), &clock);
|
1945
|
sz->Format("%04d-%02d-%02d", clock.year, clock.month, clock.day);
|
1946
|
}
|
1947
|
break;
|
1948
|
case 9:
|
1949
|
{
|
1950
|
CSeTime SE_T;
|
1951
|
SSE_CLOCK clock;
|
1952
|
SE_T.CovertTime((unsigned int)(sn->occurtime), &clock);
|
1953
|
sz->Format("%02d:%02d:%02d %03d", clock.hour,
|
1954
|
clock.minute, clock.second, (unsigned short)(sn->occurms));
|
1955
|
}
|
1956
|
break;
|
1957
|
case 10:
|
1958
|
{
|
1959
|
int idx;
|
1960
|
if (m_pFrame->m_devtypeMap.Lookup(sn->devicetype, idx))
|
1961
|
*sz = m_pFrame->m_devtype[idx].desc;
|
1962
|
else
|
1963
|
sz->Format("%d", (unsigned short)(sn->devicetype));
|
1964
|
}
|
1965
|
break;
|
1966
|
case 11:
|
1967
|
{
|
1968
|
int idx;
|
1969
|
if (m_pFrame->m_groupMap.Lookup(sn->groupname, idx))
|
1970
|
*sz = m_pFrame->m_group[idx].desc;
|
1971
|
else
|
1972
|
*sz = sn->groupname;
|
1973
|
}
|
1974
|
break;
|
1975
|
case 12:
|
1976
|
{
|
1977
|
sz->Format("%s", sn->graph);
|
1978
|
}
|
1979
|
break;
|
1980
|
case 13:
|
1981
|
{
|
1982
|
sz->Format("%s", sn->userattr[0]);
|
1983
|
}
|
1984
|
break;
|
1985
|
case 14:
|
1986
|
{
|
1987
|
sz->Format("%s", sn->userattr[1]);
|
1988
|
}
|
1989
|
break;
|
1990
|
case 15:
|
1991
|
{
|
1992
|
sz->Format("%s", sn->userattr[2]);
|
1993
|
}
|
1994
|
break;
|
1995
|
case 16:
|
1996
|
{
|
1997
|
sz->Format("%s", sn->userattr[3]);
|
1998
|
}
|
1999
|
break;
|
2000
|
case 17:
|
2001
|
{
|
2002
|
sz->Format("%s", sn->chardesc);
|
2003
|
}
|
2004
|
break;
|
2005
|
case 18:
|
2006
|
{
|
2007
|
sz->Format("%s", sn->audiodesc);
|
2008
|
}
|
2009
|
break;
|
2010
|
case 19:
|
2011
|
{
|
2012
|
sz->Format("%d", sn->serial);
|
2013
|
}
|
2014
|
break;
|
2015
|
default:
|
2016
|
{
|
2017
|
if ((sn->mode & DEF_BBD_CONFIRM) != 0)
|
2018
|
{
|
2019
|
sz->Format("%s", _T("δȷ??"));
|
2020
|
}
|
2021
|
else
|
2022
|
{
|
2023
|
sz->Format("%s", _T("??ȷ??"));
|
2024
|
}
|
2025
|
break;
|
2026
|
}
|
2027
|
}
|
2028
|
return TRUE;
|
2029
|
}*/
|
2030
|
|
2031
|
///////////////////////
|
2032
|
//Add by Yansx 2019-05-06 ??????ʾ??ʱ??,Ĭ?ϵ?MessageBox????λ???д???,
|
2033
|
//ͨ???ӹ??ӵķ?ʽ????ϵͳ??ӡ?Ի???ĵ???λ??
|
2034
|
bool bPrintBoxShow = false;
|
2035
|
HHOOK hPrintBoxHook;
|
2036
|
int getScreenNum()
|
2037
|
{
|
2038
|
char *home = getenv("SEROOT");
|
2039
|
if (NULL == home)
|
2040
|
return 1;
|
2041
|
char filename[256] = {0};
|
2042
|
sprintf(filename, "%s%s", home, "\\cfg\\ehmicfg.ini");
|
2043
|
|
2044
|
CReadConf readconf;
|
2045
|
int nScreenNum = readconf.ReadLong("ȫ?ֶ???", "??ʾ??????", filename, "1");
|
2046
|
return (nScreenNum<1 ? 1 : nScreenNum);
|
2047
|
}
|
2048
|
|
2049
|
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
|
2050
|
{
|
2051
|
if(nCode < 0)
|
2052
|
{
|
2053
|
return CallNextHookEx(hPrintBoxHook, nCode, wParam, lParam);
|
2054
|
}
|
2055
|
|
2056
|
switch(nCode)
|
2057
|
{
|
2058
|
case HCBT_ACTIVATE:
|
2059
|
// customize the MessageBox
|
2060
|
if(bPrintBoxShow)
|
2061
|
{
|
2062
|
HWND hWnd = (HWND)wParam;//PrintBox handle
|
2063
|
RECT rect;
|
2064
|
HDC hDC = ::GetDC(HWND(NULL));//??ȡ??????Ļ?Ĵ?С,????Ĭ??ÿ???????Ĵ?С????һ????
|
2065
|
rect.left = 0;
|
2066
|
rect.top = 0;
|
2067
|
rect.right = ::GetDeviceCaps(hDC,HORZRES);
|
2068
|
rect.bottom = ::GetDeviceCaps(hDC,VERTRES);
|
2069
|
::ReleaseDC(HWND(NULL),hDC);
|
2070
|
|
2071
|
int nScrrenNum = getScreenNum();
|
2072
|
|
2073
|
int nMsgBoxXPoint;
|
2074
|
int nMsgBoxYPoint = rect.bottom/2-(430/2);//Ҫ??ȥ?Ի????һ??߶? ϵͳ??ӡ?Ի??? 610*430
|
2075
|
nMsgBoxYPoint= nMsgBoxYPoint <=0 ? 0 : nMsgBoxYPoint;
|
2076
|
|
2077
|
if(nScrrenNum == 1)
|
2078
|
{
|
2079
|
nMsgBoxXPoint = rect.right/2-(610/2);//Ҫ??ȥ?Ի????һ?????
|
2080
|
nMsgBoxXPoint= nMsgBoxXPoint <=0 ? 0 : nMsgBoxXPoint;
|
2081
|
SetWindowPos(hWnd,HWND_TOP,nMsgBoxXPoint, nMsgBoxYPoint,0,0,SWP_NOSIZE);
|
2082
|
}
|
2083
|
else
|
2084
|
{
|
2085
|
int nOffset = 0;//Ĭ??????ڵ?һ????Ļ
|
2086
|
POINT p;
|
2087
|
GetCursorPos(&p);//??ȡ??굱ǰ????(???????Ļ???Ͻ?)
|
2088
|
int nScrrenWidth = rect.right;
|
2089
|
if( p.x<=nScrrenWidth ){
|
2090
|
nOffset = 0;
|
2091
|
}else if(p.x>nScrrenWidth && p.x<=2*nScrrenWidth){
|
2092
|
nOffset = 1;
|
2093
|
}else if(p.x>2*nScrrenWidth && p.x<=3*nScrrenWidth){
|
2094
|
nOffset = 2;
|
2095
|
}else if(p.x>3*nScrrenWidth && p.x<=4*nScrrenWidth){
|
2096
|
nOffset = 3;
|
2097
|
}else if(p.x>4*nScrrenWidth && p.x<=5*nScrrenWidth){
|
2098
|
nOffset = 4;
|
2099
|
}else if(p.x>5*nScrrenWidth && p.x<=6*nScrrenWidth){
|
2100
|
nOffset = 5;
|
2101
|
}else if(p.x>6*nScrrenWidth && p.x<=7*nScrrenWidth){
|
2102
|
nOffset = 6;
|
2103
|
}else if(p.x>7*nScrrenWidth && p.x<=8*nScrrenWidth){
|
2104
|
nOffset = 7;
|
2105
|
}
|
2106
|
float fMiddle = (float)(nScrrenWidth/2.0-(610/2));
|
2107
|
nMsgBoxXPoint = (int)(nScrrenWidth*nOffset + fMiddle);
|
2108
|
nMsgBoxXPoint= nMsgBoxXPoint <=0 ? 0 : nMsgBoxXPoint;
|
2109
|
|
2110
|
SetWindowPos(hWnd,HWND_TOP,nMsgBoxXPoint, nMsgBoxYPoint,0,0,SWP_NOSIZE);
|
2111
|
}
|
2112
|
bPrintBoxShow = false;
|
2113
|
return 0;
|
2114
|
}//End if(bPrintBoxShow)
|
2115
|
}
|
2116
|
return CallNextHookEx(hPrintBoxHook, nCode, wParam, lParam);
|
2117
|
}
|
2118
|
|
2119
|
//End
|
2120
|
///////////////////////
|
2121
|
|
2122
|
void CehrevtView::OnBtnFilePrint()
|
2123
|
{
|
2124
|
if (m_confirmBtnFlag)
|
2125
|
{
|
2126
|
return;
|
2127
|
}
|
2128
|
bPrintBoxShow = true;
|
2129
|
// Install a window hook, so we can intercept the system print-box
|
2130
|
hPrintBoxHook = SetWindowsHookEx(
|
2131
|
WH_CBT,
|
2132
|
CBTProc,
|
2133
|
NULL,
|
2134
|
GetCurrentThreadId() // Only install for THIS thread!!!
|
2135
|
);
|
2136
|
|
2137
|
// Display a standard print box
|
2138
|
this->SendMessage(WM_COMMAND, ID_FILE_PRINT);
|
2139
|
|
2140
|
// remove the window hook
|
2141
|
UnhookWindowsHookEx(hPrintBoxHook);
|
2142
|
}
|