コード例 #1
0
        /// <summary>
        /// Gets the state object from a scintilla control
        /// </summary>
        private static StateObject GetStateObject(ScintillaControl sci)
        {
            StateObject so = new StateObject();

            so.LineCount = sci.LineCount;
            so.Position  = sci.CurrentPos;
            so.FileName  = sci.FileName;
            for (Int32 line = 0;; line++)
            {
                Int32 lineNext = sci.ContractedFoldNext(line);
                if ((line < 0) || (lineNext < line))
                {
                    break;
                }
                line = lineNext;
                so.FoldedLines.Add(line);
            }
            Int32 lineBookmark = -1;

            while ((lineBookmark = sci.MarkerNext(lineBookmark + 1, 1 << 0)) >= 0)
            {
                so.BookmarkedLines.Add(lineBookmark);
            }
            return(so);
        }