public IBaseExportColumn CreateExportColumn() { LineDecorator style = this.CreateLineShape(); ExportGraphic item = new ExportGraphic(style); return(item as ExportGraphic); }
public void Setup() { this.mocker = new AutoMoqer(); this.mocker.SetInstance <IIndentValidator>(this.validator); this.mocker.SetInstance <IRainbowBrushGetter>(this.rainbowgetter); this.decorator = this.mocker.Resolve <LineDecorator>(); }
private LineDecorator CreateLineShape() { LineDecorator decorator = new LineDecorator(this.shape); decorator.Size = this.Size; decorator.Location = this.Location; decorator.BackColor = this.BackColor; decorator.ForeColor = this.ForeColor; decorator.Thickness = base.Thickness; decorator.DashStyle = base.DashStyle; decorator.From = this.FromPoint; decorator.To = this.ToPoint; return(decorator); }
private LineDecorator CreateLineShape() { LineDecorator ld = new LineDecorator(this.shape); ld.Size = this.Size; ld.Location = this.Location; ld.BackColor = this.BackColor; ld.ForeColor = this.ForeColor; ld.Thickness = base.Thickness; ld.DashStyle = base.DashStyle; ld.From = this.fromPoint; ld.To = this.toPoint; return(ld); }
internal static void UpdateCodeViewer(bool show, CompilationResult compilationResult, Action <object> selectionDelegate, SourceCodePhases sourceIndex = SourceCodePhases.Initial, Type pluginIndex = null) { if (compilationResult == null) { return; } // Build the collection of CodeViewerCodeLine used by the CodeViewer. // They contain the line of code, the matching semantic node's instance ID (stored in a metadata object), // and a collection of messages by alert types (ex: error, warning and info) // The matching semantic node' instance ID is stored to allow for easy panning to the node when selecting a code line. IList <string> splitSourceCode; if (pluginIndex != null) { splitSourceCode = compilationResult.pluginSourceCode[pluginIndex].Split(new[] { Environment.NewLine }, StringSplitOptions.None); } else { splitSourceCode = compilationResult.sourceCode[(int)sourceIndex].Split(new[] { Environment.NewLine }, StringSplitOptions.None); } Dictionary <int, List <CompilerError> > errorPerLine = new Dictionary <int, List <CompilerError> >(); foreach (var compilerError in compilationResult.errors) { // Line Index + Description + SemanticNode Instance Id var match = s_ErrorRowColumnRegex.Match(compilerError.description); if (!match.Success) { continue; } // The line index reported is 1-indexed. int codeLineIndex = Convert.ToInt32(match.Groups[1].Value) - 1; if (!errorPerLine.ContainsKey(codeLineIndex)) { errorPerLine[codeLineIndex] = new List <CompilerError>(); } errorPerLine[codeLineIndex].Add(compilerError); } var document = new Document(selectionDelegate); for (var lineIndex = 0; lineIndex < splitSourceCode.Count; lineIndex++) { string sourceCodeLine = splitSourceCode[lineIndex]; var line = new Line(lineIndex + 1, sourceCodeLine); if (errorPerLine.ContainsKey(lineIndex)) { var decorator = LineDecorator.CreateError(string.Join(Environment.NewLine, errorPerLine[lineIndex].Select(error => error.description))); line.AddDecorator(decorator); var sourceNode = errorPerLine[lineIndex].FirstOrDefault()?.sourceNode; if (sourceNode) { line.Metadata = sourceNode.GetInstanceID(); } } document.AddLine(line); } if (show) { EditorWindow.GetWindow(typeof(CodeViewerWindow)); } CodeViewerWindow.SetDocument(document); }