-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigDlg.cpp
109 lines (80 loc) · 2.82 KB
/
ConfigDlg.cpp
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
// ConfigDlg.cpp : implementation file
//
#include "stdafx.h"
#include "QT.h"
#include "Plugin.h"
#include "ConfigDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int g_nPortNumber;
extern int g_nRefreshInterval;
extern BOOL g_bAutoAddSymbols;
extern int g_nSymbolLimit;
extern BOOL g_bOptimizedIntraday;
extern int g_nTimeShift;
extern CString g_oServer;
extern CString GetAvailableSymbols( void );
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg dialog
CConfigDlg::CConfigDlg(CWnd* pParent /*=NULL*/)
: CDialog(CConfigDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfigDlg)
//}}AFX_DATA_INIT
}
void CConfigDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfigDlg)
//}}AFX_DATA_MAP
DDX_Text( pDX, IDC_SERVER_EDIT, g_oServer );
DDX_Check( pDX, IDC_AUTOSYMBOLS_CHECK, g_bAutoAddSymbols );
DDX_Text( pDX, IDC_PORT_EDIT, g_nPortNumber );
DDV_MinMaxInt( pDX, g_nPortNumber, 1, 65535 );
DDX_Text( pDX, IDC_INTERVAL_EDIT, g_nRefreshInterval );
DDV_MinMaxInt( pDX, g_nRefreshInterval, 1, 60 );
DDX_Text( pDX, IDC_MAXSYMBOL_EDIT, g_nSymbolLimit );
DDV_MinMaxInt( pDX, g_nSymbolLimit, 10, 500 );
DDX_Check( pDX, IDC_OPTIMIZED_INTRADAY_CHECK, g_bOptimizedIntraday );
DDX_Text( pDX, IDC_TIMESHIFT_EDIT, g_nTimeShift );
DDV_MinMaxInt( pDX, g_nTimeShift, -48, 48 );
}
BEGIN_MESSAGE_MAP(CConfigDlg, CDialog)
//{{AFX_MSG_MAP(CConfigDlg)
ON_BN_CLICKED(IDC_RETRIEVE_BUTTON, OnRetrieveButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg message handlers
BOOL CConfigDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConfigDlg::OnOK()
{
CDialog::OnOK();
AfxGetApp()->WriteProfileInt( "QuoteTracker", "TimeShift", g_nTimeShift );
AfxGetApp()->WriteProfileInt( "QuoteTracker", "Port", g_nPortNumber );
AfxGetApp()->WriteProfileString( "QuoteTracker", "Server", g_oServer );
AfxGetApp()->WriteProfileInt( "QuoteTracker", "RefreshInterval", g_nRefreshInterval );
AfxGetApp()->WriteProfileInt( "QuoteTracker", "AutoAddSymbols", g_bAutoAddSymbols );
AfxGetApp()->WriteProfileInt( "QuoteTracker", "SymbolLimit", g_nSymbolLimit );
AfxGetApp()->WriteProfileInt( "QuoteTracker", "OptimizedIntraday", g_bOptimizedIntraday );
}
void CConfigDlg::OnRetrieveButton()
{
CString oSymbolList = GetAvailableSymbols();
CString oSymbol;
int iCnt = 0;
for( ; AfxExtractSubString( oSymbol, oSymbolList, iCnt, ',' ); iCnt++ )
{
if( oSymbol != "MEDVED" ) m_pSite->AddStock( oSymbol );
}
oSymbol.Format("Retrieved %d symbols", iCnt );
SetDlgItemText( IDC_STATUS_STATIC, oSymbol );
}