forked from gopa810/gcal-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DlgMasaListing.cpp
116 lines (91 loc) · 2.23 KB
/
DlgMasaListing.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
110
111
112
113
114
115
116
// DlgMasaListing.cpp : implementation file
//
#include "stdafx.h"
#include "VCal5beta.h"
#include "DlgMasaListing.h"
#include "TString.h"
#include "TResultMasaList.h"
#include "GCUserInterface.h"
/////////////////////////////////////////////////////////////////////////////
// DlgMasaListing dialog
int DlgMasaListing::s_init = 0;
int DlgMasaListing::s_year = 0;
int DlgMasaListing::s_count = 0;
DlgMasaListing::DlgMasaListing(CWnd* pParent /*=NULL*/)
: CDialog(DlgMasaListing::IDD, pParent)
{
SYSTEMTIME st;
GetLocalTime(&st);
if (s_init == 0)
{
m_Year = st.wYear;
m_Count = 1;
s_init = 1;
}
else
{
m_Year = s_year;
m_Count = s_count;
}
//{{AFX_DATA_INIT(DlgMasaListing)
//}}AFX_DATA_INIT
bFinal = FALSE;
}
void DlgMasaListing::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgMasaListing)
DDX_Control(pDX, IDC_PROGRESS1, m_prog);
DDX_Text(pDX, IDC_EDIT1, m_Year);
DDV_MinMaxInt(pDX, m_Year, 1500, 3999);
DDX_Text(pDX, IDC_EDIT2, m_Count);
DDV_MinMaxUInt(pDX, m_Count, 1, 20);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgMasaListing, CDialog)
//{{AFX_MSG_MAP(DlgMasaListing)
ON_BN_CLICKED(IDC_BUTTON_BACK, OnButtonBack)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgMasaListing message handlers
void DlgMasaListing::OnOK()
{
// TODO: Add extra validation here
UpdateData();
s_year = m_Year;
s_count = m_Count;
if (m_Count > 20)
return;
if (m_Year + m_Count > 3999)
{
m_Count = 4000 - m_Year;
}
m_pMasaList->CalculateMasaList(m_loc, m_Year, m_Count);
if (GCUserInterface::ShowMode == 0)
{
m_pMasaList->formatText(m_strResult);
}
else if (GCUserInterface::ShowMode == 1)
{
m_pMasaList->formatRtf(m_strResult);
}
m_nNextStep = 1;
CDialog::OnOK();
}
BOOL DlgMasaListing::OnInitDialog()
{
CDialog::OnInitDialog();
if (bFinal)
SetDlgItemText(IDC_BUTTON_NEXT, "Calculate");
m_nNextStep = 0;
m_strResult.Empty();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DlgMasaListing::OnButtonBack()
{
// TODO: Add your control notification handler code here
m_nNextStep = -1;
CDialog::OnCancel();
}