]> O.S.I.I.S - jp/crow.git/commitdiff
wip 0.8.7 v0.8.7
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 12 Jan 2020 02:54:39 +0000 (03:54 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 12 Jan 2020 02:54:39 +0000 (03:54 +0100)
22 files changed:
Crow.sln
Crow/Crow.csproj
Crow/Templates/Button.template
Crow/Templates/ListBox.template
Crow/Templates/ToolWindow.template
Crow/src/IListChanged.cs
Crow/src/Instantiator.cs
Crow/src/Interface.cs
Crow/src/ItemTemplate.cs
Crow/src/ObservableList.cs
Crow/src/Widgets/Image.cs
Crow/src/Widgets/ListBox.cs
Crow/src/Widgets/TabView.cs
Crow/src/Widgets/Table.cs [new file with mode: 0644]
Crow/src/Widgets/TemplatedGroup.cs
Crow/src/Widgets/Window.cs
CrowIDE/CrowIDE.csproj
CrowIDE/src/CrowIDE.cs
CrowIDE/src/Workspace.cs
CrowIDE/ui/Options.crow
Samples/HelloWorld/HelloWorld.csproj
Samples/ShowCase/ShowCase.csproj

index 6481a424f2c2e384a4d8eddd239ec73edbf0f90a..b8997182fc4cafe0fc066690a6642986c05f10b5 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -9,10 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Samples\Hello
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowCase", "Samples\ShowCase\ShowCase.csproj", "{56329D48-D382-4850-93DE-59C453894E8A}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{C40A3F21-0558-4265-9251-718C1564D10A}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlLib", "Samples\ControlLib\ControlLib.csproj", "{91F1CE07-EECE-4F1D-A3EE-7239B563654A}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{1E5C7065-28F9-4A1A-A2FB-DB5E03A63CB3}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -25,20 +25,16 @@ Global
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU
                {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Release|Any CPU.Build.0 = Release|Any CPU
                {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}.Release|Any CPU.Build.0 = Release|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.Build.0 = Release|Any CPU
                {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {C40A3F21-0558-4265-9251-718C1564D10A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {C40A3F21-0558-4265-9251-718C1564D10A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {C40A3F21-0558-4265-9251-718C1564D10A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {C40A3F21-0558-4265-9251-718C1564D10A}.Release|Any CPU.Build.0 = Release|Any CPU
                {91F1CE07-EECE-4F1D-A3EE-7239B563654A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {91F1CE07-EECE-4F1D-A3EE-7239B563654A}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {91F1CE07-EECE-4F1D-A3EE-7239B563654A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {91F1CE07-EECE-4F1D-A3EE-7239B563654A}.Release|Any CPU.Build.0 = Release|Any CPU
+               {1E5C7065-28F9-4A1A-A2FB-DB5E03A63CB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {1E5C7065-28F9-4A1A-A2FB-DB5E03A63CB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
index e2bbd3f7a7034ee5fa5bca0e6b8601e0cd466d6c..7f92e6e752e9dba445b3547c2299ddb1218530a3 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
-               <TargetFrameworks>netstandard2.0</TargetFrameworks>
+               <TargetFramework>netstandard2.0</TargetFramework>
                <AssemblyName>Crow</AssemblyName>
                <Copyright>
                </Copyright>
-               <AssemblyVersion>0.8.6</AssemblyVersion>
+               <AssemblyVersion>0.8.7</AssemblyVersion>
                <Description>C.R.O.W. is a widget toolkit and rendering engine entirely developed in C# with templates, styles, compositing, and bindings.</Description>
                <EnableDefaultItems>false</EnableDefaultItems>
                <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
@@ -22,6 +22,7 @@
                <PackageCopyright>Copyright 2013-2019</PackageCopyright>
                <PackageReleaseNotes></PackageReleaseNotes>
                <DefineConstants>DESIGN_MODE</DefineConstants>          
+               <ReleaseVersion>0.8.0</ReleaseVersion>
        </PropertyGroup>
        <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
                <DebugType>full</DebugType>
index d2f6c602e2ba9d84d71b86ac7e7dc13fe3747de8..14b14a2f80be8828870d772b7b752b72339b5399 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <Border Background="{./Background}" MinimumSize="50,20" Name="Content"
        Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
-       MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black;caption.Foreground=White}"
-       MouseLeave="{Foreground=Transparent;caption.Foreground=LightGrey}"
+       MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}"
+       MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}"
        MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}"
        MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}"                  
        >
index a1aea50ff52d703a0386e411ca3411ab6361c9ab..eb162ba7b55cbba9bd9e06384aae5ad4957ae7e1 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="10,10">
+<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Background="{./Background}">
        <Scroller  Name="scroller1" Margin="1" >
                <VerticalStack
                        Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
index e5c9fe74ab4ae9e6ad98893a17ad70a0211f035d..bad53fea415490017f8b9bb74351b0cb24a619b9 100755 (executable)
@@ -6,7 +6,7 @@
        <VerticalStack Spacing="0">
 <!--           <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit"
                                Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">-->
-                       <HorizontalStack Background="{./TitleBarBackground}"
+                       <HorizontalStack Background="{./TitleBarBackground}" Width="Stretched"
                                        Name="hs" Margin="2" Spacing="0" Height="Fit">
                                <Widget Width="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
index b2b233753538e9c7b906ef6135e0f31eb22036af..fd6e60a719b1386c8df125ff84fd5e7ac9cfa801 100644 (file)
@@ -37,7 +37,12 @@ namespace Crow
        }
        public interface IObservableList {
                event EventHandler<ListChangedEventArg> ListAdd;
-               event EventHandler<ListChangedEventArg> ListRemove;             
+               event EventHandler<ListChangedEventArg> ListRemove;
+               event EventHandler<ListChangedEventArg> ListEdit;
+
+               void Insert ();
+               void Remove ();
+               void RaiseEdit ();
        }
 }
 
index bf9ad37bc209bd349788b5852e2375d2265d3772..1952006c3a1e39c6288cdf6b22b2f46f385cfa65 100644 (file)
@@ -1,28 +1,6 @@
-//
-// Instantiator.cs
+// Copyright (c) 2013-2019  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
 //
-// 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.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
 using System.Collections.Generic;
@@ -256,7 +234,6 @@ namespace Crow.IML {
                        emitGOLoad (ctx, tmpXml);
 
                        ctx.curLine = curLine;
-                       //emitCheckAndBindValueChanged (ctx);
                }
                /// <summary>
                /// Parses the item template tag.
@@ -1141,22 +1118,39 @@ namespace Crow.IML {
                        Debug.WriteLine("\tDataSource Changed: " + dm.Name);
 #endif
                }
+
                /// <summary>
                /// create the valuechanged handler, the datasourcechanged handler and emit event handling
                /// </summary>
-               void emitDataSourceBindings(IMLContext ctx, BindingDefinition bindingDef){
+               void emitDataSourceBindings (IMLContext ctx, BindingDefinition bindingDef)
+               {
+                       Delegate del = emitDataSourceBindings (ctx.CurrentNodeType.GetProperty (bindingDef.SourceMember), bindingDef);
+
+                       //store dschange delegate in instatiator instance for access while instancing graphic object
+                       int delDSIndex = cachedDelegates.Count;
+                       cachedDelegates.Add (del);
+
+                       ctx.emitCachedDelegateHandlerAddition (delDSIndex, CompilerServices.eiDSChange);
+               }
+
+               /// <summary>
+               /// create the valuechanged handler and the datasourcechanged handler and return the 
+               /// DataSourceChange delegate
+               /// </summary>
+               public Delegate emitDataSourceBindings (PropertyInfo piSource, BindingDefinition bindingDef){           
+
 #if DEBUG_BINDING_FUNC_CALLS
                        Console.WriteLine ($"emitDataSourceBindings: {bindingDef}");
 #endif
                        DynamicMethod dm = null;
                        ILGenerator il = null;
                        int dmVC = 0;
-                       PropertyInfo piSource = ctx.CurrentNodeType.GetProperty(bindingDef.SourceMember);
+
                        //if no dataSource member name is provided, valuechange is not handle and datasource change
                        //will be used as origine value
                        string delName = $"dyn_DSvalueChanged_{bindingDef.SourceMember}_{bindingDef.TargetMember}_{NewId}";
                        if (!string.IsNullOrEmpty(bindingDef.TargetMember)){
-#region create valuechanged method
+                       #region create valuechanged method
                                dm = new DynamicMethod (delName,
                                        typeof (void),
                                        CompilerServices.argsBoundValueChange, true);
@@ -1303,17 +1297,13 @@ namespace Crow.IML {
                        il.MarkLabel (newDSIsNull);
                        il.Emit (OpCodes.Ret);
 
-                       //store dschange delegate in instatiator instance for access while instancing graphic object
-                       int delDSIndex = cachedDelegates.Count;
-                       cachedDelegates.Add(dm.CreateDelegate (CompilerServices.ehTypeDSChange, this));
-#endregion
-
-                       ctx.emitCachedDelegateHandlerAddition(delDSIndex, CompilerServices.eiDSChange);
-
 #if DEBUG_BINDING
                        Debug.WriteLine("\tDataSource ValueChanged: " + delName);
                        Debug.WriteLine("\tDataSource Changed: " + dm.Name);
 #endif
+
+                       return dm.CreateDelegate (CompilerServices.ehTypeDSChange, this);
+#endregion
                }
 
                static void emitSetValue (ILGenerator il, MemberInfo mi)
@@ -1322,8 +1312,7 @@ namespace Crow.IML {
                                il.Emit (OpCodes.Stfld, mi as FieldInfo);
                        else if (mi.MemberType == MemberTypes.Property) {
                                MethodInfo mt = (mi as PropertyInfo).GetSetMethod ();
-                               //il.Emit (mt.IsVirtual?OpCodes.Callvirt:OpCodes.Call, mt);
-                               il.Emit (OpCodes.Callvirt, mt);
+                               il.Emit (mt.IsVirtual?OpCodes.Callvirt:OpCodes.Call, mt);
                        } else
                                throw new NotImplementedException ();
                }
index 5488b559a42c7067db7f9c3ebea0e9cdd66ce8a4..72f01bee3f51b30772a59d20c936b4e54011fd7f 100644 (file)
@@ -135,7 +135,7 @@ namespace Crow
                        loadStyling ();
 
                        initTooltip ();
-                       //initContextMenus ();
+                       initContextMenus ();
 
                        Startup ();
                }
index 3b6cf0b27e0757dd21aa5a2549c7d34450da3c53..1d779be724401f791e2872af6050c6e909803a41 100644 (file)
@@ -1,28 +1,6 @@
-//
-// ItemTemplate.cs
+// Copyright (c) 2013-2019  Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
 //
-// 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.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
 using System.IO;
index 96bfccc995e8d6598f831ed3d202d5796720bb01..52ada9acfc6f643ce1d65d8d7bef645dacd04ee6 100644 (file)
@@ -1,47 +1,89 @@
-//
-// IListChanged.cs
+// Copyright (c) 2013-2019  Bruyère Jean-Philippe jp_bruyere@hotmail.com
 //
-// 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.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
 using System;
 using System.Collections.Generic;
 
 namespace Crow
-{      
-       public class ObservableList<T> : List<T> , IObservableList {
+{
+       public class ObservableList<T> : List<T>, IObservableList, IValueChange {
+               #region IValueChange implementation
+               public event EventHandler<ValueChangeEventArgs> ValueChanged;
+               public virtual void NotifyValueChanged (string MemberName, object _value)
+               {
+                       ValueChanged?.Invoke (this, new ValueChangeEventArgs (MemberName, _value));
+               }
+               #endregion
+
+               #region IObservableList implementation
                public event EventHandler<ListChangedEventArg> ListAdd;
-               public event EventHandler<ListChangedEventArg> ListRemove;              
+               public event EventHandler<ListChangedEventArg> ListRemove;
+               public event EventHandler<ListChangedEventArg> ListEdit;
+               #endregion
+
+               public ObservableList() : base () {}
+               public ObservableList (IEnumerable<T> collection) : base (collection) { }
+
+               int selectedIndex = -1;
+
+               public int SelectedIndex {
+                       get => selectedIndex;
+                       set {
+                               if (selectedIndex == value)
+                                       return;
 
-               public void AddElement (T elem) {
-                       this.Add(elem);
+                               if (value > Count - 1)
+                                       selectedIndex = Count - 1;
+                               else
+                                       selectedIndex = value;
+
+                               NotifyValueChanged ("SelectedIndex", selectedIndex);
+                               NotifyValueChanged ("SelectedItem", SelectedItem);
+                       }
+               }
+               public T SelectedItem {
+                       get => selectedIndex < 0 ? default(T) : this [selectedIndex];
+                       set {
+                               this [selectedIndex] = value;
+                       }
+               }
+               public new void Add (T elem) {
+                       base.Add (elem);
                        ListAdd.Raise (this, new ListChangedEventArg (this.Count - 1, elem));
+                       SelectedIndex = this.Count - 1;
                }
-               public void RemoveElement (T elem) {
-                       System.Diagnostics.Debug.WriteLine ("remove elem:" + elem);
-                       int idx = this.IndexOf (elem);
-                       this.RemoveAt (idx);
+               public new void Remove (T elem) {
+                       int idx = IndexOf (elem);
+                       base.RemoveAt (idx);
                        ListRemove.Raise (this, new ListChangedEventArg (idx, elem));
                }
+               public void Remove () {
+                       if (selectedIndex < 0)
+                               return;
+                       RemoveAt (selectedIndex);
+                       SelectedIndex--;
+               }
+               public void Insert ()
+               {
+                       base.Insert (selectedIndex+1, default(T));
+                       SelectedIndex++;
+                       ListAdd.Raise (this, new ListChangedEventArg (selectedIndex, SelectedItem));
+               }
+               public void RaiseEdit () {
+                       if (selectedIndex < 0)
+                               return;
+                       ListEdit.Raise (this, new ListChangedEventArg (selectedIndex, SelectedItem));
+               }
+
+               public new void RemoveAt (int index)
+               {
+                       base.RemoveAt (index);
+                       ListRemove.Raise (this, new ListChangedEventArg (index, null));
+               }
+               public void RaiseEditAt (int index) {
+                       ListEdit.Raise (this, new ListChangedEventArg (index, this[index]));
+               }
        }
 }
 
index 98f86e58cd605cc57f8aa951edc40e9dbbfb6826..87111e845a8e107b960b5c9de49988227344f931 100644 (file)
@@ -1,28 +1,6 @@
-//
-// Image.cs
+// Copyright (c) 2013-2019  Jean-Philippe Bruyère jp_bruyere@hotmail.com
 //
-// 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.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
 using Crow.Cairo;
index 438e8d605eaea418370ed6a71ff51f0d46ac3ae9..f605fa55b738292cc2b9a1bbee00dde43645ae3a 100644 (file)
@@ -43,6 +43,8 @@ namespace Crow
                public ListBox (Interface iface) : base(iface) {}
                #endregion
 
+
+
        }
 }
 
index 423b8ab4e437152a795e51a2fe83ab88e203d984..1f9082d477a248871ec647c8b319ad464915ec08 100644 (file)
@@ -46,7 +46,7 @@ namespace Crow
                int rightSlope;
                Measure tabHeight, tabWidth;
                Orientation _orientation;
-               int selectedTab;
+               int selectedTab = -1;
                #endregion
 
                #region public properties
diff --git a/Crow/src/Widgets/Table.cs b/Crow/src/Widgets/Table.cs
new file mode 100644 (file)
index 0000000..bc14821
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (c) 2019  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+namespace Crow
+{
+       /// <summary>
+       /// Table column definition
+       /// </summary>
+       public class Column : IValueChange
+       {
+               #region IValueChange implementation
+               public event EventHandler<ValueChangeEventArgs> ValueChanged;
+               public virtual void NotifyValueChanged (string MemberName, object _value)
+                       => ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value));
+               #endregion
+
+               string caption;
+               Measure width = Measure.Inherit;
+
+               public string Caption {
+                       get => caption;
+                       set {
+                               if (caption == value)
+                                       return;
+                               caption = value;
+                               NotifyValueChanged ("Caption", caption);
+                       }
+               }
+               /// <summary>
+               /// column width, special value 'Inherit' will be used to share table width equaly among columns
+               /// </summary>
+               /// <value>The column's width.</value>
+               public Measure Width {
+                       get => width;
+                       set {
+                               if (width == value)
+                                       return;
+                               width = value;
+                               NotifyValueChanged ("Width", width);
+                       }
+               }
+
+               //public string Data {
+
+               //}
+       }
+
+
+       public class Table : TemplatedGroup
+       {
+               public Table () : base () {}
+               public Table (Interface iFace) : base (iFace) { }
+
+               public ObservableList<Column> Columns = new ObservableList<Column> ();
+       }
+}
index 42e4dc06660c277dd96978d312e572688b2e746e..9546174e338f35ddf04af6f71cea47e8c2afde89 100644 (file)
@@ -47,6 +47,7 @@ namespace Crow {
                IEnumerable data;
                int _selectedIndex = -1;
                Color selBackground, selForeground;
+               bool selColoring;
 
                int itemPerPage = 50;
                CrowThread loadingThread = null;
@@ -120,23 +121,36 @@ namespace Crow {
                                : items.Children;
                        }
                }
+               /// <summary>
+               /// Enable SelectionBackground and SelectionForeground color for selected item
+               /// </summary>
+               [DefaultValue (false)]
+               public bool SelectionColoring {
+                       get => selColoring;
+                       set {
+                               if (selColoring == value)
+                                       return;
+                               selColoring = value;
+                               NotifyValueChanged ("SelectionColoring", selColoring);
+                       }
+               }
                [DefaultValue(-1)]public virtual int SelectedIndex{
                        get { return _selectedIndex; }
                        set {
                                if (value == _selectedIndex)
                                        return;
 
-                               /*if (_selectedIndex >= 0 && Items.Count > _selectedIndex) {
+                               if (selColoring && _selectedIndex >= 0 && Items.Count > _selectedIndex) {
                                        Items[_selectedIndex].Foreground = Color.Transparent;
                                        Items[_selectedIndex].Background = Color.Transparent;
-                               }*/
+                               }
 
                                _selectedIndex = value;
 
-                               /*if (_selectedIndex >= 0 && Items.Count > _selectedIndex) {
+                               if (selColoring && _selectedIndex >= 0 && Items.Count > _selectedIndex) {
                                        Items[_selectedIndex].Foreground = SelectionForeground;
                                        Items[_selectedIndex].Background = SelectionBackground;
-                               }*/
+                               }
 
                                NotifyValueChanged ("SelectedIndex", _selectedIndex);
                                NotifyValueChanged ("SelectedItem", SelectedItem);
@@ -172,6 +186,7 @@ namespace Crow {
                                        IObservableList ol = data as IObservableList;
                                        ol.ListAdd -= Ol_ListAdd;
                                        ol.ListRemove -= Ol_ListRemove;
+                                       ol.ListEdit -= Ol_ListEdit;
                                }
 
                                data = value;
@@ -180,6 +195,7 @@ namespace Crow {
                                        IObservableList ol = data as IObservableList;
                                        ol.ListAdd += Ol_ListAdd;
                                        ol.ListRemove += Ol_ListRemove;
+                                       ol.ListEdit += Ol_ListEdit;
                                }
 
                                NotifyValueChanged ("Data", data);
@@ -221,6 +237,13 @@ namespace Crow {
                        } else
                                loadItem (e.Element, items, dataTest);
                }
+               void Ol_ListEdit (object sender, ListChangedEventArg e) {
+                       if (this.isPaged) {
+                               throw new NotImplementedException ();
+                       } else
+                               items.Children [e.Index].DataSource = e.Element;
+
+               }
 
                [DefaultValue("SteelBlue")]
                public virtual Color SelectionBackground {
@@ -483,7 +506,8 @@ namespace Crow {
                        }
                }
                internal virtual void itemClick(object sender, MouseButtonEventArgs e){
-                       SelectedIndex = (int)((IList)data)?.IndexOf((sender as Widget).DataSource);
+                       //SelectedIndex = (int)((IList)data)?.IndexOf((sender as Widget).DataSource);
+                       SelectedIndex = items.Children.IndexOf(sender as Widget);
                }
 
                bool emitHelperIsAlreadyExpanded (Widget go){
@@ -504,5 +528,20 @@ namespace Crow {
                {
                        base.OnDataSourceChanged (sender, e);
                }
+
+               public void OnInsertClick (object sender, MouseEventArgs e)
+               {
+                       if (data is IObservableList)
+                               (data as IObservableList).Insert ();
+               }
+               public void OnRemoveClick (object sender, MouseEventArgs e)
+               {
+                       if (data is IObservableList)
+                               (data as IObservableList).Remove ();
+               }
+               public void OnUpdateClick (object sender, MouseEventArgs e) {
+                       if (data is IObservableList)
+                               (data as IObservableList).RaiseEdit ();
+               }
        }
 }
index 22ad640ecffd529a48ad9feb345d3d2a3a38b5aa..23496530026f0d4685497fd6b51307a16b1d7d79 100644 (file)
@@ -1,28 +1,6 @@
-//
-// Window.cs
+// Copyright (c) 2013-2019  Bruyère Jean-Philippe jp_bruyere@hotmail.com
 //
-// 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.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
 using System;
 using System.Xml.Serialization;
index beb912d6f1afa9401feb73c4815951713b55e60a..7b180b26693890659f6c71e0e7a0020ec2a5314a 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Exe</OutputType>        
     <EnableDefaultItems>false</EnableDefaultItems>
     <StartupObject>Crow.Coding.CrowIDE</StartupObject>
+    <ReleaseVersion>0.8.0</ReleaseVersion>
   </PropertyGroup>
               
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
index 0aa743b2246e262df2f2c52817ae11b22207e1ac..07827391d961021b93498b27479555c269f7b691 100644 (file)
@@ -46,7 +46,7 @@ namespace Crow.Coding
             CMDCopy = new Command(new Action(() => copy())) { Caption = "Copy", Icon = new SvgPicture("#CrowIDE.icons.copy-file.svg"), CanExecute = false};
             CMDPaste = new Command(new Action(() => paste())) { Caption = "Paste", Icon = new SvgPicture("#CrowIDE.icons.paste-on-document.svg"), CanExecute = false};
             CMDHelp = new Command(new Action(() => System.Diagnostics.Debug.WriteLine("help"))) { Caption = "Help", Icon = new SvgPicture("#CrowIDE.icons.question.svg") };
-                       CMDOptions = new Command(new Action(() => loadWindow("#CrowIDE.ui.Options.crow"))) { Caption = "Editor Options", Icon = new SvgPicture("#CrowIDE.icons.tools.svg") };
+                       CMDOptions = new Command(new Action(() => loadWindow("#CrowIDE.ui.Options.crow", this))) { Caption = "Editor Options", Icon = new SvgPicture("#CrowIDE.icons.tools.svg") };
 
                        cmdCloseSolution = new Command(new Action(() => closeSolution()))
                        { Caption = "Close Solution", Icon = new SvgPicture("#CrowIDE.icons.paste-on-document.svg"), CanExecute = false};
@@ -71,7 +71,7 @@ namespace Crow.Coding
                        CMDViewGTExp = new Command(new Action(() => loadWindow ("#CrowIDE.ui.DockWindows.winGTExplorer.crow",this)))
                        { Caption = "Graphic Tree Explorer", CanExecute = true};
                        CMDCompile = new Command(new Action(() => compileSolution()))
-                       { Caption = "Compile", CanExecute = false};
+                       { Caption = "Compile Solution", CanExecute = false};
                        CMDViewProjProps = new Command(new Action(loadProjProps))
                        { Caption = "Project Properties", CanExecute = false};
                }
@@ -81,7 +81,7 @@ namespace Crow.Coding
                }
                void openOptionsDialog(){}
                void newFile() {                        
-                       currentSolution.OpenedItems.AddElement(new ProjectFile());
+                       currentSolution.OpenedItems.Add(new ProjectFile());
                }
                void saveFileDialog() {}
                void undo() {}
@@ -138,7 +138,7 @@ namespace Crow.Coding
 
                public CrowIDE ()
                        : base(1024, 800)
-               {                       
+               {
                }
 
                Instantiator instFileDlg;
@@ -160,8 +160,8 @@ namespace Crow.Coding
 
                        if (ReopenLastSolution && !string.IsNullOrEmpty (LastOpenSolution)) {
                                CurrentSolution = new Workspace (LastOpenSolution);
-                               //lock(MainIFace.UpdateMutex)
-                               //      CurrentSolution.ReopenItemsSavedInUserConfig ();
+                               lock(MainIFace.UpdateMutex)
+                                       CurrentSolution.ReopenItemsSavedInUserConfig ();
                        }
 
                        instFileDlg = Instantiator.CreateFromImlFragment
index a28d0fc469fece6500d80af43a054d8561dc66f4..ddbd2d6e88640689ffc8f773afd99d2e032cc75a 100644 (file)
@@ -117,7 +117,7 @@ namespace Crow.Coding
                                        t.GetCustomAttribute<DesignIgnore>(false) == null).ToArray ();
                        ToolboxItems = new ObservableList<GraphicObjectDesignContainer> ();
                        foreach (Type ci in crowItems) {
-                               toolboxItems.AddElement(new GraphicObjectDesignContainer(ci));
+                               toolboxItems.Add(new GraphicObjectDesignContainer(ci));
                        }
                }
                public bool GetProjectFileFromPath (string path, out ProjectFile pi){
@@ -247,21 +247,21 @@ namespace Crow.Coding
 
                public void OpenItem (ProjectItem pi) {
                        if (!openedItems.Contains (pi)) {
-                               openedItems.AddElement (pi);
+                               openedItems.Add (pi);
                                saveOpenedItemsInUserConfig ();
                        }
                }
                public void CloseItem (ProjectItem pi) {                        
-                       openedItems.RemoveElement (pi);
+                       openedItems.Remove (pi);
                        saveOpenedItemsInUserConfig ();
                }
 
                public void CloseSolution () {
                        while (openedItems.Count > 0) {
-                               openedItems.RemoveElement (openedItems [0]);
+                               openedItems.Remove (openedItems [0]);
                        }
                        while (toolboxItems?.Count > 0) {
-                               toolboxItems.RemoveElement (toolboxItems [0]);
+                               toolboxItems.Remove (toolboxItems [0]);
                        }
                        NotifyValueChanged ("Projects", null);
                }
index 7d401e059d66fddfd052b9ac1f720a6d754f3132..973beed7fc0244e2eb53f35d42f7f0331b6bc2df 100644 (file)
@@ -1,16 +1,13 @@
 <?xml version="1.0"?>
 <Window Caption="Crow IDE Options" Width="80%" Height="70%" Background="DimGrey" Modal="true">
-       <TabView>
-               <TabItem Caption="IML Visual Editor">
+       <TabView SelectedTab="0">
+               <TabItem Caption="IML Visual Editor" SelectedBackground="Jet">
                        <VerticalStack Margin="10">
                                <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
-                               <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
-                               <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
-                               <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
-                               <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
+                               <CheckBox Caption="Reopen last solution on startup" IsChecked="{²ReopenLastSolution}"/>
                        </VerticalStack>
                </TabItem>
-               <TabItem Caption="Text Editor">
+               <TabItem Caption="Text Editor" SelectedBackground="Jet">
                        <VerticalStack Margin="10">
                                <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
                                <CheckBox Caption="Print Line Numbers" IsChecked="True"/>
index 9363d574dfa03526fe18202701d16748b7b6af77..448fb4354449b3e267ebab9a6b1d4c6050947e5b 100644 (file)
@@ -1,8 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">  
   <PropertyGroup>
-    <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
+    <TargetFramework>net472</TargetFramework>
     <OutputType>Exe</OutputType>        
     <EnableDefaultNoneItems>false</EnableDefaultNoneItems>     
+    <ReleaseVersion>0.8.0</ReleaseVersion>
   </PropertyGroup>
             
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
index 60dbd9ec665d6c6e2fde9416a92c4c4870de0d49..d31e0a6a2e2224279d1c7184190a512bc76d4f36 100644 (file)
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFrameworks>net471</TargetFrameworks>
+    <TargetFrameworks>net472</TargetFrameworks>
     <OutputType>Exe</OutputType>        
     <EnableDefaultNoneItems>false</EnableDefaultNoneItems>    
     <ReleaseVersion>0.8.0</ReleaseVersion>