]> O.S.I.I.S - jp/crow.git/commitdiff
GetStreamFromPath as instance method of iface
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 11 Dec 2020 09:40:38 +0000 (10:40 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 11 Dec 2020 09:40:38 +0000 (10:40 +0100)
28 files changed:
Crow/src/Fill/BmpPicture.cs
Crow/src/Fill/Fill.cs
Crow/src/Fill/Gradient.cs
Crow/src/Fill/Picture.cs
Crow/src/Fill/SolidColor.cs
Crow/src/Fill/SvgPicture.cs
Crow/src/IML/Instantiator.cs
Crow/src/Interface.cs
Crow/src/ItemTemplate.cs
Crow/src/Mono.Cairo/Context.cs
Crow/src/Widgets/Border.cs
Crow/src/Widgets/ColorSlider.cs
Crow/src/Widgets/DockStack.cs
Crow/src/Widgets/Gauge.cs
Crow/src/Widgets/HueSelector.cs
Crow/src/Widgets/Image.cs
Crow/src/Widgets/Label.cs
Crow/src/Widgets/ProgressBar.cs
Crow/src/Widgets/SaturationValueSelector.cs
Crow/src/Widgets/Scroller.cs
Crow/src/Widgets/Shape.cs
Crow/src/Widgets/TabItem.cs
Crow/src/Widgets/TabView.cs
Crow/src/Widgets/TemplatedControl.cs
Crow/src/Widgets/TextRun.cs
Crow/src/Widgets/Trend.cs
Crow/src/Widgets/Widget.cs
Crow/src/XCursor.cs

index 1aade9355796df84c818a38e8d2bd0677bc75ced..70f36d3f76d3a35434b2fd488239633ecfbf2889 100644 (file)
@@ -21,30 +21,25 @@ namespace Crow
                /// <summary>
                /// Initializes a new instance of BmpPicture.
                /// </summary>
-               public BmpPicture ()
-               {}
+               public BmpPicture () {}
                /// <summary>
                /// Initializes a new instance of BmpPicture by loading the image pointed by the path argument
                /// </summary>
                /// <param name="path">image path, may be embedded</param>
-               public BmpPicture (string path) : base(path)
-               {
-                       Load ();
-               }
+               public BmpPicture (string path) : base(path) { }
                #endregion
                /// <summary>
                /// load the image for rendering from the path given as argument
                /// </summary>
-               /// <param name="path">image path, may be embedded</param>
-               void Load ()
+               void load (Interface iFace)
                {                       
-                       if (sharedResources.ContainsKey (Path)) {
-                               sharedPicture sp = sharedResources [Path];
+                       if (iFace.sharedPictures.ContainsKey (Path)) {
+                               sharedPicture sp = iFace.sharedPictures [Path];
                                image = (byte[])sp.Data;
                                Dimensions = sp.Dims;
                                return;
                        }
-                       using (Stream stream = Interface.GetStreamFromPath (Path)) {
+                       using (Stream stream = iFace.GetStreamFromPath (Path)) {
 #if STB_SHARP
                                StbImageSharp.ImageResult stbi = StbImageSharp.ImageResult.FromStream (stream, StbImageSharp.ColorComponents.RedGreenBlueAlpha);
                                image = new byte [stbi.Data.Length];
@@ -72,7 +67,7 @@ namespace Crow
 
                                //loadBitmap (new System.Drawing.Bitmap (stream));      
                        }
-                       sharedResources [Path] = new sharedPicture (image, Dimensions);
+                       iFace.sharedPictures [Path] = new sharedPicture (image, Dimensions);
                }
 
 
@@ -100,8 +95,11 @@ namespace Crow
 
 #region implemented abstract members of Fill
 
-               public override void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle))
+               public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
                {
+                       if (image == null)
+                               load (iFace);
+
                        float widthRatio = 1f;
                        float heightRatio = 1f;
 
@@ -141,8 +139,11 @@ namespace Crow
                /// <param name="gr">drawing Backend context</param>
                /// <param name="rect">bounds of the target surface to paint</param>
                /// <param name="subPart">used for svg only</param>
-               public override void Paint (Context gr, Rectangle rect, string subPart = "")
+               public override void Paint (Interface iFace, Context gr, Rectangle rect, string subPart = "")
                {
+                       if (image == null)
+                               load (iFace);
+
                        float widthRatio = 1f;
                        float heightRatio = 1f;
 
index cb555b07d482e3847a2e1bd054750e1a061a163e..022f6c05a076008ba70cba35b1e280411e15beb1 100644 (file)
@@ -17,7 +17,7 @@ namespace Crow
                /// </summary>
                /// <param name="ctx">backend context</param>
                /// <param name="bounds">paint operation bounding box, unused for SolidColor</param>
-               public abstract void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle));
+               public abstract void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle));
                public static object Parse (string s){
                        if (string.IsNullOrEmpty (s))
                                return null;
index 94311dfa5b55f08f4885aea6630141c30f84e843..ac6a638ef27aa64b4977ce63542f65e5a736bfe7 100644 (file)
@@ -79,7 +79,7 @@ namespace Crow
 
                #region implemented abstract members of Fill
 
-               public override void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle))
+               public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
                {
                        Cairo.Gradient grad = null;
                        switch (GradientType) {
index 2a71d6b51c2965885cae2485c38e40d408876808..fd86506a33b02d866674664037b240762c694a60 100644 (file)
@@ -51,11 +51,6 @@ namespace Crow
        /// </summary>
        public abstract class Picture : Fill
        {
-               /// <summary>
-               /// share a single store for picture resources among usage in different controls
-               /// </summary>
-               internal static Dictionary<string, sharedPicture> sharedResources = new Dictionary<string, sharedPicture>();
-
                /// <summary>
                /// path of the picture
                /// </summary>
@@ -91,14 +86,6 @@ namespace Crow
                }
                #endregion
 
-               #region Image Loading
-               /// <summary>
-               /// load the image for rendering from the stream given as argument
-               /// </summary>
-               /// <param name="stream">picture stream</param>
-               //public abstract void Load(Interface iface, string path);
-               #endregion
-
                /// <summary>
                /// abstract method to paint the image in the rectangle given in arguments according
                /// to the Scale and keepProportion parameters.
@@ -106,27 +93,11 @@ namespace Crow
                /// <param name="gr">drawing Backend context</param>
                /// <param name="rect">bounds of the target surface to paint</param>
                /// <param name="subPart">used for svg only</param>
-               public abstract void Paint(Context ctx, Rectangle rect, string subPart = "");
+               public abstract void Paint(Interface iFace, Context ctx, Rectangle rect, string subPart = "");
 
                #region Operators
-               public static implicit operator Picture(string path)
-               {
-                       if (string.IsNullOrEmpty (path))
-                               return null;
-                       
-                       Picture _pic = null;
-
-                       if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture)) 
-                               _pic = new SvgPicture (path);
-                       else 
-                               _pic = new BmpPicture (path);
-
-                       return _pic;
-               }
-               public static implicit operator string(Picture _pic)
-               {
-                       return _pic == null ? null : _pic.Path;
-               }
+               public static implicit operator Picture(string path) => Parse (path) as Picture;
+               public static implicit operator string(Picture _pic) => _pic == null ? null : _pic.Path;
                #endregion
 
                public static new object Parse(string path)
index efccd399adb88dbc10edfb520ef96bb97d51c39c..8ed77fbeeda4df37b9818f514e6372aef8a6720a 100644 (file)
@@ -26,9 +26,9 @@ namespace Crow
                #endregion
 
                #region implemented abstract members of Fill
-               public override void SetAsSource (Context ctx, Rectangle bounds = default)
+               public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default)
                {
-                       ctx.SetSourceRGBA (color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
+                       ctx.SetSource (color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
                }
                public static new object Parse(string s)
                {
index 850400cda4d37010964916163bea09e91f9782fc..ee6ae1ea2308d1f4682546d58fb7d16456f70734 100644 (file)
@@ -41,27 +41,23 @@ namespace Crow
                /// <summary>
                /// Initializes a new instance of SvgPicture.
                /// </summary>
-               public SvgPicture ()
-               {}
+               public SvgPicture () {}
                /// <summary>
                /// Initializes a new instance of SvgPicture by loading the SVG file pointed by the path argument
                /// </summary>
                /// <param name="path">image path, may be embedded</param>
-               public SvgPicture (string path) : base(path)
-               {
-                       Load ();
-               }
+               public SvgPicture (string path) : base(path) {}
                #endregion
 
-               void Load ()
+               void load (Interface iFace)
                {                       
-                       if (sharedResources.ContainsKey (Path)) {
-                               sharedPicture sp = sharedResources [Path];
+                       if (iFace.sharedPictures.ContainsKey (Path)) {
+                               sharedPicture sp = iFace.sharedPictures [Path];
                                hSVG = (Rsvg.Handle)sp.Data;
                                Dimensions = sp.Dims;
                                return;
                        }
-                       using (Stream stream = Interface.GetStreamFromPath (Path)) {
+                       using (Stream stream = iFace.GetStreamFromPath (Path)) {
                                using (MemoryStream ms = new MemoryStream ()) {
                                        stream.CopyTo (ms);
 
@@ -69,7 +65,7 @@ namespace Crow
                                        Dimensions = new Size (hSVG.Dimensions.Width, hSVG.Dimensions.Height);
                                }
                        }
-                       sharedResources [Path] = new sharedPicture (hSVG, Dimensions);
+                       iFace.sharedPictures [Path] = new sharedPicture (hSVG, Dimensions);
                }
 
                public void LoadSvgFragment (string fragment) {                 
@@ -79,8 +75,11 @@ namespace Crow
 
                #region implemented abstract members of Fill
 
-               public override void SetAsSource (Context ctx, Rectangle bounds = default(Rectangle))
+               public override void SetAsSource (Interface iFace, Context ctx, Rectangle bounds = default(Rectangle))
                {
+                       if (hSVG == null)
+                               load (iFace);
+
                        float widthRatio = 1f;
                        float heightRatio = 1f;
 
@@ -116,10 +115,11 @@ namespace Crow
                /// <param name="gr">drawing Backend context</param>
                /// <param name="rect">bounds of the target surface to paint</param>
                /// <param name="subPart">limit rendering to svg part named 'subPart'</param>
-               public override void Paint (Context gr, Rectangle rect, string subPart = "")
+               public override void Paint (Interface iFace, Context gr, Rectangle rect, string subPart = "")
                {
                        if (hSVG == null)
-                               return;
+                               load (iFace);
+
                        float widthRatio = 1f;
                        float heightRatio = 1f;
 
index ac203f08a7d42a09a73d20b27e285a76f709c8f1..32afce3458c3fea601492e1a3dec8460ab7c8c1a 100644 (file)
@@ -65,7 +65,7 @@ namespace Crow.IML {
                /// <summary>
                /// Initializes a new instance of the Instantiator class.
                /// </summary>
-               public Instantiator (Interface _iface, string path) : this (_iface, Interface.GetStreamFromPath(path), path) {
+               public Instantiator (Interface _iface, string path) : this (_iface, _iface.GetStreamFromPath(path), path) {
                        
                }
                /// <summary>
@@ -316,7 +316,7 @@ namespace Crow.IML {
                                                if (iface.ItemTemplates.ContainsKey (itemTemplatePath)) {
                                                        itemTemplateIds.Add (new string [] { "default", itemTemplatePath, "" });
                                                } else {
-                                                       using (Stream stream = Interface.GetStreamFromPath (itemTemplatePath)) {
+                                                       using (Stream stream = iface.GetStreamFromPath (itemTemplatePath)) {
                                                                //itemtemplate files may have multiple root nodes
                                                                XmlReaderSettings itrSettings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment };
                                                                using (XmlReader itr = XmlReader.Create (stream, itrSettings)) {                                                                        
index a9a9fa1b455ccad9d1a65a35d3a3927db215e5bf..2f5f664d6923ebd2f3d0121ee47346b70a157565 100644 (file)
@@ -92,8 +92,6 @@ namespace Crow
                        FontRenderingOptions.HintMetrics = HintMetrics.On;
                        FontRenderingOptions.HintStyle = HintStyle.Full;
                        FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default;
-
-                       loadCursors ();
                }
                public Interface (int width, int height, IntPtr glfwWindowHandle) : this (width, height, false, false)
                {
@@ -101,6 +99,8 @@ namespace Crow
                }
                public Interface (int width = 800, int height = 600, bool startUIThread = true, bool createSurface = true)
                {
+                       loadCursors ();
+
                        CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
                        CurrentInterface = this;
                        clientRectangle = new Rectangle (0, 0, width, height);
@@ -504,6 +504,11 @@ namespace Crow
 
 
                #region Load/Save
+               /// <summary>
+               /// share a single store for picture resources among usage in different controls
+               /// </summary>
+               internal Dictionary<string, sharedPicture> sharedPictures = new Dictionary<string, sharedPicture> ();
+
                static bool tryGetResource (Assembly a, string resId, out Stream stream) {
                        stream = null;
                        if (a == null)
@@ -512,10 +517,8 @@ namespace Crow
                        return stream != null;
                }
 
-               public delegate Stream GetStreamFromPathDelegate (string path);
-               public static GetStreamFromPathDelegate GetStreamFromPath = _getStreamFromPath;
 
-               static Stream _getStreamFromPath (string path)
+               public virtual Stream GetStreamFromPath (string path)
                {
                        if (path.StartsWith ("#", StringComparison.Ordinal)) {
                                Stream stream = null;
@@ -1016,73 +1019,76 @@ namespace Crow
 
                #region Mouse and Keyboard Handling
                MouseCursor cursor = MouseCursor.top_left_arrow;
-               static void loadCursors ()
+               void loadCursors ()
                {
                        const int minimumSize = 24;
+
+                       if (XCursor.Cursors.ContainsKey (MouseCursor.arrow))
+                               return;
                        //Load cursors
-                       XCursor.Cursors [MouseCursor.arrow] = XCursorFile.Load ("#Crow.Cursors.arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.base_arrow_down] = XCursorFile.Load ("#Crow.Cursors.base_arrow_down").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.base_arrow_up] = XCursorFile.Load ("#Crow.Cursors.base_arrow_up").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.boat] = XCursorFile.Load ("#Crow.Cursors.boat").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.bottom_left_corner] = XCursorFile.Load ("#Crow.Cursors.bottom_left_corner").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.bottom_right_corner] = XCursorFile.Load ("#Crow.Cursors.bottom_right_corner").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.bottom_side] = XCursorFile.Load ("#Crow.Cursors.bottom_side").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.bottom_tee] = XCursorFile.Load ("#Crow.Cursors.bottom_tee").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.center_ptr] = XCursorFile.Load ("#Crow.Cursors.center_ptr").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.circle] = XCursorFile.Load ("#Crow.Cursors.circle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.cross] = XCursorFile.Load ("#Crow.Cursors.cross").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.cross_reverse] = XCursorFile.Load ("#Crow.Cursors.cross_reverse").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.crosshair] = XCursorFile.Load ("#Crow.Cursors.crosshair").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.dot] = XCursorFile.Load ("#Crow.Cursors.dot").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.dot_box_mask] = XCursorFile.Load ("#Crow.Cursors.dot_box_mask").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.double_arrow] = XCursorFile.Load ("#Crow.Cursors.double_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.draft_large] = XCursorFile.Load ("#Crow.Cursors.draft_large").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.draft_small] = XCursorFile.Load ("#Crow.Cursors.draft_small").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.draped_box] = XCursorFile.Load ("#Crow.Cursors.draped_box").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.exchange] = XCursorFile.Load ("#Crow.Cursors.exchange").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.fleur] = XCursorFile.Load ("#Crow.Cursors.fleur").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.gumby] = XCursorFile.Load ("#Crow.Cursors.gumby").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.hand] = XCursorFile.Load ("#Crow.Cursors.hand").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.hand1] = XCursorFile.Load ("#Crow.Cursors.hand1").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.hand2] = XCursorFile.Load ("#Crow.Cursors.hand2").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.help] = XCursorFile.Load ("#Crow.Cursors.help").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.ibeam] = XCursorFile.Load ("#Crow.Cursors.ibeam").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.left_ptr] = XCursorFile.Load ("#Crow.Cursors.left_ptr").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.left_ptr_watch] = XCursorFile.Load ("#Crow.Cursors.left_ptr_watch").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.left_side] = XCursorFile.Load ("#Crow.Cursors.left_side").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.left_tee] = XCursorFile.Load ("#Crow.Cursors.left_tee").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.ll_angle] = XCursorFile.Load ("#Crow.Cursors.ll_angle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.lr_angle] = XCursorFile.Load ("#Crow.Cursors.lr_angle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.move] = XCursorFile.Load ("#Crow.Cursors.move").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.pencil] = XCursorFile.Load ("#Crow.Cursors.pencil").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.pirate] = XCursorFile.Load ("#Crow.Cursors.pirate").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.plus] = XCursorFile.Load ("#Crow.Cursors.plus").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.question_arrow] = XCursorFile.Load ("#Crow.Cursors.question_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.right_ptr] = XCursorFile.Load ("#Crow.Cursors.right_ptr").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.right_side] = XCursorFile.Load ("#Crow.Cursors.right_side").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.right_tee] = XCursorFile.Load ("#Crow.Cursors.right_tee").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sailboat] = XCursorFile.Load ("#Crow.Cursors.sailboat").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_down_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_down_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_h_double_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_h_double_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_left_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_left_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_right_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_right_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_up_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_up_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sb_v_double_arrow] = XCursorFile.Load ("#Crow.Cursors.sb_v_double_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.shuttle] = XCursorFile.Load ("#Crow.Cursors.shuttle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.sizing] = XCursorFile.Load ("#Crow.Cursors.sizing").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.target] = XCursorFile.Load ("#Crow.Cursors.target").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.tcross] = XCursorFile.Load ("#Crow.Cursors.tcross").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.top_left_arrow] = XCursorFile.Load ("#Crow.Cursors.top_left_arrow").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.top_left_corner] = XCursorFile.Load ("#Crow.Cursors.top_left_corner").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.top_right_corner] = XCursorFile.Load ("#Crow.Cursors.top_right_corner").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.top_side] = XCursorFile.Load ("#Crow.Cursors.top_side").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.top_tee] = XCursorFile.Load ("#Crow.Cursors.top_tee").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.trek] = XCursorFile.Load ("#Crow.Cursors.trek").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.ul_angle] = XCursorFile.Load ("#Crow.Cursors.ul_angle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.ur_angle] = XCursorFile.Load ("#Crow.Cursors.ur_angle").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.watch] = XCursorFile.Load ("#Crow.Cursors.watch").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.X_cursor] = XCursorFile.Load ("#Crow.Cursors.X_cursor").Cursors.First (c => c.Width >= minimumSize);
-                       XCursor.Cursors [MouseCursor.xterm] = XCursorFile.Load ("#Crow.Cursors.xterm").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.arrow] = XCursorFile.Load (this, "#Crow.Cursors.arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.base_arrow_down] = XCursorFile.Load (this, "#Crow.Cursors.base_arrow_down").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.base_arrow_up] = XCursorFile.Load (this, "#Crow.Cursors.base_arrow_up").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.boat] = XCursorFile.Load (this, "#Crow.Cursors.boat").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.bottom_left_corner] = XCursorFile.Load (this, "#Crow.Cursors.bottom_left_corner").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.bottom_right_corner] = XCursorFile.Load (this, "#Crow.Cursors.bottom_right_corner").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.bottom_side] = XCursorFile.Load (this, "#Crow.Cursors.bottom_side").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.bottom_tee] = XCursorFile.Load (this, "#Crow.Cursors.bottom_tee").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.center_ptr] = XCursorFile.Load (this, "#Crow.Cursors.center_ptr").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.circle] = XCursorFile.Load (this, "#Crow.Cursors.circle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.cross] = XCursorFile.Load (this, "#Crow.Cursors.cross").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.cross_reverse] = XCursorFile.Load (this, "#Crow.Cursors.cross_reverse").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.crosshair] = XCursorFile.Load (this, "#Crow.Cursors.crosshair").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.dot] = XCursorFile.Load (this, "#Crow.Cursors.dot").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.dot_box_mask] = XCursorFile.Load (this, "#Crow.Cursors.dot_box_mask").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.double_arrow] = XCursorFile.Load (this, "#Crow.Cursors.double_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.draft_large] = XCursorFile.Load (this, "#Crow.Cursors.draft_large").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.draft_small] = XCursorFile.Load (this, "#Crow.Cursors.draft_small").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.draped_box] = XCursorFile.Load (this, "#Crow.Cursors.draped_box").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.exchange] = XCursorFile.Load (this, "#Crow.Cursors.exchange").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.fleur] = XCursorFile.Load (this, "#Crow.Cursors.fleur").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.gumby] = XCursorFile.Load (this, "#Crow.Cursors.gumby").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.hand] = XCursorFile.Load (this, "#Crow.Cursors.hand").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.hand1] = XCursorFile.Load (this, "#Crow.Cursors.hand1").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.hand2] = XCursorFile.Load (this, "#Crow.Cursors.hand2").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.help] = XCursorFile.Load (this, "#Crow.Cursors.help").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.ibeam] = XCursorFile.Load (this, "#Crow.Cursors.ibeam").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.left_ptr] = XCursorFile.Load (this, "#Crow.Cursors.left_ptr").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.left_ptr_watch] = XCursorFile.Load (this, "#Crow.Cursors.left_ptr_watch").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.left_side] = XCursorFile.Load (this, "#Crow.Cursors.left_side").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.left_tee] = XCursorFile.Load (this, "#Crow.Cursors.left_tee").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.ll_angle] = XCursorFile.Load (this, "#Crow.Cursors.ll_angle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.lr_angle] = XCursorFile.Load (this, "#Crow.Cursors.lr_angle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.move] = XCursorFile.Load (this, "#Crow.Cursors.move").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.pencil] = XCursorFile.Load (this, "#Crow.Cursors.pencil").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.pirate] = XCursorFile.Load (this, "#Crow.Cursors.pirate").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.plus] = XCursorFile.Load (this, "#Crow.Cursors.plus").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.question_arrow] = XCursorFile.Load (this, "#Crow.Cursors.question_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.right_ptr] = XCursorFile.Load (this, "#Crow.Cursors.right_ptr").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.right_side] = XCursorFile.Load (this, "#Crow.Cursors.right_side").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.right_tee] = XCursorFile.Load (this, "#Crow.Cursors.right_tee").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sailboat] = XCursorFile.Load (this, "#Crow.Cursors.sailboat").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_down_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_down_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_h_double_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_h_double_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_left_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_left_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_right_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_right_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_up_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_up_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sb_v_double_arrow] = XCursorFile.Load (this, "#Crow.Cursors.sb_v_double_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.shuttle] = XCursorFile.Load (this, "#Crow.Cursors.shuttle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.sizing] = XCursorFile.Load (this, "#Crow.Cursors.sizing").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.target] = XCursorFile.Load (this, "#Crow.Cursors.target").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.tcross] = XCursorFile.Load (this, "#Crow.Cursors.tcross").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.top_left_arrow] = XCursorFile.Load (this, "#Crow.Cursors.top_left_arrow").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.top_left_corner] = XCursorFile.Load (this, "#Crow.Cursors.top_left_corner").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.top_right_corner] = XCursorFile.Load (this, "#Crow.Cursors.top_right_corner").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.top_side] = XCursorFile.Load (this, "#Crow.Cursors.top_side").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.top_tee] = XCursorFile.Load (this, "#Crow.Cursors.top_tee").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.trek] = XCursorFile.Load (this, "#Crow.Cursors.trek").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.ul_angle] = XCursorFile.Load (this, "#Crow.Cursors.ul_angle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.ur_angle] = XCursorFile.Load (this, "#Crow.Cursors.ur_angle").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.watch] = XCursorFile.Load (this, "#Crow.Cursors.watch").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.X_cursor] = XCursorFile.Load (this, "#Crow.Cursors.X_cursor").Cursors.First (c => c.Width >= minimumSize);
+                       XCursor.Cursors [MouseCursor.xterm] = XCursorFile.Load (this, "#Crow.Cursors.xterm").Cursors.First (c => c.Width >= minimumSize);
                }
 
 
index 11fea67197d9f1cfd71146b57c5491009b288c26..e16962560fee5269a49a3f2182b938ee5ae8a916 100644 (file)
@@ -82,7 +82,7 @@ namespace Crow
                /// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
                /// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
                public ItemTemplate (Interface _iface, string path, string _dataTest = "TypeOf", string _dataType = "default", string _fetchDataMethod = null)
-                       : base(_iface, Interface.GetStreamFromPath (path)) {
+                       : base(_iface, _iface.GetStreamFromPath (path)) {
                        strDataType = _dataType;
                        fetchMethodName = _fetchDataMethod;
                        dataTest = _dataTest;
index 1ce4cd0f3391d45f76a9bea2c40c2819839861a5..6463ecf09f76984e7baad4f60385fdce5a296079 100644 (file)
@@ -329,12 +329,12 @@ namespace Crow.Cairo {
                        NativeMethods.cairo_set_source_rgba (handle, color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
                }
 
-               public void SetSourceRGB (double r, double g, double b)
+               public void SetSource (double r, double g, double b)
                {
                        NativeMethods.cairo_set_source_rgb (handle, r, g, b);
                }
 
-               public void SetSourceRGBA (double r, double g, double b, double a)
+               public void SetSource (double r, double g, double b, double a)
                {
                        NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
                }
index e0a9ba5e40b432ba1ed3904a451d1ac08de0d5e7..d9de7f6af0c5e68002e01a8fc23b758a116420da 100644 (file)
@@ -121,14 +121,14 @@ namespace Crow
                        //                      if (BorderWidth > 0)
                        //                              rBack.Inflate (-BorderWidth / 2);
 
-                       Background.SetAsSource (gr, rBack);
+                       Background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
                        gr.Fill ();
 
 
                        if (BorderStyle == BorderStyle.Normal) {
                                if (BorderWidth > 0) {
-                                       Foreground?.SetAsSource (gr, rBack);
+                                       Foreground?.SetAsSource (IFace, gr, rBack);
                                        CairoHelpers.CairoRectangle (gr, rBack, CornerRadius, BorderWidth);
                                }
                        } else {
@@ -208,7 +208,7 @@ namespace Crow
                        //                      if (BorderWidth > 0)
                        //                              rBack.Inflate (-BorderWidth / 2);
 
-                       Background.SetAsSource (gr, rBack);
+                       Background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
                        gr.Fill ();
 
@@ -217,7 +217,7 @@ namespace Crow
 
                        if (bw > 0) {
                                if (BorderStyle == BorderStyle.Normal)
-                                       Foreground.SetAsSource (gr, rBack);
+                                       Foreground.SetAsSource (IFace, gr, rBack);
                                else {
                                        if (BorderStyle == BorderStyle.Sunken)
                                                gr.SetSource (raisedColor);
index 52e7e620702a5e73d0a5eedf929fa77625c95017..a1b54d7c85eefecb7085457ae68131f7f9e78a36 100644 (file)
@@ -181,7 +181,7 @@ namespace Crow
                                break;
                        }
 
-                       grad.SetAsSource (gr, r);
+                       grad.SetAsSource (IFace, gr, r);
                        CairoHelpers.CairoRectangle (gr, r, CornerRadius);
                        gr.Fill ();
 
index da9110e4e7395a7a0c66d96b249d03b3f2d3dd16..728a35e19556764d850ab680597f6a16d7d86d0c 100644 (file)
@@ -173,7 +173,7 @@ namespace Crow
 
                        Rectangle rBack = new Rectangle (Slot.Size);
 
-                       Background.SetAsSource (gr, rBack);
+                       Background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle (gr, rBack, CornerRadius);
                        gr.Fill ();
 
@@ -226,9 +226,9 @@ namespace Crow
                                        break;
                                }
                                gr.LineWidth = 1;
-                               gr.SetSourceRGBA (0.4, 0.4, 0.9, 0.4);
+                               gr.SetSource (0.4, 0.4, 0.9, 0.4);
                                gr.FillPreserve ();
-                               gr.SetSourceRGBA (0.9, 0.9, 1.0, 0.8);
+                               gr.SetSource (0.9, 0.9, 1.0, 0.8);
                                gr.Stroke ();
                        }
                        gr.Restore ();  
index 267692d7e0fc83d36daaec22bf6acf9d9ef17961..191a9faf27ad7d704a2f29fe8a41accfbd4b60e0 100644 (file)
@@ -114,10 +114,10 @@ namespace Crow {
                        else
                                cb.Height = (int)(cb.Height / Maximum * Value);
 
-                       Background.SetAsSource (gr, cb);
+                       Background.SetAsSource (IFace, gr, cb);
                        CairoHelpers.CairoRectangle (gr, cb, CornerRadius);
                        gr.Fill ();
-                       Foreground.SetAsSource (gr, cb);
+                       Foreground.SetAsSource (IFace, gr, cb);
                        if (borderWidth > 0)
                                CairoHelpers.CairoRectangle (gr, cb, CornerRadius, borderWidth);
                }
index 7bf2895c78818c19659908e3230c3e668eb93c2c..64f8217ee24720050d12168a4b289229331a37f8 100644 (file)
@@ -91,7 +91,7 @@ namespace Crow
                        grad.Stops.Add (new Gradient.ColorStop (0.833, new Color (1, 0, 1, 1)));
                        grad.Stops.Add (new Gradient.ColorStop (1,     new Color (1, 0, 0, 1)));
 
-                       grad.SetAsSource (gr, r);
+                       grad.SetAsSource (IFace, gr, r);
                        CairoHelpers.CairoRectangle (gr, r, CornerRadius);
                        gr.Fill();
 
index 04cb2e225478fabbf8e03c52b35fcdbbcbe2f0b2..5f8ed06e5fb556b9976bde8d2e546da3b153e653 100644 (file)
@@ -175,10 +175,10 @@ namespace Crow
                        if (_pic == null)
                                return;
 
-                       _pic.Paint (gr, ClientRectangle, _svgSub);
+                       _pic.Paint (IFace, gr, ClientRectangle, _svgSub);
 
                        if (Opacity<1.0) {
-                               gr.SetSourceRGBA (0.0, 0.0, 0.0, 1.0-Opacity);
+                               gr.SetSource (0.0, 0.0, 0.0, 1.0-Opacity);
                                gr.Operator = Operator.DestOut;
                                gr.Rectangle (ClientRectangle);
                                gr.Fill ();
index fa2fe46b45ccbfe235723b24cdc3bbdd1de781bf..3b1e4ea46c2e5d0f9953951e3c4b798d26c3a46a 100644 (file)
@@ -588,7 +588,7 @@ namespace Crow {
                                }else
                                        computeTextCursorPosition(gr);
 
-                               Foreground.SetAsSource (gr);
+                               Foreground.SetAsSource (IFace, gr);
                                gr.LineWidth = 1.0;
                                gr.MoveTo (0.5 + textCursorPos + rText.X, rText.Y + CurrentLine * (fe.Ascent+fe.Descent));
                                gr.LineTo (0.5 + textCursorPos + rText.X, rText.Y + (CurrentLine + 1) * (fe.Ascent+fe.Descent));
@@ -639,7 +639,7 @@ namespace Crow {
                                if (string.IsNullOrWhiteSpace (l))
                                        continue;
 
-                               Foreground.SetAsSource (gr);
+                               Foreground.SetAsSource (IFace, gr);
                                gr.MoveTo (lineRect.X,(double)rText.Y + fe.Ascent + (fe.Ascent+fe.Descent) * i) ;
 
                 gr.ShowText (l);
index a0d8e10a4138185236b7c2eee1152e06a175543e..c9e40b48337236e8fb3d4ebfb1bb7c2abfb0b372 100644 (file)
@@ -28,7 +28,7 @@ namespace Crow
 
                        Rectangle rBack = ClientRectangle;
                        rBack.Width = (int)((double)rBack.Width / Maximum * Value);
-                       Foreground.SetAsSource (gr, rBack);
+                       Foreground.SetAsSource (IFace, gr, rBack);
 
                        CairoHelpers.CairoRectangle(gr,rBack,CornerRadius);
                        gr.Fill();
index a2b39567c639594223b0111a608ce979357fda08..c56dd30c69361c7932b5ee004c42eb95338d3890 100644 (file)
@@ -49,7 +49,7 @@ namespace Crow
                        Rectangle r = ClientRectangle;
 
                        if (Foreground != null) {//TODO:test if null should be removed
-                               Foreground.SetAsSource (gr, r);
+                               Foreground.SetAsSource (IFace, gr, r);
                                CairoHelpers.CairoRectangle (gr, r, CornerRadius);
                                gr.Fill ();
                        }
@@ -57,13 +57,13 @@ namespace Crow
                        Crow.Gradient grad = new Gradient (Gradient.Type.Horizontal);
                        grad.Stops.Add (new Gradient.ColorStop (0, new Color (1, 1, 1, 1)));
                        grad.Stops.Add (new Gradient.ColorStop (1, new Color (1, 1, 1, 0)));
-                       grad.SetAsSource (gr, r);
+                       grad.SetAsSource (IFace, gr, r);
                        CairoHelpers.CairoRectangle (gr, r, CornerRadius);
                        gr.Fill();
                        grad = new Gradient (Gradient.Type.Vertical);
                        grad.Stops.Add (new Gradient.ColorStop (0, new Color (0, 0, 0, 0)));
                        grad.Stops.Add (new Gradient.ColorStop (1, new Color (0, 0, 0, 1)));
-                       grad.SetAsSource (gr, r);
+                       grad.SetAsSource (IFace, gr, r);
                        CairoHelpers.CairoRectangle (gr, r, CornerRadius);
                        gr.Fill();
 
index 0314be5033dcb14a18df171677c29e909240fe33..a706d692f6dcf2f160fb2e7dfaeb2e40ec976d44 100644 (file)
@@ -184,7 +184,7 @@ namespace Crow
                {
                        Rectangle rBack = new Rectangle (Slot.Size);
 
-                       Background.SetAsSource (gr, rBack);
+                       Background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle(gr,rBack, CornerRadius);
                        gr.Fill ();
 
index 979d9c4ac39365b445b8fb1c8ec6fd8c98229cb4..e1f816d514a8b806aa2e42c5f402cab52c2752c2 100644 (file)
@@ -120,7 +120,7 @@ namespace Crow
                                                        readDouble (); readDouble (); readDouble (); readDouble ();
                                                        break;
                                                }
-                                               gr.SetSourceRGBA (readDouble (), readDouble (), readDouble (), readDouble ());
+                                               gr.SetSource (readDouble (), readDouble (), readDouble (), readDouble ());
                                                break;
                                        default:
                                                throw new Exception ("Invalid character in path string of Shape control");
@@ -223,7 +223,7 @@ namespace Crow
                        gr.Translate ((cr.Width / widthRatio - w) / 2, (cr.Height / heightRatio - h) / 2);
 
                        gr.LineWidth = strokeWidth;
-                       Foreground.SetAsSource (gr, cr);
+                       Foreground.SetAsSource (IFace, gr, cr);
 
                        using (PathParser parser = new PathParser (path))
                                parser.Draw (gr);
index 19fcb94e5ce00dd9c33f1d0f15d6d831e1099acf..109b1e533cf028e8542c75dc56fe01b7c2f0c0ba 100644 (file)
@@ -154,14 +154,14 @@ namespace Crow
                        gr.LineTo (0.5, Slot.Height-0.5);
                        gr.ClosePath ();
                        gr.LineWidth = 1;
-                       Foreground.SetAsSource (gr);
+                       Foreground.SetAsSource (IFace, gr);
                        gr.StrokePreserve ();
                        gr.ClipPreserve ();
 
-                       if (IsSelected)
-                               SelectedBackground.SetAsSource (gr, ClientRectangle);
+                       if (tv.isSelectedTab (this))
+                               SelectedBackground.SetAsSource (IFace, gr, ClientRectangle);
                        else
-                               Background.SetAsSource (gr, ClientRectangle);
+                               Background.SetAsSource (IFace, gr, ClientRectangle);
 
                        gr.Fill ();
 
index cce3288316264db53019a909cc6dc85efeb58ab7..9a88d72f0e07a36a6e844271d134de9123f302c1 100644 (file)
@@ -237,7 +237,7 @@ namespace Crow
                {
                        Rectangle rBack = new Rectangle (Slot.Size);
 
-                       Background.SetAsSource (gr, rBack);
+                       Background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle(gr,rBack, CornerRadius);
                        gr.Fill ();
 
@@ -308,6 +308,8 @@ namespace Crow
                {
                        SelectedTab = Children.IndexOf (sender as Widget);
                }
+               internal bool isSelectedTab (TabItem ti) =>
+                       Children.IndexOf (ti) == selectedTab;
        }
 }
 
index e700513e4963367ec40c62d5c578f1c6297a89bf..74c71fe2801d788b5eabb2307f9a0aab34379c58 100644 (file)
@@ -119,7 +119,7 @@ namespace Crow
 
                                if (!IFace.DefaultTemplates.ContainsKey (mdTok)) {
                                        string defTmpId = this.GetType ().FullName + ".template";
-                                       Stream s = Interface.GetStreamFromPath ("#" + defTmpId);
+                                       Stream s = IFace.GetStreamFromPath ("#" + defTmpId);
                                        if (s == null)
                                                throw new Exception (string.Format ("No default template found for '{0}'", this.GetType ().FullName));
                                        IFace.DefaultTemplates [mdTok] = new IML.Instantiator (IFace, s, defTmpId);
index 042dbdbce959b15538ae95f96abd03552f03d313..4c69e0e0761475b3b0b9acbdc0ddc1ad31e3a9aa 100644 (file)
@@ -267,7 +267,7 @@ namespace Crow
                                                continue;
                                        }
 
-                                       Foreground.SetAsSource (gr);
+                                       Foreground.SetAsSource (IFace, gr);
                                        gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * curLineCount);
 
                                        gr.ShowText (ll);
index ebc3cedbf1d3b10430f51c60f61bd10787ce4f78..1a2d137529504a158038d2ed0e3d203a9f90f36a 100644 (file)
@@ -135,13 +135,13 @@ namespace Crow
 
 
 
-                       LowThresholdFill.SetAsSource (gr);
+                       LowThresholdFill.SetAsSource (IFace, gr);
                        gr.MoveTo (r.Left, r.Bottom - LowThreshold * scaleY);
                        gr.LineTo (r.Right, r.Bottom - LowThreshold * scaleY);
 //                     gr.Rectangle (r.Left, r.Bottom - LowThreshold * scaleY, r.Width, LowThreshold * scaleY);
                        gr.Stroke();
 
-                       HighThresholdFill.SetAsSource (gr);
+                       HighThresholdFill.SetAsSource (IFace, gr);
                        gr.MoveTo (r.Left, (Maximum - HighThreshold) * scaleY);
                        gr.LineTo (r.Right, (Maximum - HighThreshold) * scaleY);
 //                     gr.Rectangle (r.Left, r.Top, r.Width, (Maximum - HighThreshold) * scaleY);
@@ -149,7 +149,7 @@ namespace Crow
 
                        gr.MoveTo (ptrX, values [i] * scaleY);
 
-                       Foreground.SetAsSource (gr);
+                       Foreground.SetAsSource (IFace, gr);
                        gr.SetDash (new double[]{ }, 0.0);
 
                        while (i >= 0) {
index d75c63c4416a8cb7fa9c11f18f905b293af6624e..ac170479edf9486e1eec51c91bd3f4f9f6942a4f 100644 (file)
@@ -1792,7 +1792,7 @@ namespace Crow
 
                        Rectangle rBack = new Rectangle (Slot.Size);
 
-                       background.SetAsSource (gr, rBack);
+                       background.SetAsSource (IFace, gr, rBack);
                        CairoHelpers.CairoRectangle (gr, rBack, cornerRadius);
                        gr.Fill ();
 
@@ -1908,7 +1908,7 @@ namespace Crow
                }
                void paintDisabled(Context gr, Rectangle rb){
                        gr.Operator = Operator.Xor;
-                       gr.SetSourceRGBA (0.6, 0.6, 0.6, 0.3);
+                       gr.SetSource (0.6, 0.6, 0.6, 0.3);
                        gr.Rectangle (rb);
                        gr.Fill ();
                        gr.Operator = Operator.Over;
index cb596c7019e27b5611370f89909a99c7a1e5c279..14151b8dc5464824e896de52cbc3024dbe8e5321 100644 (file)
@@ -86,9 +86,9 @@ namespace Crow
                        return tmp;
                }
 
-               public static XCursorFile Load(string path)
+               public static XCursorFile Load(Interface iFace, string path)
                {
-                       return loadFromStream (Interface.GetStreamFromPath (path));
+                       return loadFromStream (iFace.GetStreamFromPath (path));
                }
 
                static XCursor imageLoad (BinaryReader sr)