public void comboAttackTemplate_SelectedIndexChanged(Object sender, EventArgs e) { int index = comboAttackTemplate.SelectedIndex; if (index < 0) { return; } if (index == 0) { m_note_head_handle = null; txtDuration.Enabled = false; trackDuration.Enabled = false; txtDepth.Enabled = false; trackDepth.Enabled = false; return; } txtDuration.Enabled = true; trackDuration.Enabled = true; txtDepth.Enabled = true; trackDepth.Enabled = true; NoteHeadHandle aconfig = (NoteHeadHandle)comboAttackTemplate.SelectedItem; if (m_note_head_handle == null) { txtDuration.Text = aconfig.getDuration() + ""; txtDepth.Text = aconfig.getDepth() + ""; } m_note_head_handle = (NoteHeadHandle)aconfig.clone(); m_note_head_handle.setDuration(trackDuration.Value); m_note_head_handle.setDepth(trackDepth.Value); }
public FormNoteExpressionConfig(SynthesizerType type, NoteHeadHandle note_head_handle) { InitializeComponent(); registerEventHandlers(); setResources(); Util.applyFontRecurse(this, AppManager.editorConfig.getBaseFont()); applyLanguage(); if (note_head_handle != null) { m_note_head_handle = (NoteHeadHandle)note_head_handle.clone(); } if (type == SynthesizerType.VOCALOID1) { flowLayoutPanel.Controls.Remove(groupDynamicsControl); flowLayoutPanel.Controls.Remove(panelVocaloid2Template); flowLayoutPanel.Controls.Remove(groupPitchControl); } else { flowLayoutPanel.Controls.Remove(groupAttack); } //comboAttackTemplateを更新 NoteHeadHandle empty = new NoteHeadHandle(); comboAttackTemplate.Items.Clear(); empty.IconID = "$01010000"; empty.setCaption("[Non Attack]"); comboAttackTemplate.Items.Add(empty); comboAttackTemplate.SelectedItem = empty; string icon_id = ""; if (m_note_head_handle != null) { icon_id = m_note_head_handle.IconID; txtDuration.Text = m_note_head_handle.getDuration() + ""; txtDepth.Text = m_note_head_handle.getDepth() + ""; } else { txtDuration.Enabled = false; txtDepth.Enabled = false; trackDuration.Enabled = false; trackDepth.Enabled = false; } foreach (var item in VocaloSysUtil.attackConfigIterator(SynthesizerType.VOCALOID1)) { comboAttackTemplate.Items.Add(item); if (item.IconID.Equals(icon_id)) { comboAttackTemplate.SelectedItem = comboAttackTemplate.Items[comboAttackTemplate.Items.Count - 1]; } } comboAttackTemplate.SelectedIndexChanged += new EventHandler(comboAttackTemplate_SelectedIndexChanged); comboTemplate.Items.Clear(); string[] strs = new string[] { "[Select a template]", "normal", "accent", "strong accent", "legato", "slow legate", }; for (int i = 0; i < strs.Length; i++) { comboTemplate.Items.Add(strs[i]); } Size current_size = this.ClientSize; this.ClientSize = new Size(current_size.Width, flowLayoutPanel.ClientSize.Height + flowLayoutPanel.Top * 2); this.FormBorderStyle = FormBorderStyle.FixedDialog; }