JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
WriteFilesDLG.cpp
Go to the documentation of this file.
1//
2// WriteFileDLG.cpp : インプリメンテーション ファイル
3//
4
5#include "WriteFilesDLG.h"
6
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14
15using namespace jbxwl;
16
17
19// CWriteFilesDLG ダイアログ
20
21CWriteFilesDLG::CWriteFilesDLG(LPCTSTR fname, int fmt, int fnum, int tnum, CWnd* pParent /*=NULL*/)
22 : CDialog(CWriteFilesDLG::IDD, pParent)
23{
24 //{{AFX_DATA_INIT(CWriteFilesDLG)
25 // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します.
26 //}}AFX_DATA_INIT
27
28 fmtsCMBBox = NULL;
29 fnameEBox = NULL;
30 fromNumEBox = NULL;
31 toNumEBox = NULL;
32 mltSaveCBtn = NULL;
33
34 pWnd = pParent;
35 fName = fname;
36 format = fmt;
37 fromNum = fnum;
38 toNum = tnum;
39 mltSave = FALSE;
40 zSize = abs(tnum - fnum) + 1;
41}
42
43
44//
48
49
50//
51void CWriteFilesDLG::DoDataExchange(CDataExchange* pDX)
52{
53 CDialog::DoDataExchange(pDX);
54 //{{AFX_DATA_MAP(CWriteFilesDLG)
55 // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します.
56 //}}AFX_DATA_MAP
57}
58
59
60
61BEGIN_MESSAGE_MAP(CWriteFilesDLG, CDialog)
62 //{{AFX_MSG_MAP(CWriteFilesDLG)
63 //}}AFX_MSG_MAP
66END_MESSAGE_MAP()
67
68
69
70
71// CWriteFilesDLG メッセージ ハンドラ
72
73BOOL CWriteFilesDLG::OnInitDialog()
74{
75 TCHAR buf[LNAME];
76// memset(buf, 0, LNAME);
77
78 fmtsCMBBox = (CComboBox*)GetDlgItem(IDC_WF_FORMATS);
79 fnameEBox = (CEdit*)GetDlgItem(IDC_WF_FNAME);
80 fromNumEBox = (CEdit*)GetDlgItem(IDC_WF_FROMNUM);
81 toNumEBox = (CEdit*)GetDlgItem(IDC_WF_TONUM);
82 mltSaveCBtn = (CButton*)GetDlgItem(IDC_WF_MFL);
83
84 // ComboBox
85 fmtsCMBBox->AddString(_T(CT_DATA_STR));
86 fmtsCMBBox->AddString(_T(MOON_DATA_STR));
87 fmtsCMBBox->AddString(_T(JPEG_RGB_DATA_STR));
88 fmtsCMBBox->AddString(_T(JPEG_MONO_DATA_STR));
89 fmtsCMBBox->AddString(_T(RAS_DATA_STR));
90
91 CString fmtStr = _T(CT_DATA_STR); //
92 if (format==CT_DATA) fmtStr = _T(CT_DATA_STR); //
93 else if (format==CT_3DM) fmtStr = _T(CT_DATA_STR); //
94 else if (format==MOON_DATA) fmtStr = _T(MOON_DATA_STR); //
95 else if (format==JPEG_RGB_DATA) fmtStr = _T(JPEG_RGB_DATA_STR);
96 else if (format==JPEG_MONO_DATA) fmtStr = _T(JPEG_MONO_DATA_STR);
97 else if (format==RAS_DATA) fmtStr = _T(RAS_DATA_STR);
98 //else if (format==TIFF_DATA) fmtStr = _T(TIFF_DATA_STR);
99 //else if (format==PNG_DATA) fmtStr = _T(PNG_DATA_STR);
100
101 fmtsCMBBox->SelectString(-1, fmtStr);
102 setDLGState((LPCTSTR)fmtStr);
103 setNumBoxState();
104
105 //
106 if (fName!=_T("")) fnameEBox->SetWindowText(fName);
107
108 sntprintf(buf, LNAME, _T("%d"), fromNum);
109 fromNumEBox->SetWindowText(buf);
110
111 sntprintf(buf, LNAME, _T("%d"), toNum);
112 toNumEBox->SetWindowText(buf);
113
114 mltSaveCBtn->SetCheck(0);
115
116 return TRUE;
117}
118
119
120/*
121メモ
122DoModalのリーターン
123 -1 エラー
124 IDABORT
125 IDOK
126 IDCANCEL
127/**/
128
129
130//
132{
133 TCHAR buf[LNAME];
134// memset(buf, 0, LNAME);
135
136 fnameEBox->GetWindowText(buf, LNAME);
137 fName = buf;
138
139 fromNumEBox->GetWindowText(buf, LNAME);
140 fromNum = ttoi(buf);
141
142 toNumEBox->GetWindowText(buf, LNAME);
143 toNum = ttoi(buf);
144
145 // Format
147
148 // 3D
149 if (!mltSave && zSize>1) {
150 if (format==CT_DATA) format = CT_3DM;
151 }
152
153 CDialog::OnOK();
154}
155
156
157//
159{
160 TCHAR buf[LNAME];
161 fmtsCMBBox->GetWindowText(buf, LNAME);
162
163 setDLGState(buf);
165}
166
167
168//
170{
171 if (zSize==1) {
172 mltSaveCBtn->EnableWindow(FALSE);
173 mltSaveCBtn->SetCheck(0);
174 mltSave = FALSE;
175 }
176
177 if (!tcscmp(str,_T(CT_DATA_STR))) {
178 if (zSize>1) {
179 mltSaveCBtn->EnableWindow(TRUE);
180 }
181 format = CT_DATA;
182 }
183
184 // 以降3次元データとしては保存不可
185 else if (!tcscmp(str,_T(MOON_DATA_STR))) {
186 if (zSize>1) {
187 mltSaveCBtn->EnableWindow(FALSE);
188 mltSaveCBtn->SetCheck(1);
189 mltSave = TRUE;
190 }
191 format = MOON_DATA;
192 }
193 else if (!tcscmp(str,_T(RAS_DATA_STR))) {
194 if (zSize>1) {
195 mltSaveCBtn->EnableWindow(FALSE);
196 mltSaveCBtn->SetCheck(1);
197 mltSave = TRUE;
198 }
199 format = RAS_DATA;
200 }
201 else if (!tcscmp(str,_T(JPEG_MONO_DATA_STR))) {
202 if (zSize>1) {
203 mltSaveCBtn->EnableWindow(FALSE);
204 mltSave = TRUE;
205 mltSaveCBtn->SetCheck(1);
206 }
207 format = JPEG_MONO_DATA;
208 }
209 else if (!tcscmp(str,_T(JPEG_RGB_DATA_STR))){
210 mltSaveCBtn->EnableWindow(FALSE);
211 mltSaveCBtn->SetCheck(0);
212 mltSave = FALSE;
213 format = JPEG_RGB_DATA;
214 }
215 else {
216 if (zSize>1) {
217 mltSaveCBtn->EnableWindow(FALSE);
218 mltSaveCBtn->SetCheck(1);
219 mltSave = FALSE;
220 }
221 format = UN_KNOWN_DATA;
222 }
223}
224
225
226//
228 // ナンバーBOXの状態
229 if (mltSaveCBtn->GetCheck()==1) {
230 fromNumEBox->EnableWindow(TRUE);
231 toNumEBox->EnableWindow(TRUE);
232 mltSave = TRUE;
233 }
234 else {
235 fromNumEBox->EnableWindow(FALSE);
236 toNumEBox->EnableWindow(FALSE);
237 mltSave = FALSE;
238 }
239}
240
241
242//
247
static char THIS_FILE[]
void setDLGState(LPCTSTR fmtstr)
afx_msg void OnBnClickedWfMfl()
CWriteFilesDLG(LPCTSTR fname, int fmtm, int fnum, int tnum, CWnd *pParent=NULL)
afx_msg void OnCbnSelchangeWfFormats()
virtual void DoDataExchange(CDataExchange *pDX)
#define IDC_WF_TONUM
Definition resource.h:37
#define IDC_WF_MFL
Definition resource.h:38
#define IDC_WF_FORMATS
Definition resource.h:39
#define IDC_WF_FNAME
Definition resource.h:35
#define IDC_WF_FROMNUM
Definition resource.h:36