Develop and Download Open Source Software

Browse CVS Repository

Contents of /enbanfukusyaya/EnbanFukusyaYa/Win32/SettingDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Tue Sep 19 15:39:40 2006 UTC (17 years, 6 months ago) by bananajinn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +6 -0 lines
File MIME type: text/x-c++src
*** empty log message ***

1 /* 円盤複写屋
2 * Copyright (C) 2004 Kagetani Hideto
3 */
4 // SettingDlg.cpp : インプリメンテーション ファイル
5 //
6
7 #include "stdafx.h"
8 #include "enbanfukusya.h"
9 #include "SettingDlg.h"
10
11 #ifdef _DEBUG
12 #define new DEBUG_NEW
13 #undef THIS_FILE
14 static char THIS_FILE[] = __FILE__;
15 #endif
16
17 /////////////////////////////////////////////////////////////////////////////
18 // CSettingDlg ダイアログ
19
20
21
22 CSettingDlg::CSettingDlg(CWnd* pParent /*=NULL*/)
23 : CThemeDialog(CSettingDlg::IDD, pParent)
24 {
25 //{{AFX_DATA_INIT(CSettingDlg)
26 // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します。
27 //}}AFX_DATA_INIT
28 m_pOption = NULL;
29 }
30
31
32 void CSettingDlg::DoDataExchange(CDataExchange* pDX)
33 {
34 CDialog::DoDataExchange(pDX);
35 //{{AFX_DATA_MAP(CSettingDlg)
36 DDX_Control(pDX, IDC_CHK_OUTSIDE, m_ChkOutside);
37 DDX_Control(pDX, IDC_STC_TEMPPATH, m_StcTempPath);
38 DDX_Control(pDX, IDC_EDT_TEMPPATH, m_EdtTempPath);
39 DDX_Control(pDX, IDOK, m_BtnOK);
40 DDX_Control(pDX, IDCANCEL, m_BtnCancel);
41 DDX_Control(pDX, IDC_STC_WRITESPEED, m_StcWriteSpeed);
42 DDX_Control(pDX, IDC_STC_READSPEED, m_StcReadSpeed);
43 DDX_Control(pDX, IDC_CMB_WRITESPEED, m_CmbWriteSpeed);
44 DDX_Control(pDX, IDC_CMB_READSPEED, m_CmbReadSpeed);
45 DDX_Control(pDX, IDC_CHK_TESTWRITE, m_ChkTestWrite);
46 DDX_Control(pDX, IDC_CHK_ONTHEFLY, m_ChkOnthefly);
47 DDX_Control(pDX, IDC_CHK_DAO, m_ChkDAO);
48 DDX_Control(pDX, IDC_CHK_BUFE, m_ChkBUFE);
49 //}}AFX_DATA_MAP
50 }
51
52
53 BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
54 //{{AFX_MSG_MAP(CSettingDlg)
55 //}}AFX_MSG_MAP
56 END_MESSAGE_MAP()
57
58 /////////////////////////////////////////////////////////////////////////////
59 // CSettingDlg メッセージ ハンドラ
60
61 BOOL CSettingDlg::OnInitDialog()
62 {
63 CDialog::OnInitDialog();
64
65 // TODO: この位置に初期化の補足処理を追加してください
66 CThemeSet *pTheme = GetTheme();
67 m_BtnOK.SetTheme(pTheme);
68 m_BtnCancel.SetTheme(pTheme);
69 m_CmbReadSpeed.SetTheme(pTheme);
70 m_CmbWriteSpeed.SetTheme(pTheme);
71 m_StcReadSpeed.SetTheme(pTheme);
72 m_StcWriteSpeed.SetTheme(pTheme);
73 m_ChkBUFE.SetTheme(pTheme);
74 m_ChkTestWrite.SetTheme(pTheme);
75 m_ChkDAO.SetTheme(pTheme);
76 m_ChkOnthefly.SetTheme(pTheme);
77 m_ChkOutside.SetTheme(pTheme);
78 m_StcTempPath.SetTheme(pTheme);
79
80 if(m_pOption==NULL){
81 EndDialog(IDCANCEL);
82 return TRUE;
83 }
84
85 // チェック状態設定
86 m_ChkBUFE.SetCheckState(m_pOption->bufe);
87 m_ChkTestWrite.SetCheckState(m_pOption->test_write);
88 m_ChkOnthefly.SetCheckState(m_pOption->on_the_fly);
89 m_ChkDAO.SetCheckState(m_pOption->dao);
90 m_ChkOutside.SetCheckState(m_pOption->outside);
91 // 有効/無効設定
92 m_ChkBUFE.EnableWindow((m_pOption->flags & OPFLG_BUFE)!=0);
93 m_ChkTestWrite.EnableWindow((m_pOption->flags & OPFLG_TESTWRITE)!=0);
94 m_ChkOnthefly.EnableWindow((m_pOption->flags & OPFLG_ONTHEFLY)!=0);
95 m_ChkDAO.EnableWindow((m_pOption->flags & OPFLG_DAO)!=0);
96 m_ChkOutside.EnableWindow((m_pOption->flags & OPFLG_OUTSIDE)!=0);
97 // 速度設定項目を設定
98 SetSpeedItems(&m_CmbReadSpeed, m_pOption->read_speed,
99 (m_pOption->flags & OPFLG_DVD)!=0,
100 m_pOption->readable_speed, m_pOption->num_readable_speed);
101 SetSpeedItems(&m_CmbWriteSpeed, m_pOption->write_speed,
102 (m_pOption->flags & OPFLG_DVD)!=0,
103 m_pOption->writable_speed, m_pOption->num_writable_speed);
104 // 一時ディレクトリのデフォルト設定
105 m_EdtTempPath.SetWindowText(m_pOption->temppath);
106 m_EdtTempPath.EnableWindow((m_pOption->flags & OPFLG_TEMPPATH)!=0);
107 m_EdtTempPath.SetLimitText(_MAX_PATH);
108
109 return TRUE; // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
110 // 例外: OCX プロパティ ページの戻り値は FALSE となります
111 }
112
113
114 void CSettingDlg::SetSpeedItems(CComboBox *pCB, int nDefaultSpeed, BOOL bDVD,
115 BYTE *speeds, int num_speeds)
116 {
117 int i;
118 char buf[32];
119
120 pCB->ResetContent();
121 pCB->AddString(bDVD ? "標準速" : "最大速");
122 for(i=0; i<num_speeds; i++){
123 _snprintf(buf, sizeof(buf), "%d倍速", speeds[i]);
124 pCB->AddString(buf);
125 if(speeds[i]==nDefaultSpeed){
126 pCB->SetCurSel(i+1);
127 }
128 }
129 if(pCB->GetCurSel() == CB_ERR){
130 pCB->SetCurSel(0);
131 }
132 }
133
134 void CSettingDlg::OnOK()
135 {
136 // TODO: この位置にその他の検証用のコードを追加してください
137 if((m_pOption->flags & OPFLG_BUFE)!=0)
138 m_pOption->bufe = m_ChkBUFE.GetCheckState();
139 if((m_pOption->flags & OPFLG_TESTWRITE)!=0)
140 m_pOption->test_write = m_ChkTestWrite.GetCheckState();
141 if((m_pOption->flags & OPFLG_ONTHEFLY)!=0)
142 m_pOption->on_the_fly = m_ChkOnthefly.GetCheckState();
143 if((m_pOption->flags & OPFLG_DAO)!=0)
144 m_pOption->dao = m_ChkDAO.GetCheckState();
145 if((m_pOption->flags & OPFLG_OUTSIDE)!=0)
146 m_pOption->outside = m_ChkOutside.GetCheckState();
147
148 CString csSpeed;
149 int sel;
150 sel = m_CmbReadSpeed.GetCurSel();
151 if(sel!=CB_ERR){
152 m_CmbReadSpeed.GetLBText(sel, csSpeed);
153 m_pOption->read_speed = atoi((LPCTSTR)csSpeed);
154 }
155 sel = m_CmbWriteSpeed.GetCurSel();
156 if(sel!=CB_ERR){
157 m_CmbWriteSpeed.GetLBText(sel, csSpeed);
158 m_pOption->write_speed = atoi((LPCTSTR)csSpeed);
159 }
160
161 if((m_pOption->flags & OPFLG_TEMPPATH)!=0)
162 m_EdtTempPath.GetWindowText(m_pOption->temppath, _MAX_PATH);
163
164 CDialog::OnOK();
165 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26