forked from ambilight-4-mediaportal/AtmoWin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtmoPacketQueueStatus.cpp
More file actions
102 lines (85 loc) · 2.65 KB
/
Copy pathAtmoPacketQueueStatus.cpp
File metadata and controls
102 lines (85 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "StdAfx.h"
#include "atmopacketqueuestatus.h"
CAtmoPacketQueueStatus::CAtmoPacketQueueStatus(HINSTANCE hInst,HWND parent) : CBasicWindow(hInst, parent)
{
first = ATMO_TRUE;
}
CAtmoPacketQueueStatus::~CAtmoPacketQueueStatus(void)
{
}
LPCTSTR CAtmoPacketQueueStatus::ClassName()
{
return TEXT("AtmoPacketQueueStatusClass");
}
DWORD CAtmoPacketQueueStatus::getWindowStyle()
{
return (WS_BORDER | WS_CAPTION);
}
SIZE CAtmoPacketQueueStatus::getWindowSize()
{
SIZE s;
s.cx = 200;
s.cy = 50;
return s;
}
POINT CAtmoPacketQueueStatus::getWindowPos()
{
POINT p;
p.x = 0;
p.y = 0;
return p;
}
void CAtmoPacketQueueStatus::showWindow(int cmdShow)
{
CBasicWindow::showWindow(cmdShow);
SetWindowText(this->m_hWindow,"Queue Status");
}
void CAtmoPacketQueueStatus::UpdateValues( int waits, int skips, int frames, int nullpackets, DWORD avgWait, DWORD avgDelay)
{
this->m_avgDelay = avgDelay;
this->m_avgWait = avgWait;
this->m_waitcounter = waits;
this->m_framecounter = frames;
this->m_skipcounter = skips;
this->m_nullpackets = nullpackets;
invalidate(ATMO_TRUE);
}
void CAtmoPacketQueueStatus::HandleWmPaint(PAINTSTRUCT ps,HDC hdc)
{
RECT r;
SIZE size;
char buf[100];
GetClientRect(m_hWindow, &r);
r.left += 5;
r.top +=4;
sprintf(buf,"Processed: %d",m_framecounter);
TextOut(hdc, r.left, r.top, buf, (int)strlen(buf));
GetTextExtentPoint32(hdc, buf, (int)strlen(buf), &size);
r.top += size.cy + 1;
if(m_waitcounter > 0)
sprintf(buf,"Waits: %d, AvgWaits: %d ms",m_waitcounter, m_avgWait/m_waitcounter );
else
sprintf(buf,"Waits: %d, AvgWaits: %d ms",m_waitcounter, 0 );
TextOut(hdc, r.left, r.top, buf, (int)strlen(buf));
GetTextExtentPoint32(hdc, buf, (int)strlen(buf), &size);
r.top += size.cy + 1;
if(m_waitcounter > 0)
sprintf(buf,"Skips: %d, AvgDelay: %d ms", m_waitcounter, m_avgDelay / m_waitcounter );
else
sprintf(buf,"Skips: %d, AvgDelay: %d ms", m_waitcounter, 0 );
TextOut(hdc, r.left, r.top, buf, (int)strlen(buf));
GetTextExtentPoint32(hdc, buf, (int)strlen(buf), &size);
r.top += size.cy + 1;
sprintf(buf,"RepeatPackets: %d", this->m_nullpackets );
TextOut(hdc, r.left, r.top, buf, (int)strlen(buf));
GetTextExtentPoint32(hdc, buf, (int)strlen(buf), &size);
r.top += size.cy + 1;
// first
if(first) {
first = ATMO_FALSE;
SetWindowPos(this->m_hWindow, 0, 0, 0, r.right + 60, r.top + 30, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOREPOSITION | SWP_NOSENDCHANGING | SWP_NOZORDER);
}
}
void CAtmoPacketQueueStatus::CreateWindowClass(WNDCLASSEX &wndclassex) {
// Updae Properties of wndclassex as required...
}