forked from gopa810/gcal-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDlgEventsGaubdTM.cpp
133 lines (106 loc) · 2.71 KB
/
DlgEventsGaubdTM.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// DlgEventsGaubdTM.cpp : implementation file
//
#include "stdafx.h"
#include "TString.h"
#include "vcal5beta.h"
#include "DlgEventsGaubdTM.h"
#include "GCStrings.h"
/////////////////////////////////////////////////////////////////////////////
// DlgEventsGaubdTM dialog
DlgEventsGaubdTM::DlgEventsGaubdTM(CWnd* pParent /*=NULL*/)
: CDialog(DlgEventsGaubdTM::IDD, pParent)
{
//{{AFX_DATA_INIT(DlgEventsGaubdTM)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_nRetCancel = 0;
}
void DlgEventsGaubdTM::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgEventsGaubdTM)
DDX_Control(pDX, IDC_STATIC2, m_s2);
DDX_Control(pDX, IDC_STATIC1, m_s1);
DDX_Control(pDX, IDC_LIST2, m_list2);
DDX_Control(pDX, IDC_LIST1, m_list1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgEventsGaubdTM, CDialog)
//{{AFX_MSG_MAP(DlgEventsGaubdTM)
ON_BN_CLICKED(IDC_BUTTON1, OnBack)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgEventsGaubdTM message handlers
void DlgEventsGaubdTM::OnOK()
{
// TODO: Add extra validation here
int i, n;
i = m_list1.GetCurSel();
if (i == LB_ERR)
{
CDialog::OnCancel();
return;
}
n = m_list1.GetItemData(i);
if (n == -1)
{
MessageBox("You should choose particular tithi, not only paksa in first listbox.", "Invalid selction in listbox 1", MB_OK);
return;
}
m_nTithi = n;
i = m_list2.GetCurSel();
if (i == LB_ERR)
{
CDialog::OnCancel();
return;
}
n = m_list2.GetItemData(i);
if (n == -1)
{
CDialog::OnCancel();
return;
}
m_nMasa = n;
CDialog::OnOK();
}
BOOL DlgEventsGaubdTM::OnInitDialog()
{
CDialog::OnInitDialog();
int i = 0, n;
TString str;
str.Format("%s Paksa", GCStrings::GetPaksaName(0));
i = m_list1.AddString(str);
m_list1.SetItemData(i, -1);
for(n = 0; n < 15; n++)
{
str.Format(" %s Tithi", GCStrings::GetTithiName(n));
i = m_list1.AddString(str);
m_list1.SetItemData(i, n);
}
str.Format("%s Paksa", GCStrings::GetPaksaName(1));
i = m_list1.AddString(str);
m_list1.SetItemData(i, -1);
for(n = 15; n < 30; n++)
{
str.Format(" %s Tithi", GCStrings::GetTithiName(n));
i = m_list1.AddString(str);
m_list1.SetItemData(i, n);
}
for(n = 0; n < 12; n++)
{
str.Format(" %s Masa", GCStrings::GetMasaName((n + 11)%12));
i = m_list2.AddString(str);
m_list2.SetItemData(i, (n + 11)%12);
}
m_list1.SetCurSel(1);
m_list2.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void DlgEventsGaubdTM::OnBack()
{
// TODO: Add your control notification handler code here
m_nRetCancel = 1;
CDialog::OnCancel();
}