Moving much of the WindowsFormsEngine-specific, engine-agnostic stuff to Engine proper
This commit is contained in:
parent
3353898ae2
commit
06c6d8e25f
@ -15,7 +15,7 @@ namespace UniversalEditor.UserInterface.WindowsForms.Dialogs
|
||||
InitializeComponent();
|
||||
Font = SystemFonts.MenuFont;
|
||||
|
||||
foreach (SessionManager.Session session in SessionManager.Sessions)
|
||||
foreach (SessionManager.Session session in Engine.CurrentEngine.SessionManager.Sessions)
|
||||
{
|
||||
AwesomeControls.ListView.ListViewItem lvi = new AwesomeControls.ListView.ListViewItem();
|
||||
lvi.Text = session.Title;
|
||||
@ -85,7 +85,24 @@ namespace UniversalEditor.UserInterface.WindowsForms.Dialogs
|
||||
window.Top = wnd.Top;
|
||||
window.Width = wnd.Width;
|
||||
window.Height = wnd.Height;
|
||||
window.WindowState = wnd.WindowState;
|
||||
switch (wnd.WindowState)
|
||||
{
|
||||
case FormWindowState.Maximized:
|
||||
{
|
||||
window.WindowState = UserInterface.WindowState.Maximized;
|
||||
break;
|
||||
}
|
||||
case FormWindowState.Minimized:
|
||||
{
|
||||
window.WindowState = UserInterface.WindowState.Minimized;
|
||||
break;
|
||||
}
|
||||
case FormWindowState.Normal:
|
||||
{
|
||||
window.WindowState = UserInterface.WindowState.Normal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.ObjectModel.ReadOnlyCollection<Document> documents = wnd.Documents;
|
||||
foreach (Document doc in documents)
|
||||
@ -98,7 +115,7 @@ namespace UniversalEditor.UserInterface.WindowsForms.Dialogs
|
||||
session.Windows.Add(window);
|
||||
}
|
||||
|
||||
SessionManager.Sessions.Add(session);
|
||||
Engine.CurrentEngine.SessionManager.Sessions.Add(session);
|
||||
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Close();
|
||||
|
||||
@ -16,8 +16,6 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
{
|
||||
public partial class MainWindow : AwesomeControls.Window, IHostApplicationWindow
|
||||
{
|
||||
internal WindowsFormsEngine engine = null;
|
||||
|
||||
#region Docking Windows
|
||||
private Controls.ErrorList pnlErrorList = new Controls.ErrorList();
|
||||
private DockingWindow dwErrorList = null;
|
||||
@ -64,8 +62,8 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
HostApplication.Messages.MessageAdded += Messages_MessageAdded;
|
||||
HostApplication.Messages.MessageRemoved += Messages_MessageRemoved;
|
||||
|
||||
mnuBookmarksSep1.Visible = (engine.BookmarksManager.FileNames.Count > 0);
|
||||
foreach (string FileName in engine.BookmarksManager.FileNames)
|
||||
mnuBookmarksSep1.Visible = (Engine.CurrentEngine.BookmarksManager.FileNames.Count > 0);
|
||||
foreach (string FileName in Engine.CurrentEngine.BookmarksManager.FileNames)
|
||||
{
|
||||
ToolStripMenuItem tsmi = new ToolStripMenuItem();
|
||||
tsmi.Text = System.IO.Path.GetFileName(FileName);
|
||||
@ -1548,7 +1546,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
private void RefreshRecentFilesList()
|
||||
{
|
||||
mnuFileRecentFiles.DropDownItems.Clear();
|
||||
foreach (string fileName in RecentFileManager.FileNames)
|
||||
foreach (string fileName in Engine.CurrentEngine.RecentFileManager.FileNames)
|
||||
{
|
||||
AddRecentMenuItem(fileName);
|
||||
}
|
||||
@ -1564,7 +1562,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
{
|
||||
if (MessageBox.Show("The file or folder '" + tsmi.ToolTipText + "' cannot be opened. Do you want to remove the reference(s) to it from the Recent list(s)?", "File Does Not Exist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
RecentFileManager.FileNames.Remove(tsmi.ToolTipText);
|
||||
Engine.CurrentEngine.RecentFileManager.FileNames.Remove(tsmi.ToolTipText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1821,7 +1819,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
{
|
||||
if (doc.Accessor is FileAccessor)
|
||||
{
|
||||
if (!engine.BookmarksManager.FileNames.Contains((doc.Accessor as FileAccessor).FileName))
|
||||
if (!Engine.CurrentEngine.BookmarksManager.FileNames.Contains((doc.Accessor as FileAccessor).FileName))
|
||||
{
|
||||
ToolStripMenuItem mnu = new ToolStripMenuItem();
|
||||
mnu.Text = System.IO.Path.GetFileName((doc.Accessor as FileAccessor).FileName);
|
||||
@ -1830,7 +1828,7 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
mnuBookmarks.DropDownItems.Insert(mnuBookmarks.DropDownItems.Count - 2, mnu);
|
||||
mnuBookmarksSep1.Visible = true;
|
||||
|
||||
engine.BookmarksManager.FileNames.Add((doc.Accessor as FileAccessor).FileName);
|
||||
Engine.CurrentEngine.BookmarksManager.FileNames.Add((doc.Accessor as FileAccessor).FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace UniversalEditor.UserInterface.WindowsForms.Pages
|
||||
picIcon.Image = LocalConfiguration.MainIcon.ToBitmap();
|
||||
}
|
||||
|
||||
foreach (string FileName in RecentFileManager.FileNames)
|
||||
foreach (string FileName in Engine.CurrentEngine.RecentFileManager.FileNames)
|
||||
{
|
||||
AwesomeControls.ListView.ListViewItem lvi = new AwesomeControls.ListView.ListViewItem();
|
||||
lvi.Text = System.IO.Path.GetFileName(FileName);
|
||||
@ -58,7 +58,7 @@ namespace UniversalEditor.UserInterface.WindowsForms.Pages
|
||||
{
|
||||
if (MessageBox.Show("The file \"" + lvRecent.SelectedItems[0].TooltipText + "\" does not exist. Would you like to remove it from the Recent Documents list?", "File Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
|
||||
{
|
||||
RecentFileManager.FileNames.Remove(lvRecent.SelectedItems[0].TooltipText);
|
||||
Engine.CurrentEngine.RecentFileManager.FileNames.Remove(lvRecent.SelectedItems[0].TooltipText);
|
||||
lvRecent.Items.Remove(lvRecent.SelectedItems[0]);
|
||||
}
|
||||
return;
|
||||
|
||||
@ -374,7 +374,6 @@ namespace UniversalEditor.UserInterface.WindowsForms
|
||||
public static void OpenWindow(params string[] FileNames)
|
||||
{
|
||||
MainWindow mw = new MainWindow();
|
||||
mw.Engine = this;
|
||||
|
||||
if (FileNames.Length > 0)
|
||||
{
|
||||
|
||||
@ -74,8 +74,13 @@ 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; } }
|
||||
|
||||
public void StartApplication()
|
||||
{
|
||||
Engine.mvarCurrentEngine = this;
|
||||
|
||||
string[] args1 = Environment.GetCommandLineArgs();
|
||||
string[] args = new string[args1.Length - 1];
|
||||
Array.Copy(args1, 1, args, 0, args.Length);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user