diff --git a/assets/Languages/en-US.xlf b/assets/Languages/en-US.xlf index 15d14413a..86377c10f 100755 --- a/assets/Languages/en-US.xlf +++ b/assets/Languages/en-US.xlf @@ -1711,6 +1711,9 @@ ← Back + + Tools + Customise controls diff --git a/source/LibRender2/Menu/MenuTag.cs b/source/LibRender2/Menu/MenuTag.cs index 26dd1cff8..bb726f4ac 100644 --- a/source/LibRender2/Menu/MenuTag.cs +++ b/source/LibRender2/Menu/MenuTag.cs @@ -42,6 +42,8 @@ public enum MenuTag MenuExitToMainMenu, /// Enters the submenu for customising controls MenuControls, + /// Enters the submenu for tools + MenuTools, /// Enters the submenu for quitting the program MenuQuit, /// Returns to the simulation @@ -88,12 +90,18 @@ public enum MenuTag UninstallOther, /// Shows the options menu Options, + /// Shows the tools menu + Tools, /// Toggles a switch ToggleSwitch, /// Selects the previous switch PreviousSwitch, /// Selects the next switch NextSwitch, + /// Launches Object Viewer + ObjectViewer, + /// Launches Route Viewer + RouteViewer, // OBJECT VIEWER /// Displays a list of objects diff --git a/source/LibRender2/Menu/MenuType.cs b/source/LibRender2/Menu/MenuType.cs index 4a2f42aac..a2397d9d2 100644 --- a/source/LibRender2/Menu/MenuType.cs +++ b/source/LibRender2/Menu/MenuType.cs @@ -41,6 +41,8 @@ public enum MenuType Control, /// Resets the controls to default ControlReset, + /// Provides a list of tools + Tools, /// Quits the game Quit, /// The game start menu diff --git a/source/OpenBVE/Game/Menu/Menu.SingleMenu.cs b/source/OpenBVE/Game/Menu/Menu.SingleMenu.cs index a86a399d1..0354ceef4 100644 --- a/source/OpenBVE/Game/Menu/Menu.SingleMenu.cs +++ b/source/OpenBVE/Game/Menu/Menu.SingleMenu.cs @@ -81,7 +81,7 @@ public SingleMenu(AbstractMenu menu, MenuType menuType, int data = 0, double Max //Don't allow quitting or customisation of the controls in kiosk mode Items[1] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"options","title"}), MenuTag.Options, 0); Items[2] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"menu","customize_controls"}), MenuTag.MenuControls, 0); - Items[3] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"packages","title"}), MenuTag.Packages, 0); + Items[3] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"menu","tools"}), MenuTag.Tools, 0); Items[4] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"menu","quit"}), MenuTag.MenuQuit, 0); } else @@ -479,7 +479,16 @@ public SingleMenu(AbstractMenu menu, MenuType menuType, int data = 0, double Max // method pictures mean we need top left at all times Align = TextAlignment.TopLeft; break; - + case MenuType.Tools: // ask for quit confirmation + Items = new MenuEntry[5]; + Items[0] = new MenuCaption(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "menu", "tools" })); + Items[1] = new MenuCommand(menu, "Object Viewer", MenuTag.ObjectViewer, 0); + Items[2] = new MenuCommand(menu, "Route Viewer", MenuTag.RouteViewer, 0); + Items[3] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "packages", "title" }), MenuTag.Packages, 0); + Items[4] = new MenuCommand(menu, Translations.GetInterfaceString(HostApplication.OpenBve, new[] { "menu","back" }), MenuTag.MenuBack, 0); + Selection = 1; + Align = TextAlignment.TopLeft; + break; case MenuType.Control: //Refresh the joystick list Program.Joysticks.RefreshJoysticks(); diff --git a/source/OpenBVE/Game/Menu/Menu.cs b/source/OpenBVE/Game/Menu/Menu.cs index a53a63a5d..be27920f9 100644 --- a/source/OpenBVE/Game/Menu/Menu.cs +++ b/source/OpenBVE/Game/Menu/Menu.cs @@ -3,6 +3,7 @@ using OpenBveApi.Interface; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Text; @@ -462,6 +463,9 @@ public override void ProcessCommand(Translations.Command cmd, double timeElapsed case MenuTag.MenuControls: // TO CONTROLS MENU Instance.PushMenu(MenuType.Controls); break; + case MenuTag.MenuTools: // TO CONTROLS MENU + Instance.PushMenu(MenuType.Tools); + break; case MenuTag.BackToSim: // OUT OF MENU BACK TO SIMULATION Reset(); Program.Renderer.CurrentInterface = InterfaceType.Normal; @@ -549,6 +553,9 @@ public override void ProcessCommand(Translations.Command cmd, double timeElapsed case MenuTag.Options: Instance.PushMenu(MenuType.Options); break; + case MenuTag.Tools: + Instance.PushMenu(MenuType.Tools); + break; case MenuTag.RouteList: // TO ROUTE LIST MENU Instance.PushMenu(MenuType.RouteList); routeDescriptionBox.Text = Translations.GetInterfaceString(HostApplication.OpenBve, new[] {"errors","route_please_select"}); @@ -707,6 +714,32 @@ public override void ProcessCommand(Translations.Command cmd, double timeElapsed previousSwitches.Insert(0, ns); Instance.PushMenu(Instance.Menus[CurrMenu].Type, 0, true); break; + case MenuTag.ObjectViewer: + string dir = AppDomain.CurrentDomain.BaseDirectory; + string runCmd = Path.CombineFile(dir, "ObjectViewer.exe"); + + if (Program.CurrentHost.Platform != HostPlatform.MicrosoftWindows) + { + Process.Start("mono", runCmd); + } + else + { + Process.Start(runCmd); + } + break; + case MenuTag.RouteViewer: + dir = AppDomain.CurrentDomain.BaseDirectory; + runCmd = Path.CombineFile(dir, "RouteViewer.exe"); + + if (Program.CurrentHost.Platform != HostPlatform.MicrosoftWindows) + { + Process.Start("mono", runCmd); + } + else + { + Process.Start(runCmd); + } + break; } } else if (menu.Items[menu.Selection] is MenuOption opt) diff --git a/source/OpenBVE/System/Program.cs b/source/OpenBVE/System/Program.cs index 6458f1070..aee9d7636 100644 --- a/source/OpenBVE/System/Program.cs +++ b/source/OpenBVE/System/Program.cs @@ -277,6 +277,8 @@ private static void Main(string[] args) { Translations.SetInGameLanguage(Translations.CurrentLanguageCode); } + result.ExperimentalGLMenu = true; + if (result.ExperimentalGLMenu) { result.Start = true;