Example #1
0
 private void parseCleanup()
 {
     foreach (LogAtom atom in dirty)
     {
         Matchers.reparseAtom(atom);
     }
     dirty.Clear();
 }
        private void RebuildScrollingList()
        {
            object selection = myListBoxSections.SelectedItem;

            displayList.Clear();

            TrackObjectRec[] tracks = new List <TrackObjectRec>(document.TrackList).ToArray();

            /* set stable sort subkey */
            for (int i = 0; i < tracks.Length; i++)
            {
                tracks[i].AuxVal = i;
            }

            Array.Sort(
                tracks,
                delegate(TrackObjectRec left, TrackObjectRec right)
            {
                return(Synthesizer.SynthStateRec.CompareTracksOnSection(left, right, document.SectionList));
            });

            SectionObjectRec section  = null;
            bool             firstTry = true;

            for (int i = 0; i < tracks.Length; i++)
            {
                TrackObjectRec track = tracks[i];

                /* create the section name header */
                if (firstTry || (section != track.Section))
                {
                    firstTry = false;
                    section  = track.Section;
                    if (section == null)
                    {
                        displayList.Add((string)"(Default)");
                    }
                    else
                    {
                        displayList.Add(section);
                    }
                }

                /* add the track item */
                displayList.Add(track);
            }

            /* add any sections we missed */
            for (int j = 0; j < document.SectionList.Count; j++)
            {
                section = document.SectionList[j];

                bool referenced = false;
                for (int i = 0; !referenced && (i < tracks.Length); i++)
                {
                    TrackObjectRec track = document.TrackList[i];
                    if (track.Section == section)
                    {
                        referenced = true;
                    }
                }

                if (!referenced)
                {
                    displayList.Add(section);
                }
            }

            for (int i = 0; i < displayList.Count; i++)
            {
                if (selection == displayList[i])
                {
                    myListBoxSections.SelectItem(i, true /*clearOtherSelections*/);
                }
            }
        }