private void ChangeSymbolSelection(Button ActiveButton, MusicalSymbolDuration Duration, MusicalSymbolType Symbol) { if (SelectedSymbolButton != null) { SelectedSymbolButton.BackColor = Color.FromName("Control"); } SelectedDuration = Duration; SelectedSymbolButton = ActiveButton; SelectedSymbol = Symbol; SelectedSymbolButton.BackColor = Color.FromName("ActiveCaption"); }
public void ManageModeNote(IncipitViewer viewer, int index, EditeurMode SelectedMode, int X, int Y, MusicalSymbolType SelectedSymbol, MusicalSymbolDuration SelectedDuration, Color SelectedColor) { string noteName = new StringBuilder().Append(Convert.ToChar((29 - ((Y + 2) / 4)) % 7 + 65)).ToString(); // E = B int noteOctave = (48 - ((Y + 2) / 4)) / 7; //MessageBox.Show("X = "+X+", Y = "+Y+" / "+noteName+" "+noteOctave); if (SelectedMode == EditeurMode.Delete) { DeleteSlur(viewer, index); viewer.RemoveMusicalSymbolAt(index); } if (SelectedMode == EditeurMode.Edit) { Note tmp = new Note(noteName, 0, noteOctave, SelectedDuration, SelectedColor, NoteStemDirection.Up, NoteTieType.None, (SelectedDuration > MusicalSymbolDuration.Quarter ? ((Note)viewer.IncipitElement(index)).BeamList : new List <NoteBeamType>() { NoteBeamType.Single })); if (SelectedDuration <= MusicalSymbolDuration.Quarter) { ManageModeBeam(viewer, index, EditeurMode.Delete); } if (tmp.Step == ((Note)viewer.IncipitElement(index)).Step && tmp.Octave == ((Note)viewer.IncipitElement(index)).Octave) { tmp.TieType = ((Note)viewer.IncipitElement(index)).TieType; } else { ManageModeTie(viewer, index, EditeurMode.Delete); } tmp.Slur = ((Note)viewer.IncipitElement(index)).Slur; viewer.RemoveMusicalSymbolAt(index); viewer.InciptInsert(index, tmp); } if (SelectedMode == EditeurMode.Add) { if (SelectedSymbol == MusicalSymbolType.Note) { viewer.InciptInsert( index, new Note(noteName, 0, noteOctave, SelectedDuration, SelectedColor, NoteStemDirection.Up, NoteTieType.StopAndStartAnother, new List <NoteBeamType>() { NoteBeamType.Continue }) ); ManageModeTie(viewer, index, EditeurMode.Delete); ManageModeBeam(viewer, index, EditeurMode.Delete); } else if (SelectedSymbol == MusicalSymbolType.Rest) { viewer.InciptInsert( index, new Rest(SelectedDuration, SelectedColor) ); } // Notes.Insert(i * linenb, new NoteSymb(new StringBuilder().Append(Convert.ToChar((40 - ((Y + 2) / 4)) % 7 + 65)).ToString(), 0, (38 - ((Y + 2) / 4)) / 7, SelectedDuration, SelectedColor)); } }
public MusicalSybols(MusicalSymbolType SymbType, MusicalSymbolDuration SymbDuration, Color SymbColor) { duration = SymbDuration; type = SymbType; objectcolor = SymbColor; }
public MusicalSybols(MusicalSymbolType SymbType, MusicalSymbolDuration SymbDuration) { duration = SymbDuration; type = SymbType; objectcolor = Color.Black; }
private void viewer_Click(object sender, EventArgs e) { List <int[]> line = viewer.linesCoord; int linenb = 0; bool foundY = false; #region Get Line for (int i = 0; i < line.Count; i++) { if (line[i][0] <= Y && Y <= line[i][1]) { Y -= line[i][0]; line = viewer.noteCoord[i]; foundY = true; break; } else { linenb += viewer.noteCoord[i].Count - 1; } } if (!foundY) { return; } #endregion #region Get Colone int col = -1; for (int i = 0; i < line.Count; i++) { if (line[i][0] <= X && X <= line[i][1]) { // 1 - 2 - 3 - 4 - 5 - 6 - 7 // A - B - C - D - E - F - G // La - Si - Do - Re - Mi - Fa - Sol /* * MessageBox.Show(string.Format("Num: {0} Note: {1} Octave: {2} #Note Found", * ((Y + 2) / 4), * Convert.ToChar((40 - ((Y + 2) / 4)) % 7 + 65), * (38 - ((Y + 2) / 4)) / 7)); * /* */ col = i; break; } } if (col == -1) { col = line.Count; } for (int count = 0; count < col + linenb; count++) { if (viewer.IncipitElement(count) != null) { MusicalSymbolType tmp = viewer.IncipitElement(count).Type; if (tmp != MusicalSymbolType.Note && tmp != MusicalSymbolType.Rest) { col++; } } } #endregion int index = col + linenb - 1; if (index < 0) { index = 0; } if (viewer.CountMusicalSymbols() > index || (SelectedSecondaryMode == Controller.EditeurMode.Note && SelectedMode == Controller.EditeurMode.Add)) { if (SelectedSecondaryMode == Controller.EditeurMode.Slur) { ctrl.ManageModeSlur(viewer, index, SelectedMode); } else if (SelectedSecondaryMode == Controller.EditeurMode.Note) { ctrl.ManageModeNote(viewer, index, SelectedMode, X, Y, SelectedSymbol, SelectedDuration, SelectedColor); } else if (SelectedSecondaryMode == Controller.EditeurMode.Tie) { ctrl.ManageModeTie(viewer, index, SelectedMode); } else if (SelectedSecondaryMode == Controller.EditeurMode.Beam) { ctrl.ManageModeBeam(viewer, index, SelectedMode); } } Display(); }
public MusicalSymbol() { type = MusicalSymbolType.Unknown; }