From: Jean-Philippe Bruyère Date: Fri, 9 Mar 2018 14:37:09 +0000 (+0100) Subject: editor abstract base class, svgeditor base X-Git-Tag: v0.9.5-beta~153^2~13 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=6ddcd449a085f7fa43d7f1176c47e62a3597c9ef;p=jp%2Fcrow.git editor abstract base class, svgeditor base --- diff --git a/Default.style b/Default.style index ed92e89b..5cb1aad6 100644 --- a/Default.style +++ b/Default.style @@ -128,6 +128,7 @@ DockStack { //EndDrag="{Background=Jet}"; } DockWindow { + Background = "Onyx"; Focusable = "true"; AllowDrag = "true"; Margin="0"; 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 /// limit rendering to svg part named 'subPart' public override void Paint (Context gr, Rectangle rect, string subPart = "") { + if (hSVG == null) + return; float widthRatio = 1f; float heightRatio = 1f;