diff --git a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.Designer.cs b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.Designer.cs index b553d396..7546b6dc 100644 --- a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.Designer.cs +++ b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.Designer.cs @@ -43,9 +43,6 @@ namespace UniversalEditor.UserInterface.WindowsForms this.mnuFileNew = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFileNewFile = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFileNewProject = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuFileOpen = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuFileOpenFile = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuFileOpenProject = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFileSave = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFileSaveFile = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFileSaveFileAs = new System.Windows.Forms.ToolStripMenuItem(); @@ -278,7 +275,6 @@ namespace UniversalEditor.UserInterface.WindowsForms // this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuFileNew, - this.mnuFileOpen, this.mnuFileSave, this.mnuFileClose, this.mnuFileSep1, @@ -323,34 +319,6 @@ namespace UniversalEditor.UserInterface.WindowsForms this.mnuFileNewProject.Text = "&Project/Solution..."; this.mnuFileNewProject.Click += new System.EventHandler(this.FileNewProject_Click); // - // mnuFileOpen - // - this.mnuFileOpen.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuFileOpenFile, - this.mnuFileOpenProject}); - this.mnuFileOpen.Name = "mnuFileOpen"; - this.mnuFileOpen.Size = new System.Drawing.Size(156, 22); - this.mnuFileOpen.Text = "&Open"; - // - // mnuFileOpenFile - // - this.mnuFileOpenFile.Image = ((System.Drawing.Image)(resources.GetObject("mnuFileOpenFile.Image"))); - this.mnuFileOpenFile.ImageTransparentColor = System.Drawing.Color.Magenta; - this.mnuFileOpenFile.Name = "mnuFileOpenFile"; - this.mnuFileOpenFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.mnuFileOpenFile.Size = new System.Drawing.Size(244, 22); - this.mnuFileOpenFile.Text = "&File..."; - this.mnuFileOpenFile.Click += new System.EventHandler(this.FileOpenFile_Click); - // - // mnuFileOpenProject - // - this.mnuFileOpenProject.Name = "mnuFileOpenProject"; - this.mnuFileOpenProject.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) - | System.Windows.Forms.Keys.O))); - this.mnuFileOpenProject.Size = new System.Drawing.Size(244, 22); - this.mnuFileOpenProject.Text = "&Project/Solution..."; - this.mnuFileOpenProject.Click += new System.EventHandler(this.FileOpenProject_Click); - // // mnuFileSave // this.mnuFileSave.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1090,33 +1058,6 @@ namespace UniversalEditor.UserInterface.WindowsForms this.tsbStandardNewProject.Text = "New &Project..."; this.tsbStandardNewProject.Click += new System.EventHandler(this.FileNewProject_Click); // - // tsbStandardOpen - // - this.tsbStandardOpen.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.tsbStandardOpen.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tsbStandardOpenFile, - this.tsbStandardOpenProject}); - this.tsbStandardOpen.Image = ((System.Drawing.Image)(resources.GetObject("tsbStandardOpen.Image"))); - this.tsbStandardOpen.ImageTransparentColor = System.Drawing.Color.Magenta; - this.tsbStandardOpen.Name = "tsbStandardOpen"; - this.tsbStandardOpen.Size = new System.Drawing.Size(32, 22); - this.tsbStandardOpen.Text = "&Open"; - this.tsbStandardOpen.ButtonClick += new System.EventHandler(this.FileOpenFile_Click); - // - // tsbStandardOpenFile - // - this.tsbStandardOpenFile.Name = "tsbStandardOpenFile"; - this.tsbStandardOpenFile.Size = new System.Drawing.Size(152, 22); - this.tsbStandardOpenFile.Text = "Open &File..."; - this.tsbStandardOpenFile.Click += new System.EventHandler(this.FileOpenFile_Click); - // - // tsbStandardOpenProject - // - this.tsbStandardOpenProject.Name = "tsbStandardOpenProject"; - this.tsbStandardOpenProject.Size = new System.Drawing.Size(152, 22); - this.tsbStandardOpenProject.Text = "Open &Project..."; - this.tsbStandardOpenProject.Click += new System.EventHandler(this.FileOpenProject_Click); - // // tsbStandardSave // this.tsbStandardSave.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -1349,9 +1290,6 @@ namespace UniversalEditor.UserInterface.WindowsForms private System.Windows.Forms.ToolStripMenuItem mnuFileNew; private System.Windows.Forms.ToolStripMenuItem mnuFileNewFile; private System.Windows.Forms.ToolStripMenuItem mnuFileNewProject; - private System.Windows.Forms.ToolStripMenuItem mnuFileOpen; - private System.Windows.Forms.ToolStripMenuItem mnuFileOpenFile; - private System.Windows.Forms.ToolStripMenuItem mnuFileOpenProject; private System.Windows.Forms.ToolStripMenuItem mnuFileClose; private System.Windows.Forms.ToolStripMenuItem mnuFileCloseFile; private System.Windows.Forms.ToolStripMenuItem mnuFileCloseProject; diff --git a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.cs b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.cs index 8a3af818..adff2652 100644 --- a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.cs +++ b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.cs @@ -46,7 +46,7 @@ namespace UniversalEditor.UserInterface.WindowsForms { InitializeComponent(); InitializeDockingWindows(); - InitializeCommandBars(); + InitializeCommandBars(); pnlSolutionExplorer.ParentWindow = this; @@ -77,60 +77,60 @@ namespace UniversalEditor.UserInterface.WindowsForms ShowStartPage(); } - private void InitializeCommandBars() - { - mbMenuBar.Items.Clear(); - foreach (CommandItem item in Engine.CurrentEngine.MainMenu.Items) - { - LoadCommandBarItem(item, null); - } - } + private void InitializeCommandBars() + { + mbMenuBar.Items.Clear(); + foreach (CommandItem item in Engine.CurrentEngine.MainMenu.Items) + { + LoadCommandBarItem(item, null); + } + } - private void LoadCommandBarItem(CommandItem item, ToolStripMenuItem parent) - { - ToolStripItem tsi = null; + private void LoadCommandBarItem(CommandItem item, ToolStripMenuItem parent) + { + ToolStripItem tsi = null; - if (item is CommandReferenceCommandItem) - { - CommandReferenceCommandItem crci = (item as CommandReferenceCommandItem); - Command cmd = Engine.CurrentEngine.Commands[crci.CommandID]; - if (cmd == null) - { - Console.WriteLine("Skipping invalid command reference '" + crci.CommandID + "'"); - return; - } - - ToolStripMenuItem tsmi = new ToolStripMenuItem(); - tsmi.Click += tsmiCommand_Click; - tsmi.Tag = cmd; - tsmi.Text = cmd.Title; - foreach (CommandItem item1 in cmd.Items) - { - LoadCommandBarItem(item1, tsmi); - } - tsi = tsmi; - } - else if (item is SeparatorCommandItem) - { - tsi = new ToolStripSeparator(); - } + if (item is CommandReferenceCommandItem) + { + CommandReferenceCommandItem crci = (item as CommandReferenceCommandItem); + Command cmd = Engine.CurrentEngine.Commands[crci.CommandID]; + if (cmd == null) + { + Console.WriteLine("Skipping invalid command reference '" + crci.CommandID + "'"); + return; + } + + ToolStripMenuItem tsmi = new ToolStripMenuItem(); + tsmi.Click += tsmiCommand_Click; + tsmi.Tag = cmd; + tsmi.Text = cmd.Title; + foreach (CommandItem item1 in cmd.Items) + { + LoadCommandBarItem(item1, tsmi); + } + tsi = tsmi; + } + else if (item is SeparatorCommandItem) + { + tsi = new ToolStripSeparator(); + } - if (parent == null) - { - mbMenuBar.Items.Add(tsi); - } - else - { - parent.DropDownItems.Add(tsi); - } - } + if (parent == null) + { + mbMenuBar.Items.Add(tsi); + } + else + { + parent.DropDownItems.Add(tsi); + } + } - void tsmiCommand_Click(object sender, EventArgs e) - { - ToolStripMenuItem tsmi = (sender as ToolStripMenuItem); - Command cmd = (tsmi.Tag as Command); - if (cmd != null) cmd.Execute(); - } + void tsmiCommand_Click(object sender, EventArgs e) + { + ToolStripMenuItem tsmi = (sender as ToolStripMenuItem); + Command cmd = (tsmi.Tag as Command); + if (cmd != null) cmd.Execute(); + } private void Messages_MessageAdded(object sender, HostApplicationMessageModifiedEventArgs e) @@ -660,15 +660,15 @@ namespace UniversalEditor.UserInterface.WindowsForms public void OpenFile() { - DocumentPropertiesDialog dlg = new DocumentPropertiesDialog(); - dlg.Mode = DocumentPropertiesDialogMode.Open; - if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) - { - OpenFile((dlg.Accessor as FileAccessor).FileName); - } + DocumentPropertiesDialog dlg = new DocumentPropertiesDialog(); + dlg.Mode = DocumentPropertiesDialogMode.Open; + if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + OpenFile((dlg.Accessor as FileAccessor).FileName); + } // Display the Open File dialog - /* + /* using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.AutoUpgradeEnabled = true; @@ -692,7 +692,7 @@ namespace UniversalEditor.UserInterface.WindowsForms OpenFile(ofd.FileNames); } } - */ + */ } public void OpenFile(params string[] FileNames) { @@ -1067,25 +1067,25 @@ namespace UniversalEditor.UserInterface.WindowsForms retrySaveFileAs: if (FileName == null) { - DocumentPropertiesDialog dlg = new DocumentPropertiesDialog(); - dlg.ObjectModel = doc.ObjectModel; - dlg.DataFormat = doc.DataFormat; - dlg.Accessor = doc.Accessor; - dlg.Mode = DocumentPropertiesDialogMode.Save; - if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) - { - dfr = dlg.DataFormat.MakeReference(); + DocumentPropertiesDialog dlg = new DocumentPropertiesDialog(); + dlg.ObjectModel = doc.ObjectModel; + dlg.DataFormat = doc.DataFormat; + dlg.Accessor = doc.Accessor; + dlg.Mode = DocumentPropertiesDialogMode.Save; + if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + dfr = dlg.DataFormat.MakeReference(); - // TODO: Rewrite Save code to make everything use Accessor instead - // of FileName to support multiple types of accessors - FileName = (dlg.Accessor as FileAccessor).FileName; - } - else - { - return false; - } + // TODO: Rewrite Save code to make everything use Accessor instead + // of FileName to support multiple types of accessors + FileName = (dlg.Accessor as FileAccessor).FileName; + } + else + { + return false; + } - /* + /* SaveFileDialog sfd = new SaveFileDialog(); List list = new List(); @@ -1101,9 +1101,9 @@ namespace UniversalEditor.UserInterface.WindowsForms dfr = list[sfd.FilterIndex - 2]; } FileName = sfd.FileName; - */ + */ } - /* + /* if (dfr == null) { DataFormatReference[] dfrs = UniversalEditor.Common.Reflection.GetAvailableDataFormats(FileName, doc.ObjectModel.MakeReference()); @@ -1121,11 +1121,11 @@ namespace UniversalEditor.UserInterface.WindowsForms } dfr = dfrs[0]; } - */ + */ DataFormat df = dfr.Create(); DataFormatOptionsDialog.ShowDialog(ref df, DataFormatOptionsDialogType.Export); - + #region Save Code NotifySaving(doc); @@ -1432,15 +1432,6 @@ namespace UniversalEditor.UserInterface.WindowsForms NewProject(); } - private void FileOpenFile_Click(object sender, EventArgs e) - { - OpenFile(); - } - private void FileOpenProject_Click(object sender, EventArgs e) - { - OpenProject(); - } - #region Save private void FileSaveFile_Click(object sender, EventArgs e) { @@ -1464,7 +1455,7 @@ namespace UniversalEditor.UserInterface.WindowsForms } #endregion #region Close - private void FileCloseFile_Click(object sender, EventArgs e) + public void CloseFile() { if (dcc.SelectedWindow != null) { @@ -1472,7 +1463,7 @@ namespace UniversalEditor.UserInterface.WindowsForms } else { - mnuFileCloseWindow_Click(sender, e); + CloseWindow(); } } private void FileCloseProject_Click(object sender, EventArgs e) @@ -1676,8 +1667,14 @@ namespace UniversalEditor.UserInterface.WindowsForms if (dwStartPage == null) { Pages.StartPage sp = new Pages.StartPage(); - sp.NewProjectClicked += FileNewProject_Click; - sp.OpenProjectClicked += FileOpenProject_Click; + sp.NewProjectClicked += delegate(object sender, EventArgs e) + { + Engine.CurrentEngine.Commands["FileNewProject"].Execute(); + }; + sp.OpenProjectClicked += delegate(object sender, EventArgs e) + { + Engine.CurrentEngine.Commands["FileOpenProject"].Execute(); + }; dwStartPage = dcc.Windows.Add("pnlStartPage", "Start Page", sp); dcc.Areas[DockPosition.Center].Areas[DockPosition.Center].Windows.Add(dwStartPage); @@ -1956,7 +1953,7 @@ namespace UniversalEditor.UserInterface.WindowsForms dlg.ShowDialog(); } - private void mnuFileCloseWindow_Click(object sender, EventArgs e) + public void CloseWindow() { this.Close(); } diff --git a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.resx b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.resx index 4e5dfb4c..bfa5bae1 100644 --- a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.resx +++ b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/MainWindow.resx @@ -133,22 +133,6 @@ WQfst3f0Ep7CGSqw3amYzBWI/TkfcAdTZ4B60LCQt+hJK3yJEz7g8ifOAGWzhzRdo9WdofYt8QFSnzlI 42bLDdqDBZqtMUpC3zpgbtxPe4rq5xDZSsc6YG6c8DtCodZDsihaA4x5s1bmGI0Zkw2X8lofWHf+AdjM 9sNc+xBlAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJQSURBVDhPlZNdSNNRGMb/F110ZZEVhVBgeeHNICiiuggp - olAUyyxI0oSaH1QYC3N+tKnp5ubm1JUua5uuqdPKMgr7kApFItTUkWZqVhSVYmao5Nev/xyoQ4k88Nyc - 8z6/93nP4QjCfy6lwc4ltZVso4P/tMyXRcmMHqZ0EeY6jZQVInzuf0e1Tb9Ina3P/tkpLD6XkNg8BJe5 - u93C+HDVrP4M2ZkcMOOw5tLZ9nxJyJE4HSExBoKkBQhVpTrGhso9zNPfiph0JlB+U01ZcRbmwnRMeWlc - 08opUCV6QissGsZ+WOY6z4hmuuXglC6pRYBbJSp+fzXNxnaZ66o1s3rkyKHWruJuWRYOcwZ2kxKr8TI3 - DCkU6+QYNUnuNGWmLEY+5uOK3degoKZcx3SfEvozPfVB3OtNhi4ZvI2nrTIc23U9gtmYwa8eNXzScq8i - l6bHWnfRwhHeREJzGFONgYw/CeB9qQSZNNR9FyUGBT87lfQ3plJj1zLTq4COGDegLVo0HmeqKZjx+gOM - PNzDYPU2lLF+4jhyN6BIl8pgexK3bRpaXopJuhJEwGloiWDmVSgTLw4xWreXoZrtfK/wp/nKak4E+s6/ - hDFHTkd9GndsOdCTBq1i3NdHmWgIYvRpAMO1OxlwSPhi2YpT641CuoWzsSfnAfnZiVRZ1Tjvx9GsF+bU - pF1BvWolD9JXUZmyDnOiD1cvbCZiYXfXCPrMi+gVZ8hOiiL53DHORwdzKnw/hw/uYt9uCTskfvj7+rBp - 41rWr/Fig7fX8j/Tsn/fcgx/ARfG3ml6M3rzAAAAAElFTkSuQmCC diff --git a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/WindowsFormsEngine.cs b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/WindowsFormsEngine.cs index 45242825..47357465 100644 --- a/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/WindowsFormsEngine.cs +++ b/CSharp/Environments/WindowsForms/Engines/UniversalEditor.UserInterface.WindowsForms.DesktopApplication/WindowsFormsEngine.cs @@ -31,6 +31,49 @@ namespace UniversalEditor.UserInterface.WindowsForms { base.AfterInitialization(); + #region File + Commands["FileNewDocument"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.NewFile(); + }; + Commands["FileNewProject"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.NewProject(); + }; + Commands["FileOpenDocument"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.OpenFile(); + }; + Commands["FileOpenProject"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.OpenProject(); + }; + Commands["FileSaveDocument"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.SaveFile(); + }; + Commands["FileSaveDocumentAs"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.SaveFileAs(); + }; + Commands["FileSaveProject"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.SaveProject(); + }; + Commands["FileSaveProjectAs"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.SaveProjectAs(); + }; + Commands["FileSaveAll"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.SaveAll(); + }; + Commands["FileCloseDocument"].Executed += delegate(object sender, EventArgs e) + { + LastWindow.CloseFile(); + }; + #endregion + Commands["HelpLicensingAndActivation"].Executed += delegate(object sender, EventArgs e) { MessageBox.Show("This product has already been activated.", "Licensing and Activation", MessageBoxButtons.OK, MessageBoxIcon.Information);