NotifyTextContentSizeChanged() public static method

public static NotifyTextContentSizeChanged ( TextEditRenderBox ts ) : void
ts TextEditRenderBox
return void
        public void AddTextRunsToCurrentLine(IEnumerable <EditableRun> textRuns)
        {
            RemoveSelectedText();
            int  startLineNum   = textLineWriter.LineNumber;
            int  startCharIndex = textLineWriter.CharIndex;
            bool isRecordingHx  = EnableUndoHistoryRecording;

            EnableUndoHistoryRecording = false;
            foreach (EditableRun t in textRuns)
            {
                if (t.IsLineBreak)
                {
                    textLineWriter.SplitToNewLine();
                    CurrentLineNumber++;
                }
                else
                {
                    textLineWriter.AddTextSpan(t);
                }
            }
            EnableUndoHistoryRecording = isRecordingHx;
            commandHistory.AddDocAction(
                new DocActionInsertRuns(textRuns, startLineNum, startCharIndex,
                                        textLineWriter.LineNumber, textLineWriter.CharIndex));
            updateJustCurrentLine = false;
            TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
        }
Esempio n. 2
0
 public void SplitCurrentLineIntoNewLine()
 {
     RemoveSelectedText();
     commandHistory.AddDocAction(
         new DocActionSplitToNewLine(textLineWriter.LineNumber, textLineWriter.CharIndex));
     textLineWriter.SplitToNewLine();
     CurrentLineNumber++;
     updateJustCurrentLine = false;
     TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
 }
Esempio n. 3
0
 void JoinWithNextLine()
 {
     textLineWriter.JoinWithNextLine();
     TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
 }
Esempio n. 4
0
        VisualSelectionRangeSnapShot RemoveSelectedText()
        {
#if DEBUG
            if (dbugEnableTextManRecorder)
            {
                dbugTextManRecorder.WriteInfo("TxLMan::RemoveSelectedText");
                dbugTextManRecorder.BeginContext();
            }
#endif

            if (selectionRange == null)
            {
#if DEBUG
                if (dbugEnableTextManRecorder)
                {
                    dbugTextManRecorder.WriteInfo("NO_SEL_RANGE");
                    dbugTextManRecorder.EndContext();
                }
#endif
                return(VisualSelectionRangeSnapShot.Empty);
            }
            else if (!selectionRange.IsValid)
            {
#if DEBUG
                if (dbugEnableTextManRecorder)
                {
                    dbugTextManRecorder.WriteInfo("!RANGE_ON_SAME_POINT");
                }
#endif
                CancelSelect();
#if DEBUG
                if (dbugEnableTextManRecorder)
                {
                    dbugTextManRecorder.EndContext();
                }
#endif
                return(VisualSelectionRangeSnapShot.Empty);
            }
            selectionRange.SwapIfUnOrder();
            VisualSelectionRangeSnapShot selSnapshot = selectionRange.GetSelectionRangeSnapshot();
            VisualPointInfo startPoint = selectionRange.StartPoint;
            CurrentLineNumber = startPoint.LineId;
            int preCutIndex = startPoint.LineCharIndex;
            textLineWriter.CharIndex = startPoint.LineCharIndex;
            if (selectionRange.IsOnTheSameLine)
            {
                LinkedList <EditableRun> tobeDeleteTextRun = textLineWriter.CopySelectedTextRuns(selectionRange);
                if (tobeDeleteTextRun != null)
                {
                    commandHistory.AddDocAction(
                        new DocActionDeleteRange(tobeDeleteTextRun,
                                                 selSnapshot.startLineNum,
                                                 selSnapshot.startColumnNum,
                                                 selSnapshot.endLineNum,
                                                 selSnapshot.endColumnNum));
                    textLineWriter.RemoveSelectedTextRuns(selectionRange);
                    updateJustCurrentLine = true;
                }
            }
            else
            {
                int startPointLindId    = startPoint.LineId;
                int startPointCharIndex = startPoint.LineCharIndex;
                LinkedList <EditableRun> tobeDeleteTextRun = textLineWriter.CopySelectedTextRuns(selectionRange);
                if (tobeDeleteTextRun != null)
                {
                    commandHistory.AddDocAction(
                        new DocActionDeleteRange(tobeDeleteTextRun,
                                                 selSnapshot.startLineNum,
                                                 selSnapshot.startColumnNum,
                                                 selSnapshot.endLineNum,
                                                 selSnapshot.endColumnNum));
                    textLineWriter.RemoveSelectedTextRuns(selectionRange);
                    updateJustCurrentLine = false;
                    textLineWriter.MoveToLine(startPointLindId);
                    textLineWriter.CharIndex = startPointCharIndex;
                }
            }
            CancelSelect();
            TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
#if DEBUG
            if (dbugEnableTextManRecorder)
            {
                dbugTextManRecorder.EndContext();
            }
#endif
            return(selSnapshot);
        }
 public void Clear()
 {
     CancelSelect();
     textLineWriter.Clear();
     TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
 }