]> O.S.I.I.S - jp/crow.git/commitdiff
vknet
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 13 Apr 2019 14:58:43 +0000 (16:58 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 13 Apr 2019 14:58:43 +0000 (16:58 +0200)
Crow/Crow.csproj
Crow/Default.style
Crow/src/GraphicObjects/Splitter.cs
Crow/src/Interface.cs

index dce02f07e457c436711c9376ba6b91bd4be05fad..dd3c9881579daac8c932ed5c2ce026383bda39fe 100644 (file)
@@ -21,7 +21,6 @@
     <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
     <AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
-    <ReleaseVersion>0.8.0</ReleaseVersion>
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
@@ -32,7 +31,7 @@
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
     <Optimize>false</Optimize>
     <OutputPath>$(SolutionDir)build\Debug</OutputPath>
-    <DefineConstants>TRACE0;DEBUG;DEBUG_BINDING_FUNC_CALLS0;DEBUG_DRAGNDROP0;DEBUG_LOG0;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+    <DefineConstants>TRACE0;DEBUG;DEBUG_BINDING_FUNC_CALLS0;DEBUG_DRAGNDROP0;DEBUG_LOG0;XLIB_BACKEND0;DESIGN_MODE;DEBUG_UPDATE0;DEBUG_FOCUS;DEBUG_DISPOSE0;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
     <EnvironmentVariables>
       <EnvironmentVariables>
         <Variable name="MONO_CAIRO_DEBUG_DISPOSE" value="1" />
index 5343c09f583bc3b4eebcf97caf5022962f1ac2b9..61678fdfc32c60ec7eab53d85388d6ec265f7d1c 100644 (file)
@@ -114,6 +114,7 @@ ToolWindow {
        Caption = "Window";
        Template = "#Crow.ToolWindow.template";
        Focusable = "true";
+    Movable = "true";
        MinimumSize="50,50";
        Width = "150";
        Height = "150";
index 70c6451071fb2fb21c6bf67bd42469d03451d3ce..53515eb83207dd8a02036799828faf338dbcb355 100644 (file)
@@ -98,7 +98,6 @@ namespace Crow
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {
                        base.onMouseLeave (sender, e);
-                       IFace.backend.SetCursor (MouseCursors.Default);
                }
                public override void onMouseDown (object sender, MouseButtonEventArgs e)
                {
index 170403c4670d0d742af9269143eb80f1d4f840a7..2eab589d8a60317aff0ae6daf40ad15f724c75d0 100644 (file)
@@ -73,14 +73,8 @@ namespace Crow
                }
                #endregion
 
-               internal IBackend backend;
-
                #region CTOR
                static Interface(){
-                       /*if (Type.GetType ("Mono.Runtime") == null) {
-                               throw new Exception (@"C.R.O.W. run only on Mono, download latest version at: http://www.mono-project.com/download/stable/");
-                       }*/
-
                        CrowConfigRoot =
                                System.IO.Path.Combine(
                                        Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
@@ -111,20 +105,12 @@ namespace Crow
 
                        Init ();
 
-                       InitBackend ();
+                       ProcessResize (clientRectangle);
                }
                #endregion
 
                protected bool running;
-               protected virtual void InitBackend () {
-            if (Environment.OSVersion.Platform == PlatformID.Unix)
-                               backend = new XLib.XLibBackend();
-                               //backend = new Crow.XCB.XCBBackend();
-                       else
-                               backend = new Crow.Win32.Win32Backend();
 
-                       backend.Init (this);
-               }
                public void Run () {
                        //load default main.crow if present
                        try {
@@ -162,7 +148,6 @@ namespace Crow
                                        // TODO: dispose managed state (managed objects).
                                }
 
-                               backend.CleanUp ();
 
 
                                disposedValue = true;
@@ -194,13 +179,11 @@ namespace Crow
                        }
 
                        Widget w = _hoverWidget;  //previous hover widget 
+                               
+                       //if (!FocusOnHover || (w == _hoverWidget))
+                       //      return;
 
-                       backend.ProcessEvents ();
-
-                       if (!FocusOnHover || (w == _hoverWidget))
-                               return;
-
-                       w = _hoverWidget;
+                       //w = _hoverWidget;
                        while (w != null) {
                                if (w.Focusable) {
                                        FocusedWidget = _hoverWidget;
@@ -581,8 +564,19 @@ namespace Crow
 
                                _hoverWidget = value;
 
+                               if (FocusOnHover) {
+                                       Widget w = _hoverWidget;  //previous hover widget 
+                                       while (w != null) {
+                                               if (w.Focusable) {
+                                                       FocusedWidget = w;
+                                                       break;
+                                               }
+                                               w = w.focusParent;
+                                       }
+                               }
+
                                #if DEBUG_FOCUS
-                               NotifyValueChanged("HoverWidget", _hoverWidget);
+                               NotifyValueChanged ("HoverWidget", _hoverWidget);
                                #endif
                                /*
                                if (_hoverWidget != null)
@@ -751,61 +745,61 @@ namespace Crow
                        #endif
                        if (DragImage != null)
                                clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight));
-                       //using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
-                       using (ctx = new Context (surf)){
-                               if (!clipping.IsEmpty) {
-                                       IsDirty = true;
+                       using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
+                               using (ctx = new Context (surf)) {
+                                       if (!clipping.IsEmpty) {
+                                               IsDirty = true;
+
+                                               for (int i = 0; i < clipping.NumRectangles; i++)
+                                                       ctx.Rectangle (clipping.GetRectangle (i));
+
+                                               ctx.ClipPreserve ();
+                                               ctx.Operator = Operator.Clear;
+                                               ctx.Fill ();
+                                               ctx.Operator = Operator.Over;
+
+                                               for (int i = GraphicTree.Count - 1; i >= 0; i--) {
+                                                       Widget p = GraphicTree[i];
+                                                       if (!p.Visible)
+                                                               continue;
+                                                       if (clipping.Contains (p.Slot) == RegionOverlap.Out)
+                                                               continue;
 
-                                       for (int i = 0; i < clipping.NumRectangles; i++)
-                                               ctx.Rectangle(clipping.GetRectangle(i));
-                                       
-                                       ctx.ClipPreserve();
-                                       ctx.Operator = Operator.Clear;
-                                       ctx.Fill();
-                                       ctx.Operator = Operator.Over;
-
-                                       for (int i = GraphicTree.Count -1; i >= 0 ; i--){
-                                               Widget p = GraphicTree[i];
-                                               if (!p.Visible)
-                                                       continue;
-                                               if (clipping.Contains (p.Slot) == RegionOverlap.Out)
-                                                       continue;
-
-                                               ctx.Save ();
-                                               p.Paint (ref ctx);
-                                               ctx.Restore ();
-                                       }
-
-                                       if (DragAndDropOperation != null) {
-                                               if (DragImage != null) {
-                                                       DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
-                                                       DragImageX = Mouse.X - DragImageWidth / 2;
-                                                       DragImageY = Mouse.Y - DragImageHeight / 2;
                                                        ctx.Save ();
-                                                       ctx.ResetClip ();
-                                                       ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
-                                                       ctx.PaintWithAlpha (0.8);
+                                                       p.Paint (ref ctx);
                                                        ctx.Restore ();
-                                                       DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
-                                                       IsDirty = true;
-                                                       //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
                                                }
-                                       }
 
-                                       #if DEBUG_CLIP_RECTANGLE
-                                       ctx.LineWidth = 1;
-                                       ctx.SetSourceColor(Color.Magenta.AdjustAlpha (0.5));
-                                       for (int i = 0; i < clipping.NumRectangles; i++)
-                                               ctx.Rectangle(clipping.GetRectangle(i));
-                                       ctx.Stroke ();
-                                       #endif
+                                               if (DragAndDropOperation != null) {
+                                                       if (DragImage != null) {
+                                                               DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+                                                               DragImageX = Mouse.X - DragImageWidth / 2;
+                                                               DragImageY = Mouse.Y - DragImageHeight / 2;
+                                                               ctx.Save ();
+                                                               ctx.ResetClip ();
+                                                               ctx.SetSourceSurface (DragImage, DragImageX, DragImageY);
+                                                               ctx.PaintWithAlpha (0.8);
+                                                               ctx.Restore ();
+                                                               DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
+                                                               IsDirty = true;
+                                                               //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
+                                                       }
+                                               }
 
-                                       clipping.Dispose ();
-                                       clipping = new Region ();
-                                       //}
-                                       //surf.WriteToPng (@"/mnt/data/test.png");
+#if DEBUG_CLIP_RECTANGLE
+                                               ctx.LineWidth = 1;
+                                               ctx.SetSourceColor(Color.Magenta.AdjustAlpha (0.5));
+                                               for (int i = 0; i < clipping.NumRectangles; i++)
+                                                       ctx.Rectangle(clipping.GetRectangle(i));
+                                               ctx.Stroke ();
+#endif
 
-                                       backend?.Flush ();
+                                               clipping.Dispose ();
+                                               clipping = new Region ();
+                                               //}
+                                               //surf.WriteToPng (@"/mnt/data/test.png");
+                                                       
+                                       }
                                }
                        }
                        /*#if DEBUG_LOG
@@ -935,10 +929,9 @@ namespace Crow
                        lock (UpdateMutex) {
                                clientRectangle = bounds;
 
-                               if (surf is XlibSurface)
-                                       (surf as XlibSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
-                               else if (surf is XcbSurface)
-                                       (surf as XcbSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
+                               int stride = 4 * ClientRectangle.Width;
+                               int bmpSize = Math.Abs (stride) * ClientRectangle.Height;
+                               bmp = new byte[bmpSize];
 
                                foreach (Widget g in GraphicTree)
                                        g.RegisterForLayouting (LayoutingType.All);
@@ -956,7 +949,7 @@ namespace Crow
 
                public MouseCursors MouseCursor {
                        set {
-                               backend.SetCursor (value);
+                               //backend.SetCursor (value);
                        }
                }
                /// <summary>Processes mouse move events from the root container, this function
@@ -1118,6 +1111,17 @@ namespace Crow
 
                        _hoverWidget.onMouseDown (_hoverWidget, lastMouseDownEvent);
 
+                       if (!FocusOnHover) {
+                               Widget w = _hoverWidget;  //previous hover widget 
+                               while (w != null) {
+                                       if (w.Focusable) {
+                                               FocusedWidget = w;
+                                               break;
+                                       }
+                                       w = w.focusParent;
+                               }
+                       }
+
                        ActiveWidget = _hoverWidget;
                        return true;
                }
@@ -1156,15 +1160,15 @@ namespace Crow
                }
 
                public bool Shift {
-                       get { return backend.Shift; }
+                       get { return false; }
                }
 
                public bool Ctrl {
-                       get { return backend.Ctrl; }
+                       get { return false; }
                }
 
                public bool Alt {
-                       get { return backend.Alt; }
+                       get { return false; }
                }
                public bool IsKeyDown (Key key) {
                        return false;