<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
- <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
- <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<ConsolePause>false</ConsolePause>
- <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
- <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="cairo-sharp">
<Package>gtk-sharp-3.0</Package>
</Reference>
- <Reference Include="gdk-sharp">
- <Package>gtk-sharp-2.0</Package>
- </Reference>
- <Reference Include="gio-sharp">
- <Package>gio-sharp-3.0</Package>
- </Reference>
- <Reference Include="glib-sharp">
- <Package>glib-sharp-3.0</Package>
- </Reference>
<Reference Include="OpenTK">
<HintPath>$(SolutionDir)packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
<Package>opentk</Package>
<EmbeddedResource Include="ui\MembersView.template">
<LogicalName>CrowIDE.MembersView.template</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="ui\bindingExplorer.crow" />
- <EmbeddedResource Include="ui\bindingExpITemp.crow" />
<EmbeddedResource Include="ui\LQIsExplorer.crow" />
<EmbeddedResource Include="Default.style" />
+ <EmbeddedResource Include="ui\GTreeExplorer.crow" />
+ <EmbeddedResource Include="ui\GTreeExpITemp.crow" />
</ItemGroup>
<ItemGroup>
<None Include="ui\test.crow">
if (bindingExp != null) {
CrowInterface.DeleteWidget (bindingExp);
}
- bindingExp = CrowInterface.LoadInterface ("#CrowIDE.ui.bindingExplorer.crow");
+ bindingExp = CrowInterface.LoadInterface ("#CrowIDE.ui.GTreeExplorer.crow");
bindingExp.DataSource = imlVE;
return;
} else if (e.Key == OpenTK.Input.Key.F6) {
public static class Extensions
{
public static List<GraphicObject> GetChildren(this GraphicObject go){
- if (go is Group)
+ Type goType = go.GetType();
+ if (typeof (Group).IsAssignableFrom (goType))
return (go as Group).Children;
- if (go is Container)
+ if (typeof(Container).IsAssignableFrom (goType))
return new List<GraphicObject>( new GraphicObject[] { (go as Container).Child });
+ if (typeof(TemplatedContainer).IsAssignableFrom (goType))
+ return new List<GraphicObject>( new GraphicObject[] { (go as TemplatedContainer).Content });
+ if (typeof(TemplatedGroup).IsAssignableFrom (goType))
+ return (go as TemplatedGroup).Items;
+
return new List<GraphicObject>();
}
}
public ImlVisualEditor () : base()
{
imlVE = new Interface ();
+ imlVE.DesignMode = true;
Thread t = new Thread (interfaceThread);
t.IsBackground = true;
t.Start ();
}
}
+ public List<GraphicObject> GraphicTree {
+ get { return imlVE.GraphicTree; }
+ }
void reloadFromSource(){
using (StreamReader sr = new StreamReader (imlPath)) {
ImlSource = sr.ReadToEnd ();
}
+ NotifyValueChanged ("GraphicTree", GraphicTree);
}
void reload_iTor(Instantiator new_iTot){
itor = new_iTot;
--- /dev/null
+<?xml version="1.0"?>
+<Expandable Caption="{Name}" >
+ <Template>
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}">
+ <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
+ MouseEnter="{Background=LightGray}"
+ MouseLeave="{Background=Transparent}">
+ <Image
+ Path="{./Image}"
+ Visible="{./IsExpandable}"
+ SvgSub="{./IsExpanded}"/>
+ </Container>
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Images.Icons.folder.svg"/>
+ <Label Text="{./Caption}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false"/>
+ </VerticalStack>
+ </Template>
+ <HorizontalStack Height="Fit">
+ <GraphicObject Width="12" Height="10"/>
+ <TreeView Name="List" Height="Fit"
+ Template="#Crow.Templates.treeList.crow" />
+ </HorizontalStack>
+</Expandable>
--- /dev/null
+<?xml version="1.0"?>
+<Window Title="Graphic Tree" Width="20%" Height="90%" Background="DimGray" AlwaysOnTop="true">
+ <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}" Background="Jet">
+ <ItemTemplate>
+ <Label Text="{Name}" Width="Stretched"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}"/>
+ </ItemTemplate>
+ <ItemTemplate DataType="Crow.Group" Data="GetChildren"
+ Path="#CrowIDE.ui.GTreeExpITemp.crow"/>
+ <ItemTemplate DataType="Crow.Container" Data="GetChildren"
+ Path="#CrowIDE.ui.GTreeExpITemp.crow"/>
+ <ItemTemplate DataType="Crow.TemplatedContainer" Data="GetChildren"
+ Path="#CrowIDE.ui.GTreeExpITemp.crow"/>
+ <ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren"
+ Path="#CrowIDE.ui.GTreeExpITemp.crow"/>
+ </TreeView>
+</Window>
+++ /dev/null
-<?xml version="1.0"?>
-<Expandable Caption="{Name}" >
- <Template>
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
- MouseLeave="{Background=Transparent}">
- <Image Margin="2" Width="12" Height="12"
- Visible="{./HasContent}"
- Path="{./Image}"
- SvgSub="{./IsExpanded}"/>
- <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
- </HorizontalStack>
- <Container Name="Content" Visible="false"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
- </VerticalStack>
- </Template>
- <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
- <GraphicObject Width="12" Height="10"/>
- <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}"
- Template="#Crow.Templates.treeList.crow" />
- </HorizontalStack>
-</Expandable>
+++ /dev/null
-<?xml version="1.0"?>
-<Window Width="50%" Height="50%" Background="DimGray">
- <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}">
- <ItemTemplate DataType="Crow.GraphicObject">
- <Label Text="{Name}" Width="Stretched"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
- MouseLeave="{Background=Transparent}"/>
- </ItemTemplate>
- <ItemTemplate DataType="Crow.Container" Data="GetChildren"
- Path="#CrowIDE.ui.bindingExpITemp.crow"/>
- <ItemTemplate DataType="Crow.Group" Data="GetChildren"
- Path="#CrowIDE.ui.bindingExpITemp.crow"/>
- </TreeView>
-</Window>
public virtual List<GraphicObject> Items{ get { return items.Children; }}
[XmlAttributeAttribute][DefaultValue(-1)]public int SelectedIndex{
get { return _selectedIndex; }
- set {
+ set {
if (value == _selectedIndex)
return;
- _selectedIndex = value;
+ _selectedIndex = value;
NotifyValueChanged ("SelectedIndex", _selectedIndex);
NotifyValueChanged ("SelectedItem", SelectedItem);
protected void raiseSelectedItemChanged(){
SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem));
}
-
+
public virtual void AddItem(GraphicObject g){
items.AddChild (g);
if (loadingThread == null)
return;
if (!loadingThread.IsAlive)
- return;
+ return;
cancelLoading = true;
loadingThread.Join ();
cancelLoading = false;
page = gs;
}else
- page = Activator.CreateInstance (items.GetType ()) as Group;
+ page = Activator.CreateInstance (items.GetType ()) as Group;
page.Name = "page" + pageNum;
itempKey = getItempKey (dataType, data [i]);
if (ItemTemplates.ContainsKey (itempKey))
- iTemp = ItemTemplates [itempKey];
- else
- iTemp = ItemTemplates ["default"];
+ iTemp = ItemTemplates [itempKey];
+ else {
+ foreach (string it in ItemTemplates.Keys) {
+ Type t = Type.GetType (it);
+ if (t == null)
+ continue;
+ if (t.IsAssignableFrom (dataType)) {//TODO:types could be cached
+ iTemp = ItemTemplates [it];
+ break;
+ }
+ }
+ if (iTemp == null)
+ iTemp = ItemTemplates ["default"];
+ }
lock (CurrentInterface.LayoutMutex) {
g = iTemp.CreateInstance(CurrentInterface);