private void mnLoadMotif_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = StringConstants.ABC_DIR; ofd.Filter = "ABC file (*.abc)|*.abc|All files (*.*)|*.*"; ofd.FilterIndex = 1; ofd.RestoreDirectory = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } string name = controller.generateDefaultMotifName(System.IO.Path.GetFileNameWithoutExtension(ofd.FileName)); Motif m = AbcFileReader.readFromFile(ofd.FileName); m.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m); this.controller.executeAction(action); controller.treeview_selectNode(m); }
private void mcmDuplicate_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Motif clonedMotif = m.Clone(); string name = controller.generateDefaultMotifName(m.getName() + "_copy"); clonedMotif.setName(name); ProgramAction action = new CreateMotifAction(controller, clonedMotif); this.controller.executeAction(action); }
private void mcmOrnamentate_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); OrnamentationVariation ornamentationVariation = new OrnamentationVariation(-1); Motif m2 = ornamentationVariation.variate(m); m2.setVariation(ornamentationVariation, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_ornament"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); }
private void mnNewMotif_Click(object sender, EventArgs e) { Forms.EditMotifForm emf = new Forms.EditMotifForm(new Motif(), this.controller); if (emf.ShowDialog() == DialogResult.OK) { Motif m2 = emf.editedMotif; string name = controller.generateDefaultMotifName("motif"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }
private void mcmRachmaninoffInversion_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); RachmaninoffInversionVariation rachmaninoffInversionVariation = new RachmaninoffInversionVariation(); Motif m2 = rachmaninoffInversionVariation.variate(m); m2.setVariation(rachmaninoffInversionVariation, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_inversion_Rachmaninoff"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); }
private void mcmEditMotif_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Forms.EditMotifForm emf = new Forms.EditMotifForm(m, this.controller); if (emf.ShowDialog() == DialogResult.OK) { Motif m2 = emf.editedMotif; m2.setVariation(new NullVariation(), m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_edited"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }
private void mcmTonalTransport_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Forms.TonalTransportVariationForm ttvf = new Forms.TonalTransportVariationForm(); if (ttvf.ShowDialog() == DialogResult.OK) { TonalTransportVariation tonalTransport = new TonalTransportVariation(ttvf.orig, ttvf.dest); Motif m2 = tonalTransport.variate(m); m2.setVariation(tonalTransport, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_tonaltransp"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }
private void mcmModulate_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Forms.ModulationVariationForm mvf = new Forms.ModulationVariationForm(); if (mvf.ShowDialog() == DialogResult.OK) { ModulationVariation modulationVariation = new ModulationVariation(mvf.newTonality); Motif m2 = modulationVariation.variate(m); m2.setVariation(modulationVariation, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_modulation"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }
private void mcmChangeNoteDuration_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Forms.NoteValueVariationForm nvv = new Forms.NoteValueVariationForm(); if (nvv.ShowDialog() == DialogResult.OK) { NoteValueVariation nvVariation = new NoteValueVariation(nvv.multiplier); Motif m2 = nvVariation.variate(m); m2.setVariation(nvVariation, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_changeNoteDuration"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }
private void mcmDelay_Click(object sender, EventArgs e) { Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Forms.DelayVariationForm dvf = new Forms.DelayVariationForm(); if (dvf.ShowDialog() == DialogResult.OK) { DelayVariation transportVariation = new DelayVariation(dvf.delay); Motif m2 = transportVariation.variate(m); m2.setVariation(transportVariation, m.getId()); string name = controller.generateDefaultMotifName(m.getName() + "_delay"); m2.setName(name); ProgramAction action = new CreateMotifAction(this.controller, m2); this.controller.executeAction(action); controller.treeview_selectNode(m2); } }