public override void ResetStatus() { foreach (SMWordBase wb in drawWords) { if (wb is SMWordToken) { SMWordToken wt = (SMWordToken)wb; wt.droppedItem = null; wt.editedText = ""; } } base.ResetStatus(); }
public override void DisplayAnswers() { drawWords.Clear(); foreach (string w in ExpectedTags()) { SMWordToken item = new SMWordToken(this.Font); item.text = w; item.tag = w; item.Draggable = SMDragResponse.Drag; item.Cardinality = SMConnectionCardinality.None; drawWords.Add(item); } base.DisplayAnswers(); }
public void SetNextEditableField() { SMWordToken firstEdit = null; bool catchEdit = false; SMWordToken nextEdit = null; foreach (SMWordBase wb in this.drawWords) { if (!(wb is SMWordToken)) { continue; } SMWordToken wt = (SMWordToken)wb; if (!wt.Editable) { continue; } if (firstEdit == null) { firstEdit = wt; } if (catchEdit) { catchEdit = false; nextEdit = wt; break; } if (wt.Focused) { wt.Focused = false; catchEdit = true; continue; } } if (catchEdit) { nextEdit = firstEdit; } if (nextEdit != null) { nextEdit.Focused = true; } }
private bool SendContentToToken(PVDragContext dc, SMWordToken wtk) { if (HasImmediateEvaluation) { if (wtk.tag != null && wtk.tag.Length > 0 && !wtk.tag.Equals(dc.draggedItem.Tag, StringComparison.CurrentCultureIgnoreCase)) { return(false); } } wtk.droppedItem = dc.draggedItem; drawWordsModified = true; return(true); }
public override GSCore ExecuteMessage(string token, GSCoreCollection args) { if (token.Equals("showNextPage")) { if (HasNextPage()) { CurrentPage++; } PostExecuteEvent("OnCurrentPageChanged"); } else if (token.Equals("showPrevPage")) { if (HasPrevPage()) { CurrentPage--; } PostExecuteEvent("OnCurrentPageChanged"); } else if (token.Equals("gotoNextEdit")) { SetNextEditableField(); } else if (token.Equals("acceptString")) { SMWordToken edit = GetFocusedEditField(); if (edit != null) { edit.AcceptString(args.getSafe(0).getStringValue()); } drawWordsModified = true; } else if (token.Equals("acceptEnter")) { SetNextEditableField(); } else if (token.Equals("acceptBack")) { SMWordToken edit = GetFocusedEditField(); if (edit != null) { edit.AcceptBack(); } drawWordsModified = true; } return(base.ExecuteMessage(token, args)); }
public SMWordToken GetFocusedEditField() { foreach (SMWordBase wb in this.drawWords) { if (!(wb is SMWordToken)) { continue; } SMWordToken wt = (SMWordToken)wb; if (wt.Editable && wt.Focused) { return(wt); } } return(null); }
public List <string> ExpectedTags() { string[] s = Tag.ToLower().Split(','); List <string> et = new List <string>(); et.AddRange(s); foreach (SMWordBase wd in drawWords) { if (wd is SMWordToken) { SMWordToken wt = (SMWordToken)wd; if (wt.Cardinality == SMConnectionCardinality.One && wd.tag != null && wd.tag.Length > 0) { et.Add(wd.tag); } } } return(et); }
public override void TextDidChange() { drawWords = SMWordToken.WordListFromString(Text, this); drawWordsModified = true; }
public override bool OnDropFinished(PVDragContext dc) { bool needUpdateDrawWords = false; /*if (this.Cardinality == SMConnectionCardinality.One && dc.draggedItem != null) * { * drawWords.Clear(); * DroppedItems.Clear(); * drawWordsModified = true; * needUpdateDrawWords = true; * } * else if (this.Cardinality == SMConnectionCardinality.Many) * { * needUpdateDrawWords = true; * } * else*/ { if (dc.draggedItem != null) { Point p = dc.lastPoint; p.Offset(-Area.Left, -Area.Top); SMWordToken lastToken = null; foreach (SMWordBase wt in drawWords) { if (wt is SMWordToken) { lastToken = wt as SMWordToken; } if (wt.rect.Contains(p)) { if (wt is SMWordToken) { SMWordToken wtk = (SMWordToken)wt; if (wtk.Editable) { wtk.AcceptString(dc.draggedItem.Tag); wtk.UIStateHover = false; drawWordsModified = true; return(true); } else if (wtk.Cardinality == SMConnectionCardinality.One || wtk.Cardinality == SMConnectionCardinality.Many) { wtk.UIStateHover = false; return(SendContentToToken(dc, wtk)); } } } } if (DropablesCount == 1 && lastToken != null) { return(SendContentToToken(dc, lastToken)); } } } if (base.OnDropFinished(dc) && needUpdateDrawWords) { SMWordBase wr = null; if (dc.draggedItem.Image != null) { wr = new SMWordImage(this.Font, dc.draggedItem); } else { wr = new SMWordText(this.Font, dc.draggedItem); } wr.Evaluation = this.HasImmediateEvaluation ? MNEvaluationType.Immediate : MNEvaluationType.Lazy; drawWords.Add(wr); drawWordsModified = true; return(true); } return(false); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="textBounds"></param> /// <param name="drawWords"></param> /// <param name="control"></param> /// <param name="RunningLine"></param> /// <param name="Columns">Value -1 means, that no paging is done, normaly columns are 1,2,3...</param> /// <param name="ColumnSeparatorWidth"></param> /// <param name="PageCount"></param> /// <returns></returns> public static SMRichLayout RecalculateWordsLayout(MNPageContext context, Rectangle textBounds, List <SMWordBase> drawWords, SMControl control, SMRunningLine RunningLine, int Columns) { textBounds.X = 0; textBounds.Y = 0; float lineY = textBounds.Y; float lineX = textBounds.X; float lineEnd = textBounds.Right; float lineHeight = 0f; float lineWidth = textBounds.Width; float columnWidth = textBounds.Width; int lineNo = 0; int columnNo = 0; int pageNo = 0; int rightX = textBounds.X; bool writeLineNo = false; bool isNewLine = false; bool isNewColumn = false; SMWordLine currLine = new SMWordLine(); SMRichLayout richLayout = new SMRichLayout(); richLayout.Lines = new List <SMWordLine>(); richLayout.Lines.Add(currLine); richLayout.DropablesCount = 0; //context.g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; if (Columns > 1) { columnWidth = textBounds.Width / Columns; lineWidth = textBounds.Width / Columns - control.ContentPadding.Left - control.ContentPadding.Right; lineX = textBounds.X + columnNo * columnWidth + control.ContentPadding.Left; lineEnd = lineX + lineWidth; } else { columnWidth = textBounds.Width; lineWidth = textBounds.Width - control.ContentPadding.Left - control.ContentPadding.Right; lineX = textBounds.X + control.ContentPadding.Left; lineEnd = lineX + lineWidth; } float bottom = textBounds.Bottom; bool isSpaceText = false; int startsWithParentheses = 0; bool isNewPage = false; // first placement of word tokens foreach (SMWordBase wt in drawWords) { isSpaceText = false; writeLineNo = true; isNewLine = false; isNewColumn = false; isNewPage = false; startsWithParentheses = 0; if (wt is SMWordSpecial) { SMWordSpecial spwt = (SMWordSpecial)wt; if (spwt.Type == SMWordSpecialType.Newline) { isNewLine = true; writeLineNo = false; } else if (spwt.Type == SMWordSpecialType.NewColumn) { isNewLine = false; writeLineNo = false; isNewColumn = true; } else if (spwt.Type == SMWordSpecialType.HorizontalLine) { wt.rect.Width = lineEnd - lineX - 1; wt.rect.Height = 20; } else if (spwt.Type == SMWordSpecialType.NewPage) { isNewPage = true; writeLineNo = false; } } else if (wt is SMWordToken) { SMWordToken wtk = (SMWordToken)wt; if (wtk.Cardinality == SMConnectionCardinality.One || wtk.Editable) { richLayout.DropablesCount++; } string s = wtk.GetCurrentText(); wt.rect.Size = context.g.MeasureString(s, wtk.Font.Font, textBounds.Width, StringFormat.GenericTypographic); } else if (wt is SMWordText) { SMWordText wtt = wt as SMWordText; if (wtt.Draggable != SMDragResponse.None && control.Draggable != wtt.Draggable) { control.Draggable = wtt.Draggable; } if (wtt.text.StartsWith("\"") || wtt.text.StartsWith("\u201c")) { SizeF sf = context.g.MeasureString("\u201c", wtt.Font.Font, textBounds.Width, StringFormat.GenericTypographic); startsWithParentheses = (int)sf.Width; } if (wtt.text.Equals(" ")) { wtt.rect.Size = context.g.MeasureString(wtt.text, wtt.Font.Font); isSpaceText = true; } else { wtt.rect.Size = context.g.MeasureString(wtt.text, wtt.Font.Font, textBounds.Width, StringFormat.GenericTypographic); } } else if (wt is SMWordImage) { SMWordImage wti = wt as SMWordImage; wti.rect.Size = wti.imageSize; } if (writeLineNo && !control.Autosize) { if ((lineX + wt.rect.Width > lineEnd) || RunningLine == SMRunningLine.SingleWord) { if (currLine.Count > 0) { isNewLine = true; } } } if (isNewLine) { if (currLine.Count == 0) { lineY += lineHeight * control.Paragraph.LineSpacing / 2; } else { lineY += lineHeight * control.Paragraph.LineSpacing; } currLine = new SMWordLine(); richLayout.Lines.Add(currLine); lineHeight = context.g.MeasureString("M", control.GetUsedFont()).Height / 2; lineNo++; if (Columns != -1 && !control.Autosize) { if (lineY + lineHeight > textBounds.Bottom) { isNewColumn = true; } } } if (isNewPage) { lineNo = 0; columnNo = 0; pageNo++; lineY = textBounds.Top; } if (isNewColumn) { columnNo++; lineNo = 0; if (columnNo >= Columns) { pageNo++; columnNo = 0; } lineY = textBounds.Top; } if (isNewLine || isNewColumn || isNewPage) { lineX = textBounds.X + columnNo * columnWidth + control.ContentPadding.Left; lineEnd = lineX + lineWidth; } if (writeLineNo) { if (currLine.Count == 0 && startsWithParentheses > 0) { wt.rect.X -= startsWithParentheses; lineX -= startsWithParentheses; } if (currLine.Count > 0 || !isSpaceText) { currLine.Add(wt); wt.LineNo = lineNo; wt.ColumnNo = columnNo; wt.PageNo = pageNo; wt.rect.Location = new PointF(lineX, lineY); lineX += wt.rect.Width; rightX = Math.Max(rightX, (int)lineX); } lineHeight = Math.Max(lineHeight, wt.rect.Height); writeLineNo = false; } } lineY += lineHeight * control.Paragraph.LineSpacing; // vertical alignment AdjustVerticaly(textBounds, richLayout.Lines, control.GetVerticalAlign()); // horizontal aligment AdjustLinesHorizontaly((int)lineWidth, control.GetHorizontalAlign(), richLayout.Lines); richLayout.Pages = pageNo + 1; richLayout.bottomY = (int)lineY + 1; richLayout.rightX = rightX + 1; return(richLayout); }
public override void ExportToHtml(MNExportContext ctx, int zorder, StringBuilder sbHtml, StringBuilder sbCss, StringBuilder sbJS) { sbHtml.Append("<div "); sbHtml.AppendFormat(" id=\"c{0}\" ", this.Id); sbHtml.AppendFormat(" style ='overflow-y:scroll;position:absolute;z-index:{0};", zorder); sbHtml.Append(Area.HtmlLTRB()); sbHtml.Append(Font.HtmlString() + Paragraph.Html() + ContentPaddingHtml()); sbHtml.Append("'>"); int tvid = 0; if (Text.IndexOf("<edit") >= 0 || Text.IndexOf("<drop") >= 0) { sbHtml.Append("<div style='display:flex;flex-direction:row;'>"); drawWords = SMWordToken.WordListFromString(Text, this); int previousCount = 0; foreach (SMWordBase wb in drawWords) { string elemId = string.Format("tv{0}_{1}", Id, tvid++); if (previousCount > 0) { sbHtml.AppendFormat("<div class=\"textViewElem\"> </div>"); } if (wb is SMWordImage wbi) { sbHtml.AppendFormat("<div class=\"textViewElem\"><img src=\"{0}\" width={1} height={2}></div>", ctx.GetFileNameFromImage(wbi.image), wbi.imageSize.Width, wbi.imageSize.Height); previousCount++; } else if (wb is SMWordSpecial wbs) { switch (wbs.Type) { case SMWordSpecialType.HorizontalLine: sbHtml.Append("<hr>"); previousCount = 0; break; case SMWordSpecialType.Newline: sbHtml.Append("</div>"); sbHtml.Append("<div style='display:flex;flex-direction:row;'>"); previousCount = 0; break; case SMWordSpecialType.NewPage: sbHtml.Append("</div>"); sbHtml.Append("<div style='display:flex;flex-direction:row;margin-top:16pt;'>"); previousCount = 0; break; case SMWordSpecialType.NewColumn: sbHtml.Append("</div>"); sbHtml.Append("<div style='display:flex;flex-direction:row;margin-top:16pt;'>"); previousCount = 0; break; } } else if (wb is SMWordText wbt) { sbHtml.AppendFormat("<div id=\"{1}\" class=\"textViewElem\">{0}</div>", wbt.text, elemId); previousCount++; } else if (wb is SMWordToken wbk) { if (wbk.Editable) { sbHtml.AppendFormat("<div class=\"textViewElem\"><input id=\"{2}\" type=text size={1} style='background:LightYellow;font-family:{0};font-size:100%;'></div>", Font.Name, wbk.tag.Length, elemId); } else { sbHtml.AppendFormat("<div id=\"{2}\" class=\"textViewElem dropable\" data-tag=\"{1}\">{0}</div>", wbk.text.Length > 0 ? wbk.text : "__________", wbk.tag, elemId); } previousCount++; } } sbHtml.Append("</div>"); } else { sbHtml.Append(this.Text.Replace("\n", "<br>")); } sbHtml.Append("</div>\n"); }
private void AppendTag(List <SMWordBase> list, StringBuilder word, TextTag tt, RunningFormat fmt) { // TODO switch (tt.tag) { case "draggable": fmt.dragResponse = SMDragResponse.Drag; break; case "/draggable": ClearWordBuffer(list, word, fmt); fmt.dragResponse = SMDragResponse.None; break; case "drop": { SMWordToken wt = new SMWordToken(Font); wt.text = tt.attrs.ContainsKey("text") ? tt.attrs["text"] : "_____"; wt.tag = tt.attrs.ContainsKey("tag") ? tt.attrs["tag"] : ""; wt.Draggable = SMDragResponse.None; wt.Cardinality = SMConnectionCardinality.One; wt.Evaluation = EvaluationType; list.Add(wt); } break; case "edit": { SMWordToken wt = new SMWordToken(Font); wt.text = tt.attrs.ContainsKey("text") ? tt.attrs["text"] : "_____"; wt.tag = tt.attrs.ContainsKey("tag") ? tt.attrs["tag"] : ""; wt.Draggable = SMDragResponse.None; wt.Editable = true; wt.Cardinality = SMConnectionCardinality.One; wt.Evaluation = EvaluationType; list.Add(wt); } break; case "page": ClearWordBuffer(list, word, fmt); list.Add(new SMWordSpecial(Font) { Type = SMWordSpecialType.NewPage }); break; case "hr": ClearWordBuffer(list, word, fmt); list.Add(new SMWordSpecial(Font) { Type = SMWordSpecialType.HorizontalLine }); break; case "br": ClearWordBuffer(list, word, fmt); list.Add(new SMWordSpecial(Font) { Type = SMWordSpecialType.Newline }); AppendWord(list, "\n", fmt); break; case "col": ClearWordBuffer(list, word, fmt); list.Add(new SMWordSpecial(Font) { Type = SMWordSpecialType.NewColumn }); //AppendWord(list, "\n", control, fmt); break; case "r": ClearWordBuffer(list, word, fmt); fmt.Bold = false; fmt.Italic = false; fmt.Strikeout = false; fmt.Underline = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "/r": ClearWordBuffer(list, word, fmt); fmt.Bold = Font.Bold; fmt.Italic = Font.Italic; fmt.Underline = Font.Underline; fmt.Strikeout = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "b": ClearWordBuffer(list, word, fmt); fmt.Bold = true; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "/b": ClearWordBuffer(list, word, fmt); fmt.Bold = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "i": ClearWordBuffer(list, word, fmt); fmt.Italic = true; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "/i": ClearWordBuffer(list, word, fmt); fmt.Italic = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "u": ClearWordBuffer(list, word, fmt); fmt.Underline = true; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "/u": ClearWordBuffer(list, word, fmt); fmt.Underline = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "so": ClearWordBuffer(list, word, fmt); fmt.Strikeout = true; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; case "/so": ClearWordBuffer(list, word, fmt); fmt.Strikeout = false; //fmt.fontStyleValid = (fmt.fontStyle != control.Style.Font.Style); break; default: if (tt.tag.StartsWith("fs")) { int arg = 0; if (int.TryParse(tt.tag.Substring(2), out arg)) { fmt.fontSize = (float)arg / 100 * fmt.defaultFontSize; fmt.lineOffset = (float)arg / 100 - 1f; } } break; } }
/// <summary> /// Text is normal text and contains words, spaces and tags /// tags are like HTML tags /// examples are given bellow /// </summary> /// <param name="text"></param> /// <returns></returns> // examples of tags: // <tag> // <tag attr1=val1> // <tag attr2="val1" attr3='val3' attr4=val5> public List <SMWordBase> WordListFromString(string text) { List <SMWordBase> list = new List <SMWordBase>(); TextParseMode mode = TextParseMode.General; StringBuilder word = new StringBuilder(); StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); RunningFormat fmt = new RunningFormat(); TextTag tt = new TextTag(); string argumentName = ""; fmt.SetFontStyle(Font.Style); fmt.fontSize = Font.Size; fmt.fontName = Font.Name; fmt.defaultFontSize = fmt.fontSize; foreach (char readedChar in text) { if (mode == TextParseMode.General) { if (readedChar == '&') { mode = TextParseMode.SpecChar; sb.Clear(); continue; } else if (readedChar == '<') { mode = TextParseMode.WaitForTagNameStart; sb.Clear(); continue; } else if (Char.IsWhiteSpace(readedChar)) { ClearWordBuffer(list, word, fmt); if (readedChar == '\n') { list.Add(new SMWordSpecial(Font) { Type = SMWordSpecialType.Newline }); } else if (readedChar == '\r') { } else { AppendWord(list, " ", fmt); } } else { word.Append(readedChar); } } else if (mode == TextParseMode.SpecChar) { if (readedChar == ';') { word.Append(GetCharFromCode(sb.ToString())); mode = TextParseMode.General; } else { sb.Append(readedChar); } } else if (mode == TextParseMode.WaitForTagNameStart) { if (readedChar == '>') { mode = TextParseMode.General; } else if (!Char.IsWhiteSpace(readedChar)) { sb.Append(readedChar); mode = TextParseMode.ReadTagName; } } else if (mode == TextParseMode.ReadTagName) { if (Char.IsWhiteSpace(readedChar)) { tt.tag = sb.ToString(); sb.Clear(); mode = TextParseMode.WaitForArgOrEnd; } else if (readedChar == '>') { tt.tag = sb.ToString(); mode = TextParseMode.General; AppendTag(list, word, tt, fmt); tt.Clear(); } else { sb.Append(readedChar); } } else if (mode == TextParseMode.WaitForArgOrEnd) { if (readedChar == '>') { mode = TextParseMode.General; AppendTag(list, word, tt, fmt); tt.Clear(); } else if (Char.IsWhiteSpace(readedChar)) { } else { sb.Clear(); sb.Append(readedChar); mode = TextParseMode.ReadArgName; } } else if (mode == TextParseMode.ReadArgName) { if (readedChar == '>') { mode = TextParseMode.General; if (sb.Length > 0) { tt.attrs.Add(sb.ToString(), string.Empty); AppendTag(list, word, tt, fmt); tt.Clear(); } } else if (readedChar == '=') { argumentName = sb.ToString(); sb.Clear(); mode = TextParseMode.WaitForArgValue; } else if (Char.IsWhiteSpace(readedChar)) { argumentName = sb.ToString(); sb.Clear(); mode = TextParseMode.WaitForAssignOrEnd; } else { sb.Append(readedChar); } } else if (mode == TextParseMode.WaitForAssignOrEnd) { if (readedChar == '=') { mode = TextParseMode.WaitForArgValue; } else if (readedChar == '>') { mode = TextParseMode.General; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, string.Empty); AppendTag(list, word, tt, fmt); tt.Clear(); } } else if (!Char.IsWhiteSpace(readedChar)) { mode = TextParseMode.ReadArgName; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, string.Empty); } sb.Clear(); sb.Append(readedChar); } } else if (mode == TextParseMode.WaitForArgValue) { if (readedChar == '>') { mode = TextParseMode.General; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, string.Empty); AppendTag(list, word, tt, fmt); tt.Clear(); } } else if (readedChar == '\"') { sb.Clear(); mode = TextParseMode.ReadArgValueString; } else if (readedChar == '\'') { sb.Clear(); mode = TextParseMode.ReadArgValueQuote; } else if (!Char.IsWhiteSpace(readedChar)) { sb.Clear(); sb.Append(readedChar); mode = TextParseMode.ReadArgValue; } } else if (mode == TextParseMode.ReadArgValue) { if (readedChar == '>') { mode = TextParseMode.General; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, sb.ToString()); AppendTag(list, word, tt, fmt); tt.Clear(); } } else if (readedChar == '&') { sb2.Clear(); mode = TextParseMode.ReadArgValueSpecChar; } else if (Char.IsWhiteSpace(readedChar)) { mode = TextParseMode.WaitForArgOrEnd; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, sb.ToString()); sb.Clear(); argumentName = ""; } } else { sb.Append(readedChar); } } else if (mode == TextParseMode.ReadArgValueSpecChar) { if (readedChar == ';') { sb.Append(GetCharFromCode(sb2.ToString())); mode = TextParseMode.ReadArgValue; } else { sb2.Append(readedChar); } } else if (mode == TextParseMode.ReadArgValueString) { if (readedChar == '&') { sb2.Clear(); mode = TextParseMode.ReadArgValueStringSpecChar; } else if (readedChar == '\"') { mode = TextParseMode.WaitForArgOrEnd; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, sb.ToString()); sb.Clear(); argumentName = ""; } } else { sb.Append(readedChar); } } else if (mode == TextParseMode.ReadArgValueStringSpecChar) { if (readedChar == ';') { sb.Append(GetCharFromCode(sb2.ToString())); mode = TextParseMode.ReadArgValueString; } else { sb2.Append(readedChar); } } else if (mode == TextParseMode.ReadArgValueQuote) { if (readedChar == '&') { sb2.Clear(); mode = TextParseMode.ReadArgValueQuoteSpecChar; } else if (readedChar == '\"') { mode = TextParseMode.WaitForArgOrEnd; if (argumentName.Length > 0) { tt.attrs.Add(argumentName, sb.ToString()); sb.Clear(); argumentName = ""; } } else { sb.Append(readedChar); } } else if (mode == TextParseMode.ReadArgValueQuoteSpecChar) { if (readedChar == ';') { sb.Append(GetCharFromCode(sb2.ToString())); mode = TextParseMode.ReadArgValueQuote; } else { sb2.Append(readedChar); } } } // finalization if (word.Length > 0) { AppendWord(list, word.ToString(), fmt); word.Clear(); } // set first editable as focused foreach (SMWordBase wb in list) { if (wb is SMWordToken) { SMWordToken wt = (SMWordToken)wb; if (wt.Editable) { wt.Focused = true; break; } } } return(list); }