public EditableTextFlowLayer(TextEditRenderBox owner) : base(owner) { this.owner = owner; //start with single line per layer //and can change to multiline lineCollection = new EditableTextLine(this); }
public InternalTextLayerController( TextEditRenderBox visualTextSurface, EditableTextFlowLayer textLayer) { this.visualTextSurface = visualTextSurface; textLineWriter = new TextLineWriter(textLayer); backGroundTextLineWriter = textLineWriter.GetBackgroundWriter(); commandHistory = new DocumentCommandCollection(this); this.textMan = new TextMan(this, visualTextSurface); #if DEBUG if (dbugEnableTextManRecorder) { dbugTextManRecorder = new dbugMultiTextManRecorder(); textLineWriter.dbugTextManRecorder = dbugTextManRecorder; throw new NotSupportedException(); dbugTextManRecorder.Start(null); } #endif }
public static void NotifyTextContentSizeChanged(TextEditRenderBox ts) { ts.BoxEvaluateScrollBar(); }
public void SetMonitoringTextSurface(TextEditRenderBox textSurfaceElement) { this.targetTextSurface = textSurfaceElement; }
public void Clear() { CancelSelect(); textLineWriter.Clear(); TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface); }
void JoinWithNextLine() { textLineWriter.JoinWithNextLine(); TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface); }
VisualSelectionRangeSnapShot RemoveSelectedText() { #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.WriteInfo("TxLMan::RemoveSelectedText"); _dbugActivityRecorder.BeginContext(); } #endif if (selectionRange == null) { #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.WriteInfo("NO_SEL_RANGE"); _dbugActivityRecorder.EndContext(); } #endif return(VisualSelectionRangeSnapShot.Empty); } else if (!selectionRange.IsValid) { #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.WriteInfo("!RANGE_ON_SAME_POINT"); } #endif CancelSelect(); #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.EndContext(); } #endif return(VisualSelectionRangeSnapShot.Empty); } selectionRange.SwapIfUnOrder(); VisualSelectionRangeSnapShot selSnapshot = selectionRange.GetSelectionRangeSnapshot(); VisualPointInfo startPoint = selectionRange.StartPoint; CurrentLineNumber = startPoint.LineId; int preCutIndex = startPoint.LineCharIndex; textLineWriter.SetCurrentCharIndex(startPoint.LineCharIndex); if (selectionRange.IsOnTheSameLine) { List <EditableRun> tobeDeleteTextRuns = new List <EditableRun>(); textLineWriter.CopySelectedTextRuns(selectionRange, tobeDeleteTextRuns); if (tobeDeleteTextRuns != null && tobeDeleteTextRuns.Count > 0) { commandHistory.AddDocAction( new DocActionDeleteRange(tobeDeleteTextRuns, selSnapshot.startLineNum, selSnapshot.startColumnNum, selSnapshot.endLineNum, selSnapshot.endColumnNum)); textLineWriter.RemoveSelectedTextRuns(selectionRange); updateJustCurrentLine = true; } } else { int startPointLindId = startPoint.LineId; int startPointCharIndex = startPoint.LineCharIndex; List <EditableRun> tobeDeleteTextRuns = new List <EditableRun>(); textLineWriter.CopySelectedTextRuns(selectionRange, tobeDeleteTextRuns); if (tobeDeleteTextRuns != null && tobeDeleteTextRuns.Count > 0) { commandHistory.AddDocAction( new DocActionDeleteRange(tobeDeleteTextRuns, selSnapshot.startLineNum, selSnapshot.startColumnNum, selSnapshot.endLineNum, selSnapshot.endColumnNum)); textLineWriter.RemoveSelectedTextRuns(selectionRange); updateJustCurrentLine = false; textLineWriter.MoveToLine(startPointLindId); textLineWriter.SetCurrentCharIndex(startPointCharIndex); } } CancelSelect(); TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface); #if DEBUG if (dbugEnableTextManRecorder) { _dbugActivityRecorder.EndContext(); } #endif return(selSnapshot); }
internal TextMan(InternalTextLayerController innerTextMan, TextEditRenderBox visualTextSurface) { this.innerTextMan = innerTextMan; this.visualTextSurface = visualTextSurface; }
public override RenderElement GetPrimaryRenderElement(RootGraphic rootgfx) { if (textEditRenderElement == null) { var tbox = new TextEditRenderBox(rootgfx, this.Width, this.Height, _multiline); tbox.SetLocation(this.Left, this.Top); tbox.HasSpecificSize = true; if (this.defaultSpanStyle.IsEmpty()) { this.defaultSpanStyle = new TextSpanStyle(); this.defaultSpanStyle.FontInfo = rootgfx.DefaultTextEditFontInfo; tbox.CurrentTextSpanStyle = this.defaultSpanStyle; } else { tbox.CurrentTextSpanStyle = this.defaultSpanStyle; } tbox.BackgroundColor = this.backgroundColor; tbox.SetController(this); if (this.textSurfaceListener != null) { tbox.TextSurfaceListener = textSurfaceListener; } this.textEditRenderElement = tbox; if (userTextContent != null) { this.Text = userTextContent; userTextContent = null;//clear } } return textEditRenderElement; }