Esempio n. 1
0
 public SerMultiLineComment(MultiLineComment mlc)
 {
     Text            = mlc.Text;
     BoxMode         = mlc.BoxMode;
     MaxWidth        = mlc.MaxWidth;
     BackgroundColor = CommonWPF.Helper.ColorToInt(mlc.BackgroundColor);
 }
Esempio n. 2
0
 public SerMultiLineComment(MultiLineComment mlc)
 {
     Text            = mlc.Text;
     BoxMode         = mlc.BoxMode;
     MaxWidth        = mlc.MaxWidth;
     BackgroundColor = mlc.BackgroundColor.ToArgb();
 }
Esempio n. 3
0
        /// <summary>
        /// Creates an UndoableChange for a note update.
        /// </summary>
        /// <param name="offset">Affected offset.</param>
        /// <param name="oldNote">Current note.</param>
        /// <param name="newNote">New note.</param>
        /// <returns>Change record.</returns>
        public static UndoableChange CreateNoteChange(int offset,
                                                      MultiLineComment oldNote, MultiLineComment newNote)
        {
            if (oldNote == newNote)
            {
                Debug.WriteLine("No-op note change at +" + offset.ToString("x6") +
                                ": " + oldNote);
            }

            UndoableChange uc = new UndoableChange();

            uc.Type               = ChangeType.SetNote;
            uc.Offset             = offset;
            uc.OldValue           = oldNote;
            uc.NewValue           = newNote;
            uc.ReanalysisRequired = ReanalysisScope.None;
            return(uc);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates an UndoableChange for a long comment update.
        /// </summary>
        /// <param name="offset">Affected offset.</param>
        /// <param name="oldComment">Current comment.</param>
        /// <param name="newComment">New comment.</param>
        /// <returns>Change record.</returns>
        public static UndoableChange CreateLongCommentChange(int offset,
                                                             MultiLineComment oldComment, MultiLineComment newComment)
        {
            if (oldComment == newComment)
            {
                Debug.WriteLine("No-op long comment change at +" + offset.ToString("x6") +
                                ": " + oldComment);
            }

            UndoableChange uc = new UndoableChange();

            uc.Type               = ChangeType.SetLongComment;
            uc.Offset             = offset;
            uc.OldValue           = oldComment;
            uc.NewValue           = newComment;
            uc.ReanalysisRequired = ReanalysisScope.None;
            return(uc);
        }
Esempio n. 5
0
        private static bool DeserializeMlc(JavaScriptSerializer ser, string cereal, bool isNote,
                                           out MultiLineComment mlc)
        {
            mlc = null;
            SerMultiLineComment smlc;

            try {
                smlc = ser.Deserialize <SerMultiLineComment>(cereal);
            } catch (Exception ex) {
                Debug.WriteLine("Deserialization failed: " + ex.Message);
                return(false);
            }

            if (isNote)
            {
                mlc = new MultiLineComment(smlc.Text,
                                           CommonWPF.Helper.ColorFromInt(smlc.BackgroundColor));
            }
            else
            {
                mlc = new MultiLineComment(smlc.Text, smlc.BoxMode, smlc.MaxWidth);
            }
            return(true);
        }