From 9053e149b46149b26e94d268dda4759a7d0e5604 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 9 May 2020 22:45:27 -0400 Subject: [PATCH] improvements to UWT ContainerLayout-based AboutDialog and NewDialog --- .../Dialogs/AboutDialog.glade | 114 ++++++++-- .../Dialogs/NewDialog.glade | 7 +- .../Dialogs/AboutDialog.cs | 202 +++++++++++------- .../Dialogs/NewDialog.cs | 1 + 4 files changed, 226 insertions(+), 98 deletions(-) diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/AboutDialog.glade b/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/AboutDialog.glade index 5c05967d..dbc48f11 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/AboutDialog.glade +++ b/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/AboutDialog.glade @@ -24,14 +24,28 @@ along with Universal Editor. If not, see . - + - - - - + + + + + + + + + + + + + + Michael Becker + Project lead, lead developer, designer + + + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -807,7 +821,7 @@ Public License instead of this License. But first, please read True False - Copyright (c) 1997-2019 Michael Becker + Copyright (c) 1997-2020 Michael Becker @@ -839,26 +853,51 @@ Public License instead of this License. But first, please read True True - + True - True - tsContributors - - - + False + vertical - - True - Name - True - - - - - True - Responsibility - True + + True + True + tmContributors + 0 + + + + + + True + Name + True + + + + 0 + + + + + + + True + Responsibility + True + + + + 1 + + + + + + True + True + 0 + @@ -880,9 +919,38 @@ Public License instead of this License. But first, please read True True + tmComponents + + + True + Name + True + True + + + + 0 + + + + + + + True + Details + True + True + + + + 1 + + + + True diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/NewDialog.glade b/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/NewDialog.glade index 3502574e..48f379a2 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/NewDialog.glade +++ b/Content/UniversalEditor.Content.PlatformIndependent/Dialogs/NewDialog.glade @@ -64,6 +64,9 @@ along with Universal Editor. If not, see . True True True + True @@ -110,7 +113,7 @@ along with Universal Editor. If not, see . True True - 250 + 150 True True @@ -177,7 +180,7 @@ along with Universal Editor. If not, see . - 0 + 0 diff --git a/Libraries/UniversalEditor.UserInterface/Dialogs/AboutDialog.cs b/Libraries/UniversalEditor.UserInterface/Dialogs/AboutDialog.cs index 9bf3783e..69710c51 100644 --- a/Libraries/UniversalEditor.UserInterface/Dialogs/AboutDialog.cs +++ b/Libraries/UniversalEditor.UserInterface/Dialogs/AboutDialog.cs @@ -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 +// +// 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 . + +using System; + using MBS.Framework.UserInterface; using MBS.Framework.UserInterface.Controls; namespace UniversalEditor.UserInterface.Dialogs { + /// + /// Provides a UWT -based for displaying information about the installed Universal Editor + /// platform components. + /// [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("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 (omr.Path, s) == omr.Path.Length - 1) { + if (Array.IndexOf(omr.Path, s) == omr.Path.Length - 1) + { // tnParent.ImageKey = "ObjectModel"; // tnParent.SelectedImageKey = "ObjectModel"; - tnParent.SetExtraData ("omr", omr); + tnParent.SetExtraData("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 ("dfr", dfr); - tnParentDataFormats.Rows.Add (tnDataFormat); + tnDataFormat.SetExtraData("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("er", reditor); } } diff --git a/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs b/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs index fb4b9bf0..5847da53 100644 --- a/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs +++ b/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs @@ -59,6 +59,7 @@ namespace UniversalEditor.UserInterface.Dialogs this.InitializeTreeView(); Buttons[0].Enabled = false; + DefaultButton = Buttons[0]; } private void InitializeDocumentTemplateTreeView() {