public void HandleGutter(Gutter gutter) { foreach (var item in gutter.Items) { output.AppendLine(StringTuple(item)); } }
public void PaintLine(Line line, Gutter.Gutter gutter, int firstColumn, Document doc) { var x = 0; var offset = gutter.Width - (firstColumn * geometry.CharWidth); var spans = doc.ApplySelectionSpan(line.Spans, line); foreach (var span in SplitSpansForRendering(spans)) { if (span.renderCache == null) span.renderCache = new RenderCache(span, geometry, line, x); if (offset + span.renderCache.Width >= 0) PaintSpan(span, offset); offset += span.renderCache.Width; x += span.renderCache.Text.Length; if (offset > g.ClipBounds.Right) break; } }
/// <summary> /// Filter all the edges from the element which gutter can be created on. /// </summary> /// <param name="elem"></param> private void FilterEdgesForGutter(Autodesk.Revit.DB.Element elem) { Transaction transaction = new Transaction(this.RvtDocument, "FilterEdgesForGutter"); transaction.Start(); // Note: This method will create a Gutter with no reference. // In the future, API may not allow to create such Gutter with // no references, invoke this methods like this may throw exception. // Gutter gutter = m_rvtDoc.Create.NewGutter(null, new ReferenceArray()); List <Edge> roofEdges = m_roofGutterEdges[elem]; foreach (Edge edge in m_elemGeom[elem].EdgeBindingDic.Keys) { if (edge.Reference == null) { continue; } try { gutter.AddSegment(edge.Reference); // AddSegment successfully, so this edge can be used to crate Gutter. roofEdges.Add(edge); } catch (Autodesk.Revit.Exceptions.ArgumentOutOfRangeException) { // Exception, this edge will be discard. } } // Delete this element, because we just use it to filter the edges. m_rvtDoc.Delete(gutter.Id); transaction.RollBack(); }
/// <summary> /// Returns html SyntaxHighlighter expects to understand. /// </summary> /// <remarks> /// Config params are based on <see cref="http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/"/> /// and <see cref="https://en.support.wordpress.com/code/posting-source-code/"/>. Only part of all params I /// think useful are supported here. /// </remarks> public override string Process() { if (Content.IsNullOrEmpty()) { return(""); } string brush = GetBrush(); string firstline = Firstline.IsNullOrEmpty() ? "" : $"; first-line: {Firstline}"; string gutter = Gutter.IsNullOrEmpty() ? "" : $"; gutter: {Gutter}"; string highlight = Highlight.IsNullOrEmpty() ? "" : $"; highlight: [{Highlight}]"; string htmlscript = Htmlscript.IsNullOrEmpty() ? "" : $"; html-script: {Htmlscript}"; // massage the code to make syntaxhighlighter happy, olw mixes in p, br and /n StringBuilder sb = new StringBuilder(Content); Content = sb.Replace("<p>", "") .Replace("</p>", "") .Replace("<br>", "\n") .Replace("\n\n", "\n") .ToString(); return($"<pre class=\"{brush}{firstline}{gutter}{highlight}{htmlscript}\">{Content}</pre>"); }
private void Stream( ArrayList data, Gutter gutter ) { data.Add( new Snoop.Data.ClassSeparator( typeof( Gutter ) ) ); data.Add( new Snoop.Data.Object( "Gutter type", gutter.GutterType ) ); }
/// <summary> /// Create a Gutter. /// </summary> /// <param name="symbol">Gutter type</param> /// <param name="refArr">Gutter Reference array</param> /// <returns>Created Gutter</returns> protected override HostedSweep CreateHostedSweep(ElementType symbol, ReferenceArray refArr) { Gutter gutter = m_rvtDoc.Create.NewGutter(symbol as GutterType, refArr); return(gutter); }
private void FileContent_ScrollChanged(object sender, ScrollChangedEventArgs e) { //keep the gutter on track with the file Gutter.ScrollToVerticalOffset(e.VerticalOffset); }