#include "EditorShellAssetBuilderSupport.h" #include namespace XCEngine::UI::Editor::App::CompositionSupport { namespace { UIEditorMenuItemDescriptor BuildCommandItem( std::string itemId, std::string label, std::string commandId, UIEditorMenuCheckedStateBinding checkedState = {}) { UIEditorMenuItemDescriptor item = {}; item.kind = UIEditorMenuItemKind::Command; item.itemId = std::move(itemId); item.label = std::move(label); item.commandId = std::move(commandId); item.checkedState = std::move(checkedState); return item; } UIEditorMenuItemDescriptor BuildSeparatorItem(std::string itemId) { UIEditorMenuItemDescriptor item = {}; item.kind = UIEditorMenuItemKind::Separator; item.itemId = std::move(itemId); return item; } UIEditorMenuItemDescriptor BuildSubmenuItem( std::string itemId, std::string label, std::vector children) { UIEditorMenuItemDescriptor item = {}; item.kind = UIEditorMenuItemKind::Submenu; item.itemId = std::move(itemId); item.label = std::move(label); item.children = std::move(children); return item; } } // namespace UIEditorMenuModel BuildEditorMenuModel() { UIEditorMenuModel model = {}; UIEditorMenuDescriptor fileMenu = {}; fileMenu.menuId = "file"; fileMenu.label = "File"; fileMenu.items = { BuildCommandItem("file-new-project", "New Project...", "file.new_project"), BuildCommandItem("file-open-project", "Open Project...", "file.open_project"), BuildCommandItem("file-save-project", "Save Project", "file.save_project"), BuildSeparatorItem("file-separator-project"), BuildCommandItem("file-new-scene", "New Scene", "file.new_scene"), BuildCommandItem("file-open-scene", "Open Scene", "file.open_scene"), BuildCommandItem("file-save-scene", "Save Scene", "file.save_scene"), BuildCommandItem("file-save-scene-as", "Save Scene As...", "file.save_scene_as"), BuildSeparatorItem("file-separator-exit"), BuildCommandItem("file-exit", "Exit", "file.exit") }; UIEditorMenuDescriptor editMenu = {}; editMenu.menuId = "edit"; editMenu.label = "Edit"; editMenu.items = { BuildCommandItem("edit-undo", "Undo", "edit.undo"), BuildCommandItem("edit-redo", "Redo", "edit.redo"), BuildSeparatorItem("edit-separator-history"), BuildCommandItem("edit-cut", "Cut", "edit.cut"), BuildCommandItem("edit-copy", "Copy", "edit.copy"), BuildCommandItem("edit-paste", "Paste", "edit.paste"), BuildCommandItem("edit-duplicate", "Duplicate", "edit.duplicate"), BuildCommandItem("edit-delete", "Delete", "edit.delete"), BuildCommandItem("edit-rename", "Rename", "edit.rename") }; UIEditorMenuDescriptor assetsMenu = {}; assetsMenu.menuId = "assets"; assetsMenu.label = "Assets"; assetsMenu.items = { BuildCommandItem("assets-reimport-selected", "Reimport Selected Asset", "assets.reimport_selected"), BuildCommandItem("assets-reimport-all", "Reimport All Assets", "assets.reimport_all"), BuildSeparatorItem("assets-separator-clear"), BuildCommandItem("assets-clear-library", "Clear Library", "assets.clear_library") }; UIEditorMenuDescriptor runMenu = {}; runMenu.menuId = "run"; runMenu.label = "Run"; runMenu.items = { BuildCommandItem("run-play", "Play", "run.play"), BuildCommandItem("run-pause", "Pause", "run.pause"), BuildCommandItem("run-step", "Step", "run.step") }; UIEditorMenuDescriptor scriptsMenu = {}; scriptsMenu.menuId = "scripts"; scriptsMenu.label = "Scripts"; scriptsMenu.items = { BuildCommandItem("scripts-rebuild", "Rebuild Script Assemblies", "scripts.rebuild") }; UIEditorMenuCheckedStateBinding hierarchyActive = { UIEditorMenuCheckedStateSource::PanelActive, "hierarchy" }; UIEditorMenuCheckedStateBinding sceneActive = { UIEditorMenuCheckedStateSource::PanelActive, "scene" }; UIEditorMenuCheckedStateBinding gameActive = { UIEditorMenuCheckedStateSource::PanelActive, "game" }; UIEditorMenuCheckedStateBinding inspectorActive = { UIEditorMenuCheckedStateSource::PanelActive, "inspector" }; UIEditorMenuCheckedStateBinding consoleActive = { UIEditorMenuCheckedStateSource::PanelActive, "console" }; UIEditorMenuCheckedStateBinding projectActive = { UIEditorMenuCheckedStateSource::PanelActive, "project" }; UIEditorMenuDescriptor viewMenu = {}; viewMenu.menuId = "view"; viewMenu.label = "View"; viewMenu.items = { BuildCommandItem("view-reset-layout", "Reset Layout", "view.reset_layout"), BuildSeparatorItem("view-separator-panels"), BuildSubmenuItem( "view-panels", "Panels", { BuildCommandItem("view-panel-hierarchy", "Hierarchy", "view.activate_hierarchy", hierarchyActive), BuildCommandItem("view-panel-scene", "Scene", "view.activate_scene", sceneActive), BuildCommandItem("view-panel-game", "Game", "view.activate_game", gameActive), BuildCommandItem("view-panel-inspector", "Inspector", "view.activate_inspector", inspectorActive), BuildCommandItem("view-panel-console", "Console", "view.activate_console", consoleActive), BuildCommandItem("view-panel-project", "Project", "view.activate_project", projectActive) }) }; UIEditorMenuDescriptor helpMenu = {}; helpMenu.menuId = "help"; helpMenu.label = "Help"; helpMenu.items = { BuildCommandItem("help-about", "About", "help.about") }; model.menus = { std::move(fileMenu), std::move(editMenu), std::move(assetsMenu), std::move(runMenu), std::move(scriptsMenu), std::move(viewMenu), std::move(helpMenu) }; return model; } } // namespace XCEngine::UI::Editor::App::CompositionSupport