示例#1
0
        public void ClearSelect()
        {
            bool isSingle = false;

            if (NoteSelectIndexs.Count == 1)
            {
                isSingle = true;
            }
            NoteSelectIndexs.Clear();
            if (isSingle && NoteSelecting != null)
            {
                NoteSelecting(-1);
            }
            if (NoteSelectListChange != null)
            {
                NoteSelectListChange(NoteSelectIndexs);
            }
        }
示例#2
0
 void PianoWindow_TrackMouseClick(object sender, PianoMouseEventArgs e)
 {
     if (NoteDragingWork == NoteDragingType.NoteMove)
     {
         if (CurrentNoteIndex > -1)
         {
             if (e.Tick - NoteTempTick == NoteList[CurrentNoteIndex].Tick)
             {
                 if (Control.ModifierKeys != Keys.Control &&
                     Control.ModifierKeys != Keys.Shift)
                 {
                     ClearSelect();
                 }
                 if (Control.ModifierKeys == Keys.Shift && NoteSelectIndexs.Count > 0)
                 {
                     for (int i = Math.Min(NoteSelectIndexs[NoteSelectIndexs.Count - 1], CurrentNoteIndex); i <= Math.Max(NoteSelectIndexs[NoteSelectIndexs.Count - 1], CurrentNoteIndex); i++)
                     {
                         if (!NoteSelectIndexs.Contains(i))
                         {
                             NoteSelectIndexs.Add(i);
                         }
                     }
                     if (NoteSelectListChange != null)
                     {
                         NoteSelectListChange(NoteSelectIndexs);
                     }
                 }
                 else
                 {
                     NoteSelectIndexs.Add(CurrentNoteIndex);
                     if (NoteSelecting != null && NoteSelectIndexs.Count == 1)
                     {
                         NoteSelecting(NoteSelectIndexs[0]);
                     }
                     if (NoteSelectListChange != null)
                     {
                         NoteSelectListChange(NoteSelectIndexs);
                     }
                 }
             }
         }
     }
 }
示例#3
0
 public void NoteDelete()
 {
     if (NoteSelectIndexs.Count > 0)
     {
         if (NoteActionBegin != null)
         {
             NoteActionBegin(NoteDragingType.NoteDelete);
         }
         NoteSelectIndexs.Sort();
         int First = NoteSelectIndexs[0];
         int Last  = NoteSelectIndexs[NoteSelectIndexs.Count - 1];
         for (int i = Last; i >= First; i--)
         {
             NoteList.RemoveAt(i);
         }
         int Sp = First - 1;
         int Se = First;
         if (Sp < 0)
         {
             Sp = 0;
         }
         ClearSelect();
         PartsObject.PitchCompiler.SetupBasePitch_Aysnc(new Formats.Model.VocalObject.ParamTranslater.PitchCompiler.AsyncWorkCallbackHandler((F, L) =>
         {
             this.PianoWindow.Invoke(new Action(() => { this.PianoWindow.RedrawPiano(); }));
         }), Sp, Se);
         if (this.SingerDataFinder != null)
         {
             PartsObject po = PartsObject;
             int         Lp = Se;
             if (Sp > 0)
             {
                 Lp = Sp;
             }
             this.SingerDataFinder.GetPhonemesDictionary(PartsObject).UpdateLyrics_Aysnc(new Formats.Model.Database.VocalDatabase.SplitDictionary.AsyncWorkCallbackHandler((P, F, L) => {
             }), ref po, Lp, Lp);;
         }
         if (NoteActionEnd != null)
         {
             NoteActionEnd(NoteDragingType.NoteDelete);
         }
     }
 }
示例#4
0
        public void EditNoteLyric(int StartIndex = -1)
        {
            if (StartIndex == -1 && CurrentNoteIndex > -1)
            {
                StartIndex = CurrentNoteIndex;
            }
            else if (StartIndex == -1 && NoteSelectIndexs.Count > 0)
            {
                StartIndex = NoteSelectIndexs[0];
            }
            if (StartIndex > -1)
            {
                int    BeginIndex = StartIndex;
                string Lyric2     = "";
                if (NoteSelectIndexs.IndexOf(StartIndex) != -1)
                {
                    List <string> Lyrics   = new List <string>();
                    int           MinIndex = StartIndex;
                    int           MaxIndex = StartIndex;
                    for (int i = 0; i < NoteSelectIndexs.Count; i++)
                    {
                        MinIndex = Math.Min(NoteSelectIndexs[i], MinIndex);
                        MaxIndex = Math.Max(NoteSelectIndexs[i], MaxIndex);
                    }
                    for (int i = MinIndex; i <= MaxIndex; i++)
                    {
                        Lyrics.Add(NoteList[i].Lyric);
                    }

                    Lyric2     = Microsoft.VisualBasic.Interaction.InputBox("Input New Lyric", "Input Lyric", String.Join(" ", Lyrics.ToArray()));
                    BeginIndex = MinIndex;
                }
                else
                {
                    Lyric2     = Microsoft.VisualBasic.Interaction.InputBox("Input New Lyric", "Input Lyric", NoteList[StartIndex].Lyric);
                    BeginIndex = StartIndex;
                }
                if (Lyric2 != "")
                {
                    if (NoteActionBegin != null)
                    {
                        NoteActionBegin(NoteDragingType.LyricEdit);
                    }
                    string[] NLyric = Lyric2.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < NLyric.Length; i++)
                    {
                        if ((BeginIndex + i) >= NoteList.Count)
                        {
                            break;
                        }
                        if (NoteList[BeginIndex + i].Lyric != NLyric[i])
                        {
                            NoteList[BeginIndex + i].Lyric = NLyric[i];
                            if (this.SingerDataFinder != null)
                            {
                                PartsObject po = PartsObject;
                                this.SingerDataFinder.GetPhonemesDictionary(PartsObject).UpdateLyrics(ref po, BeginIndex + i);
                            }
                        }
                    }
                    if (NoteActionEnd != null)
                    {
                        NoteActionEnd(NoteDragingType.LyricEdit);
                    }
                }
            }
        }