convert PropertyListPanel to use Glade-based ContainerLayout
This commit is contained in:
parent
8195bf1615
commit
d1b00ff02e
@ -0,0 +1,222 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkListStore" id="tmObject">
|
||||
<columns>
|
||||
<!-- column-name colObjectName -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkTreeStore" id="tmProperties">
|
||||
<columns>
|
||||
<!-- column-name colPropertyName -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name colPropertyValue -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkWindow">
|
||||
<property name="can_focus">False</property>
|
||||
<child type="titlebar">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="cboObject">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">tmObject</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned" id="scPropertiesDescription">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="position">250</property>
|
||||
<property name="position_set">True</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="lvPropertyGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">tmProperties</property>
|
||||
<property name="search_column">0</property>
|
||||
<property name="enable_grid_lines">both</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>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkPaned" id="scDescriptionCommands">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="position">120</property>
|
||||
<property name="position_set">True</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="margin_right">8</property>
|
||||
<property name="margin_bottom">8</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblPropertyTitle">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="margin_right">8</property>
|
||||
<property name="margin_top">8</property>
|
||||
<property name="margin_bottom">8</property>
|
||||
<property name="label" translatable="yes">Property Title </property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="txtPropertyDescription">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@ -316,6 +316,7 @@
|
||||
<Content Include="ProjectTypes\{69878862-DA7D-4DC6-B0A1-50D8FAB4242F}.uexml" />
|
||||
<Content Include="ProjectTypes\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.uexml" />
|
||||
<Content Include="Editors\Blockchain\BlockchainEditor.glade" />
|
||||
<Content Include="Panels\PropertyList\PropertyListPanel.glade" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Configuration\Application.upl" />
|
||||
@ -349,6 +350,7 @@
|
||||
<Folder Include="Editors\Multimedia\Audio\Waveform\" />
|
||||
<Folder Include="Templates\Project\SCE\" />
|
||||
<Folder Include="Templates\Project\SCE\PSM\" />
|
||||
<Folder Include="Panels\PropertyList\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Templates\Project\Concertroid\Images\Concert.xcf" />
|
||||
|
||||
@ -1,108 +0,0 @@
|
||||
//
|
||||
// PropertyListPanel.Designer.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019 Mike Becker
|
||||
//
|
||||
// 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.Controls.ListView;
|
||||
using MBS.Framework.UserInterface.Layouts;
|
||||
|
||||
namespace UniversalEditor.UserInterface.Panels
|
||||
{
|
||||
public partial class PropertyListPanel : Panel
|
||||
{
|
||||
private ComboBox cboObject = null;
|
||||
private SplitContainer scPropertiesDescription = null;
|
||||
private ListViewControl lvPropertyGrid = null;
|
||||
private TextBox txtCommands = null;
|
||||
private TextBox txtDescription = null;
|
||||
private DefaultTreeModel tmPropertyGrid = null;
|
||||
private DefaultTreeModel tmObject = null;
|
||||
private SplitContainer scCommandsDescription = null;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Text = "Property List";
|
||||
Layout = new BoxLayout(Orientation.Vertical);
|
||||
|
||||
cboObject = new ComboBox();
|
||||
tmObject = new DefaultTreeModel(new Type[] { typeof(string), typeof(string) });
|
||||
cboObject.Model = tmObject;
|
||||
// i'd hate to limit it like this.. we should be able to type in an object name, hit "enter", and have it work
|
||||
// cboObject.ReadOnly = true;
|
||||
cboObject.KeyDown += CboObject_KeyDown;
|
||||
cboObject.Changed += cboObject_Changed;
|
||||
|
||||
Controls.Add(cboObject);
|
||||
|
||||
scPropertiesDescription = new SplitContainer(Orientation.Horizontal);
|
||||
scPropertiesDescription.Panel1.Layout = new BoxLayout(Orientation.Vertical);
|
||||
|
||||
tmPropertyGrid = new DefaultTreeModel(new Type[] { typeof(string), typeof(string) });
|
||||
|
||||
lvPropertyGrid = new ListViewControl();
|
||||
lvPropertyGrid.SelectionChanged += lvPropertyGrid_SelectionChanged; ;
|
||||
lvPropertyGrid.Model = tmPropertyGrid;
|
||||
lvPropertyGrid.Columns.Add(new ListViewColumnText(tmPropertyGrid.Columns[0], "Name"));
|
||||
lvPropertyGrid.Columns.Add(new ListViewColumnText(tmPropertyGrid.Columns[1], "Value"));
|
||||
|
||||
scPropertiesDescription.Panel1.Controls.Add(lvPropertyGrid, new BoxLayout.Constraints(true, true));
|
||||
scPropertiesDescription.Panel2.Layout = new BoxLayout(Orientation.Vertical);
|
||||
|
||||
scCommandsDescription = new SplitContainer(Orientation.Horizontal);
|
||||
txtCommands = new TextBox();
|
||||
txtCommands.Editable = false;
|
||||
txtCommands.Multiline = true;
|
||||
txtCommands.Text = "<A>Command 1</A> <A>Command 2</A>";
|
||||
scCommandsDescription.SplitterPosition = 100;
|
||||
scCommandsDescription.Panel1.Layout = new BoxLayout(Orientation.Vertical);
|
||||
// scCommandsDescription.Panel1.Controls.Add(txtCommands, new BoxLayout.Constraints(true, true));
|
||||
// not sure how to do this yet
|
||||
|
||||
txtDescription = new TextBox();
|
||||
txtDescription.Editable = false;
|
||||
txtDescription.Multiline = true;
|
||||
scCommandsDescription.Panel2.Layout = new BoxLayout(Orientation.Vertical);
|
||||
scCommandsDescription.Panel2.Controls.Add(txtDescription, new BoxLayout.Constraints(true, true));
|
||||
|
||||
scPropertiesDescription.SplitterPosition = 100;
|
||||
scPropertiesDescription.Panel2.Controls.Add(scCommandsDescription, new BoxLayout.Constraints(true, true));
|
||||
|
||||
Controls.Add(scPropertiesDescription, new BoxLayout.Constraints(true, true));
|
||||
}
|
||||
|
||||
void CboObject_KeyDown(object sender, MBS.Framework.UserInterface.Input.Keyboard.KeyEventArgs e)
|
||||
{
|
||||
// this don't work, Gtk blocks keyboard input (probably cause it's technically a text box)
|
||||
if (e.Key == MBS.Framework.UserInterface.Input.Keyboard.KeyboardKey.Enter)
|
||||
{
|
||||
if (cboObject.Model != null)
|
||||
{
|
||||
TreeModelRow row = cboObject.Model.Find(cboObject.Text);
|
||||
if (row != null)
|
||||
{
|
||||
cboObject.SelectedItem = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Controls.ListView;
|
||||
|
||||
namespace UniversalEditor.UserInterface.Panels
|
||||
{
|
||||
@ -114,42 +116,62 @@ namespace UniversalEditor.UserInterface.Panels
|
||||
}
|
||||
}
|
||||
|
||||
[ContainerLayout("~/Panels/PropertyList/PropertyListPanel.glade")]
|
||||
partial class PropertyListPanel : Panel
|
||||
{
|
||||
private ComboBox cboObject;
|
||||
private SplitContainer scDescriptionCommands;
|
||||
private ListViewControl lvPropertyGrid;
|
||||
|
||||
public PropertyPanelObject.PropertyPanelObjectCollection Objects { get; private set; } = null;
|
||||
|
||||
public PropertyListPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Objects = new PropertyPanelObject.PropertyPanelObjectCollection(this);
|
||||
}
|
||||
|
||||
[EventHandler(nameof(cboObject), nameof(ComboBox.KeyDown))]
|
||||
void cboObject_KeyDown(object sender, MBS.Framework.UserInterface.Input.Keyboard.KeyEventArgs e)
|
||||
{
|
||||
// this don't work, Gtk blocks keyboard input (probably cause it's technically a text box)
|
||||
if (e.Key == MBS.Framework.UserInterface.Input.Keyboard.KeyboardKey.Enter)
|
||||
{
|
||||
if (cboObject.Model != null)
|
||||
{
|
||||
TreeModelRow row = cboObject.Model.Find(cboObject.Text);
|
||||
if (row != null)
|
||||
{
|
||||
cboObject.SelectedItem = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void ClearPropertyPanelObjects()
|
||||
{
|
||||
tmObject.Rows.Clear();
|
||||
(cboObject.Model as DefaultTreeModel).Rows.Clear();
|
||||
}
|
||||
internal void AddPropertyPanelObject(PropertyPanelObject item)
|
||||
{
|
||||
TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmObject.Columns[0], item.Name),
|
||||
new TreeModelRowColumn(tmObject.Columns[1], item.ObjectClass?.Name)
|
||||
new TreeModelRowColumn((cboObject.Model as DefaultTreeModel).Columns[0], item.Name),
|
||||
new TreeModelRowColumn((cboObject.Model as DefaultTreeModel).Columns[1], item.ObjectClass?.Name)
|
||||
});
|
||||
row.SetExtraData<PropertyPanelObject>("obj", item);
|
||||
_rowsByObject[item] = row;
|
||||
|
||||
tmObject.Rows.Add(row);
|
||||
(cboObject.Model as DefaultTreeModel).Rows.Add(row);
|
||||
}
|
||||
private Dictionary<PropertyPanelObject, TreeModelRow> _rowsByObject = new Dictionary<PropertyPanelObject, TreeModelRow>();
|
||||
internal void RemovePropertyPanelObject(PropertyPanelObject item)
|
||||
{
|
||||
if (!_rowsByObject.ContainsKey(item)) return;
|
||||
tmObject.Rows.Remove(_rowsByObject[item]);
|
||||
(cboObject.Model as DefaultTreeModel).Rows.Remove(_rowsByObject[item]);
|
||||
}
|
||||
internal void RefreshList()
|
||||
{
|
||||
tmObject.Rows.Clear();
|
||||
(cboObject.Model as DefaultTreeModel).Rows.Clear();
|
||||
for (int i = 0; i < Objects.Count; i++)
|
||||
{
|
||||
AddPropertyPanelObject(Objects[i]);
|
||||
@ -164,7 +186,7 @@ namespace UniversalEditor.UserInterface.Panels
|
||||
{
|
||||
_SelectedObject = value;
|
||||
|
||||
tmPropertyGrid.Rows.Clear();
|
||||
lvPropertyGrid.Model.Rows.Clear();
|
||||
if (_SelectedObject != null)
|
||||
{
|
||||
if (SelectedObject.ObjectClass != null)
|
||||
@ -186,8 +208,8 @@ namespace UniversalEditor.UserInterface.Panels
|
||||
{
|
||||
TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmPropertyGrid.Columns[0], property.Name),
|
||||
new TreeModelRowColumn(tmPropertyGrid.Columns[1], property.Value == null ? String.Empty : property.Value.ToString())
|
||||
new TreeModelRowColumn(lvPropertyGrid.Model.Columns[0], property.Name),
|
||||
new TreeModelRowColumn(lvPropertyGrid.Model.Columns[1], property.Value == null ? String.Empty : property.Value.ToString())
|
||||
});
|
||||
|
||||
for (int i = 0; i < property.Properties.Count; i++)
|
||||
@ -201,15 +223,17 @@ namespace UniversalEditor.UserInterface.Panels
|
||||
}
|
||||
else
|
||||
{
|
||||
tmPropertyGrid.Rows.Add(row);
|
||||
lvPropertyGrid.Model.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
[EventHandler(nameof(cboObject), nameof(ComboBox.Changed))]
|
||||
void cboObject_Changed(object sender, EventArgs e)
|
||||
{
|
||||
SelectedObject = cboObject.SelectedItem?.GetExtraData<PropertyPanelObject>("obj");
|
||||
}
|
||||
|
||||
[EventHandler(nameof(lvPropertyGrid), nameof(ListViewControl.SelectionChanged))]
|
||||
private void lvPropertyGrid_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
@ -115,7 +115,6 @@
|
||||
<Compile Include="Editors\Database\DatabaseEditor.cs" />
|
||||
<Compile Include="EditorPlugin.cs" />
|
||||
<Compile Include="Panels\PropertyListPanel.cs" />
|
||||
<Compile Include="Panels\PropertyListPanel.Designer.cs" />
|
||||
<Compile Include="View.cs" />
|
||||
<Compile Include="Panels\DocumentExplorerPanel.cs" />
|
||||
<Compile Include="Editors\FileSystem\FileSystemEditorDocumentPropertiesSettingsProvider.cs" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user