-
Notifications
You must be signed in to change notification settings - Fork 0
/
AGAIN.CPP
110 lines (99 loc) · 2.5 KB
/
AGAIN.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
// again.cpp : implementation file
// IDD_REPOST
#include "stdafx.h"
#include "again.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern _gconfig gc;
static char DlgName[]="IDD_REPOST";
// ===================================================
again::again(CWnd* pParent ) : CDialog(again::IDD, pParent)
// ===================================================
{
period=-1;
//{{AFX_DATA_INIT(again)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
// ===================================================
void again::DoDataExchange(CDataExchange* pDX)
// ===================================================
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(again)
DDX_Control(pDX, IDC_EDIT_DAYS, m_edit_days);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(again, CDialog)
//{{AFX_MSG_MAP(again)
ON_BN_CLICKED(IDC_1DAY, On1day)
ON_BN_CLICKED(IDC_3DAYS, On3days)
ON_BN_CLICKED(IDC_WEEK, OnWeek)
ON_BN_CLICKED(IDC_MONTH, OnMonth)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// ===================================================
BOOL again::OnInitDialog()
// ===================================================
{
int lng[]={
IDOK,
IDCANCEL,
IDC_STATIC1,
IDC_STATIC2,
IDC_1DAY,
IDC_3DAYS,
IDC_WEEK,
IDC_MONTH,
};
CDialog::OnInitDialog();
m_edit_days.SetLimitText(3);
set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int));
m_edit_days.SetWindowText(get_cfg(CFG_COMMON,"DefRepost","7"));
return TRUE;
}
// ===================================================
void again::OnOK()
// ===================================================
{
CString str;
int ret;
m_edit_days.GetWindowText(str);
ret=sscanf(str,"%d",&period);
if (ret != 1)
period=-1;
else
set_cfg(CFG_COMMON,"DefRepost",period);
CDialog::OnOK();
}
// ===================================================
void again::On1day()
// ===================================================
{
m_edit_days.SetWindowText("1");
OnOK();
}
// ===================================================
void again::On3days()
// ===================================================
{
m_edit_days.SetWindowText("3");
OnOK();
}
// ===================================================
void again::OnWeek()
// ===================================================
{
m_edit_days.SetWindowText("7");
OnOK();
}
// ===================================================
void again::OnMonth()
// ===================================================
{
m_edit_days.SetWindowText("30");
OnOK();
}