finish implementing the PropertyListEditor as a UWT ContainerLayout-based control
This commit is contained in:
parent
c14c2d5f92
commit
255e61deb3
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkTreeStore" id="tm">
|
||||
<columns>
|
||||
<!-- column-name colName -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name colValue -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkWindow">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="tv">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">tm</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcPropertyName">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="sort_column_id">0</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcPropertyValue">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Value</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="sort_column_id">1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@ -719,6 +719,7 @@
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\Ultra3D\Associations\TBV.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\Webfoot\Associations\DAT.uexml" />
|
||||
<Content Include="Extensions\GameDeveloper\Extensions\CRI\CRIFileSystemEditorExtensions.uexml" />
|
||||
<Content Include="Editors\PropertyList\PropertyListEditor.glade" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Configuration\Application.upl" />
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
//
|
||||
// PropertyListEditor.Designer.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019
|
||||
//
|
||||
// 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 MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Layouts;
|
||||
|
||||
namespace UniversalEditor.Editors.PropertyList
|
||||
{
|
||||
partial class PropertyListEditor
|
||||
{
|
||||
private ListView tv = null;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.Layout = new BoxLayout(Orientation.Vertical);
|
||||
|
||||
this.tv = new ListView();
|
||||
this.Controls.Add(tv, new BoxLayout.Constraints(true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
//
|
||||
// PropertyListEditor.cs
|
||||
// PropertyListEditor.cs - cross-platform (UWT) property list editor for Universal Editor
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019
|
||||
// Copyright (c) 2019-2020 Mike Becker's Software
|
||||
//
|
||||
// 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
|
||||
@ -18,17 +18,22 @@
|
||||
//
|
||||
// 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 MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
|
||||
using UniversalEditor.ObjectModels.PropertyList;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Editors.PropertyList
|
||||
{
|
||||
public partial class PropertyListEditor : Editor
|
||||
[ContainerLayout("~/Editors/PropertyList/PropertyListEditor.glade")]
|
||||
public class PropertyListEditor : Editor
|
||||
{
|
||||
public PropertyListEditor()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
private ListView tv = null;
|
||||
private DefaultTreeModel tm = null;
|
||||
|
||||
private static EditorReference _er = null;
|
||||
public override EditorReference MakeReference()
|
||||
@ -50,9 +55,72 @@ namespace UniversalEditor.Editors.PropertyList
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void OnCreated(EventArgs e)
|
||||
{
|
||||
base.OnCreated(e);
|
||||
OnObjectModelChanged(EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected override void OnObjectModelChanged(EventArgs e)
|
||||
{
|
||||
base.OnObjectModelChanged(e);
|
||||
|
||||
if (!IsCreated) return;
|
||||
|
||||
PropertyListObjectModel plom = (ObjectModel as PropertyListObjectModel);
|
||||
for (int i = 0; i < plom.Properties.Count; i++)
|
||||
{
|
||||
RecursiveAddProperty(plom.Properties[i], null);
|
||||
}
|
||||
for (int i = 0; i < plom.Groups.Count; i++)
|
||||
{
|
||||
RecursiveAddGroup(plom.Groups[i], null);
|
||||
}
|
||||
}
|
||||
|
||||
private void RecursiveAddProperty(Property p, TreeModelRow parent = null)
|
||||
{
|
||||
TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tm.Columns[0], p.Name),
|
||||
new TreeModelRowColumn(tm.Columns[1], p.Value)
|
||||
});
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
tm.Rows.Add(row);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.Rows.Add(row);
|
||||
}
|
||||
row.SetExtraData<Property>("property", p);
|
||||
}
|
||||
private void RecursiveAddGroup(Group g, TreeModelRow parent = null)
|
||||
{
|
||||
TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tm.Columns[0], g.Name)
|
||||
});
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
tm.Rows.Add(row);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.Rows.Add(row);
|
||||
}
|
||||
|
||||
for (int i = 0; i < g.Properties.Count; i++)
|
||||
{
|
||||
RecursiveAddProperty(g.Properties[i], row);
|
||||
}
|
||||
for (int i = 0; i < g.Groups.Count; i++)
|
||||
{
|
||||
RecursiveAddGroup(g.Groups[i], row);
|
||||
}
|
||||
row.SetExtraData<Group>("group", g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,6 @@
|
||||
<Compile Include="Editors\FileSystem\FileSystemEditor.Designer.cs" />
|
||||
<Compile Include="Common\FileInfo.cs" />
|
||||
<Compile Include="Editors\PropertyList\PropertyListEditor.cs" />
|
||||
<Compile Include="Editors\PropertyList\PropertyListEditor.Designer.cs" />
|
||||
<Compile Include="Dialogs\DocumentPropertiesDialog.cs" />
|
||||
<Compile Include="Dialogs\GenericBrowserPopup.cs" />
|
||||
<Compile Include="Dialogs\GenericBrowserPopup.Designer.cs" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user