author | Michael Krelin <hacker@klever.net> | 2004-07-05 01:53:09 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2004-07-05 01:53:09 (UTC) |
commit | fb8b43dbce8bc310718614384297aeaabb9a3cbb (patch) (unidiff) | |
tree | af9d2c2b71ddffff93a97a02fe26611096b78645 /Preferences.cpp | |
download | bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.zip bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.tar.gz bigbrother-fb8b43dbce8bc310718614384297aeaabb9a3cbb.tar.bz2 |
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/bigbrother/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | Preferences.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/Preferences.cpp b/Preferences.cpp new file mode 100644 index 0000000..b975d00 --- a/dev/null +++ b/Preferences.cpp | |||
@@ -0,0 +1,93 @@ | |||
1 | // Preferences.cpp : implementation file | ||
2 | // | ||
3 | |||
4 | #include "stdafx.h" | ||
5 | #include "BigBrother.h" | ||
6 | #include "Preferences.h" | ||
7 | |||
8 | #ifdef _DEBUG | ||
9 | #define new DEBUG_NEW | ||
10 | #undef THIS_FILE | ||
11 | static char THIS_FILE[] = __FILE__; | ||
12 | #endif | ||
13 | |||
14 | ///////////////////////////////////////////////////////////////////////////// | ||
15 | // CPreferences dialog | ||
16 | |||
17 | |||
18 | CPreferences::CPreferences(CWnd* pParent /*=NULL*/) | ||
19 | : CDialog(CPreferences::IDD, pParent) | ||
20 | { | ||
21 | //{{AFX_DATA_INIT(CPreferences) | ||
22 | m_AutosaveMinutes = 0; | ||
23 | m_LogFile = _T(""); | ||
24 | m_MaxThreads = 0; | ||
25 | m_PingSize = 0; | ||
26 | m_SaveOnShutdown = FALSE; | ||
27 | m_LogMins = 0; | ||
28 | m_bStoreLastActivity = FALSE; | ||
29 | //}}AFX_DATA_INIT | ||
30 | } | ||
31 | |||
32 | |||
33 | void CPreferences::DoDataExchange(CDataExchange* pDX) | ||
34 | { | ||
35 | CDialog::DoDataExchange(pDX); | ||
36 | //{{AFX_DATA_MAP(CPreferences) | ||
37 | DDX_Control(pDX, IDC_LOGMINSPIN, m_LogMinSpinCtl); | ||
38 | DDX_Control(pDX, IDC_LOGFILE, m_LogFileCtl); | ||
39 | DDX_Control(pDX, IDC_THREADSPIN, m_ThreadsSpinCtl); | ||
40 | DDX_Control(pDX, IDC_DATASIZESPIN, m_DatasizeSpinCtl); | ||
41 | DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl); | ||
42 | DDX_Control(pDX, IDC_AUTOSPIN, m_AutosaveSpinCtl); | ||
43 | DDX_Text(pDX, IDC_AUTOSAVEMINS, m_AutosaveMinutes); | ||
44 | DDV_MinMaxUInt(pDX, m_AutosaveMinutes, 0, 300); | ||
45 | DDX_Text(pDX, IDC_LOGFILE, m_LogFile); | ||
46 | DDX_Text(pDX, IDC_MAXTHREADS, m_MaxThreads); | ||
47 | DDV_MinMaxUInt(pDX, m_MaxThreads, 1, 50); | ||
48 | DDX_Text(pDX, IDC_PINGSIZE, m_PingSize); | ||
49 | DDV_MinMaxUInt(pDX, m_PingSize, 0, 32768); | ||
50 | DDX_Check(pDX, IDC_SAVEONSHUTDOWN, m_SaveOnShutdown); | ||
51 | DDX_Text(pDX, IDC_LOGMINS, m_LogMins); | ||
52 | DDV_MinMaxUInt(pDX, m_LogMins, 1, 1440); | ||
53 | DDX_Check(pDX, IDC_STOREACTIVITY, m_bStoreLastActivity); | ||
54 | //}}AFX_DATA_MAP | ||
55 | } | ||
56 | |||
57 | |||
58 | BEGIN_MESSAGE_MAP(CPreferences, CDialog) | ||
59 | //{{AFX_MSG_MAP(CPreferences) | ||
60 | ON_BN_CLICKED(IDC_BROWSE, OnBrowse) | ||
61 | //}}AFX_MSG_MAP | ||
62 | END_MESSAGE_MAP() | ||
63 | |||
64 | ///////////////////////////////////////////////////////////////////////////// | ||
65 | // CPreferences message handlers | ||
66 | |||
67 | BOOL CPreferences::OnInitDialog() | ||
68 | { | ||
69 | CDialog::OnInitDialog(); | ||
70 | |||
71 | m_BrowseCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSESOUND)); | ||
72 | m_AutosaveSpinCtl.SetRange(0,300); | ||
73 | m_DatasizeSpinCtl.SetRange(1,32767); | ||
74 | m_ThreadsSpinCtl.SetRange(1,50); | ||
75 | m_LogMinSpinCtl.SetRange(1,1440); | ||
76 | |||
77 | return TRUE; // return TRUE unless you set the focus to a control | ||
78 | // EXCEPTION: OCX Property Pages should return FALSE | ||
79 | } | ||
80 | |||
81 | void CPreferences::OnBrowse() | ||
82 | { | ||
83 | CString filter; | ||
84 | filter.LoadString(IDS_LOGFILTER); | ||
85 | CString title; | ||
86 | title.LoadString(IDS_LOGFILE_SELECT); | ||
87 | CFileDialog cfd(FALSE,NULL,m_LogFile,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOTESTFILECREATE,filter,this); | ||
88 | cfd.m_ofn.lpstrTitle=title; | ||
89 | if(cfd.DoModal()==IDOK){ | ||
90 | m_LogFile=cfd.GetPathName(); | ||
91 | m_LogFileCtl.SetWindowText(cfd.GetPathName()); | ||
92 | } | ||
93 | } | ||