]> O.S.I.I.S - jp/crow.git/commitdiff
editor abstract base class, svgeditor base
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Mar 2018 14:37:09 +0000 (15:37 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Mar 2018 14:37:09 +0000 (15:37 +0100)
Default.style
src/Interface.cs
src/ParsingException.cs
src/SvgPicture.cs

index ed92e89b0d7c30a1233f9825e463a02d7282976d..5cb1aad68a0c766fdbe70379740736e5130d7cdd 100644 (file)
@@ -128,6 +128,7 @@ DockStack {
        //EndDrag="{Background=Jet}";
 }
 DockWindow {
+       Background = "Onyx";
        Focusable = "true";
        AllowDrag = "true";
        Margin="0";
index a3bd9fd49c7b4c63beb1952985dacdf6f4b3017b..eb4caefaaf5beafc7702515fd9fc53c8b27dd6e2 100644 (file)
@@ -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) {
index eb85504dc592fa85e75f3fba1eb0deb6bcd4a6ff..1b59698156b063766e02503197b3162c333a3c66 100644 (file)
@@ -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);
+               }
        }
 }
 
index 01aaeb5fa75ca4aa94682a28af43664d0426f222..ce7fdedfc5a16237c7c44d0aabfcc41a7900d693 100644 (file)
@@ -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;