-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCaptureCfg.cpp
More file actions
130 lines (114 loc) · 3.09 KB
/
CaptureCfg.cpp
File metadata and controls
130 lines (114 loc) · 3.09 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// CaptureCfg.cpp : implementation file
//
#include "stdafx.h"
#include "WinDV.h"
#include "CaptureCfg.h"
#include "DShow.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCaptureCfg dialog
CCaptureCfg::CCaptureCfg()
: CPropertyPage(CCaptureCfg::IDD)
{
//{{AFX_DATA_INIT(CCaptureCfg)
m_discontinuityTreshold = 0;
m_everyNth = 0;
m_maxAVIFrames = 0;
m_type12 = -1;
m_dtformat = _T("");
m_ndigits = -1;
//}}AFX_DATA_INIT
}
void CCaptureCfg::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCaptureCfg)
DDX_Control(pDX, IDC_FEXAMPLE, m_fexample);
DDX_Control(pDX, IDC_DTFORMAT, m_dtformatctl);
DDX_Control(pDX, IDC_NDIGITS, m_ndigitsctl);
DDX_Text(pDX, IDC_DISCONTINUITY_TRESHOLD, m_discontinuityTreshold);
DDV_MinMaxUInt(pDX, m_discontinuityTreshold, 0, 1000000);
DDX_Text(pDX, IDC_EVERY_NTH, m_everyNth);
DDV_MinMaxUInt(pDX, m_everyNth, 1, 1000000);
DDX_Text(pDX, IDC_MAX_FRAMES, m_maxAVIFrames);
DDV_MinMaxUInt(pDX, m_maxAVIFrames, 10, 1000000);
DDX_Radio(pDX, IDC_TYPE_1, m_type12);
DDX_CBString(pDX, IDC_DTFORMAT, m_dtformat);
DDX_CBIndex(pDX, IDC_NDIGITS, m_ndigits);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCaptureCfg, CPropertyPage)
//{{AFX_MSG_MAP(CCaptureCfg)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCaptureCfg message handlers
void CCaptureCfg::OnTimer(UINT nIDEvent)
{
if (nIDEvent == 1) {
CString tmp;
m_dtformatctl.GetWindowText(tmp);
CString tmp2 = FormatTime(tmp, time(NULL));
tmp = "...example";
if (!tmp2.IsEmpty()) {
tmp += ".";
tmp += tmp2;
}
int n = m_ndigitsctl.GetCurSel();
tmp2.Empty();
if (n) tmp2.Format(".%0*d", n, 0);
m_fexample.SetWindowText(tmp+tmp2+".avi");
}
else {
CPropertyPage::OnTimer(nIDEvent);
}
}
BOOL CCaptureCfg::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CString tmp;
int i;
for(i = 0; i<=4; i++) {
tmp.Format("%d", i);
m_ndigitsctl.AddString(tmp);
}
m_dtformatctl.AddString(m_dtformat);
while (!m_dtformathistory.IsEmpty()) {
tmp = m_dtformathistory.SpanExcluding("\n");
int l = tmp.GetLength();
if (l < m_dtformathistory.GetLength())
m_dtformathistory = m_dtformathistory.Mid(l+1);
else
m_dtformathistory.Empty();
m_dtformatctl.AddString(tmp);
}
if (!m_dtformat.IsEmpty()) m_dtformatctl.AddString("");
m_ndigitsctl.SetCurSel(m_ndigits);
OnTimer(1);
SetTimer(1, 500, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCaptureCfg::OnOK()
{
CPropertyPage::OnOK();
int i,n;
i = m_dtformatctl.FindStringExact(-1,m_dtformat);
if (i>=0) m_dtformatctl.DeleteString(i);
m_dtformathistory.Empty();
n = m_dtformatctl.GetCount();
if (n > 10) n = 10;
for (i=0; i<n; i++) {
CString tmp;
m_dtformatctl.GetLBText(i, tmp);
if (!tmp.IsEmpty()) {
if (!m_dtformathistory.IsEmpty()) m_dtformathistory += "\n";
m_dtformathistory += tmp;
}
}
}