migrate Application to a non-static class so we can develop UI-specific stuff in a subclass

This commit is contained in:
Michael Becker 2020-10-26 11:41:03 -04:00
parent d519ffbed4
commit e8eab14089
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7
26 changed files with 292 additions and 285 deletions

View File

@ -12,17 +12,14 @@ namespace UniversalEditor.UserInterface
{
public class BookmarksManager
{
private System.Collections.Specialized.StringCollection mvarFileNames = new System.Collections.Specialized.StringCollection();
public System.Collections.Specialized.StringCollection FileNames { get { return mvarFileNames; } }
private string mvarDataFileName = String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[]
public System.Collections.Specialized.StringCollection FileNames { get; } = new System.Collections.Specialized.StringCollection();
public string DataFileName { get; set; } = String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[]
{
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"Mike Becker's Software",
"Universal Editor",
"Bookmarks.xml"
});
public string DataFileName { get { return mvarDataFileName; } set { mvarDataFileName = value; } }
private Version mvarFormatVersion = new Version(1, 0);
@ -31,9 +28,9 @@ namespace UniversalEditor.UserInterface
MarkupObjectModel mom = new MarkupObjectModel();
XMLDataFormat xml = new XMLDataFormat();
if (!System.IO.File.Exists(mvarDataFileName)) return;
if (!System.IO.File.Exists(DataFileName)) return;
Document.Load(mom, xml, new FileAccessor(mvarDataFileName), true);
Document.Load(mom, xml, new FileAccessor(DataFileName), true);
MarkupTagElement tagBookmarks = (mom.Elements["Bookmarks"] as MarkupTagElement);
if (tagBookmarks == null) return;
@ -53,7 +50,7 @@ namespace UniversalEditor.UserInterface
MarkupAttribute attFileName = tagBookmark.Attributes["FileName"];
if (attFileName == null) continue;
mvarFileNames.Add(attFileName.Value);
FileNames.Add(attFileName.Value);
}
}
public void Save()
@ -72,9 +69,9 @@ namespace UniversalEditor.UserInterface
mom.Elements.Add(tagBookmarks);
if (mvarFileNames.Count > 0)
if (FileNames.Count > 0)
{
foreach (string fileName in mvarFileNames)
foreach (string fileName in FileNames)
{
MarkupTagElement tagBookmark = new MarkupTagElement();
tagBookmark.FullName = "Bookmark";
@ -83,13 +80,13 @@ namespace UniversalEditor.UserInterface
}
}
string dir = System.IO.Path.GetDirectoryName (mvarDataFileName);
string dir = System.IO.Path.GetDirectoryName(DataFileName);
if (!System.IO.Directory.Exists (dir))
{
System.IO.Directory.CreateDirectory (dir);
}
Document.Save(mom, xml, new FileAccessor(mvarDataFileName, true, true), true);
Document.Save(mom, xml, new FileAccessor(DataFileName, true, true), true);
}
}
}

View File

@ -7,6 +7,7 @@ using UniversalEditor.DataFormats.Markup.XML;
using UniversalEditor.Accessors;
using MBS.Framework.UserInterface;
using MBS.Framework.Logic;
using MBS.Framework;
namespace UniversalEditor.UserInterface.Common
{
@ -69,7 +70,7 @@ namespace UniversalEditor.UserInterface.Common
private static void InitializeFromXML(ref List<EditorReference> listEditors)
{
string[] paths = Application.EnumerateDataPaths();
string[] paths = ((UIApplication)Application.Instance).EnumerateDataPaths();
foreach (string path in paths)
{
if (!System.IO.Directory.Exists(path))
@ -187,8 +188,8 @@ namespace UniversalEditor.UserInterface.Common
MarkupTagElement tagItem = (elItem as MarkupTagElement);
if (tagItem == null) continue;
CommandItem ci = CommandItem.FromMarkup(tagItem);
CommandItem.AddToCommandBar(ci, cmd, null);
CommandItem ci = CommandItemLoader.FromMarkup(tagItem);
ci.AddToCommandBar(cmd, null);
}
}
}
@ -205,7 +206,7 @@ namespace UniversalEditor.UserInterface.Common
MarkupTagElement tagItem = (elItem as MarkupTagElement);
if (tagItem == null) continue;
CommandItem ci = CommandItem.FromMarkup(tagItem);
CommandItem ci = CommandItemLoader.FromMarkup(tagItem);
if (ci != null)
{
er.MenuBar.Items.Add(ci);

View File

@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MBS.Framework;
using MBS.Framework.UserInterface;
using UniversalEditor.ObjectModels.PropertyList;
namespace UniversalEditor.UserInterface
@ -48,7 +50,7 @@ namespace UniversalEditor.UserInterface
{
UniversalEditor.DataFormats.PropertyList.XML.XMLPropertyListDataFormat xdf = new DataFormats.PropertyList.XML.XMLPropertyListDataFormat();
string FileName = MBS.Framework.UserInterface.Application.BasePath + System.IO.Path.DirectorySeparatorChar.ToString() + "Configuration.xml";
string FileName = ((UIApplication)Application.Instance).BasePath + System.IO.Path.DirectorySeparatorChar.ToString() + "Configuration.xml";
if (System.IO.File.Exists(FileName))
{
Document.Load(mvarLocalConfiguration, xdf, new Accessors.FileAccessor(FileName));
@ -58,7 +60,7 @@ namespace UniversalEditor.UserInterface
public void Save()
{
UniversalEditor.DataFormats.PropertyList.XML.XMLPropertyListDataFormat xdf = new DataFormats.PropertyList.XML.XMLPropertyListDataFormat();
string FileName = MBS.Framework.UserInterface.Application.BasePath + System.IO.Path.DirectorySeparatorChar.ToString() + "Configuration.xml";
string FileName = ((UIApplication)Application.Instance).BasePath + System.IO.Path.DirectorySeparatorChar.ToString() + "Configuration.xml";
string dir = System.IO.Path.GetDirectoryName (FileName);
if (!System.IO.Directory.Exists(dir))
{

View File

@ -20,7 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;
@ -50,8 +50,8 @@ namespace UniversalEditor.UserInterface.Dialogs
{
base.OnCreated(e);
Text = String.Format(Text, Application.Title);
lblApplicationTitle.Text = Application.Title;
Text = String.Format(Text, Application.Instance.Title);
lblApplicationTitle.Text = Application.Instance.Title;
lblApplicationVersion.Text = String.Format("Version {0}", System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString());
object[] atts = System.Reflection.Assembly.GetEntryAssembly().GetCustomAttributes(typeof(System.Reflection.AssemblyCopyrightAttribute), false);

View File

@ -29,6 +29,7 @@ using MBS.Framework.UserInterface.Drawing;
using MBS.Framework.Drawing;
using System.ComponentModel;
using MBS.Framework.UserInterface.Dialogs;
using MBS.Framework;
namespace UniversalEditor.UserInterface.Dialogs
{

View File

@ -26,6 +26,7 @@ using MBS.Framework.UserInterface.Layouts;
using MBS.Framework.UserInterface.Controls.FileBrowser;
using MBS.Framework.UserInterface.Dialogs;
using UniversalEditor.UserInterface.Controls;
using MBS.Framework;
namespace UniversalEditor.UserInterface.Dialogs
{

View File

@ -27,6 +27,7 @@ using System.Text;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Input.Keyboard;
using MBS.Framework.UserInterface.Dialogs;
using MBS.Framework;
namespace UniversalEditor.UserInterface
{
@ -83,7 +84,7 @@ namespace UniversalEditor.UserInterface
{
base.OnCreated(e);
Plugin[] plugins = Plugin.Get();
UserInterfacePlugin[] plugins = UserInterfacePlugin.Get();
Type typ = typeof(EditorPlugin);
for (int i = 0; i < plugins.Length; i++)
{
@ -684,9 +685,7 @@ namespace UniversalEditor.UserInterface
}
public string DataPath { get { return String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[] { "Editors", this.GetType().FullName }); } }
private Command.CommandCollection mvarCommands = new Command.CommandCollection();
public Command.CommandCollection Commands { get { return mvarCommands; } }
public Command.CommandCollection Commands { get; } = new Command.CommandCollection();
/*
protected override bool ProcessKeyPreview(ref Message m)
@ -702,7 +701,7 @@ namespace UniversalEditor.UserInterface
base.OnKeyDown(e);
// look at this editor's configuration to see if we have any registered keybindings
foreach (Command cmd in mvarCommands)
foreach (Command cmd in Commands)
{
/*
if (cmd.Shortcut.CompareTo(e.KeyData))

View File

@ -26,7 +26,7 @@ namespace UniversalEditor.UserInterface
/// <summary>
/// Represents a <see cref="MBS.Framework.UserInterface.Context" /> associated with an <see cref="Editor" />.
/// </summary>
public class EditorContext : Context
public class EditorContext : UIContext
{
public EditorReference Reference { get; private set; } = null;

View File

@ -25,9 +25,9 @@ using MBS.Framework.UserInterface;
namespace UniversalEditor.UserInterface
{
/// <summary>
/// Provides a <see cref="Plugin" /> subclass for a Universal Editor plugin which has access to documents.
/// Provides a <see cref="UserInterfacePlugin" /> subclass for a Universal Editor plugin which has access to documents.
/// </summary>
public class EditorPlugin : Plugin
public class EditorPlugin : UserInterfacePlugin
{
public Editor Editor { get; private set; }
public Document Document { get; private set; }

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MBS.Framework;
using MBS.Framework.Logic;
using MBS.Framework.UserInterface;
using UniversalEditor.ObjectModels.Markup;

View File

@ -19,6 +19,7 @@
// 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;
using MBS.Framework.Drawing;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;

View File

@ -34,6 +34,7 @@ using MBS.Framework.UserInterface.Input.Keyboard;
using MBS.Framework.UserInterface.Input.Mouse;
using System.Collections.Specialized;
using UniversalEditor.ObjectModels.FileSystem.FileSources;
using MBS.Framework;
namespace UniversalEditor.Editors.FileSystem
{
@ -876,7 +877,7 @@ namespace UniversalEditor.Editors.FileSystem
tv.ContextMenuCommandID = "FileSystemContextMenu_Unselected";
}
Application.Commands["EditPaste"].Enabled = Clipboard.Default.ContainsFileList;
((UIApplication)Application.Instance).Commands["EditPaste"].Enabled = Clipboard.Default.ContainsFileList;
// (tv.ContextMenu.Items["FileSystemContextMenu_PasteShortcut"] as CommandMenuItem).Enabled = Clipboard.Default.ContainsFileList;
}

View File

@ -22,6 +22,7 @@ using UniversalEditor.UserInterface.Panels;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.Docking;
using MBS.Framework.UserInterface.Controls.ListView;
using MBS.Framework;
namespace UniversalEditor.UserInterface
{
@ -31,16 +32,17 @@ namespace UniversalEditor.UserInterface
public class Engine
{
private static Engine _TheEngine = new Engine();
public static Engine CurrentEngine { get; } = new Engine();
#region implemented abstract members of Engine
protected void BeforeInitialization ()
{
Application.CommandLine.Options.Add("command", '\0', null, CommandLineOptionValueType.Multiple);
Application app = (UIApplication)Application.Instance;
app.CommandLine.Options.Add("command", '\0', null, CommandLineOptionValueType.Multiple);
Application.ID = new Guid("{b359fe9a-080a-43fc-ae38-00ba7ac1703e}");
Application.UniqueName = "net.alcetech.UniversalEditor";
Application.ShortName = "universal-editor";
app.ID = new Guid("{b359fe9a-080a-43fc-ae38-00ba7ac1703e}");
app.UniqueName = "net.alcetech.UniversalEditor";
app.ShortName = "universal-editor";
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
@ -67,14 +69,14 @@ namespace UniversalEditor.UserInterface
// AwesomeControls.Theming.Theme.CurrentTheme.Properties["UseAllCapsMenus"] = false;
Application.ConfigurationFileNameFilter = "*.uexml";
((UIApplication)Application.Instance).ConfigurationFileNameFilter = "*.uexml";
Application.BeforeShutdown += Application_BeforeShutdown;
Application.AfterConfigurationLoaded += Application_AfterConfigurationLoaded;
Application.Startup += Application_Startup;
Application.Activated += Application_Activated;
((UIApplication)Application.Instance).BeforeShutdown += Application_BeforeShutdown;
((UIApplication)Application.Instance).AfterConfigurationLoaded += Application_AfterConfigurationLoaded;
((UIApplication)Application.Instance).Startup += Application_Startup;
((UIApplication)Application.Instance).Activated += Application_Activated;
Application.Initialize();
app.Initialize();
}
void Application_AfterConfigurationLoaded(object sender, EventArgs e)
@ -83,7 +85,7 @@ namespace UniversalEditor.UserInterface
{
UpdateSplashScreenStatus("Loading global configuration");
MarkupTagElement tagConfiguration = (Application.RawMarkup.FindElement("UniversalEditor", "Configuration") as MarkupTagElement);
MarkupTagElement tagConfiguration = (((UIApplication)Application.Instance).RawMarkup.FindElement("UniversalEditor", "Configuration") as MarkupTagElement);
if (tagConfiguration != null)
{
foreach (MarkupElement el in tagConfiguration.Elements)
@ -99,7 +101,7 @@ namespace UniversalEditor.UserInterface
{
UpdateSplashScreenStatus("Loading object model configuration");
MarkupTagElement tagObjectModels = (Application.RawMarkup.FindElement("UniversalEditor", "ObjectModels") as MarkupTagElement);
MarkupTagElement tagObjectModels = (((UIApplication)Application.Instance).RawMarkup.FindElement("UniversalEditor", "ObjectModels") as MarkupTagElement);
if (tagObjectModels != null)
{
MarkupTagElement tagDefault = (tagObjectModels.Elements["Default"] as MarkupTagElement);
@ -146,15 +148,15 @@ namespace UniversalEditor.UserInterface
UniversalEditor.Common.Reflection.GetAvailableDataFormats();
// Initialize Recent File Manager
Engine.CurrentEngine.RecentFileManager.DataFileName = Application.DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "RecentItems.xml";
Engine.CurrentEngine.RecentFileManager.DataFileName = ((UIApplication)Application.Instance).DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "RecentItems.xml";
Engine.CurrentEngine.RecentFileManager.Load();
// Initialize Bookmarks Manager
Engine.CurrentEngine.BookmarksManager.DataFileName = Application.DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "Bookmarks.xml";
Engine.CurrentEngine.BookmarksManager.DataFileName = ((UIApplication)Application.Instance).DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "Bookmarks.xml";
Engine.CurrentEngine.BookmarksManager.Load();
// Initialize Session Manager
Engine.CurrentEngine.SessionManager.DataFileName = Application.DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "Sessions.xml";
Engine.CurrentEngine.SessionManager.DataFileName = ((UIApplication)Application.Instance).DataPath + System.IO.Path.DirectorySeparatorChar.ToString() + "Sessions.xml";
Engine.CurrentEngine.SessionManager.Load();
// load editors into memory so we don't wait 10-15 seconds before opening a file
@ -166,9 +168,9 @@ namespace UniversalEditor.UserInterface
void Application_BeforeShutdown(object sender, System.ComponentModel.CancelEventArgs e)
{
for (int i = 0; i < Application.Windows.Count; i++)
for (int i = 0; i < ((UIApplication)Application.Instance).Windows.Count; i++)
{
MainWindow mw = (Application.Windows[i] as MainWindow);
MainWindow mw = (((UIApplication)Application.Instance).Windows[i] as MainWindow);
if (mw == null) continue;
if (!mw.Close())
@ -195,12 +197,12 @@ namespace UniversalEditor.UserInterface
OpenWindow(e.CommandLine.FileNames.ToArray());
}
List<string> commandsToExecute = (Application.CommandLine.Options.GetValueOrDefault<List<string>>("command", null));
List<string> commandsToExecute = (((UIApplication)Application.Instance).CommandLine.Options.GetValueOrDefault<List<string>>("command", null));
if (commandsToExecute != null)
{
for (int i = 0; i < commandsToExecute.Count; i++)
{
Application.ExecuteCommand(commandsToExecute[i]);
((UIApplication)Application.Instance).ExecuteCommand(commandsToExecute[i]);
}
}
}
@ -243,9 +245,7 @@ namespace UniversalEditor.UserInterface
#if !DEBUG
// Application.ThreadException += Application_ThreadException;
#endif
Application.Title = "Universal Editor";
MBS.Framework.UserInterface.Application.Start();
Application.Instance.Start();
// Glue.Common.Methods.SendApplicationEvent(new Glue.ApplicationEventEventArgs(Glue.Common.Constants.EventNames.ApplicationStop));
}
@ -311,12 +311,6 @@ namespace UniversalEditor.UserInterface
}
#endregion
private static Engine[] m_AvailableEngines = null;
public static Engine[] GetAvailableEngines()
{
return new Engine[] { _TheEngine };
}
private void Bookmarks_Bookmark_Click(object sender, EventArgs e)
{
Command cmd = (Command)sender;
@ -328,99 +322,99 @@ namespace UniversalEditor.UserInterface
{
if (Engine.CurrentEngine.BookmarksManager.FileNames.Count > 0)
{
Application.Commands["Bookmarks"].Items.Add(new SeparatorCommandItem());
Application.Instance.Commands["Bookmarks"].Items.Add(new SeparatorCommandItem());
for (int i = 0; i < Engine.CurrentEngine.BookmarksManager.FileNames.Count; i++)
{
Application.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", i.ToString()), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[i]).Replace("_", "__")));
Application.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", i.ToString())));
Application.Instance.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", i.ToString()), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[i]).Replace("_", "__")));
Application.Instance.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", i.ToString())));
Application.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", i.ToString()), Bookmarks_Bookmark_Click);
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", i.ToString()), Bookmarks_Bookmark_Click);
}
}
// Initialize all the commands that are common to UniversalEditor
#region File
Application.AttachCommandEventHandler("FileNewDocument", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileNewDocument", delegate(object sender, EventArgs e)
{
LastWindow.NewFile();
});
Application.AttachCommandEventHandler("FileNewProject", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileNewProject", delegate(object sender, EventArgs e)
{
LastWindow.NewProject();
});
Application.AttachCommandEventHandler("FileOpenDocument", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileOpenDocument", delegate(object sender, EventArgs e)
{
LastWindow.OpenFile();
});
Application.AttachCommandEventHandler("FileOpenProject", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileOpenProject", delegate(object sender, EventArgs e)
{
LastWindow.OpenProject();
});
Application.AttachCommandEventHandler("FileSaveDocument", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileSaveDocument", delegate(object sender, EventArgs e)
{
LastWindow.SaveFile();
});
Application.AttachCommandEventHandler("FileSaveDocumentAs", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileSaveDocumentAs", delegate(object sender, EventArgs e)
{
LastWindow.SaveFileAs();
});
Application.AttachCommandEventHandler("FileSaveProject", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileSaveProject", delegate(object sender, EventArgs e)
{
LastWindow.SaveProject();
});
Application.AttachCommandEventHandler("FileSaveProjectAs", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileSaveProjectAs", delegate(object sender, EventArgs e)
{
LastWindow.SaveProjectAs();
});
Application.AttachCommandEventHandler("FileSaveAll", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileSaveAll", delegate(object sender, EventArgs e)
{
LastWindow.SaveAll();
});
Application.AttachCommandEventHandler("FileCloseDocument", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileCloseDocument", delegate(object sender, EventArgs e)
{
LastWindow.CloseFile();
});
Application.AttachCommandEventHandler("FileCloseProject", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileCloseProject", delegate(object sender, EventArgs e)
{
LastWindow.CloseProject();
});
Application.AttachCommandEventHandler("FilePrint", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FilePrint", delegate(object sender, EventArgs e)
{
LastWindow.PrintDocument();
});
Application.AttachCommandEventHandler("FileProperties", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileProperties", delegate (object sender, EventArgs e)
{
LastWindow.ShowDocumentPropertiesDialog();
});
Application.AttachCommandEventHandler("FileRestart", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileRestart", delegate(object sender, EventArgs e)
{
RestartApplication();
});
Application.AttachCommandEventHandler("FileExit", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("FileExit", delegate(object sender, EventArgs e)
{
StopApplication();
});
#endregion
#region Edit
Application.AttachCommandEventHandler("EditCut", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditCut", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor == null) return;
editor.Cut();
});
Application.AttachCommandEventHandler("EditCopy", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditCopy", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor == null) return;
editor.Copy();
});
Application.AttachCommandEventHandler("EditPaste", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditPaste", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor == null) return;
editor.Paste();
});
Application.AttachCommandEventHandler("EditDelete", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditDelete", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor != null)
@ -436,7 +430,7 @@ namespace UniversalEditor.UserInterface
}
}
});
Application.AttachCommandEventHandler("EditBatchFindReplace", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditBatchFindReplace", delegate (object sender, EventArgs e)
{
if (LastWindow == null) return;
@ -447,13 +441,13 @@ namespace UniversalEditor.UserInterface
dlg.Editor = ed;
dlg.Show();
});
Application.AttachCommandEventHandler("EditUndo", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditUndo", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor == null) return;
editor.Undo();
});
Application.AttachCommandEventHandler("EditRedo", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("EditRedo", delegate(object sender, EventArgs e)
{
Editor editor = LastWindow.GetCurrentEditor();
if (editor == null) return;
@ -461,64 +455,64 @@ namespace UniversalEditor.UserInterface
});
#endregion
#region View
Application.AttachCommandEventHandler("ViewFullScreen", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewFullScreen", delegate(object sender, EventArgs e)
{
Command cmd = (sender as Command);
LastWindow.FullScreen = !LastWindow.FullScreen;
cmd.Checked = LastWindow.FullScreen;
});
#region Perspective
Application.AttachCommandEventHandler("ViewPerspective1", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective1", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(1);
});
Application.AttachCommandEventHandler("ViewPerspective2", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective2", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(2);
});
Application.AttachCommandEventHandler("ViewPerspective3", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective3", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(3);
});
Application.AttachCommandEventHandler("ViewPerspective4", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective4", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(4);
});
Application.AttachCommandEventHandler("ViewPerspective5", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective5", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(5);
});
Application.AttachCommandEventHandler("ViewPerspective6", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective6", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(6);
});
Application.AttachCommandEventHandler("ViewPerspective7", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective7", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(7);
});
Application.AttachCommandEventHandler("ViewPerspective8", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective8", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(8);
});
Application.AttachCommandEventHandler("ViewPerspective9", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewPerspective9", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(9);
});
#endregion
Application.AttachCommandEventHandler("ViewStartPage", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewStartPage", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.ShowStartPage();
});
Application.AttachCommandEventHandler("ViewStatusBar", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ViewStatusBar", delegate (object sender, EventArgs e)
{
HostApplication.CurrentWindow.StatusBar.Visible = !HostApplication.CurrentWindow.StatusBar.Visible;
Application.Commands["ViewStatusBar"].Checked = HostApplication.CurrentWindow.StatusBar.Visible;
Application.Instance.Commands["ViewStatusBar"].Checked = HostApplication.CurrentWindow.StatusBar.Visible;
});
#endregion
#region Bookmarks
Application.AttachCommandEventHandler("BookmarksAdd", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("BookmarksAdd", delegate (object sender, EventArgs e)
{
Editor ed = LastWindow.GetCurrentEditor();
if (ed == null) return;
@ -532,19 +526,19 @@ namespace UniversalEditor.UserInterface
string filename = acc.GetFileName();
BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = Application.Commands["Bookmarks"];
Command cmdBookmarks = Application.Instance.Commands["Bookmarks"];
if (cmdBookmarks.Items.Count == 4)
{
cmdBookmarks.Items.Add(new SeparatorCommandItem());
}
Application.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString()), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
Application.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString())));
((UIApplication)Application.Instance).Commands.Add(new Command(String.Format("{0}", (Engine.CurrentEngine.BookmarksManager.FileNames.Count - 1).ToString()), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
((UIApplication)Application.Instance).Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString())));
Application.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (Engine.CurrentEngine.BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
ShowBookmarksManagerDialog();
});
Application.AttachCommandEventHandler("BookmarksAddAll", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("BookmarksAddAll", delegate (object sender, EventArgs e)
{
Page[] pages = CurrentEngine.LastWindow.GetPages();
for (int i = 0; i < pages.Length; i++)
@ -556,55 +550,55 @@ namespace UniversalEditor.UserInterface
// FIXME: BookmarksAdd copypasta
string filename = ed.ObjectModel.Accessor.GetFileName();
BookmarksManager.FileNames.Add(filename);
Engine.CurrentEngine.BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = Application.Commands["Bookmarks"];
Command cmdBookmarks = ((UIApplication)Application.Instance).Commands["Bookmarks"];
if (cmdBookmarks.Items.Count == 4)
{
cmdBookmarks.Items.Add(new SeparatorCommandItem());
}
Application.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString()), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
Application.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString())));
Application.Instance.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", (Engine.CurrentEngine.BookmarksManager.FileNames.Count - 1)), System.IO.Path.GetFileName(Engine.CurrentEngine.BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
Application.Instance.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", Engine.CurrentEngine.BookmarksManager.FileNames.Count - 1)));
Application.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (Engine.CurrentEngine.BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
}
}
ShowBookmarksManagerDialog();
});
Application.AttachCommandEventHandler("BookmarksManage", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("BookmarksManage", delegate (object sender, EventArgs e)
{
ShowBookmarksManagerDialog();
});
#endregion
#region Tools
// ToolsOptions should actually be under the Edit menu as "Preferences" on Linux systems
Application.AttachCommandEventHandler("ToolsOptions", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ToolsOptions", delegate(object sender, EventArgs e)
{
LastWindow.ShowOptionsDialog();
});
Application.AttachCommandEventHandler("ToolsCustomize", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("ToolsCustomize", delegate (object sender, EventArgs e)
{
Application.ShowSettingsDialog(new string[] { "Application", "Command Bars" });
((UIApplication)Application.Instance).ShowSettingsDialog(new string[] { "Application", "Command Bars" });
});
#endregion
#region Window
Application.AttachCommandEventHandler("WindowNewWindow", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("WindowNewWindow", delegate(object sender, EventArgs e)
{
OpenWindow();
});
Application.AttachCommandEventHandler("WindowWindows", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("WindowWindows", delegate(object sender, EventArgs e)
{
LastWindow.SetWindowListVisible(true, true);
});
#endregion
#region Help
Application.AttachCommandEventHandler("HelpViewHelp", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("HelpViewHelp", delegate (object sender, EventArgs e)
{
Application.ShowHelp();
((UIApplication)Application.Instance).ShowHelp();
});
Application.AttachCommandEventHandler("HelpCustomerFeedbackOptions", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("HelpCustomerFeedbackOptions", delegate (object sender, EventArgs e)
{
// MessageDialog.ShowDialog("This product has already been activated.", "Licensing and Activation", MessageDialogButtons.OK, MessageDialogIcon.Information);
TaskDialog td = new TaskDialog();
@ -612,7 +606,7 @@ namespace UniversalEditor.UserInterface
td.Prompt = "Please open a trouble ticket on GitHub if you need support.";
td.Text = "Customer Experience Improvement Program";
td.Content = String.Format("You are using the GNU GPLv3 licensed version of {0}. This program comes with ABSOLUTELY NO WARRANTY.\r\n\r\nSupport contracts may be available for purchase; please contact your software distributor.", Application.Title);
td.Content = String.Format("You are using the GNU GPLv3 licensed version of {0}. This program comes with ABSOLUTELY NO WARRANTY.\r\n\r\nSupport contracts may be available for purchase; please contact your software distributor.", Application.Instance.Title);
td.Footer = "<a href=\"GPLLicense\">View the license terms</a>";
td.EnableHyperlinks = true;
td.HyperlinkClicked += Td_HyperlinkClicked;
@ -621,7 +615,7 @@ namespace UniversalEditor.UserInterface
td.Parent = (Window)CurrentEngine.LastWindow;
td.ShowDialog();
});
Application.AttachCommandEventHandler("HelpLicensingAndActivation", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("HelpLicensingAndActivation", delegate (object sender, EventArgs e)
{
// MessageDialog.ShowDialog("This product has already been activated.", "Licensing and Activation", MessageDialogButtons.OK, MessageDialogIcon.Information);
TaskDialog td = new TaskDialog();
@ -629,7 +623,7 @@ namespace UniversalEditor.UserInterface
td.Prompt = "This product has already been activated.";
td.Text = "Licensing and Activation";
td.Content = String.Format("You are using the GNU GPLv3 licensed version of {0}. No activation is necessary.", Application.Title);
td.Content = String.Format("You are using the GNU GPLv3 licensed version of {0}. No activation is necessary.", Application.Instance.Title);
td.Footer = "<a href=\"GPLLicense\">View the license terms</a>";
td.EnableHyperlinks = true;
td.HyperlinkClicked += Td_HyperlinkClicked;
@ -638,14 +632,14 @@ namespace UniversalEditor.UserInterface
td.Parent = (Window)CurrentEngine.LastWindow;
td.ShowDialog();
});
Application.AttachCommandEventHandler("HelpAboutPlatform", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("HelpAboutPlatform", delegate(object sender, EventArgs e)
{
ShowAboutDialog();
});
#endregion
Application.AttachCommandEventHandler("DockingContainerContextMenu_Close", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("DockingContainerContextMenu_Close", delegate (object sender, EventArgs e)
{
CommandEventArgs ce = (e as CommandEventArgs);
if (ce != null)
@ -654,11 +648,11 @@ namespace UniversalEditor.UserInterface
LastWindow?.CloseFile(dw);
}
});
Application.AttachCommandEventHandler("DockingContainerContextMenu_CloseAll", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("DockingContainerContextMenu_CloseAll", delegate (object sender, EventArgs e)
{
LastWindow?.CloseWindow();
});
Application.AttachCommandEventHandler("DockingContainerContextMenu_CloseAllButThis", delegate (object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("DockingContainerContextMenu_CloseAllButThis", delegate (object sender, EventArgs e)
{
MessageDialog.ShowDialog("Not implemented ... yet", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
});
@ -667,23 +661,23 @@ namespace UniversalEditor.UserInterface
#region Dynamic Commands
#region View
#region Panels
for (int i = Application.CommandBars.Count - 1; i >= 0; i--)
for (int i = ((UIApplication)Application.Instance).CommandBars.Count - 1; i >= 0; i--)
{
Command cmdViewToolbarsToolbar = new Command();
cmdViewToolbarsToolbar.ID = "ViewToolbars" + i.ToString();
cmdViewToolbarsToolbar.Title = Application.CommandBars[i].Title;
cmdViewToolbarsToolbar.Title = ((UIApplication)Application.Instance).CommandBars[i].Title;
cmdViewToolbarsToolbar.Executed += cmdViewToolbarsToolbar_Executed;
Application.Commands.Add(cmdViewToolbarsToolbar);
Application.Commands["ViewToolbars"].Items.Insert(0, new CommandReferenceCommandItem(cmdViewToolbarsToolbar.ID));
Application.Instance.Commands.Add(cmdViewToolbarsToolbar);
Application.Instance.Commands["ViewToolbars"].Items.Insert(0, new CommandReferenceCommandItem(cmdViewToolbarsToolbar.ID));
}
#endregion
#region Panels
if (Application.Commands["ViewPanels"] != null)
if (Application.Instance.Commands["ViewPanels"] != null)
{
Command cmdViewPanels1 = new Command();
cmdViewPanels1.ID = "ViewPanels1";
Application.Commands.Add(cmdViewPanels1);
Application.Commands["ViewPanels"].Items.Add(new CommandReferenceCommandItem("ViewPanels1"));
Application.Instance.Commands.Add(cmdViewPanels1);
((UIApplication)Application.Instance).Commands["ViewPanels"].Items.Add(new CommandReferenceCommandItem("ViewPanels1"));
}
#endregion
#endregion
@ -691,27 +685,27 @@ namespace UniversalEditor.UserInterface
#region Language Strings
#region Help
Command helpAboutPlatform = Application.Commands["HelpAboutPlatform"];
Command helpAboutPlatform = Application.Instance.Commands["HelpAboutPlatform"];
if (helpAboutPlatform != null)
{
helpAboutPlatform.Title = String.Format(helpAboutPlatform.Title, Application.DefaultLanguage.GetStringTableEntry("Application.Title", "Universal Editor"));
helpAboutPlatform.Title = String.Format(helpAboutPlatform.Title, ((UIApplication)Application.Instance).DefaultLanguage.GetStringTableEntry("Application.Title", "Universal Editor"));
}
Command helpLanguage = Application.Commands["HelpLanguage"];
Command helpLanguage = Application.Instance.Commands["HelpLanguage"];
if (helpLanguage != null)
{
foreach (Language lang in Application.Languages)
foreach (Language lang in ((UIApplication)Application.Instance).Languages)
{
Command cmdLanguage = new Command();
cmdLanguage.ID = "HelpLanguage_" + lang.ID;
cmdLanguage.ID = String.Format("HelpLanguage_{0}", lang.ID);
cmdLanguage.Title = lang.Title;
cmdLanguage.Executed += delegate(object sender, EventArgs e)
cmdLanguage.Executed += delegate (object sender, EventArgs e)
{
HostApplication.Messages.Add(HostApplicationMessageSeverity.Notice, "Clicked language " + lang.ID);
};
Application.Commands.Add(cmdLanguage);
Application.Instance.Commands.Add(cmdLanguage);
helpLanguage.Items.Add(new CommandReferenceCommandItem("HelpLanguage_" + lang.ID));
helpLanguage.Items.Add(new CommandReferenceCommandItem(cmdLanguage.ID));
}
}
#endregion
@ -756,19 +750,11 @@ namespace UniversalEditor.UserInterface
public static bool Execute()
{
Console.WriteLine(" *** There is only UWT *** ");
mvarCurrentEngine = _TheEngine;
if (mvarCurrentEngine != null)
{
Console.WriteLine("Using engine " + mvarCurrentEngine.GetType().FullName);
}
#if !DEBUG
try
{
#endif
mvarCurrentEngine.StartApplication();
CurrentEngine.StartApplication();
#if !DEBUG
}
catch (Exception ex)
@ -845,7 +831,7 @@ namespace UniversalEditor.UserInterface
{
if (relativePath.StartsWith("~/"))
{
string[] potentialFileNames = MBS.Framework.UserInterface.Application.EnumerateDataPaths();
string[] potentialFileNames = ((UIApplication)Application.Instance).EnumerateDataPaths();
for (int i = potentialFileNames.Length - 1; i >= 0; i--)
{
potentialFileNames[i] = potentialFileNames[i] + '/' + relativePath.Substring(2);
@ -1024,20 +1010,17 @@ namespace UniversalEditor.UserInterface
private SessionManager mvarSessionManager = new SessionManager();
public SessionManager SessionManager { get { return mvarSessionManager; } set { mvarSessionManager = value; } }
private static Engine mvarCurrentEngine = null;
public static Engine CurrentEngine { get { return mvarCurrentEngine; } }
private Perspective.PerspectiveCollection mvarPerspectives = new Perspective.PerspectiveCollection();
public Perspective.PerspectiveCollection Perspectives { get { return mvarPerspectives; } }
protected internal virtual void UpdateSplashScreenStatus(string message)
{
Application.UpdateSplashScreenStatus(message);
((UIApplication)Application.Instance).UpdateSplashScreenStatus(message);
Console.WriteLine(message);
}
protected internal virtual void UpdateSplashScreenStatus(string message, int progressValue = 0, int progressMinimum = 0, int progressMaximum = 100)
{
Application.UpdateSplashScreenStatus(message, progressValue, progressMinimum, progressMaximum);
((UIApplication)Application.Instance).UpdateSplashScreenStatus(message, progressValue, progressMinimum, progressMaximum);
Console.WriteLine(message);
}
@ -1053,7 +1036,9 @@ namespace UniversalEditor.UserInterface
public void StartApplication()
{
Engine.mvarCurrentEngine = this;
Application.Instance = new UIApplication();
Application.Instance.Title = "Universal Editor";
mvarRunning = true;
string[] args1 = Environment.GetCommandLineArgs();
@ -1101,7 +1086,7 @@ namespace UniversalEditor.UserInterface
public void StopApplication()
{
if (!BeforeStopApplication()) return;
Application.Stop();
Application.Instance.Stop();
}
protected virtual void RestartApplicationInternal()
{

View File

@ -30,6 +30,7 @@ using UniversalEditor.DataFormats.Binary;
using System.Collections.Generic;
using System.Text;
using MBS.Framework.UserInterface.Controls.ListView;
using MBS.Framework;
namespace UniversalEditor.UserInterface
{
@ -107,13 +108,18 @@ namespace UniversalEditor.UserInterface
protected override void OnKeyDown(KeyEventArgs e)
{
// we have to process key shortcuts manually if we do not use a traditional menu bar
foreach (Command cmd in Application.Commands) {
if (cmd.Shortcut == null) continue;
foreach (Command cmd in ((UIApplication)Application.Instance).Commands)
{
if (cmd is UICommand)
{
if (((UICommand)cmd).Shortcut == null) continue;
if (cmd.Shortcut.Key == e.Key && cmd.Shortcut.ModifierKeys == e.ModifierKeys) {
Application.ExecuteCommand (cmd.ID);
e.Cancel = true;
break;
if (((UICommand)cmd).Shortcut.Key == e.Key && ((UICommand)cmd).Shortcut.ModifierKeys == e.ModifierKeys)
{
((UIApplication)Application.Instance).ExecuteCommand(cmd.ID);
e.Cancel = true;
break;
}
}
}
UpdateSuperDuperButtonBar(e.KeyAsModifier);
@ -131,16 +137,21 @@ namespace UniversalEditor.UserInterface
SuperButtons[i].Text = ((KeyboardKey)((int)KeyboardKey.F1 + i)).ToString() + " ";
SuperButtons[i].SetExtraData<Command>("command", null);
}
for (int i = 0; i < Application.Contexts.Count; i++)
for (int i = 0; i < Application.Instance.Contexts.Count; i++)
{
for (int j = 0; j < Application.Contexts[i].KeyBindings.Count; j++)
if (Application.Instance.Contexts[i] is UIContext)
{
if (((int)Application.Contexts[i].KeyBindings[j].Key >= (int)KeyboardKey.F1 && (int)Application.Contexts[i].KeyBindings[j].Key <= (int)KeyboardKey.F12)
&& Application.Contexts[i].KeyBindings[j].ModifierKeys == modifierKeys)
for (int j = 0; j < ((UIContext)Application.Instance.Contexts[i]).KeyBindings.Count; j++)
{
int q = (int)Application.Contexts[i].KeyBindings[j].Key - (int)KeyboardKey.F1;
SuperButtons[q].Text = Application.Contexts[i].KeyBindings[j].Key.ToString() + " " + Application.Contexts[i].KeyBindings[j].Command?.Title;
SuperButtons[q].SetExtraData<Command>("command", Application.Contexts[i].KeyBindings[j].Command);
KeyBinding keyb = ((UIContext)Application.Instance.Contexts[i]).KeyBindings[j];
if (((int)(keyb.Key) >= (int)KeyboardKey.F1 && (int)(keyb).Key <= (int)KeyboardKey.F12)
&& keyb.ModifierKeys == modifierKeys)
{
int q = (int)keyb.Key - (int)KeyboardKey.F1;
SuperButtons[q].Text = keyb.Key.ToString() + " " + keyb.Command?.Title;
SuperButtons[q].SetExtraData<Command>("command", keyb.Command);
}
}
}
}
@ -167,7 +178,7 @@ namespace UniversalEditor.UserInterface
Button btn = (Button)sender;
Command cmd = btn.GetExtraData<Command>("command");
if (cmd != null)
Application.ExecuteCommand(cmd.ID);
((UIApplication)Application.Instance).ExecuteCommand(cmd.ID);
}
private DefaultTreeModel tmToolbox = new DefaultTreeModel(new Type[] { typeof(string) });
@ -180,7 +191,7 @@ namespace UniversalEditor.UserInterface
this.CommandDisplayMode = CommandDisplayMode.CommandBar;
if (this.CommandDisplayMode == CommandDisplayMode.Ribbon || this.CommandDisplayMode == CommandDisplayMode.Both) {
foreach (CommandBar cb in Application.CommandBars) {
foreach (CommandBar cb in ((UIApplication)Application.Instance).CommandBars) {
RibbonTab ribbonTabHome = LoadRibbonBar (cb);
ribbonTabHome.Title = "Home";
this.Ribbon.Tabs.Add (ribbonTabHome);
@ -218,10 +229,10 @@ namespace UniversalEditor.UserInterface
this.Bounds = new Rectangle(0, 0, 600, 400);
this.Size = new Dimension2D(800, 600);
this.Text = Application.Title;
this.Text = Application.Instance.Title;
Application.ContextAdded += Application_ContextChanged;
Application.ContextRemoved += Application_ContextChanged;
Application.Instance.ContextAdded += Application_ContextChanged;
Application.Instance.ContextRemoved += Application_ContextChanged;
UpdateSuperDuperButtonBar();
}
@ -353,11 +364,11 @@ namespace UniversalEditor.UserInterface
if (editor != _prevEditor)
{
if (_prevEditor != null)
Application.Contexts.Remove(_prevEditor.Context);
Application.Instance.Contexts.Remove(_prevEditor.Context);
if (editor != null)
{
Application.Contexts.Add(editor.Context);
Application.Instance.Contexts.Add(editor.Context);
// initialize toolbox items
EditorReference er = editor.MakeReference();
@ -771,7 +782,7 @@ namespace UniversalEditor.UserInterface
Engine.CurrentEngine.Windows.Remove(this);
if (Engine.CurrentEngine.Windows.Count <= 0)
{
MBS.Framework.UserInterface.Application.Stop();
Application.Instance.Stop();
}
}
@ -1332,7 +1343,7 @@ namespace UniversalEditor.UserInterface
public bool ShowOptionsDialog()
{
return Application.ShowSettingsDialog();
return ((UIApplication)Application.Instance).ShowSettingsDialog();
}
public void ToggleMenuItemEnabled(string menuItemName, bool enabled)
@ -1347,27 +1358,27 @@ namespace UniversalEditor.UserInterface
private void AddRecentMenuItem(string FileName)
{
Command mnuFileRecentFiles = Application.Commands["FileRecentFiles"];
Command mnuFileRecentFiles = ((UIApplication)Application.Instance).Commands["FileRecentFiles"];
Command mnuFileRecentFile = new Command();
mnuFileRecentFile.ID = "FileRecentFile_" + FileName;
mnuFileRecentFile.Title = System.IO.Path.GetFileName(FileName);
// mnuFileRecentFile.ToolTipText = FileName;
Application.Commands.Add(mnuFileRecentFile);
((UIApplication)Application.Instance).Commands.Add(mnuFileRecentFile);
CommandReferenceCommandItem tsmi = new CommandReferenceCommandItem("FileRecentFile_" + FileName);
mnuFileRecentFiles.Items.Add(tsmi);
}
private void RefreshRecentFilesList()
{
Command mnuFileRecentFiles = Application.Commands["FileRecentFiles"];
Command mnuFileRecentFiles = ((UIApplication)Application.Instance).Commands["FileRecentFiles"];
mnuFileRecentFiles.Items.Clear();
foreach (string fileName in Engine.CurrentEngine.RecentFileManager.FileNames)
{
AddRecentMenuItem(fileName);
}
Command mnuFileRecentProjects = Application.Commands["FileRecentProjects"];
Command mnuFileRecentProjects = ((UIApplication)Application.Instance).Commands["FileRecentProjects"];
mnuFileRecentFiles.Visible = (mnuFileRecentFiles.Items.Count > 0);
mnuFileRecentProjects.Visible = (mnuFileRecentProjects.Items.Count > 0);

View File

@ -29,6 +29,7 @@ using MBS.Framework.UserInterface.Layouts;
using MBS.Framework.UserInterface;
using UniversalEditor.ObjectModels.Text.Plain;
using UniversalEditor.ObjectModels.Binary;
using MBS.Framework;
namespace UniversalEditor.UserInterface.Pages
{
@ -271,7 +272,7 @@ namespace UniversalEditor.UserInterface.Pages
EditorView view = tib.GetExtraData<EditorView>("view");
editor.CurrentView = view;
Console.WriteLine("Switching to view '" + view.Title + "'");
Application.Instance.Log(this, 274, String.Format("Switching to view '{0}'", view.Title));
}

View File

@ -19,7 +19,7 @@
// 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;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;
@ -188,7 +188,7 @@ namespace UniversalEditor.UserInterface.Panels
this.Controls.Add(tvSolutionExplorer, new BoxLayout.Constraints(true, true));
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_OpenContainingFolder", delegate(object sender, EventArgs e)
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_OpenContainingFolder", delegate(object sender, EventArgs e)
{
if (tvSolutionExplorer.SelectedRows.Count != 1) return;
@ -218,34 +218,34 @@ namespace UniversalEditor.UserInterface.Panels
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
Application.Launch("nautilus", String.Format("-s \"{0}\"", fullpath));
((UIApplication)Application.Instance).Launch("nautilus", String.Format("-s \"{0}\"", fullpath));
}
else if (Environment.OSVersion.Platform == PlatformID.Win32Windows)
{
Application.Launch("explorer", String.Format("/select \"{0}\"", fullpath));
((UIApplication)Application.Instance).Launch("explorer", String.Format("/select \"{0}\"", fullpath));
}
else
{
Application.Launch(System.IO.Path.GetDirectoryName(fullpath));
((UIApplication)Application.Instance).Launch(System.IO.Path.GetDirectoryName(fullpath));
}
}
catch (Exception ex)
{
// not using nautilus, just launch the folder
Application.Launch(System.IO.Path.GetDirectoryName(fullpath));
((UIApplication)Application.Instance).Launch(System.IO.Path.GetDirectoryName(fullpath));
}
}
}
});
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Project_Add_ExistingFiles", mnuContextProjectAddExistingFiles_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Project_Add_NewFolder", mnuContextProjectAddNewFolder_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_ExistingFiles", mnuContextSolutionAddExistingProject_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_ExistingProject", mnuContextSolutionAddExistingProject_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_NewProject", mnuContextSolutionAddNewProject_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_File_Open", mnuContextFileOpen_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_NewFile", mnuContextFolderAddNewFile_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_ExistingFiles", mnuContextFolderAddExistingFile_Click);
Application.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_NewFolder", mnuContextFolderAddNewFolder_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Project_Add_ExistingFiles", mnuContextProjectAddExistingFiles_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Project_Add_NewFolder", mnuContextProjectAddNewFolder_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_ExistingFiles", mnuContextSolutionAddExistingProject_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_ExistingProject", mnuContextSolutionAddExistingProject_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Solution_Add_NewProject", mnuContextSolutionAddNewProject_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_File_Open", mnuContextFileOpen_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_NewFile", mnuContextFolderAddNewFile_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_ExistingFiles", mnuContextFolderAddExistingFile_Click);
Application.Instance.AttachCommandEventHandler("SolutionExplorer_ContextMenu_Folder_Add_NewFolder", mnuContextFolderAddNewFolder_Click);
}
private void mnuContextFileOpen_Click(object sender, EventArgs e)

View File

@ -19,7 +19,7 @@
// 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;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Layouts;
@ -43,10 +43,10 @@ namespace UniversalEditor.UserInterface.Panels
cmdCreateNewProject.Click += cmdCreateNewProject_Click;
cmdOpenExistingProject.Click += cmdOpenExistingProject_Click;
lblHeader.Text = String.Format(lblHeader.Text, Application.Title);
lblNewsTitle.Text = String.Format(lblNewsTitle.Text, Application.Title);
lblHeader.Text = String.Format(lblHeader.Text, Application.Instance.Title);
lblNewsTitle.Text = String.Format(lblNewsTitle.Text, Application.Instance.Title);
string header_bmp = Application.ExpandRelativePath("~/header.bmp");
string header_bmp = ((UIApplication)Application.Instance).ExpandRelativePath("~/header.bmp");
if (System.IO.File.Exists(header_bmp))
{
imgHeader.Image = MBS.Framework.UserInterface.Drawing.Image.FromFile(header_bmp);

View File

@ -28,6 +28,7 @@ using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.Drawing;
using MBS.Framework.UserInterface.Controls.ListView;
using MBS.Framework;
namespace UniversalEditor.Editors.Contact
{

View File

@ -21,6 +21,7 @@
using System;
using System.Text;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Dialogs;

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using MBS.Framework.UserInterface;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.Plugins.CRI.DataFormats.FileSystem.CPK;
@ -39,7 +40,7 @@ namespace UniversalEditor.Plugins.CRI.UserInterface
protected override void InitializeInternal()
{
Context = new Context(new Guid("{7A5A7675-529E-46B1-A4FF-0786956DAE47}"), "CRI Extensions for FileSystemEditor");
Context = new UIContext(new Guid("{7A5A7675-529E-46B1-A4FF-0786956DAE47}"), "CRI Extensions for FileSystemEditor");
}
private bool _initOnce = false;
@ -74,15 +75,15 @@ namespace UniversalEditor.Plugins.CRI.UserInterface
}
else
{
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_Header", CRI_FileSystem_Extensions_Export_Header_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_TOC", CRI_FileSystem_Extensions_Export_TOC_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ITOC", CRI_FileSystem_Extensions_Export_ITOC_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_GTOC", CRI_FileSystem_Extensions_Export_GTOC_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ETOC", CRI_FileSystem_Extensions_Export_ETOC_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_Header", CRI_FileSystem_Extensions_Export_Header_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_TOC", CRI_FileSystem_Extensions_Export_TOC_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ITOC", CRI_FileSystem_Extensions_Export_ITOC_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_GTOC", CRI_FileSystem_Extensions_Export_GTOC_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ETOC", CRI_FileSystem_Extensions_Export_ETOC_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_View_Info", CRI_FileSystem_Extensions_View_Info_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_CSV", CRI_FileSystem_Extensions_Export_CSV_Click);
Application.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_All", CRI_FileSystem_Extensions_Export_All_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_View_Info", CRI_FileSystem_Extensions_View_Info_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_CSV", CRI_FileSystem_Extensions_Export_CSV_Click);
((UIApplication)Application.Instance).AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_All", CRI_FileSystem_Extensions_Export_All_Click);
}
_initOnce = true;

View File

@ -22,6 +22,7 @@
using System;
using System.Reflection;
using System.Text;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;

View File

@ -31,11 +31,11 @@ using UniversalEditor.UserInterface;
namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
public class MultimediaCollaborationPlugin : Plugin
public class MultimediaCollaborationPlugin : UserInterfacePlugin
{
public MultimediaCollaborationPlugin()
{
Context = new Context(new Guid("{262a622c-c9e3-458b-8fbb-49cf9258b05d}"), "Multimedia Collaboration Plugin");
Context = new UIContext(new Guid("{262a622c-c9e3-458b-8fbb-49cf9258b05d}"), "Multimedia Collaboration Plugin");
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
@ -161,7 +161,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
if (!_initted(d))
return null;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection list = collab.GetExtraData<SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection>("TrackedChanges", new SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection());
@ -173,7 +173,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
if (collab.TrackChangesEnabled)
@ -190,7 +190,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
if (collab.TrackChangesEnabled)
@ -216,7 +216,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
return collab.GetExtraData<int>("SelectedChangeIndex", -1);
}
@ -224,7 +224,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
collab.SetExtraData<int>("SelectedChangeIndex", value);
}
@ -234,7 +234,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
// painting is handled by PianoRoll._vp, not PianoRollView!!!
SynthesizedAudioEditor editor = HostApplication.CurrentWindow.GetCurrentEditor() as SynthesizedAudioEditor;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings();
if (collab.TrackChangesEnabled)
@ -255,7 +255,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
if (collab.TrackChangesEnabled)

View File

@ -22,7 +22,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MBS.Framework;
using MBS.Framework.Drawing;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
@ -60,63 +60,6 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
Controls.Add(txt, new AbsoluteLayout.Constraints(0, 0, 128, 18));
this.ContextMenuCommandID = "PianoRollEditor_ContextMenu";
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Arrow", ContextMenuArrow_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Draw", ContextMenuPencil_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Erase", ContextMenuErase_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_4", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_8", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_16", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_32", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_64", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_Off", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_Triplet", ContextMenu_Quantize_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_4", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_8", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_16", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_32", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_64", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Off", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Default", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Triplet", ContextMenu_NoteLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_1", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_2", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_4", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_8", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_16", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_32", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_64", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Off", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Triplet", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Dot", ContextMenu_NoteFixedLength_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_None", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Major", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_MinorHarmonic", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_MinorMelodic", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Diminished", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_BebopMajor", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_BebopDominant", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Arabic", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Enigmatic", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Neopolitan", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_NeopolitanMinor", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Hungarian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Dorian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Phyrogolydian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Lydian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Mixolydian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Aeolian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Locrian", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Minor", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Chromatic", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_HalfWholeDiminished", ContextMenu_Scale_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_ShowGridLines", ContextMenuToggleGridLines_Click);
Application.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Properties", ContextMenuProperties_Click);
}
private void txt_KeyDown(object sender, KeyEventArgs e)
@ -167,7 +110,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
switch (e.Key)
{
case KeyboardKey.Tab:
case KeyboardKey.Tab:
{
if (SelectedCommands.Count > 0)
{
@ -440,6 +383,63 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(GetMaxWidth(), MAXSCROLLHEIGHT);
VerticalAdjustment.Value = MAXSCROLLHEIGHT / 2;
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Arrow", ContextMenuArrow_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Draw", ContextMenuPencil_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Erase", ContextMenuErase_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_4", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_8", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_16", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_32", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_64", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_Off", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Quantize_Triplet", ContextMenu_Quantize_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_4", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_8", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_16", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_32", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_64", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Off", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Default", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteLength_Triplet", ContextMenu_NoteLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_1", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_2", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_4", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_8", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_16", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_32", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_64", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Off", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Triplet", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_NoteFixedLength_Dot", ContextMenu_NoteFixedLength_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_None", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Major", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_MinorHarmonic", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_MinorMelodic", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Diminished", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_BebopMajor", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_BebopDominant", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Arabic", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Enigmatic", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Neopolitan", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_NeopolitanMinor", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Hungarian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Dorian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Phyrogolydian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Lydian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Mixolydian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Aeolian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Locrian", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Minor", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_Chromatic", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Scale_HalfWholeDiminished", ContextMenu_Scale_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_ShowGridLines", ContextMenuToggleGridLines_Click);
(Parent.Parent as Editor).Context.AttachCommandEventHandler("PianoRollEditor_ContextMenu_Properties", ContextMenuProperties_Click);
}
public Dimension2D NoteSize { get; set; } = new Dimension2D(12, 16);

View File

@ -21,7 +21,7 @@
using System;
using System.Collections.Generic;
using MBS.Framework;
using MBS.Framework.Drawing;
using MBS.Framework.Rendering;
using MBS.Framework.UserInterface;
@ -182,7 +182,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
{
p = gla.Engine.CreateShaderProgram();
string vtxFileName = Application.ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_vtx.glsl");
string vtxFileName = ((UIApplication)Application.Instance).ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_vtx.glsl");
if (!System.IO.File.Exists(vtxFileName))
{
MessageDialog.ShowDialog(String.Format("Vertex shader not found . The rendering will be unavailable. Check to ensure the file exists and is readable .\n\n{0}", vtxFileName), "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
@ -194,7 +194,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
Shader vtx = gla.Engine.CreateShaderFromFile(ShaderType.Vertex, vtxFileName);
vtx.Compile();
string frgFileName = Application.ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_frg.glsl");
string frgFileName = ((UIApplication)Application.Instance).ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_frg.glsl");
if (!System.IO.File.Exists(vtxFileName))
{
MessageDialog.ShowDialog(String.Format("Fragment shader not found . The rendering will be unavailable. Check to ensure the file exists and is readable .\n\n{0}", frgFileName), "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);

View File

@ -20,13 +20,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Dialogs;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Plugins.Collaboration
{
public class CollaborationPlugin : Plugin
public class CollaborationPlugin : UserInterfacePlugin
{
private Dictionary<Document, CollaborationSettings> _CollaborationSettings = new Dictionary<Document, CollaborationSettings>();
public CollaborationSettings GetCollaborationSettings(Document document = null)
@ -46,7 +47,7 @@ namespace UniversalEditor.Plugins.Collaboration
public CollaborationPlugin()
{
ID = new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}");
Context = new Context(ID, "Collaboration Plugin");
Context = new UIContext(ID, "Collaboration Plugin");
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();