<Compile Include="OpenGL\vaoMesh.cs" />
<Compile Include="src\CrowIDE.cs" />
<Compile Include="src\ImlVisualEditor.cs" />
+ <Compile Include="src\MembersView.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="ui\" />
<EmbeddedResource Include="ui\imlEditor.crow" />
<EmbeddedResource Include="images\save.svg" />
<EmbeddedResource Include="ui\IDE.style" />
+ <EmbeddedResource Include="ui\MembersView.template">
+ <LogicalName>CrowIDE.MembersView.template</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="ui\test.crow">
reloadFromSource ();
}
}
-
[XmlAttributeAttribute][DefaultValue("")]
public string ImlPath {
get { return imlPath; }
reloadFromPath ();
}
}
+
+
+
void reloadFromSource(){
if (string.IsNullOrEmpty (imlSource)) {
reload_iTor (null);
}
}
}
+
[XmlAttributeAttribute()][DefaultValue(true)]
public bool DrawGrid {
get { return drawGrid; }
RegisterForRedraw ();
}
}
- public ImlVisualEditor () : base()
- {
- imlVE = new Interface ();
- Thread t = new Thread (interfaceThread);
- t.IsBackground = true;
- t.Start ();
+ [XmlIgnore]public object SelectedItem {
+ get { return imlVE.HoverWidget; }
}
-
void interfaceThread()
{
while (true) {
GraphicObject oldHW = imlVE.HoverWidget;
Rectangle scr = this.ScreenCoordinates (this.getSlot ());
imlVE.ProcessMouseMove (e.X - scr.X, e.Y - scr.Y);
- if (oldHW != imlVE.HoverWidget)
- RegisterForRedraw ();
+ if (oldHW == imlVE.HoverWidget)
+ return;
+ RegisterForRedraw ();
+
+ }
+ public override void onMouseDown (object sender, MouseButtonEventArgs e)
+ {
+ base.onMouseDown (sender, e);
+ NotifyValueChanged ("SelectedItem", imlVE.HoverWidget);
}
protected override void onDraw (Cairo.Context gr)
{
--- /dev/null
+//
+// MembersView.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using Crow;
+using System.Xml.Serialization;
+using System.ComponentModel;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace CrowIDE
+{
+ public class PropertyContainer {
+ PropertyInfo pi;
+ object instance;
+
+ public string Name { get { return pi.Name; }}
+ public object Value { get { return pi.GetValue(instance); }}
+
+ public PropertyContainer(PropertyInfo prop, object _instance){
+ pi = prop;
+ instance = _instance;
+ }
+
+ }
+ public class MembersView : ListBox
+ {
+ object instance;
+
+ [XmlAttributeAttribute][DefaultValue(null)]
+ public virtual object Instance {
+ get { return instance; }
+ set {
+ if (instance == value)
+ return;
+ instance = value;
+ NotifyValueChanged ("Instance", instance);
+
+ if (instance == null) {
+ Data = null;
+ return;
+ }
+
+ MemberInfo[] members = instance.GetType ().GetMembers (BindingFlags.Public | BindingFlags.Instance);
+
+ List<PropertyContainer> props = new List<PropertyContainer> ();
+ foreach (MemberInfo m in members) {
+ if (m.MemberType == MemberTypes.Property) {
+ PropertyInfo pi = m as PropertyInfo;
+ if (!pi.CanWrite)
+ continue;
+ if (pi.GetCustomAttribute (typeof(XmlIgnoreAttribute)) != null)
+ continue;
+ props.Add (new PropertyContainer (pi, instance));
+ }
+ }
+ Data = props.ToArray ();
+ }
+ }
+ public MembersView () : base()
+ {
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0"?>
+<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Height="{./HeightPolicy}" Width="{./WidthPolicy}" >
+ <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
+ Height="{./HeightPolicy}" Width="{./WidthPolicy}"
+ ValueChanged="./_scroller_ValueChanged">
+ <VerticalStack LayoutChanged="./_list_LayoutChanged" Spacing="0"
+ Height="Fit" Width="{./WidthPolicy}" Name="List" Margin="0" VerticalAlignment="Top"/>
+ </Scroller>
+</Border>
\ No newline at end of file
<DirectoryView Name="dv" Root="./" SelectedItemChanged="Tv_SelectedItemChanged"
Width="20%" Height="100%" Margin="10"/>
<Splitter/>
- <VerticalStack Height="100%">
- <ImlVisualEditor Height="50%" Margin="0" MinimumSize="10,10" Foreground="SkyBlue"
+ <VerticalStack Width="60%">
+ <ImlVisualEditor Height="60%" Margin="0" MinimumSize="10,10" Foreground="SkyBlue"
ImlPath="{../../../dv.SelectedItem}"
Name="crowContainer" Background="Onyx"/>
<Splitter/>
- <HorizontalStack Height="50%" Margin="10" MinimumSize="10,1">
+ <HorizontalStack Margin="10" MinimumSize="10,1">
<Scroller Name="scroller1" Background="White"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="./_scroller_ValueChanged">
Width="14" />
</HorizontalStack>
</VerticalStack>
+ <Splitter/>
+ <MembersView Width="20%" Instance="{../crowContainer.SelectedItem}">
+ <ItemTemplate DataType="CrowIDE.PropertyContainer">
+ <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Spacing="0"
+ MouseEnter="{Background=UnitedNationsBlue}"
+ MouseLeave="{Background=Transparent}" >
+ <Border Height="Fit" Width="50%" Foreground="DimGray">
+ <Label Margin="1" Text="{Name}" Height="Stretched" Width="Stretched"/>
+ </Border>
+ <Border Height="Fit" Width="50%" Foreground="DimGray">
+ <TextBox Margin="1" Text="{Value}" Height="Stretched" Width="Stretched"/>
+ </Border>
+ </HorizontalStack>
+ </ItemTemplate>
+ </MembersView>
</HorizontalStack>
</VerticalStack>
</Window>
ItemTemplate iTemp = null;
Type dataType = data [i].GetType ();
- if (ItemTemplates.ContainsKey (dataType.FullName))
- iTemp = ItemTemplates [dataType.FullName];
- else
+ while (dataType.FullName != "System.Object") {
+ if (ItemTemplates.ContainsKey (dataType.FullName)) {
+ iTemp = ItemTemplates [dataType.FullName];
+ break;
+ }
+ dataType = dataType.BaseType;
+ if (dataType == null)
+ break;
+ }
+
+ if (iTemp == null)
iTemp = ItemTemplates ["default"];
lock (CurrentInterface.LayoutMutex) {