various fixes improvements, localized panel titles, output window, etc.

This commit is contained in:
Michael Becker 2023-05-05 07:44:10 -04:00
parent 48e04882ff
commit 36315b5189
9 changed files with 130 additions and 9 deletions

3
.gitignore vendored
View File

@ -185,6 +185,9 @@ RemoteSystemsTempFiles
mono_crash.*.blob
mono_crash.*.json
# VSCode crap
.vscode
# Geany (?) crap
.#*.*

View File

@ -3,6 +3,14 @@
<Language ID="English">
<StringTable>
<StringTableEntry ID="Application.Title" Value="Universal Editor" />
<StringTableEntry ID="UniversalEditor.Panels.PropertyListPanel.Title" Value="Properties" />
<StringTableEntry ID="UniversalEditor.Panels.ToolboxPanel.Title" Value="Toolbox" />
<StringTableEntry ID="UniversalEditor.Panels.DocumentExplorerPanel.Title" Value="Document Explorer" />
<StringTableEntry ID="UniversalEditor.Panels.SolutionExplorerPanel.Title" Value="Solution Explorer" />
<StringTableEntry ID="UniversalEditor.Panels.ErrorListPanel.Title" Value="Problems" />
<StringTableEntry ID="UniversalEditor.Panels.OutputWindowPanel.Title" Value="Output" />
<StringTableEntry ID="Framework.Errors.GenericErrorTitle" Value="Error" />
</StringTable>
<OptionPanels>

View File

@ -118,7 +118,7 @@ namespace UniversalEditor.UserInterface
{
base.OnCreated(e);
UserInterfacePlugin[] plugins = UserInterfacePlugin.Get();
UserInterfacePlugin[] plugins = Plugin.Get<UserInterfacePlugin>();
Type typ = typeof(EditorPlugin);
for (int i = 0; i < plugins.Length; i++)
{

View File

@ -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);

View File

@ -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<UserInterfacePlugin>())
{
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<DockingItem> e = dckContainer.Items.Where(item => item.Placement == DockingItemPlacement.Center);
List<DockingItem> list = e.ToList();
foreach (DockingItem item in list)
{
dckContainer.Items.Remove(item);
}
UpdateMenuItems();
}
private System.Collections.Generic.List<Window> Windows = new System.Collections.Generic.List<Window>();
public void CloseFile(DockingWindow dw = null)
{
@ -1855,6 +1870,20 @@ namespace UniversalEditor.UserInterface
{
return GetCurrentPage() as EditorPage;
}
public DockingWindow[] GetDocumentWindows()
{
List<DockingWindow> list = new List<DockingWindow>();
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<EditorPage> list = new List<EditorPage>();

View File

@ -37,6 +37,8 @@ namespace UniversalEditor.UserInterface
void SwitchPerspective(int index);
void CloseFile(DockingWindow dw = null);
void CloseAllFiles();
void CloseProject();
void CloseWindow();

View File

@ -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 <http://www.gnu.org/licenses/>.
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));
}
}
}

View File

@ -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<PropertyPanelObject, TreeModelRow> _rowsByObject = new Dictionary<PropertyPanelObject, TreeModelRow>();
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++)
{

View File

@ -140,6 +140,7 @@
<Compile Include="Panels\ToolboxPanel.cs" />
<Compile Include="PanelReference.cs" />
<Compile Include="Editors\Text\Formatted\FormattedTextEditor.cs" />
<Compile Include="Panels\OutputWindowPanel.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">