public void buttonAdd_Click(Object sender, EventArgs e) { // 追加し, VibratoHandle handle = new VibratoHandle(); handle.setCaption("No-Name"); mHandles.Add(handle); listPresets.SelectedIndices.Clear(); // 表示反映させて updateStatus(); // 追加したのを選択状態にする listPresets.SelectedIndex = mHandles.Count - 1; }
public void textName_TextChanged(Object sender, EventArgs e) { if (mSelected == null) { return; } mSelected.setCaption(textName.Text); int index = listPresets.SelectedIndex; if (index >= 0) { listPresets.Items[index] = mSelected.getCaption(); } }
/// <summary> /// ビブラートの選択肢の状態を更新します /// </summary> private void updateComboBoxStatus() { // 選択位置 int old = comboVibratoType.SelectedIndex; // 全部削除 comboVibratoType.Items.Clear(); // 「ビブラート無し」を表すアイテムを追加 VibratoHandle empty = new VibratoHandle(); empty.setCaption("[Non Vibrato]"); empty.IconID = "$04040000"; comboVibratoType.Items.Add(empty); // 選択元を元に,選択肢を追加する if (radioUserDefined.Checked) { // ユーザー定義のを使う場合 int size = AppManager.editorConfig.AutoVibratoCustom.Count; for (int i = 0; i < size; i++) { VibratoHandle handle = AppManager.editorConfig.AutoVibratoCustom[i]; comboVibratoType.Items.Add(handle); } } else { // VOCALOID1/VOCALOID2のシステム定義のを使う場合 SynthesizerType type = radioVocaloid1.Checked ? SynthesizerType.VOCALOID1 : SynthesizerType.VOCALOID2; foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(type)) { comboVibratoType.Items.Add(vconfig); } } // 選択位置を戻せるなら戻す int index = old; if (index >= comboVibratoType.Items.Count) { index = comboVibratoType.Items.Count - 1; } if (0 <= index) { comboVibratoType.SelectedIndex = index; } }