forked from tsupo/Chirrup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SettingUploadWassr.cpp
159 lines (132 loc) · 4.23 KB
/
SettingUploadWassr.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
* SettingUploadWassr.cpp : Wassr クライアント chirrup
* 画像投稿関連設定ダイアログ(Wassr) インプリメンテーション ファイル
* written by H.Tsujimura 31 Jul 2008
*
* Copyright (c) 2008 by H.Tsujimura (tsupo@na.rim.or.jp)
* All Rights Reserved.
*
* $Log: /comm/chirrup/SettingUploadWassr.cpp $
*
* 1 09/05/14 3:50 tsupo
* (1) ビルド環境のディレクトリ構造を整理
* (2) VSSサーバ拠点を変更
*
* 2 08/07/31 20:26 Tsujimura543
* 「状況に応じた入力可能/不可の切替処理」を修正
*
* 1 08/07/31 17:34 Tsujimura543
* 新規作成
*/
#include "chirrup.h"
#include "SettingUploadWassr.h"
#ifndef lint
static char *rcs_id =
"$Header: /comm/chirrup/SettingUploadWassr.cpp 1 09/05/14 3:50 tsupo $";
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSettingUploadWassr ダイアログ
CSettingUploadWassr::CSettingUploadWassr(CWnd* pParent /*=NULL*/)
: CDialog(CSettingUploadWassr::IDD, pParent)
{
//{{AFX_DATA_INIT(CSettingUploadWassr)
m_applied = FALSE;
m_writeLogfile = FALSE;
m_logFilename = _T("");
//}}AFX_DATA_INIT
}
void CSettingUploadWassr::InputFileName( CString &targetFilename, int id )
{
CFileDialog *fileDlg = NULL;
CString fileName;
CString fileType;
const char *fileExtention;
const char *fileDefault = NULL;
fileExtention = "txt";
fileType = _T("テキストファイル (*.txt)|*.txt||");
if ( fileExtention )
fileDlg = new CFileDialog( FALSE, fileExtention, fileDefault,
OFN_CREATEPROMPT,
fileType );
if ( fileDlg ) {
if ( fileDlg->DoModal() == IDOK )
fileName = fileDlg->GetPathName();
delete fileDlg;
if ( fileName.GetLength() > 0 ) {
targetFilename = fileName;
CEdit *p = (CEdit *)GetDlgItem( id );
p->SetWindowText( targetFilename );
}
}
}
void CSettingUploadWassr::SetCheckApplied()
{
CButton *bp = (CButton *)GetDlgItem(IDC_WRITE_LOGFILE);
bp->EnableWindow( m_applied );
SetCheckWriteLogfile();
}
void CSettingUploadWassr::SetCheckWriteLogfile()
{
CEdit *ep = (CEdit *)GetDlgItem(IDC_EDIT_LOGFILENAME_UPLOAD);
ep->EnableWindow( m_applied && m_writeLogfile );
CButton *bp = (CButton *)GetDlgItem(IDC_BUTTON_FILESPEC);
bp->EnableWindow( m_applied && m_writeLogfile );
}
void CSettingUploadWassr::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSettingUploadWassr)
DDX_Check(pDX, IDC_APPLIED, m_applied);
DDX_Check(pDX, IDC_WRITE_LOGFILE, m_writeLogfile);
DDX_Text(pDX, IDC_EDIT_LOGFILENAME_UPLOAD, m_logFilename);
DDV_MaxChars(pDX, m_logFilename, 256);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSettingUploadWassr, CDialog)
//{{AFX_MSG_MAP(CSettingUploadWassr)
ON_WM_SHOWWINDOW()
ON_BN_CLICKED(IDC_WRITE_LOGFILE, OnWriteLogfile)
ON_BN_CLICKED(IDC_BUTTON_FILESPEC, OnButtonFilespec)
ON_BN_CLICKED(IDC_APPLIED, OnApplied)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSettingUploadWassr メッセージ ハンドラ
void CSettingUploadWassr::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if ( bShow ) {
CButton *bp = (CButton *)GetDlgItem( IDC_APPLIED );
bp->SetCheck( m_applied );
bp = (CButton *)GetDlgItem( IDC_WRITE_LOGFILE );
bp->SetCheck( m_writeLogfile );
CEdit *ep = (CEdit *)GetDlgItem(IDC_EDIT_LOGFILENAME_UPLOAD);
ep->SetWindowText( m_logFilename );
SetCheckApplied();
}
else {
CEdit *ep = (CEdit *)GetDlgItem(IDC_EDIT_LOGFILENAME_UPLOAD);
ep->GetWindowText( m_logFilename );
}
}
void CSettingUploadWassr::OnApplied()
{
CButton *bp = (CButton *)GetDlgItem( IDC_APPLIED );
m_applied = bp->GetCheck();
SetCheckApplied();
}
void CSettingUploadWassr::OnWriteLogfile()
{
CButton *bp = (CButton *)GetDlgItem( IDC_WRITE_LOGFILE );
m_writeLogfile = bp->GetCheck();
SetCheckWriteLogfile();
}
void CSettingUploadWassr::OnButtonFilespec()
{
InputFileName( m_logFilename, IDC_EDIT_LOGFILENAME_UPLOAD );
}