improvements to UWT ContainerLayout-based AboutDialog and NewDialog
This commit is contained in:
parent
2724d9461d
commit
9053e149b4
@ -24,14 +24,28 @@ along with Universal Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||
<!-- interface-license-type gplv3 -->
|
||||
<!-- interface-name Universal Editor -->
|
||||
<!-- interface-copyright 2019 Michael Becker -->
|
||||
<object class="GtkTreeStore" id="tsContributors">
|
||||
<object class="GtkTreeStore" id="tmComponents">
|
||||
<columns>
|
||||
<!-- column-name chName -->
|
||||
<column type="gchar"/>
|
||||
<!-- column-name chResponsibility -->
|
||||
<column type="gchar"/>
|
||||
<!-- column-name colComponentName -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name colComponentDetails -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="tmContributors">
|
||||
<columns>
|
||||
<!-- column-name colContributorName -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name colContributorResponsibility -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Michael Becker</col>
|
||||
<col id="1" translatable="yes">Project lead, lead developer, designer</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkTextBuffer" id="txbApplicationLicense">
|
||||
<property name="text" translatable="yes"> GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@ -807,7 +821,7 @@ Public License instead of this License. But first, please read
|
||||
<object class="GtkAccelLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Copyright (c) 1997-2019 Michael Becker</property>
|
||||
<property name="label" translatable="yes">Copyright (c) 1997-2020 Michael Becker</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="0.80000000000000004"/>
|
||||
</attributes>
|
||||
@ -839,26 +853,51 @@ Public License instead of this License. But first, please read
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkTreeView">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">tsContributors</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="chName">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="clickable">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="chResponsibility">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Responsibility</property>
|
||||
<property name="clickable">True</property>
|
||||
<object class="GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">tmContributors</property>
|
||||
<property name="search_column">0</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcContributorName">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="clickable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcContributorResponsibility">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Responsibility</property>
|
||||
<property name="clickable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@ -880,9 +919,38 @@ Public License instead of this License. But first, please read
|
||||
<object class="GtkTreeView" id="tvComponents">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">tmComponents</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcComponentName">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="reorderable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="tvcComponentDetails">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Details</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="reorderable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
||||
@ -64,6 +64,9 @@ along with Universal Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
@ -110,7 +113,7 @@ along with Universal Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||
<object class="GtkPaned">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="position">250</property>
|
||||
<property name="position">150</property>
|
||||
<property name="position_set">True</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
@ -177,7 +180,7 @@ along with Universal Editor. If not, see <http://www.gnu.org/licenses/>.
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="markup">0</attribute>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@ -1,155 +1,211 @@
|
||||
using System;
|
||||
//
|
||||
// AboutDialog.cs - provides a UWT ContainerLayout-based CustomDialog for displaying information about the installed Universal Editor platform components
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2011-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
|
||||
// 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;
|
||||
|
||||
namespace UniversalEditor.UserInterface.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a UWT <see cref="ContainerLayoutAttribute" />-based <see cref="CustomDialog" /> for displaying information about the installed Universal Editor
|
||||
/// platform components.
|
||||
/// </summary>
|
||||
[ContainerLayout("~/Dialogs/AboutDialog.glade", "GtkDialog")]
|
||||
public class AboutDialog : Dialog
|
||||
{
|
||||
private ListView tvComponents;
|
||||
private DefaultTreeModel tmComponents;
|
||||
|
||||
public AboutDialog()
|
||||
{
|
||||
Buttons.Add(new Button(StockType.Close, DialogResult.Cancel));
|
||||
}
|
||||
|
||||
protected override void OnCreating (EventArgs e)
|
||||
protected override void OnCreated(EventArgs e)
|
||||
{
|
||||
base.OnCreating (e);
|
||||
base.OnCreated(e);
|
||||
|
||||
InitializeInstalledComponentsTab ();
|
||||
tvComponents.Columns.Add (new ListViewColumnText (tmComponents.Columns [0], "Name"));
|
||||
tvComponents.Columns.Add (new ListViewColumnText (tmComponents.Columns [1], "Details"));
|
||||
tvComponents.Model = tmComponents;
|
||||
InitializeInstalledComponentsTab();
|
||||
}
|
||||
|
||||
private DefaultTreeModel tmComponents = new DefaultTreeModel (new Type [] { typeof (string), typeof(string) });
|
||||
|
||||
private void InitializeInstalledComponentsTab ()
|
||||
private void InitializeInstalledComponentsTab()
|
||||
{
|
||||
#region Object Models
|
||||
{
|
||||
TreeModelRow tnParent = null;
|
||||
ObjectModelReference [] omrs = UniversalEditor.Common.Reflection.GetAvailableObjectModels ();
|
||||
foreach (ObjectModelReference omr in omrs) {
|
||||
string title = omr.Type.Assembly.GetName ().Name;
|
||||
object [] atts = omr.Type.Assembly.GetCustomAttributes (typeof (System.Reflection.AssemblyTitleAttribute), false);
|
||||
if (atts.Length > 0) {
|
||||
title = (atts [0] as System.Reflection.AssemblyTitleAttribute).Title;
|
||||
ObjectModelReference[] omrs = UniversalEditor.Common.Reflection.GetAvailableObjectModels();
|
||||
foreach (ObjectModelReference omr in omrs)
|
||||
{
|
||||
string title = omr.Type.Assembly.GetName().Name;
|
||||
object[] atts = omr.Type.Assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), false);
|
||||
if (atts.Length > 0)
|
||||
{
|
||||
title = (atts[0] as System.Reflection.AssemblyTitleAttribute).Title;
|
||||
}
|
||||
|
||||
if (tnParent == null) {
|
||||
if (tmComponents.Rows.Contains (title)) {
|
||||
tnParent = tmComponents.Rows [title];
|
||||
} else {
|
||||
tnParent = new TreeModelRow (
|
||||
new TreeModelRowColumn []
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], title)
|
||||
}); // LibraryClosed
|
||||
tnParent.Name = title;
|
||||
tmComponents.Rows.Add (tnParent);
|
||||
if (tnParent == null)
|
||||
{
|
||||
if (tmComponents.Rows.Contains(title))
|
||||
{
|
||||
tnParent = tmComponents.Rows[title];
|
||||
}
|
||||
} else {
|
||||
if (tnParent.Rows.Contains (title)) {
|
||||
tnParent = tnParent.Rows [title];
|
||||
} else {
|
||||
tnParent = new TreeModelRow (
|
||||
new TreeModelRowColumn []
|
||||
else
|
||||
{
|
||||
tnParent = new TreeModelRow(
|
||||
new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], title)
|
||||
}); // LibraryClosed
|
||||
tnParent.Name = title;
|
||||
tnParent.Rows.Add (tnParent);
|
||||
tmComponents.Rows.Add(tnParent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tnParent.Rows.Contains(title))
|
||||
{
|
||||
tnParent = tnParent.Rows[title];
|
||||
}
|
||||
else
|
||||
{
|
||||
tnParent = new TreeModelRow(
|
||||
new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], title)
|
||||
}); // LibraryClosed
|
||||
tnParent.Name = title;
|
||||
tnParent.Rows.Add(tnParent);
|
||||
}
|
||||
}
|
||||
tnParent.SetExtraData<System.Reflection.Assembly>("asm", omr.Type.Assembly);
|
||||
|
||||
foreach (string s in omr.Path) {
|
||||
if (tnParent == null) {
|
||||
if (tmComponents.Rows.Contains (s)) {
|
||||
tnParent = tmComponents.Rows [s];
|
||||
} else {
|
||||
tnParent = new TreeModelRow (new TreeModelRowColumn []
|
||||
foreach (string s in omr.Path)
|
||||
{
|
||||
if (tnParent == null)
|
||||
{
|
||||
if (tmComponents.Rows.Contains(s))
|
||||
{
|
||||
tnParent = tmComponents.Rows[s];
|
||||
}
|
||||
else
|
||||
{
|
||||
tnParent = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], s)
|
||||
}); //"generic-folder-closed", "generic-folder-closed");
|
||||
tnParent.Name = s;
|
||||
tmComponents.Rows.Add (tnParent);
|
||||
tmComponents.Rows.Add(tnParent);
|
||||
}
|
||||
} else {
|
||||
if (tnParent.Rows.Contains (s)) {
|
||||
tnParent = tnParent.Rows [s];
|
||||
} else {
|
||||
TreeModelRow tnNew = new TreeModelRow (new TreeModelRowColumn []
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tnParent.Rows.Contains(s))
|
||||
{
|
||||
tnParent = tnParent.Rows[s];
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeModelRow tnNew = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], s)
|
||||
}); //"generic-folder-closed", "generic-folder-closed");
|
||||
tnNew.Name = s;
|
||||
tnParent.Rows.Add (tnNew);
|
||||
tnParent.Rows.Add(tnNew);
|
||||
tnParent = tnNew;
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.IndexOf<string> (omr.Path, s) == omr.Path.Length - 1) {
|
||||
if (Array.IndexOf<string>(omr.Path, s) == omr.Path.Length - 1)
|
||||
{
|
||||
// tnParent.ImageKey = "ObjectModel";
|
||||
// tnParent.SelectedImageKey = "ObjectModel";
|
||||
tnParent.SetExtraData<ObjectModelReference> ("omr", omr);
|
||||
tnParent.SetExtraData<ObjectModelReference>("omr", omr);
|
||||
|
||||
DataFormatReference [] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats (omr);
|
||||
if (dfrs.Length > 0) {
|
||||
DataFormatReference[] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats(omr);
|
||||
if (dfrs.Length > 0)
|
||||
{
|
||||
TreeModelRow tnParentDataFormats = null;
|
||||
if (!tnParent.Rows.Contains ("DataFormats")) {
|
||||
tnParentDataFormats = new TreeModelRow (new TreeModelRowColumn [] {
|
||||
if (!tnParent.Rows.Contains("DataFormats"))
|
||||
{
|
||||
tnParentDataFormats = new TreeModelRow(new TreeModelRowColumn[] {
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], "DataFormats")
|
||||
});
|
||||
tnParentDataFormats.Name = "DataFormats";
|
||||
// tnParentDataFormats.Text = "DataFormats";
|
||||
// tnParentDataFormats.ImageKey = "generic-folder-closed";
|
||||
// tnParentDataFormats.SelectedImageKey = "generic-folder-closed";
|
||||
tnParent.Rows.Add (tnParentDataFormats);
|
||||
} else {
|
||||
tnParentDataFormats = tnParent.Rows ["DataFormats"];
|
||||
tnParent.Rows.Add(tnParentDataFormats);
|
||||
}
|
||||
foreach (DataFormatReference dfr in dfrs) {
|
||||
if (!tnParentDataFormats.Rows.Contains (dfr.Title)) {
|
||||
string [] deets = dfr.GetDetails ();
|
||||
else
|
||||
{
|
||||
tnParentDataFormats = tnParent.Rows["DataFormats"];
|
||||
}
|
||||
foreach (DataFormatReference dfr in dfrs)
|
||||
{
|
||||
if (!tnParentDataFormats.Rows.Contains(dfr.Title))
|
||||
{
|
||||
string[] deets = dfr.GetDetails();
|
||||
|
||||
TreeModelRow tnDataFormat = new TreeModelRow (new TreeModelRowColumn []
|
||||
TreeModelRow tnDataFormat = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], deets.Length > 0 ? deets[0] : String.Empty),
|
||||
new TreeModelRowColumn(tmComponents.Columns[1], deets.Length > 1 ? deets[1] : String.Empty)
|
||||
});
|
||||
// "DataFormat", "DataFormat"
|
||||
tnDataFormat.SetExtraData<DataFormatReference> ("dfr", dfr);
|
||||
tnParentDataFormats.Rows.Add (tnDataFormat);
|
||||
tnDataFormat.SetExtraData<DataFormatReference>("dfr", dfr);
|
||||
tnParentDataFormats.Rows.Add(tnDataFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorReference [] reditors = UniversalEditor.UserInterface.Common.Reflection.GetAvailableEditors (omr);
|
||||
if (reditors.Length > 0) {
|
||||
EditorReference[] reditors = UniversalEditor.UserInterface.Common.Reflection.GetAvailableEditors(omr);
|
||||
if (reditors.Length > 0)
|
||||
{
|
||||
TreeModelRow tnParentEditors = null;
|
||||
if (!tnParent.Rows.Contains ("Editors")) {
|
||||
tnParentEditors = new TreeModelRow (new TreeModelRowColumn []
|
||||
if (!tnParent.Rows.Contains("Editors"))
|
||||
{
|
||||
tnParentEditors = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], "Editors")
|
||||
});
|
||||
tnParentEditors.Name = "Editors";
|
||||
// tnParentEditors.ImageKey = "generic-folder-closed";
|
||||
// tnParentEditors.SelectedImageKey = "generic-folder-closed";
|
||||
tnParent.Rows.Add (tnParentEditors);
|
||||
} else {
|
||||
tnParentEditors = tnParent.Rows ["Editors"];
|
||||
tnParent.Rows.Add(tnParentEditors);
|
||||
}
|
||||
foreach (EditorReference reditor in reditors) {
|
||||
if (!tnParentEditors.Rows.Contains (reditor.Title)) {
|
||||
TreeModelRow tnEditor = new TreeModelRow (new TreeModelRowColumn []
|
||||
else
|
||||
{
|
||||
tnParentEditors = tnParent.Rows["Editors"];
|
||||
}
|
||||
foreach (EditorReference reditor in reditors)
|
||||
{
|
||||
if (!tnParentEditors.Rows.Contains(reditor.Title))
|
||||
{
|
||||
TreeModelRow tnEditor = new TreeModelRow(new TreeModelRowColumn[]
|
||||
{
|
||||
new TreeModelRowColumn(tmComponents.Columns[0], reditor.Title)
|
||||
});
|
||||
tnParentEditors.Rows.Add (tnEditor); // Editor
|
||||
tnParentEditors.Rows.Add(tnEditor); // Editor
|
||||
tnEditor.SetExtraData<EditorReference>("er", reditor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ namespace UniversalEditor.UserInterface.Dialogs
|
||||
this.InitializeTreeView();
|
||||
|
||||
Buttons[0].Enabled = false;
|
||||
DefaultButton = Buttons[0];
|
||||
}
|
||||
private void InitializeDocumentTemplateTreeView()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user