private void pcmPaste_Click(object sender, EventArgs e) { int track = selectedPastePosition.Key; Duration startTime = selectedPastePosition.Value; ProgramAction action = new InsertMotifAction(this.controller, this.selectedCopyMotifId, track, startTime); this.controller.executeAction(action); }
private void playlist_DragDrop(object sender, DragEventArgs e) { if (e.Effect == DragDropEffects.Copy) { Motif motif = this.controller.getMotifFromName(this.motifTreeView.SelectedNode.Text); Point relativePoint = playlist.PointToClient(new Point(e.X, e.Y)); KeyValuePair <int, Duration> position = this.playlist.getClickPosition(relativePoint.X, relativePoint.Y); int track = position.Key; Duration startTime = position.Value; if (track >= controller.trackCount()) { return; //off range } if (!controller.fitsMotif(motif, track, startTime)) { return; } ProgramAction action = new InsertMotifAction(this.controller, motif.getId(), track, startTime); this.controller.executeAction(action); mnUndo.Enabled = true; mnRedo.Enabled = false; } }