public void AddNote(int length, int index, string pitch, DockPanel panelToAddNote) { RollElement noteToAdd = new RollElement(); int spaceToLeft = getAllLeftSpace(panelToAddNote); foreach (RollElement note in panelToAddNote.Children) { spaceToLeft -= ((int)note.Width + (int)note.Margin.Left); } noteToAdd.Height = 24; noteToAdd.Width = length; noteToAdd.Margin = new Thickness(spaceToLeft, 0, 0, 0); noteToAdd.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; noteToAdd.Pitch = pitch; noteToAdd.ElementPropertiesChanged += Roll_ElementPropertiesChanged; noteToAdd.ElementRemoved += Roll_ElementRemoved; noteToAdd.ElementSelected += Roll_ElementSelected; noteToAdd.NoteIndex = index; noteToAdd.BPM = baseTempo; panelToAddNote.Children.Insert(index - countNotesNotOnLane(panelToAddNote), noteToAdd); Note n = noteToAdd.ElementNote; n.VoiceProperties = oRead.GetVoicePropFromSampleName(n.DispName); noteSheet.notes.Insert(index, n); totalNotes++; }
void Roll_ElementRemoved(RollElement sender) { noteSheet.notes.RemoveAt(sender.NoteIndex); try { foreach (DockPanel notePane in notePanel.Children) { foreach (RollElement note in notePane.Children) { if (note.NoteIndex == sender.NoteIndex + 1) { note.Margin = new Thickness(note.Margin.Left - sender.Width, 0, 0, 0); } } } } catch (Exception) { } }
private void bkgCanvas_MouseDown(object sender, MouseButtonEventArgs e) { if (!mouseOverNote) { MouseDownLoc = (int)Mouse.GetPosition(bkgCanvas).X; tempNote = new RollElement(); tempNote.Width = 40; tempNote.Height = 24; tempNote.Opacity = 0.5; bkgCanvas.Children.Add(tempNote); Canvas.SetLeft(tempNote, Mouse.GetPosition(bkgCanvas).X); Canvas.SetTop(tempNote, (int)Mouse.GetPosition(bkgCanvas).Y / 24 * 24); } isCreatingNote = true; }
private void displayNote_ElementPropertiesChanged(RollElement sender) { noteSheet.notes[sender.NoteIndex].VoiceProperties = otoRead.GetVoicePropFromSampleName(sender.NoteName); }
private void displayNote_ElementRemoved(RollElement sender) { noteSheet.notes.RemoveAt(sender.NoteIndex); foreach (RollElement dispNote in bkgCanvas.Children) { if (dispNote.NoteIndex >= sender.NoteIndex) { Canvas.SetLeft(dispNote, Canvas.GetLeft(dispNote) - sender.Width); } } bkgCanvas.Children.Remove(sender); totalNotesLength -= (int)sender.Width; for (int i = 0; i < bkgCanvas.Children.Count; i++) { ((RollElement)bkgCanvas.Children[i]).NoteIndex = i; } dataDisp.Text = "Removed note " + sender.NoteIndex.ToString() + ", \r\nnumber of display notes: " + bkgCanvas.Children.Count.ToString() + "\r\nnumber of logical notes: " + noteSheet.notes.Count.ToString(); }
void displayNote_ElementMouseDown(RollElement sender) { if (sender.IsMouseOverResize) { isSizingNote = true; currentNoteIndex = sender.NoteIndex; mouseDownNoteSize = (int)sender.Width; MouseDownLoc = (int)Mouse.GetPosition(bkgCanvas).X - (int)sender.Width; Cursor = Cursors.SizeWE; } else if (Mouse.RightButton == MouseButtonState.Pressed) { } else { isMovingNote = true; currentNoteIndex = sender.NoteIndex; tempNote = new RollElement(); tempNote.Width = sender.Width; tempNote.Height = 24; tempNote.Opacity = 0.5; //bkgCanvas.Children.Add(tempNote); //Canvas.SetLeft(tempNote, Mouse.GetPosition(bkgCanvas).X); //Canvas.SetTop(tempNote, (int)Mouse.GetPosition(bkgCanvas).Y / 24 * 24); } }
void displayNote_ElementMouseUp(RollElement sender) { }
/// <summary> /// Add a note to NoteSheet and add a RollElement representing the note /// to this control. /// </summary> /// <param name="location">The refrence point for locating the note. The note /// will be further positioned to line up to the nearest lane. </param> /// <param name="length">The display length of the note. </param> /// <param name="index">the index to insert the note at, or -1 to /// add to the end of the list. </param> public void AddNote(Point location, int length, int index) { RollElement displayNote = new RollElement(); Note logicalNote; displayNote.Width = length; displayNote.Height = 24; displayNote.BPM = internalBpm; displayNote.ElementPropertiesChanged += displayNote_ElementPropertiesChanged; displayNote.ElementRemoved += displayNote_ElementRemoved; displayNote.NoteIndex = index; displayNote.MouseEnter += displayNote_MouseEnter; displayNote.MouseLeave += displayNote_MouseLeave; displayNote.ElementMouseDown += displayNote_ElementMouseDown; displayNote.ElementMouseUp += displayNote_ElementMouseUp; bkgCanvas.Children.Add(displayNote); Canvas.SetLeft(displayNote, location.X); Canvas.SetTop(displayNote, location.Y); logicalNote = displayNote.ElementNote; logicalNote.NotePitch = generatePitchString((int)location.Y); logicalNote.VoiceProperties = otoRead.GetVoicePropFromSampleName(logicalNote.DispName); noteSheet.notes.Insert(index, logicalNote); //System.Windows.Forms.MessageBox.Show(noteSheet.notes[index].DispName + " " + // noteSheet.notes[index].Length.ToString() + " " + noteSheet.notes[index].NotePitch); }
void Roll_ElementPropertiesChanged(RollElement sender) { noteSheet.notes[sender.NoteIndex].DispName = sender.NoteName; noteSheet.notes[sender.NoteIndex].VoiceProperties = oRead.GetVoicePropFromSampleName(sender.NoteName); }
void Roll_ElementSelected(RollElement sender, bool isSelected) { }
void Roll_ElementRemoved(RollElement sender) { noteSheet.notes.RemoveAt(sender.NoteIndex); try { foreach (DockPanel notePane in notePanel.Children) { foreach (RollElement note in notePane.Children) { if (note.NoteIndex == sender.NoteIndex + 1) note.Margin = new Thickness(note.Margin.Left - sender.Width, 0, 0, 0); } } } catch (Exception) { } }
public void AddNote(int length, int index, string pitch, DockPanel panelToAddNote) { RollElement noteToAdd = new RollElement(); int spaceToLeft = getAllLeftSpace(panelToAddNote); foreach (RollElement note in panelToAddNote.Children) spaceToLeft -= ((int)note.Width + (int)note.Margin.Left); noteToAdd.Height = 24; noteToAdd.Width = length; noteToAdd.Margin = new Thickness(spaceToLeft, 0, 0, 0); noteToAdd.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; noteToAdd.Pitch = pitch; noteToAdd.ElementPropertiesChanged += Roll_ElementPropertiesChanged; noteToAdd.ElementRemoved += Roll_ElementRemoved; noteToAdd.ElementSelected += Roll_ElementSelected; noteToAdd.NoteIndex = index; noteToAdd.BPM = baseTempo; panelToAddNote.Children.Insert(index - countNotesNotOnLane(panelToAddNote), noteToAdd); Note n = noteToAdd.ElementNote; n.VoiceProperties = oRead.GetVoicePropFromSampleName(n.DispName); noteSheet.notes.Insert(index, n); totalNotes++; }