/// <summary> /// Can be called by OrnamentSettingsForm when clearing the ornament settings. /// </summary> public void NewOrnamentSettingsForm() { if (_ornamentsForm != null) { DialogResult result = MessageBox.Show("Do you really want to replace the existing ornament settings?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { DeleteOrnamentsForm(); //_ornamentSettingsForm.Close(); //_ornamentSettingsForm = null; } } if (_ornamentsForm == null) { _ornamentsForm = new OrnamentsForm(this, _hostForm, _fsf); SetOrnamentControls(); _fsf.SetSettingsAreUnconfirmed(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton); _ornamentsForm.Show(); _ornamentsForm.BringToFront(); } }
public OrnamentSettings(PaletteForm paletteform) { OrnamentsForm osf = paletteform.OrnamentsForm; Debug.Assert(osf != null && osf.Ornaments != null); BasicChordFormSettings bcs = new BasicChordFormSettings(); /// relative durations bcs.Durations = M.StringToIntList(osf.BasicChordControl.DurationsTextBox.Text, ','); /// velocity increments bcs.Velocities = M.StringToByteList(osf.BasicChordControl.VelocitiesTextBox.Text, ','); /// transposition intervals bcs.MidiPitches = M.StringToByteList(osf.BasicChordControl.MidiPitchesTextBox.Text, ','); bcs.ChordOffs = M.StringToBoolList(osf.BasicChordControl.ChordOffsTextBox.Text, ','); bcs.ChordDensities = M.StringToByteList(osf.BasicChordControl.ChordDensitiesTextBox.Text, ','); bcs.Inversions = paletteform.GetLinearInversions(osf.BasicChordControl.RootInversionTextBox.Text); bcs.InversionIndices = M.StringToIntList(osf.BasicChordControl.InversionIndicesTextBox.Text, ','); bcs.VerticalVelocityFactors = M.StringToFloatList(osf.BasicChordControl.VerticalVelocityFactorsTextBox.Text, ','); BasicChordMidiSettings = new BasicChordMidiSettings(bcs); // if BankIndices or PatchIndices != null, their values override the values in the upper BasicMidiChord if (osf.BankIndicesTextBox.Text == "") { BankIndices = null; } else { BankIndices = M.StringToByteList(osf.BankIndicesTextBox.Text, ','); } if (osf.PatchIndicesTextBox.Text == "") { PatchIndices = null; } else { PatchIndices = M.StringToByteList(osf.PatchIndicesTextBox.Text, ','); } OrnamentValues = osf.Ornaments; }
private void DeleteOrnamentsForm() { if(_ornamentsForm != null) { _fsf.Remove(_ornamentsForm); _ornamentsForm.Close(); _ornamentsForm = null; ShowOrnamentSettingsButton.Enabled = false; DeleteOrnamentSettingsButton.Enabled = false; OrnamentNumbersTextBox.Text = ""; OrnamentNumbersHelpLabel.Text = ""; OrnamentNumbersLabel.Enabled = false; OrnamentNumbersTextBox.Enabled = false; OrnamentNumbersHelpLabel.Enabled = false; MinMsDurationsTextBox.Text = ""; MinMsDurationsHelpLabel.Text = ""; MinMsDurationsLabel.Enabled = false; MinMsDurationsTextBox.Enabled = false; MinMsDurationsHelpLabel.Enabled = false; SetSettingsHaveChanged(); } }
public void ReadPalette(XmlReader r) { Debug.Assert(r.Name == "name" || r.Name == "domain" || r.Name == "percussion"); // attributes Debug.Assert(_bcc != null); #region BankIndicesTextBox.Text = ""; PatchIndicesTextBox.Text = ""; PitchwheelDeviationsTextBox.Text = ""; PitchwheelEnvelopesTextBox.Text = ""; PanEnvelopesTextBox.Text = ""; ModulationWheelEnvelopesTextBox.Text = ""; ExpressionEnvelopesTextBox.Text = ""; OrnamentNumbersTextBox.Text = ""; MinMsDurationsTextBox.Text = ""; #endregion M.ReadToXmlElementTag(r, "basicChord"); while(r.Name == "basicChord" || r.Name == "bankIndices" || r.Name == "patchIndices" || r.Name == "repeats" || r.Name == "pitchwheelDeviations" || r.Name == "pitchwheelEnvelopes" || r.Name == "panEnvelopes" || r.Name == "modulationWheelEnvelopes" || r.Name == "expressionEnvelopes" || r.Name == "audioFiles" || r.Name == "ornamentNumbers" || r.Name == "ornamentMinMsDurations" || r.Name == "ornamentSettings") { if(r.NodeType != XmlNodeType.EndElement) { switch(r.Name) { case "basicChord": _bcc.ReadBasicChordControl(r); break; case "bankIndices": BankIndicesTextBox.Text = r.ReadElementContentAsString(); break; case "patchIndices": PatchIndicesTextBox.Text = r.ReadElementContentAsString(); break; case "pitchwheelDeviations": PitchwheelDeviationsTextBox.Text = r.ReadElementContentAsString(); break; case "pitchwheelEnvelopes": PitchwheelEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "panEnvelopes": PanEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "modulationWheelEnvelopes": ModulationWheelEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "expressionEnvelopes": ExpressionEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "audioFiles": if(_paletteButtonsControl != null) { _paletteButtonsControl.ReadAudioFiles(r); } break; case "ornamentNumbers": OrnamentNumbersTextBox.Text = r.ReadElementContentAsString(); break; case "ornamentMinMsDurations": MinMsDurationsTextBox.Text = r.ReadElementContentAsString(); break; case "ornamentSettings": _ornamentsForm = new OrnamentsForm(r, this, _hostForm, _fsf); ShowOrnamentSettingsButton.Enabled = true; DeleteOrnamentSettingsButton.Enabled = true; break; } } M.ReadToXmlElementTag(r, "palette", "basicChord", "bankIndices", "patchIndices", "repeats", "pitchwheelDeviations", "pitchwheelEnvelopes", "panEnvelopes", "modulationWheelEnvelopes", "expressionEnvelopes", "audioFiles", "ornamentNumbers", "ornamentMinMsDurations", "ornamentSettings"); } Debug.Assert(r.Name == "palette"); // end element SetOrnamentControls(); TouchAllTextBoxes(); _fsf.SetSettingsAreSaved(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton); }
/// <summary> /// Can be called by OrnamentSettingsForm when clearing the ornament settings. /// </summary> public void NewOrnamentSettingsForm() { if(_ornamentsForm != null) { DialogResult result = MessageBox.Show("Do you really want to replace the existing ornament settings?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); if(result == DialogResult.Yes) { DeleteOrnamentsForm(); //_ornamentSettingsForm.Close(); //_ornamentSettingsForm = null; } } if(_ornamentsForm == null) { _ornamentsForm = new OrnamentsForm(this, _hostForm, _fsf); SetOrnamentControls(); _fsf.SetSettingsAreUnconfirmed(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton); _ornamentsForm.Show(); _ornamentsForm.BringToFront(); } }
/// <summary> /// This form is deleted only by the AssistantComposer form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Delete() { if(_ornamentsForm != null) { _fsf.Remove(_ornamentsForm); _ornamentsForm.Close(); _ornamentsForm = null; } _fsf.Remove(this); CloseMidiPitchesHelpForm(); CloseMIDIInstrumentsHelpForm(); this.Close(); }
public void ReadPalette(XmlReader r) { Debug.Assert(r.Name == "name" || r.Name == "domain" || r.Name == "percussion"); // attributes Debug.Assert(_bcc != null); #region BankIndicesTextBox.Text = ""; PatchIndicesTextBox.Text = ""; PitchwheelDeviationsTextBox.Text = ""; PitchwheelEnvelopesTextBox.Text = ""; PanEnvelopesTextBox.Text = ""; ModulationWheelEnvelopesTextBox.Text = ""; ExpressionEnvelopesTextBox.Text = ""; OrnamentNumbersTextBox.Text = ""; MinMsDurationsTextBox.Text = ""; #endregion M.ReadToXmlElementTag(r, "basicChord"); while (r.Name == "basicChord" || r.Name == "bankIndices" || r.Name == "patchIndices" || r.Name == "repeats" || r.Name == "pitchwheelDeviations" || r.Name == "pitchwheelEnvelopes" || r.Name == "panEnvelopes" || r.Name == "modulationWheelEnvelopes" || r.Name == "expressionEnvelopes" || r.Name == "audioFiles" || r.Name == "ornamentNumbers" || r.Name == "ornamentMinMsDurations" || r.Name == "ornamentSettings") { if (r.NodeType != XmlNodeType.EndElement) { switch (r.Name) { case "basicChord": _bcc.ReadBasicChordControl(r); break; case "bankIndices": BankIndicesTextBox.Text = r.ReadElementContentAsString(); break; case "patchIndices": PatchIndicesTextBox.Text = r.ReadElementContentAsString(); break; case "pitchwheelDeviations": PitchwheelDeviationsTextBox.Text = r.ReadElementContentAsString(); break; case "pitchwheelEnvelopes": PitchwheelEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "panEnvelopes": PanEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "modulationWheelEnvelopes": ModulationWheelEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "expressionEnvelopes": ExpressionEnvelopesTextBox.Text = r.ReadElementContentAsString(); break; case "audioFiles": if (_paletteButtonsControl != null) { _paletteButtonsControl.ReadAudioFiles(r); } break; case "ornamentNumbers": OrnamentNumbersTextBox.Text = r.ReadElementContentAsString(); break; case "ornamentMinMsDurations": MinMsDurationsTextBox.Text = r.ReadElementContentAsString(); break; case "ornamentSettings": _ornamentsForm = new OrnamentsForm(r, this, _hostForm, _fsf); ShowOrnamentSettingsButton.Enabled = true; DeleteOrnamentSettingsButton.Enabled = true; break; } } M.ReadToXmlElementTag(r, "palette", "basicChord", "bankIndices", "patchIndices", "repeats", "pitchwheelDeviations", "pitchwheelEnvelopes", "panEnvelopes", "modulationWheelEnvelopes", "expressionEnvelopes", "audioFiles", "ornamentNumbers", "ornamentMinMsDurations", "ornamentSettings"); } Debug.Assert(r.Name == "palette"); // end element SetOrnamentControls(); TouchAllTextBoxes(); _fsf.SetSettingsAreSaved(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton); }
/// <summary> /// Returns false if the file already exists and the user cancels the save. /// </summary> /// <returns></returns> public void WritePalette(XmlWriter w) { w.WriteStartElement("palette"); w.WriteAttributeString("name", SavedName); w.WriteAttributeString("domain", _domain.ToString()); if (PercussionCheckBox.Checked) { w.WriteAttributeString("percussion", "1"); } _bcc.WriteBasicChordControl(w); if (!string.IsNullOrEmpty(this.BankIndicesTextBox.Text)) { w.WriteStartElement("bankIndices"); w.WriteString(BankIndicesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(this.PatchIndicesTextBox.Text)) { w.WriteStartElement("patchIndices"); w.WriteString(PatchIndicesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(PitchwheelDeviationsTextBox.Text)) { w.WriteStartElement("pitchwheelDeviations"); w.WriteString(PitchwheelDeviationsTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(PitchwheelEnvelopesTextBox.Text)) { w.WriteStartElement("pitchwheelEnvelopes"); w.WriteString(PitchwheelEnvelopesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(PanEnvelopesTextBox.Text)) { w.WriteStartElement("panEnvelopes"); w.WriteString(PanEnvelopesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(ModulationWheelEnvelopesTextBox.Text)) { w.WriteStartElement("modulationWheelEnvelopes"); w.WriteString(ModulationWheelEnvelopesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(this.ExpressionEnvelopesTextBox.Text)) { w.WriteStartElement("expressionEnvelopes"); w.WriteString(this.ExpressionEnvelopesTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (_paletteButtonsControl != null) { _paletteButtonsControl.WriteAudioFiles(w); } if (!string.IsNullOrEmpty(OrnamentNumbersTextBox.Text)) { w.WriteStartElement("ornamentNumbers"); w.WriteString(OrnamentNumbersTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (!string.IsNullOrEmpty(this.MinMsDurationsTextBox.Text)) { w.WriteStartElement("ornamentMinMsDurations"); w.WriteString(MinMsDurationsTextBox.Text.Replace(" ", "")); w.WriteEndElement(); } if (OrnamentsForm != null) { OrnamentsForm.WriteOrnamentSettingsForm(w); } w.WriteEndElement(); // closes the palette element _fsf.SetSettingsAreSaved(this, M.HasError(_allTextBoxes), ConfirmButton, RevertToSavedButton); }