diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Interface.cs | 13 | ||||
| -rw-r--r-- | src/ParsingException.cs | 16 | ||||
| -rw-r--r-- | src/SvgPicture.cs | 7 |
3 files changed, 33 insertions, 3 deletions
diff --git a/src/Interface.cs b/src/Interface.cs index a3bd9fd4..eb4caefa 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -1133,6 +1133,19 @@ namespace Crow ctxMenuContainer = Load ("#Crow.ContextMenu.template") as MenuItem; } + void CtxMenuContainer_LayoutChanged (object sender, LayoutingEventArgs e) + { + Rectangle r = ctxMenuContainer.ScreenCoordinates (ctxMenuContainer.Slot); + if (e.LayoutType == LayoutingType.Width) { + if (r.Right > this.clientRectangle.Right) + ctxMenuContainer.Left = this.clientRectangle.Right - ctxMenuContainer.Slot.Width; + }else if (e.LayoutType == LayoutingType.Width) { + if (r.Bottom > this.clientRectangle.Bottom) + ctxMenuContainer.Top = this.clientRectangle.Bottom - ctxMenuContainer.Slot.Height; + } + + } + public void ShowContextMenu (GraphicObject go) { lock (UpdateMutex) { diff --git a/src/ParsingException.cs b/src/ParsingException.cs index eb85504d..1b596981 100644 --- a/src/ParsingException.cs +++ b/src/ParsingException.cs @@ -6,15 +6,25 @@ namespace Crow.Coding { public int Line; public int Column; + public string Source; public ParserException(int line, int column, string txt, string source = null) - : base(string.Format("{3}:({0},{1}): {2}", line, column, txt, source)) + : base(txt) { Line = line; Column = column; + Source = source; } public ParserException(int line, int column, string txt, Exception innerException, string source = null) - : base(string.Format("{3}:({0},{1}): {2}", line, column, txt, source), innerException) - {} + : base(txt, innerException) + { + Line = line; + Column = column; + Source = source; + } + public override string ToString () + { + return string.Format("{3}:({0},{1}): {2}", Line, Column, Message, Source); + } } } diff --git a/src/SvgPicture.cs b/src/SvgPicture.cs index 01aaeb5f..ce7fdedf 100644 --- a/src/SvgPicture.cs +++ b/src/SvgPicture.cs @@ -71,6 +71,11 @@ namespace Crow sharedResources [path] = new sharedPicture (hSVG, Dimensions); } + public void LoadSvgFragment (string fragment) { + hSVG = new Rsvg.Handle (System.Text.Encoding.Unicode.GetBytes(fragment)); + Dimensions = new Size (hSVG.Dimensions.Width, hSVG.Dimensions.Height); + } + #region implemented abstract members of Fill public override void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle)) @@ -112,6 +117,8 @@ namespace Crow /// <param name="subPart">limit rendering to svg part named 'subPart'</param> public override void Paint (Context gr, Rectangle rect, string subPart = "") { + if (hSVG == null) + return; float widthRatio = 1f; float heightRatio = 1f; |