diff --git a/.gitignore b/.gitignore index 83e7e152..09b3a76e 100644 --- a/.gitignore +++ b/.gitignore @@ -185,6 +185,9 @@ RemoteSystemsTempFiles mono_crash.*.blob mono_crash.*.json +# VSCode crap +.vscode + # Geany (?) crap .#*.* diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Languages/English.uexml b/Content/UniversalEditor.Content.PlatformIndependent/Languages/English.uexml index 59faed6b..63dba6bf 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/Languages/English.uexml +++ b/Content/UniversalEditor.Content.PlatformIndependent/Languages/English.uexml @@ -3,6 +3,14 @@ + + + + + + + + diff --git a/Libraries/UniversalEditor.UserInterface/Editor.cs b/Libraries/UniversalEditor.UserInterface/Editor.cs index a8b031e3..2b9ec00f 100644 --- a/Libraries/UniversalEditor.UserInterface/Editor.cs +++ b/Libraries/UniversalEditor.UserInterface/Editor.cs @@ -118,7 +118,7 @@ namespace UniversalEditor.UserInterface { base.OnCreated(e); - UserInterfacePlugin[] plugins = UserInterfacePlugin.Get(); + UserInterfacePlugin[] plugins = Plugin.Get(); Type typ = typeof(EditorPlugin); for (int i = 0; i < plugins.Length; i++) { diff --git a/Libraries/UniversalEditor.UserInterface/EditorApplication.cs b/Libraries/UniversalEditor.UserInterface/EditorApplication.cs index 55e8a631..e2c3f779 100644 --- a/Libraries/UniversalEditor.UserInterface/EditorApplication.cs +++ b/Libraries/UniversalEditor.UserInterface/EditorApplication.cs @@ -45,7 +45,6 @@ namespace UniversalEditor.UserInterface { base.InitializeInternal(); - InitializePanels(); InitializeWindowSwitcher(); } @@ -95,34 +94,40 @@ namespace UniversalEditor.UserInterface { // FIXME: this should all be done in XML PanelReference prPropertyList = new PanelReference(PropertyListPanel.ID); - prPropertyList.Title = "Property List"; + prPropertyList.Title = this._("UniversalEditor.Panels.PropertyListPanel.Title"); prPropertyList.Control = new PropertyListPanel(); prPropertyList.Placement = DockingItemPlacement.Right; Panels.Add(prPropertyList); PanelReference prToolbox = new PanelReference(ToolboxPanel.ID); - prToolbox.Title = "Toolbox"; + prToolbox.Title = this._("UniversalEditor.Panels.ToolboxPanel.Title"); prToolbox.Control = new ToolboxPanel(); prToolbox.Placement = DockingItemPlacement.Left; Panels.Add(prToolbox); PanelReference prSolutionExplorer = new PanelReference(SolutionExplorerPanel.ID); - prSolutionExplorer.Title = "Solution Explorer"; + prSolutionExplorer.Title = this._("UniversalEditor.Panels.SolutionExplorerPanel.Title"); prSolutionExplorer.Control = new SolutionExplorerPanel(); prSolutionExplorer.Placement = DockingItemPlacement.Left; Panels.Add(prSolutionExplorer); PanelReference prDocumentExplorer = new PanelReference(DocumentExplorerPanel.ID); - prDocumentExplorer.Title = "Document Explorer"; + prDocumentExplorer.Title = this._("UniversalEditor.Panels.DocumentExplorerPanel.Title"); prDocumentExplorer.Control = new DocumentExplorerPanel(); prDocumentExplorer.Placement = DockingItemPlacement.Left; Panels.Add(prDocumentExplorer); PanelReference prErrorList = new PanelReference(ErrorListPanel.ID); - prErrorList.Title = "Error List"; + prErrorList.Title = this._("UniversalEditor.Panels.ErrorListPanel.Title"); prErrorList.Control = new ErrorListPanel(); prErrorList.Placement = DockingItemPlacement.Bottom; Panels.Add(prErrorList); + + PanelReference prOutputWindow = new PanelReference(OutputWindowPanel.ID); + prOutputWindow.Title = this._("UniversalEditor.Panels.OutputWindowPanel.Title"); + prOutputWindow.Control = new OutputWindowPanel(); + prOutputWindow.Placement = DockingItemPlacement.Bottom; + Panels.Add(prOutputWindow); } public ConfigurationManager ConfigurationManager { get; } = new ConfigurationManager(); @@ -465,6 +470,7 @@ namespace UniversalEditor.UserInterface protected override void OnAfterConfigurationLoaded(EventArgs e) { base.OnAfterConfigurationLoaded(e); + InitializePanels(); #region Global Configuration { @@ -1005,6 +1011,10 @@ namespace UniversalEditor.UserInterface { OpenWindow(); }); + Application.Instance.AttachCommandEventHandler("WindowCloseAllDocuments", delegate (object sender, EventArgs e) + { + LastWindow.CloseAllFiles(); + }); Application.Instance.AttachCommandEventHandler("WindowWindows", delegate (object sender, EventArgs e) { LastWindow.SetWindowListVisible(true, true); diff --git a/Libraries/UniversalEditor.UserInterface/EditorWindow.cs b/Libraries/UniversalEditor.UserInterface/EditorWindow.cs index 70cc9bd2..cf9a5831 100644 --- a/Libraries/UniversalEditor.UserInterface/EditorWindow.cs +++ b/Libraries/UniversalEditor.UserInterface/EditorWindow.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Text; +using System.Linq; + using MBS.Framework; using MBS.Framework.Drawing; using MBS.Framework.UserInterface; @@ -508,6 +510,7 @@ namespace UniversalEditor.UserInterface Application.Instance.Commands["ProjectProperties"].Enabled = hasProject; Application.Instance.Commands["BookmarksAddAll"].Enabled = GetEditorPages().Length > 0; + Application.Instance.Commands["WindowCloseAllDocuments"].Enabled = GetDocumentWindows().Length > 0; if (CurrentProject != null) { @@ -578,7 +581,7 @@ namespace UniversalEditor.UserInterface Application.Instance.Commands["BookmarksAdd"].Enabled = false; } - foreach (UserInterfacePlugin pl in UserInterfacePlugin.Get()) + foreach (UserInterfacePlugin pl in Plugin.Get()) { pl.UpdateMenuItems(); } @@ -689,7 +692,8 @@ namespace UniversalEditor.UserInterface if (parent != null) { - parent.Items.Add(dw); + //parent.Items.Add(dw); + dckContainer.Items.Add(dw); } else { @@ -1650,6 +1654,17 @@ namespace UniversalEditor.UserInterface throw new NotImplementedException(); } + public void CloseAllFiles() + { + IEnumerable e = dckContainer.Items.Where(item => item.Placement == DockingItemPlacement.Center); + List list = e.ToList(); + foreach (DockingItem item in list) + { + dckContainer.Items.Remove(item); + } + UpdateMenuItems(); + } + private System.Collections.Generic.List Windows = new System.Collections.Generic.List(); public void CloseFile(DockingWindow dw = null) { @@ -1855,6 +1870,20 @@ namespace UniversalEditor.UserInterface { return GetCurrentPage() as EditorPage; } + public DockingWindow[] GetDocumentWindows() + { + List list = new List(); + for (int i = 0; i < dckContainer.Items.Count; i++) + { + DockingWindow dw = dckContainer.Items[i] as DockingWindow; + if (dw == null) continue; + + if (dw.Placement != DockingItemPlacement.Center) continue; + list.Add(dw); + } + return list.ToArray(); + } + public EditorPage[] GetEditorPages() { List list = new List(); diff --git a/Libraries/UniversalEditor.UserInterface/IHostApplicationWindow.cs b/Libraries/UniversalEditor.UserInterface/IHostApplicationWindow.cs index 81721c63..c836bce5 100644 --- a/Libraries/UniversalEditor.UserInterface/IHostApplicationWindow.cs +++ b/Libraries/UniversalEditor.UserInterface/IHostApplicationWindow.cs @@ -37,6 +37,8 @@ namespace UniversalEditor.UserInterface void SwitchPerspective(int index); void CloseFile(DockingWindow dw = null); + void CloseAllFiles(); + void CloseProject(); void CloseWindow(); diff --git a/Libraries/UniversalEditor.UserInterface/Panels/OutputWindowPanel.cs b/Libraries/UniversalEditor.UserInterface/Panels/OutputWindowPanel.cs new file mode 100644 index 00000000..2ed0199b --- /dev/null +++ b/Libraries/UniversalEditor.UserInterface/Panels/OutputWindowPanel.cs @@ -0,0 +1,44 @@ +// +// OutputWindowPanel.cs +// +// Author: +// beckermj <> +// +// Copyright (c) 2023 ${CopyrightHolder} +// +// 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; +using MBS.Framework.UserInterface.Layouts; + +namespace UniversalEditor.UserInterface.Panels +{ + public class OutputWindowPanel : Panel + { + public static readonly Guid ID = new Guid("{34e9b282-4803-4797-b1ed-18261cf29b96}"); + + private TextBox txt; + + public OutputWindowPanel() + { + this.Layout = new BoxLayout(Orientation.Vertical); + + txt = new TextBox(); + txt.Multiline = true; + txt.Editable = false; + this.Controls.Add(txt, new BoxLayout.Constraints(true, true)); + } + } + } diff --git a/Libraries/UniversalEditor.UserInterface/Panels/PropertyListPanel.cs b/Libraries/UniversalEditor.UserInterface/Panels/PropertyListPanel.cs index f3ce2165..6a9d5c9d 100644 --- a/Libraries/UniversalEditor.UserInterface/Panels/PropertyListPanel.cs +++ b/Libraries/UniversalEditor.UserInterface/Panels/PropertyListPanel.cs @@ -190,10 +190,22 @@ namespace UniversalEditor.UserInterface.Panels internal void ClearPropertyPanelObjects() { + if (cboObject == null) + { + Console.Error.WriteLine("PropertyPanel: cboObject was not created correctly"); + return; + } + (cboObject.Model as DefaultTreeModel).Rows.Clear(); } internal void AddPropertyPanelObject(PropertyPanelObject item) { + if (cboObject == null) + { + Console.Error.WriteLine("PropertyPanel: cboObject was not created correctly"); + return; + } + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] { new TreeModelRowColumn((cboObject.Model as DefaultTreeModel).Columns[0], item.Name), @@ -207,11 +219,23 @@ namespace UniversalEditor.UserInterface.Panels private Dictionary _rowsByObject = new Dictionary(); internal void RemovePropertyPanelObject(PropertyPanelObject item) { + if (cboObject == null) + { + Console.Error.WriteLine("PropertyPanel: cboObject was not created correctly"); + return; + } + if (!_rowsByObject.ContainsKey(item)) return; (cboObject.Model as DefaultTreeModel).Rows.Remove(_rowsByObject[item]); } internal void RefreshList() { + if (cboObject == null) + { + Console.Error.WriteLine("PropertyPanel: cboObject was not created correctly"); + return; + } + (cboObject.Model as DefaultTreeModel).Rows.Clear(); for (int i = 0; i < Objects.Count; i++) { diff --git a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj index 0d425fa6..ff3eb5fc 100644 --- a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj +++ b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj @@ -140,6 +140,7 @@ +