2 using System.Collections.Generic;
4 using System.Windows.Forms;
5 using System.ComponentModel;
6 using DTXCreator.Properties;
9 namespace DTXCreator.譜面
11 public partial class C検索ダイアログ : Form
13 public static bool b前回値_チップ範囲指定 = true;
14 public static bool[] b前回値_レーンリストチェック = null;
15 public static bool b前回値_レーン指定 = false;
16 public static bool b前回値_小節範囲指定 = false;
17 public static bool b前回値_表チップ = true;
18 public static bool b前回値_裏チップ = true;
19 public static string[] str前回値_レーンリスト = null;
21 public bool bチップ範囲指定CheckBoxがチェックされている
25 return this.checkBoxチップ範囲指定.Checked;
28 public bool bレーンリストの内訳が生成済みである
32 if( str前回値_レーンリスト == null )
39 public bool bレーン指定CheckBoxがチェックされている
43 return this.checkBoxレーン指定.Checked;
46 public bool b小節範囲指定CheckBoxがチェックされている
50 return this.checkBox小節範囲指定.Checked;
53 public bool b表チップCheckBoxがチェックされている
57 return this.checkBox表チップ.Checked;
60 public bool b裏チップCheckBoxがチェックされている
64 return this.checkBox裏チップ.Checked;
71 if( this.textBoxチップ範囲開始.Text.Length > 0 )
73 string num = this.textBoxチップ範囲開始.Text;
78 return C変換.n36進数2桁の文字列を数値に変換して返す( num );
80 if( this.textBoxチップ範囲終了.Text.Length <= 0 )
84 string text = this.textBoxチップ範囲終了.Text;
85 if( text.Length == 1 )
89 return C変換.n36進数2桁の文字列を数値に変換して返す( text );
96 if( this.textBoxチップ範囲終了.Text.Length > 0 )
98 string num = this.textBoxチップ範囲終了.Text;
103 return C変換.n36進数2桁の文字列を数値に変換して返す( num );
105 if( this.textBoxチップ範囲開始.Text.Length <= 0 )
109 string text = this.textBoxチップ範囲開始.Text;
110 if( text.Length == 1 )
114 return C変換.n36進数2桁の文字列を数値に変換して返す( text );
122 if( this.textBox小節範囲開始.Text.Length > 0 )
125 if( !int.TryParse( this.textBox小節範囲開始.Text, out num ) )
131 if( this.textBox小節範囲終了.Text.Length <= 0 )
135 if( !int.TryParse( this.textBox小節範囲終了.Text, out num2 ) )
147 if( this.textBox小節範囲終了.Text.Length > 0 )
150 if( !int.TryParse( this.textBox小節範囲終了.Text, out num ) )
156 if( this.textBox小節範囲開始.Text.Length <= 0 )
160 if( !int.TryParse( this.textBox小節範囲開始.Text, out num2 ) )
170 this.InitializeComponent();
171 this.checkBoxレーン指定.CheckState = b前回値_レーン指定 ? CheckState.Checked : CheckState.Unchecked;
172 this.checkBoxチップ範囲指定.CheckState = b前回値_チップ範囲指定 ? CheckState.Checked : CheckState.Unchecked;
173 this.checkBox小節範囲指定.CheckState = b前回値_小節範囲指定 ? CheckState.Checked : CheckState.Unchecked;
174 this.checkBox表チップ.CheckState = b前回値_表チップ ? CheckState.Checked : CheckState.Unchecked;
175 this.checkBox裏チップ.CheckState = b前回値_裏チップ ? CheckState.Checked : CheckState.Unchecked;
176 if( ( str前回値_レーンリスト != null ) && ( str前回値_レーンリスト.Length > 0 ) )
178 for( int i = 0; i < str前回値_レーンリスト.Length; i++ )
180 this.checkedListBoxレーン選択リスト.Items.Add( str前回値_レーンリスト[ i ], b前回値_レーンリストチェック[ i ] );
183 this.tチェックに連動して有効無効が決まるパーツについてEnabledを設定する();
185 public bool bレーンが検索対象である( int nレーン番号 )
187 if( ( nレーン番号 < 0 ) || ( nレーン番号 >= this.checkedListBoxレーン選択リスト.Items.Count ) )
191 if( this.checkedListBoxレーン選択リスト.GetItemCheckState( nレーン番号 ) != CheckState.Checked )
197 public void tレーンリストの内訳を生成する( string[] strリスト要素 )
199 b前回値_レーンリストチェック = new bool[ strリスト要素.Length ];
200 for( int i = 0; i < strリスト要素.Length; i++ )
202 this.checkedListBoxレーン選択リスト.Items.Add( strリスト要素[ i ] );
203 b前回値_レーンリストチェック[ i ] = false;
205 str前回値_レーンリスト = strリスト要素;
208 private void tチェックに連動して有効無効が決まるパーツについてEnabledを設定する()
210 bool flag = this.checkBoxレーン指定.Checked;
211 this.buttonALL.Enabled = flag;
212 this.buttonNONE.Enabled = flag;
213 this.checkedListBoxレーン選択リスト.Enabled = flag;
214 flag = this.checkBoxチップ範囲指定.Checked;
215 this.textBoxチップ範囲開始.Enabled = flag;
216 this.textBoxチップ範囲終了.Enabled = flag;
217 flag = this.checkBox小節範囲指定.Checked;
218 this.textBox小節範囲開始.Enabled = flag;
219 this.textBox小節範囲終了.Enabled = flag;
222 private void C検索ダイアログ_FormClosing( object sender, FormClosingEventArgs e )
224 if( base.DialogResult == DialogResult.OK )
226 string text = this.textBoxチップ範囲開始.Text;
227 if( text.Length == 1 )
231 if( ( text.Length > 0 ) && ( ( text.Length > 2 ) || ( C変換.n36進数2桁の文字列を数値に変換して返す( text ) == -1 ) ) )
233 MessageBox.Show( Resources.strチップ番号に誤りがありますMSG + Environment.NewLine + "'" + text + "'", Resources.strエラーダイアログのタイトル, MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
234 this.textBoxチップ範囲開始.Focus();
235 this.textBoxチップ範囲開始.SelectAll();
240 text = this.textBoxチップ範囲終了.Text;
241 if( text.Length == 1 )
245 if( ( text.Length > 0 ) && ( ( text.Length > 2 ) || ( C変換.n36進数2桁の文字列を数値に変換して返す( text ) == -1 ) ) )
247 MessageBox.Show( Resources.strチップ番号に誤りがありますMSG + Environment.NewLine + "'" + text + "'", Resources.strエラーダイアログのタイトル, MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
248 this.textBoxチップ範囲終了.Focus();
249 this.textBoxチップ範囲終了.SelectAll();
255 text = this.textBox小節範囲開始.Text;
256 if( ( text.Length > 0 ) && ( !int.TryParse( text, out num ) || ( num < 0 ) ) )
258 MessageBox.Show( Resources.str小節番号に誤りがありますMSG + Environment.NewLine + "'" + text + "'", Resources.strエラーダイアログのタイトル, MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
259 this.textBox小節範囲開始.Focus();
260 this.textBox小節範囲開始.SelectAll();
265 text = this.textBox小節範囲終了.Text;
266 if( ( text.Length > 0 ) && ( !int.TryParse( text, out num ) || ( num < 0 ) ) )
268 MessageBox.Show( Resources.str小節番号に誤りがありますMSG + Environment.NewLine + "'" + text + "'", Resources.strエラーダイアログのタイトル, MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
269 this.textBox小節範囲終了.Focus();
270 this.textBox小節範囲終了.SelectAll();
275 b前回値_レーン指定 = this.checkBoxレーン指定.Checked;
276 b前回値_チップ範囲指定 = this.checkBoxチップ範囲指定.Checked;
277 b前回値_小節範囲指定 = this.checkBox小節範囲指定.Checked;
278 b前回値_表チップ = this.checkBox表チップ.Checked;
279 b前回値_裏チップ = this.checkBox裏チップ.Checked;
280 for( int i = 0; i < this.checkedListBoxレーン選択リスト.Items.Count; i++ )
282 b前回値_レーンリストチェック[ i ] = this.checkedListBoxレーン選択リスト.GetItemCheckState( i ) == CheckState.Checked;
290 private void C検索ダイアログ_KeyDown( object sender, KeyEventArgs e )
292 if( e.KeyCode == Keys.Return )
294 this.buttonOK.PerformClick();
296 else if( e.KeyCode == Keys.Escape )
298 this.buttonキャンセル.PerformClick();
301 private void textBoxチップ範囲開始_KeyDown( object sender, KeyEventArgs e )
303 if( e.KeyCode == Keys.Return )
305 this.buttonOK.PerformClick();
307 else if( e.KeyCode == Keys.Escape )
309 this.buttonキャンセル.PerformClick();
312 private void textBoxチップ範囲終了_KeyDown( object sender, KeyEventArgs e )
314 if( e.KeyCode == Keys.Return )
316 this.buttonOK.PerformClick();
318 else if( e.KeyCode == Keys.Escape )
320 this.buttonキャンセル.PerformClick();
323 private void textBox小節範囲開始_KeyDown( object sender, KeyEventArgs e )
325 if( e.KeyCode == Keys.Return )
327 this.buttonOK.PerformClick();
329 else if( e.KeyCode == Keys.Escape )
331 this.buttonキャンセル.PerformClick();
334 private void textBox小節範囲終了_KeyDown( object sender, KeyEventArgs e )
336 if( e.KeyCode == Keys.Return )
338 this.buttonOK.PerformClick();
340 else if( e.KeyCode == Keys.Escape )
342 this.buttonキャンセル.PerformClick();
345 private void checkBox小節範囲指定_CheckStateChanged( object sender, EventArgs e )
347 this.tチェックに連動して有効無効が決まるパーツについてEnabledを設定する();
349 private void checkBox小節範囲指定_KeyDown( object sender, KeyEventArgs e )
351 if( e.KeyCode == Keys.Return )
353 this.buttonOK.PerformClick();
355 else if( e.KeyCode == Keys.Escape )
357 this.buttonキャンセル.PerformClick();
360 private void checkBoxチップ範囲指定_CheckStateChanged( object sender, EventArgs e )
362 this.tチェックに連動して有効無効が決まるパーツについてEnabledを設定する();
364 private void checkBoxチップ範囲指定_KeyDown( object sender, KeyEventArgs e )
366 if( e.KeyCode == Keys.Return )
368 this.buttonOK.PerformClick();
370 else if( e.KeyCode == Keys.Escape )
372 this.buttonキャンセル.PerformClick();
375 private void checkBoxレーン指定_CheckStateChanged( object sender, EventArgs e )
377 this.tチェックに連動して有効無効が決まるパーツについてEnabledを設定する();
379 private void checkBoxレーン指定_KeyDown( object sender, KeyEventArgs e )
381 if( e.KeyCode == Keys.Return )
383 this.buttonOK.PerformClick();
385 else if( e.KeyCode == Keys.Escape )
387 this.buttonキャンセル.PerformClick();
390 private void checkedListBoxレーン選択リスト_KeyDown( object sender, KeyEventArgs e )
392 if( e.KeyCode == Keys.Return )
394 this.buttonOK.PerformClick();
396 else if( e.KeyCode == Keys.Escape )
398 this.buttonキャンセル.PerformClick();
401 private void checkBox表チップ_KeyDown( object sender, KeyEventArgs e )
403 if( e.KeyCode == Keys.Return )
405 this.buttonOK.PerformClick();
407 else if( e.KeyCode == Keys.Escape )
409 this.buttonキャンセル.PerformClick();
412 private void checkBox裏チップ_KeyDown( object sender, KeyEventArgs e )
414 if( e.KeyCode == Keys.Return )
416 this.buttonOK.PerformClick();
418 else if( e.KeyCode == Keys.Escape )
420 this.buttonキャンセル.PerformClick();
423 private void buttonNONE_Click( object sender, EventArgs e )
425 for( int i = 0; i < this.checkedListBoxレーン選択リスト.Items.Count; i++ )
427 this.checkedListBoxレーン選択リスト.SetItemCheckState( i, CheckState.Unchecked );
430 private void buttonNONE_KeyDown( object sender, KeyEventArgs e )
432 if( e.KeyCode == Keys.Escape )
434 this.buttonキャンセル.PerformClick();
437 private void buttonALL_Click( object sender, EventArgs e )
439 for( int i = 0; i < this.checkedListBoxレーン選択リスト.Items.Count; i++ )
441 this.checkedListBoxレーン選択リスト.SetItemChecked( i, true );
444 private void buttonALL_KeyDown( object sender, KeyEventArgs e )
446 if( e.KeyCode == Keys.Escape )
448 this.buttonキャンセル.PerformClick();