OSDN Git Service

5a1863555f43e23ce3664d4d347651af3dcd77fb
[dtxmania/dtxmania.git] / DTXCreator / コード / 03.オプション関連 / Cオプション管理.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows.Forms;
5
6 namespace DTXCreator.オプション関連
7 {
8         internal class Cオプション管理
9         {
10                 public Cオプション管理( Cメインフォーム pメインフォーム )
11                 {
12                         this.formメインフォーム = pメインフォーム;
13                 }
14                 public void tオプションダイアログを開いて編集し結果をアプリ設定に格納する()
15                 {
16                         Cオプションダイアログ cオプションダイアログ = new Cオプションダイアログ();
17                         #region [ Generalタブ ]
18                         cオプションダイアログ.checkBoxオートフォーカス.CheckState = this.formメインフォーム.appアプリ設定.AutoFocus ? CheckState.Checked : CheckState.Unchecked;
19                         cオプションダイアログ.checkBox最近使用したファイル.CheckState = this.formメインフォーム.appアプリ設定.ShowRecentFiles ? CheckState.Checked : CheckState.Unchecked;
20                         cオプションダイアログ.numericUpDown最近使用したファイルの最大表示個数.Value = this.formメインフォーム.appアプリ設定.RecentFilesNum;
21                         cオプションダイアログ.checkBoxPreviewBGM.CheckState = this.formメインフォーム.appアプリ設定.NoPreviewBGM ? CheckState.Checked : CheckState.Unchecked;
22                         cオプションダイアログ.checkBoxPlaySoundOnChip.CheckState = this.formメインフォーム.appアプリ設定.PlaySoundOnWAVChipAllocated ? CheckState.Checked : CheckState.Unchecked;
23                         cオプションダイアログ.radioButton_SelectMode.Checked = this.formメインフォーム.appアプリ設定.InitialOperationMode;
24                         cオプションダイアログ.radioButton_EditMode.Checked = !this.formメインフォーム.appアプリ設定.InitialOperationMode;
25                         #endregion
26                         #region [ Laneタブ ]
27                         if ( !cオプションダイアログ.bレーンリストの内訳が生成済みである )
28                         {
29                                 cオプションダイアログ.tレーンリストの内訳を生成する( this.formメインフォーム.mgr譜面管理者.listレーン );
30                         }
31                         #endregion
32                         #region [ Viewerタブ ]
33                         cオプションダイアログ.radioButton_UseDTXViewer.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.bViewerIsDTXV;
34                         cオプションダイアログ.radioButton_UseDTXManiaGR.Checked = !this.formメインフォーム.appアプリ設定.ViewerInfo.bViewerIsDTXV;
35
36                         cオプションダイアログ.groupBox_SoundDeviceSettings.Enabled = !this.formメインフォーム.appアプリ設定.ViewerInfo.bViewerIsDTXV;
37                         cオプションダイアログ.radioButton_DirectSound.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.SoundType == FDK.ESoundDeviceType.DirectSound;
38                         cオプションダイアログ.radioButton_WASAPI_Exclusive.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.SoundType == FDK.ESoundDeviceType.ExclusiveWASAPI;
39                         cオプションダイアログ.radioButton_WASAPI_Shared.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.SoundType == FDK.ESoundDeviceType.SharedWASAPI;
40                         cオプションダイアログ.radioButton_ASIO.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.SoundType == FDK.ESoundDeviceType.ASIO;
41
42                         int nASIOdevs = cオプションダイアログ.tASIOデバイスリストの内訳を生成する();
43                         if ( nASIOdevs <= this.formメインフォーム.appアプリ設定.ViewerInfo.ASIODeviceNo )   // ASIOの構成が変わった(機器が減った)場合は、ASIOを使わない
44                         {
45                                 this.formメインフォーム.appアプリ設定.ViewerInfo.ASIODeviceNo = 0;
46                                 cオプションダイアログ.radioButton_ASIO.Checked = false;
47                                 cオプションダイアログ.radioButton_DirectSound.Checked = true;
48                         }
49                         cオプションダイアログ.comboBox_ASIOdevices.SelectedIndex = this.formメインフォーム.appアプリ設定.ViewerInfo.ASIODeviceNo;
50                         if ( nASIOdevs == 1 && cオプションダイアログ.comboBox_ASIOdevices.Items[ 0 ].ToString() == "None" )
51                         {
52                                 cオプションダイアログ.radioButton_ASIO.Enabled = false;
53                         }
54
55                         cオプションダイアログ.checkBox_GRmode.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.GRmode;
56                         cオプションダイアログ.checkBox_TimeStretch.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.TimeStretch;
57                         cオプションダイアログ.checkBox_VSyncWait.Checked = this.formメインフォーム.appアプリ設定.ViewerInfo.VSyncWait;
58                         #endregion
59
60
61
62                         if( cオプションダイアログ.ShowDialog() == DialogResult.OK )
63                         {
64                                 this.formメインフォーム.appアプリ設定.AutoFocus = cオプションダイアログ.checkBoxオートフォーカス.Checked;
65                                 this.formメインフォーム.appアプリ設定.ShowRecentFiles = cオプションダイアログ.checkBox最近使用したファイル.Checked;
66                                 this.formメインフォーム.appアプリ設定.RecentFilesNum = (int) cオプションダイアログ.numericUpDown最近使用したファイルの最大表示個数.Value;
67                                 this.formメインフォーム.appアプリ設定.NoPreviewBGM = cオプションダイアログ.checkBoxPreviewBGM.Checked;
68                                 this.formメインフォーム.appアプリ設定.PlaySoundOnWAVChipAllocated = cオプションダイアログ.checkBoxPlaySoundOnChip.Checked;
69
70                                 this.formメインフォーム.appアプリ設定.InitialOperationMode = cオプションダイアログ.radioButton_SelectMode.Checked;
71                                 
72                                 for ( int i = 0; i < this.formメインフォーム.mgr譜面管理者.listレーン.Count; i++ )
73                                 {
74                                         DTXCreator.譜面.Cレーン.ELaneType e = this.formメインフォーム.mgr譜面管理者.listレーン[ i ].eLaneType;
75                                         int index = cオプションダイアログ.checkedListBoxLaneSelectList.FindStringExact( e.ToString() );
76                                         bool ch = cオプションダイアログ.checkedListBoxLaneSelectList.GetItemChecked( index );
77                                         this.formメインフォーム.mgr譜面管理者.listレーン[ i ].bIsVisible = ch;
78                                 }
79
80                                 #region [ Viewer設定 ]
81                                 this.formメインフォーム.appアプリ設定.ViewerInfo.bViewerIsDTXV = cオプションダイアログ.radioButton_UseDTXViewer.Checked;
82
83                                 //AppSetting.ViewerSoundType vst = ( FDK.COS.bIsVistaOrLater ) ? AppSetting.ViewerSoundType.WASAPI : AppSetting.ViewerSoundType.DirectSound;
84                                 FDK.ESoundDeviceType vst = ( FDK.COS.bIsVistaOrLater() ) ? FDK.ESoundDeviceType.ExclusiveWASAPI :  FDK.ESoundDeviceType.DirectSound;
85                                 if ( cオプションダイアログ.radioButton_DirectSound.Checked )
86                                 {
87                                         //vst = AppSetting.ViewerSoundType.DirectSound;
88                                         vst = FDK.ESoundDeviceType.DirectSound;
89                                 }
90                                 else if ( cオプションダイアログ.radioButton_WASAPI_Exclusive.Checked )
91                                 {
92                                         //vst = AppSetting.ViewerSoundType.WASAPI;
93                                         vst = FDK.ESoundDeviceType.ExclusiveWASAPI;
94                                 }
95                                 else if ( cオプションダイアログ.radioButton_WASAPI_Shared.Checked )
96                                 {
97                                         //vst = AppSetting.ViewerSoundType.WASAPI;
98                                         vst = FDK.ESoundDeviceType.SharedWASAPI;
99                                 }
100                                 else if ( cオプションダイアログ.radioButton_ASIO.Checked )
101                                 {
102                                         //vst = AppSetting.ViewerSoundType.ASIO;
103                                         vst = FDK.ESoundDeviceType.ASIO;
104                                 }
105                                 this.formメインフォーム.appアプリ設定.ViewerInfo.SoundType = vst;
106
107                                 this.formメインフォーム.appアプリ設定.ViewerInfo.ASIODeviceNo = cオプションダイアログ.comboBox_ASIOdevices.SelectedIndex;
108
109                                 this.formメインフォーム.appアプリ設定.ViewerInfo.GRmode = cオプションダイアログ.checkBox_GRmode.Checked;
110                                 this.formメインフォーム.appアプリ設定.ViewerInfo.TimeStretch = cオプションダイアログ.checkBox_TimeStretch.Checked;
111                                 this.formメインフォーム.appアプリ設定.ViewerInfo.VSyncWait = cオプションダイアログ.checkBox_VSyncWait.Checked;
112
113                                 this.formメインフォーム.tDTXV演奏関連のボタンとメニューのEnabledの設定();
114
115                                 #endregion
116
117                                 this.formメインフォーム.t最近使ったファイルをFileメニューへ追加する();
118                         }
119                 }
120
121                 #region [ private ]
122                 //-----------------
123                 private Cメインフォーム formメインフォーム;
124                 //-----------------
125                 #endregion
126         }
127 }