]> O.S.I.I.S - jp/crow.git/commitdiff
crowIDE wip, lock layouting for items loading in tg
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 23 Feb 2018 11:07:22 +0000 (12:07 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 23 Feb 2018 11:07:22 +0000 (12:07 +0100)
Crow.csproj
Crow.sln
Icons/frame.svg [new file with mode: 0644]
Templates/ContextMenu.template
Tests/GraphicObjects/TechBorder.cs [new file with mode: 0644]
Tests/Tests.csproj
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/TemplatedGroup.cs
src/Interface.cs

index af3df9f19a575c23e9f3f1e1be788be6d33631f6..6a4c56b32ea01ac340582882cf0d9837a9a5d4e2 100644 (file)
     <AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
-    <ReleaseVersion>0.7</ReleaseVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
     <Optimize>false</Optimize>
     <OutputPath>$(SolutionDir)build\Debug</OutputPath>
+    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_DISPOSE0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <Optimize>true</Optimize>
     <EmbeddedResource Include="Icons\folder.svg" />
     <EmbeddedResource Include="Icons\file.svg" />
     <EmbeddedResource Include="Icons\level-up.svg" />
+    <EmbeddedResource Include="Icons\frame.svg" />
     <EmbeddedResource Include="Templates\FileItems.template" />
     <EmbeddedResource Include="Templates\DefaultItem.template">
       <LogicalName>Crow.DefaultItem.template</LogicalName>
index 156e43df52e0506bec5ca09dcf0eb291f63b9337..61aaa3af8775aeb9a09a749f64f9daf9dd49ede9 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Test", "Crow.Test\Crow.Test.csproj", "{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{B6D911CD-1D09-42FC-B300-9187190F2AE1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Coding", "..\gts\CrowEdit\Crow.Coding\Crow.Coding.csproj", "{78842EE4-8A2F-4C75-AEC6-C95F15AD3994}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -19,31 +23,47 @@ Global
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
                $0.StandardHeader = $1
                $1.Text = @\n${FileName}\n \nAuthor:\n      ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) 2013-2017 Jean-Philippe Bruyère\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
-               $1.IncludeInNewFiles = True
                $0.DotNetNamingPolicy = $2
-               $2.DirectoryNamespaceAssociation = None
-               $2.ResourceNamePolicy = FileFormatDefault
                $0.TextStylePolicy = $3
-               $3.FileWidth = 120
-               $3.TabsToSpaces = False
                $3.EolMarker = Unix
-               $3.inheritsSet = VisualStudio
-               $3.inheritsScope = text/plain
                $3.scope = text/x-csharp
                $0.CSharpFormattingPolicy = $4
                $4.AfterDelegateDeclarationParameterComma = True
-               $4.inheritsSet = Mono
-               $4.inheritsScope = text/x-csharp
                $4.scope = text/x-csharp
+               $4.IndentSwitchSection = False
+               $4.NewLinesForBracesInProperties = False
+               $4.NewLinesForBracesInAccessors = False
+               $4.NewLinesForBracesInAnonymousMethods = False
+               $4.NewLinesForBracesInControlBlocks = False
+               $4.NewLinesForBracesInAnonymousTypes = False
+               $4.NewLinesForBracesInObjectCollectionArrayInitializers = False
+               $4.NewLinesForBracesInLambdaExpressionBody = False
+               $4.NewLineForElse = False
+               $4.NewLineForCatch = False
+               $4.NewLineForFinally = False
+               $4.NewLineForMembersInObjectInit = False
+               $4.NewLineForMembersInAnonymousTypes = False
+               $4.NewLineForClausesInQuery = False
+               $4.SpacingAfterMethodDeclarationName = True
+               $4.SpaceAfterMethodCallName = True
+               $4.SpaceBeforeOpenSquareBracket = True
                $0.VersionControlPolicy = $5
                $5.CommitMessageStyle = $6
                $6.Indent = @\t
@@ -51,8 +71,7 @@ Global
                $6.LastFilePostfix = "@:\n  "
                $6.LineAlign = 0
                $6.Wrap = False
-               $5.inheritsSet = Mono
                description = @C.R.O.W. c# Rapid Open Widgets\n\nCrow is a pure c# widget toolkit with XML definition of interface, bindings, styling...\n
-               version = 0.7
+               version = 0.5
        EndGlobalSection
 EndGlobal
diff --git a/Icons/frame.svg b/Icons/frame.svg
new file mode 100644 (file)
index 0000000..576d418
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="67.316353mm"
+   height="27.756908mm"
+   viewBox="0 0 67.316353 27.756908"
+   version="1.1"
+   id="svg8895"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="frame.svg">
+  <defs
+     id="defs8889" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#434343"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.35"
+     inkscape:cx="195.58263"
+     inkscape:cy="-58.812438"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1600"
+     inkscape:window-height="881"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0" />
+  <metadata
+     id="metadata8892">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Calque 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(106.44585,-169.24652)">
+    <polygon
+       transform="matrix(0.26458333,0,0,0.26458333,-314.15488,52.734079)"
+       style="fill:#f5fcff"
+       id="polygon6818"
+       points="860.815,440.362 785.042,440.362 785.042,469.369 789.327,469.369 789.327,515.071 815.242,540.986 971.44,540.986 971.44,545.27 1001.438,545.27 1001.438,540.986 1039.466,540.986 1039.466,470.564 1013.109,444.207 1012.21,445.105 1038.193,471.091 1038.193,539.714 815.77,539.714 790.598,514.544 790.598,445.919 1014.176,445.919 1014.176,444.648 860.815,444.648 " />
+  </g>
+</svg>
index 3fb2955225c592b40e16ea18b0e0092971d7979e..58e71b7ce89f36f5777201301e9f496f1a82f579 100644 (file)
@@ -14,7 +14,7 @@
                <MenuItem Command="{}" Width="150" PopWidth="120" SelectionBackground="Transparent">
                        <Template>
                                <Popper Font="{./Font}" Caption="{./Caption}"  Background="{./Background}" PopDirection="{./PopDirection}"
-                                       Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseClick="./onMI_Click"
+                                       Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseDown="./onMI_Click"
                                        IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}">
                                        <Template>
                                                <Border Name="border1"
diff --git a/Tests/GraphicObjects/TechBorder.cs b/Tests/GraphicObjects/TechBorder.cs
new file mode 100644 (file)
index 0000000..4f818e5
--- /dev/null
@@ -0,0 +1,88 @@
+//
+// TechBorder.cs
+//
+// Author:
+//       Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Crow;
+
+namespace Tests
+{
+       public class TechBorder : Container
+       {
+               public TechBorder () : base() {}
+               public TechBorder (Interface iface): base (iface){}
+
+               protected override int measureRawSize (LayoutingType lt)
+               {
+                       return base.measureRawSize (lt) + 6;
+               }
+               protected override void onDraw (Cairo.Context gr)
+               {
+                       gr.Save ();
+
+                       drawTechBorder1 (gr);
+
+                       if (child != null) {
+                               if (child.Visible)
+                                       child.Paint (ref gr);
+                       }
+
+                       gr.Restore ();
+               }
+
+               void drawTechBorder1 (Cairo.Context gr){
+                       Rectangle r = ClientRectangle;
+
+                       double l1 = Math.Round(0.2 * Math.Min (r.Width, r.Height)) + 0.5;
+
+                       Foreground.SetAsSource (gr);
+                       gr.LineWidth = 6.0;
+                       gr.MoveTo (r.Left + 1.5, r.Top + l1);
+                       gr.LineTo (r.Left + 1.5, r.Top + 1.5);
+                       gr.LineTo (r.Left + l1, r.Top + 1.5);
+                       gr.MoveTo (r.Left + r.Width * 0.65, r.Bottom - 1.5);
+                       gr.LineTo (r.Left + r.Width * 0.85, r.Bottom - 1.5);
+                       gr.Stroke ();
+
+                       gr.MoveTo (r.Left + 2.5, r.Top + 2.5);
+                       gr.LineTo (r.Left + 2.5, r.Bottom - l1);
+                       gr.LineTo (r.Left + l1, r.Bottom - 2.5);
+                       gr.LineTo (r.Right - 2.5, r.Bottom - 2.5);
+                       gr.LineTo (r.Right - 2.5, r.Top + l1);
+                       gr.LineTo (r.Right - l1, r.Top + 2.5);
+                       gr.ClosePath ();
+
+                       if (ClipToClientRect) //clip to client zone                             
+                               gr.ClipPreserve ();                     
+
+                       Background.SetAsSource (gr);
+                       gr.FillPreserve ();
+
+                       gr.LineWidth = 1.0;
+                       Foreground.SetAsSource (gr);
+                       gr.Stroke ();                   
+               }
+       }
+}
+
index be91d79121b5b4beef7b08ec05beaee6a9b8df07..677eec33cdda71d77b29d8b331242cc21e16c02d 100644 (file)
@@ -8,10 +8,10 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>Tests.Showcase</StartupObject>
+    <StartupObject>Tests.BasicTests</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ReleaseVersion>0.7</ReleaseVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
     <OutputPath>$(SolutionDir)build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build/obj/$(Configuration)</IntermediateOutputPath>
     <CustomCommands>
     <Compile Include="Tutorials\T4_Gauge.cs" />
     <Compile Include="Tutorials\T2_IML.cs" />
     <Compile Include="GraphicObjects\HexaContainer.cs" />
+    <Compile Include="GraphicObjects\TechBorder.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="image\u.svg">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="Interfaces\Container\0.crow">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-    <None Include="Interfaces\Container\1.crow">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\Container\1.crow" />
     <None Include="Interfaces\Container\2.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
index dbd12d414c14a8f02a5cd80b19f5a2b47506d0b2..1e7fab8e4628bb05b65688fbe369e7ee206ea9a9 100644 (file)
@@ -159,18 +159,18 @@ namespace Crow.IML
                                                        else
                                                                il.Emit (OpCodes.Ldc_I4_0);
                                                        break;
-                                                       //                                              case TypeCode.Empty:
-                                                       //                                                      break;
-                                                       //                                              case TypeCode.Object:
-                                                       //                                                      break;
-                                                       //                                              case TypeCode.DBNull:
-                                                       //                                                      break;
-                                                       //                                              case TypeCode.SByte:
-                                                       //                                                      break;
-                                                       //                                              case TypeCode.Decimal:
-                                                       //                                                      break;
-                                                       //                                              case TypeCode.DateTime:
-                                                       //                                                      break;
+//                                             case TypeCode.Empty:
+//                                                     break;
+//                                             case TypeCode.Object:
+//                                                     break;
+//                                             case TypeCode.DBNull:
+//                                                     break;
+//                                             case TypeCode.SByte:
+//                                                     break;
+//                                             case TypeCode.Decimal:
+//                                                     break;
+//                                             case TypeCode.DateTime:
+//                                                     break;
                                                case TypeCode.Char:
                                                        il.Emit (OpCodes.Ldc_I4, Convert.ToChar (val));
                                                        break;
index 8025435d8483cd0fff8afaa04f7d74e5181b917d..a6f1b1514269f009b1d2fa130602eed8f7a9ad4c 100644 (file)
@@ -427,13 +427,13 @@ namespace Crow
                                        iTemp = ItemTemplates ["default"];
                        }
 
-                       //lock (CurrentInterface.LayoutMutex) {
+                       lock (CurrentInterface.LayoutMutex) {
                                g = iTemp.CreateInstance(CurrentInterface);
                                page.AddChild (g);
 //                             if (isPaged)
                                g.LogicalParent = this;
                                g.MouseDown += itemClick;
-                       //}
+                       }
 
                        if (iTemp.Expand != null && g is Expandable) {
                                (g as Expandable).Expand += iTemp.Expand;
index 485101e61c2b505426a3bee51ff238399865f293..3d2389b2db00604755baff0761c6b1e01be3ddd7 100644 (file)
@@ -1091,16 +1091,18 @@ namespace Crow
 
                public void ShowContextMenu (GraphicObject go) {
 
-                       if (ctxMenuContainer.Parent == null)
-                               this.AddWidget (ctxMenuContainer);
-                       else
-                               ctxMenuContainer.IsOpened = true;
+                       lock (UpdateMutex) {
+                               if (ctxMenuContainer.Parent == null)
+                                       this.AddWidget (ctxMenuContainer);
+                               else
+                                       ctxMenuContainer.IsOpened = true;
 
-                       ctxMenuContainer.isPopup = true;
-                       ctxMenuContainer.LogicalParent = go;
-                       ctxMenuContainer.DataSource = go;
+                               ctxMenuContainer.isPopup = true;
+                               ctxMenuContainer.LogicalParent = go;
+                               ctxMenuContainer.DataSource = go;
 
-                       PutOnTop (ctxMenuContainer, true);
+                               PutOnTop (ctxMenuContainer, true);
+                       }
                        ctxMenuContainer.Left = Mouse.X - 5;
                        ctxMenuContainer.Top = Mouse.Y - 5;