diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-23 12:07:22 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-02-23 12:07:22 +0100 |
| commit | 938d7a404ec022a077579a8245e80d6fa5bbb890 (patch) | |
| tree | 24cce03708b03fdfddc75dcecc58d2986c992317 | |
| parent | c6ca894ad25ed736e58464dfb0b224145691f529 (diff) | |
crowIDE wip, lock layouting for items loading in tg
| -rw-r--r-- | Crow.csproj | 5 | ||||
| -rw-r--r-- | Crow.sln | 41 | ||||
| -rw-r--r-- | Icons/frame.svg | 66 | ||||
| -rw-r--r-- | Templates/ContextMenu.template | 2 | ||||
| -rw-r--r-- | Tests/GraphicObjects/TechBorder.cs | 88 | ||||
| -rw-r--r-- | Tests/Tests.csproj | 11 | ||||
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 24 | ||||
| -rw-r--r-- | src/GraphicObjects/TemplatedGroup.cs | 4 | ||||
| -rw-r--r-- | src/Interface.cs | 18 |
9 files changed, 217 insertions, 42 deletions
diff --git a/Crow.csproj b/Crow.csproj index af3df9f1..6a4c56b3 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -24,15 +24,15 @@ <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> @@ -361,6 +361,7 @@ <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> @@ -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 index 00000000..576d418f --- /dev/null +++ b/Icons/frame.svg @@ -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> diff --git a/Templates/ContextMenu.template b/Templates/ContextMenu.template index 3fb29552..58e71b7c 100644 --- a/Templates/ContextMenu.template +++ b/Templates/ContextMenu.template @@ -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 index 00000000..4f818e51 --- /dev/null +++ b/Tests/GraphicObjects/TechBorder.cs @@ -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 (); + } + } +} + diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index be91d791..677eec33 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -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> @@ -103,6 +103,7 @@ <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"> @@ -133,11 +134,9 @@ <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> diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index dbd12d41..1e7fab8e 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -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; diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index 8025435d..a6f1b151 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -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; diff --git a/src/Interface.cs b/src/Interface.cs index 485101e6..3d2389b2 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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; |