EditorActionsHandler.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/std/containers/vector.h>
  10. #include <AzCore/std/string/string.h>
  11. #include <AzToolsFramework/ActionManager/ActionManagerRegistrationNotificationBus.h>
  12. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  13. #include <AzToolsFramework/ContainerEntity/ContainerEntityNotificationBus.h>
  14. #include <AzToolsFramework/Entity/EditorEntityContextBus.h>
  15. #include <AzToolsFramework/Viewport/ViewportMessages.h>
  16. class CCryEditApp;
  17. class MainWindow;
  18. class QMainWindow;
  19. class QtViewPaneManager;
  20. class QWidget;
  21. namespace AzToolsFramework
  22. {
  23. class ActionManagerInterface;
  24. class ActionManagerInternalInterface;
  25. class HotKeyManagerInterface;
  26. class MenuManagerInterface;
  27. class MenuManagerInternalInterface;
  28. class ToolBarManagerInterface;
  29. } // namespace AzToolsFramework
  30. class EditorViewportDisplayInfoHandler;
  31. class EditorActionsHandler
  32. : private AzToolsFramework::ActionManagerRegistrationNotificationBus::Handler
  33. , private AzToolsFramework::EditorEventsBus::Handler
  34. , private AzToolsFramework::EditorEntityContextNotificationBus::Handler
  35. , private AzToolsFramework::ToolsApplicationNotificationBus::Handler
  36. , private AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler
  37. , private AzToolsFramework::EditorPickModeNotificationBus::Handler
  38. , private AzToolsFramework::ContainerEntityNotificationBus::Handler
  39. {
  40. public:
  41. void Initialize(MainWindow* mainWindow);
  42. ~EditorActionsHandler();
  43. private:
  44. QWidget* CreateDocsSearchWidget();
  45. QWidget* CreateExpander();
  46. QWidget* CreatePlayControlsLabel();
  47. // ActionManagerRegistrationNotificationBus overrides ...
  48. void OnActionContextRegistrationHook() override;
  49. void OnActionUpdaterRegistrationHook() override;
  50. void OnMenuBarRegistrationHook() override;
  51. void OnMenuRegistrationHook() override;
  52. void OnToolBarAreaRegistrationHook() override;
  53. void OnToolBarRegistrationHook() override;
  54. void OnActionRegistrationHook() override;
  55. void OnWidgetActionRegistrationHook() override;
  56. void OnMenuBindingHook() override;
  57. void OnToolBarBindingHook() override;
  58. void OnPostActionManagerRegistrationHook() override;
  59. // EditorEventsBus overrides ...
  60. void OnViewPaneOpened(const char* viewPaneName) override;
  61. void OnViewPaneClosed(const char* viewPaneName) override;
  62. // EditorEntityContextNotificationBus overrides ...
  63. void OnStartPlayInEditor() override;
  64. void OnStopPlayInEditor() override;
  65. void OnEntityStreamLoadSuccess() override;
  66. // ToolsApplicationNotificationBus overrides ...
  67. void AfterEntitySelectionChanged(
  68. const AzToolsFramework::EntityIdList& newlySelectedEntities, const AzToolsFramework::EntityIdList& newlyDeselectedEntities) override;
  69. void AfterUndoRedo() override;
  70. void OnEndUndo(const char* label, bool changed) override;
  71. // ViewportSettingsNotificationBus overrides ...
  72. void OnAngleSnappingChanged(bool enabled) override;
  73. void OnDrawHelpersChanged(bool enabled) override;
  74. void OnGridShowingChanged(bool showing) override;
  75. void OnGridSnappingChanged(bool enabled) override;
  76. void OnIconsVisibilityChanged(bool enabled) override;
  77. // EditorPickModeNotificationBus overrides ...
  78. void OnEntityPickModeStarted() override;
  79. void OnEntityPickModeStopped() override;
  80. // ContainerEntityNotificationBus overrides ...
  81. void OnContainerEntityStatusChanged(AZ::EntityId entityId, bool open);
  82. // Layouts
  83. void RefreshLayoutActions();
  84. // Recent Files
  85. const char* m_levelExtension = nullptr;
  86. int m_recentFileActionsCount = 0;
  87. bool IsRecentFileActionActive(int index);
  88. bool IsRecentFileEntryValid(const QString& entry, const QString& gameFolderPath);
  89. void UpdateRecentFileActions();
  90. void OpenLevelByRecentFileEntryIndex(int index);
  91. // Toolbox Macros
  92. void RefreshToolboxMacroActions();
  93. // Tools
  94. void RefreshToolActions();
  95. // View Bookmarks
  96. int m_defaultBookmarkCount = 12;
  97. void InitializeViewBookmarkActions();
  98. bool m_initialized = false;
  99. // Editor Action Manager initialization functions
  100. AzToolsFramework::ActionManagerInterface* m_actionManagerInterface = nullptr;
  101. AzToolsFramework::ActionManagerInternalInterface* m_actionManagerInternalInterface = nullptr;
  102. AzToolsFramework::HotKeyManagerInterface* m_hotKeyManagerInterface = nullptr;
  103. AzToolsFramework::MenuManagerInterface* m_menuManagerInterface = nullptr;
  104. AzToolsFramework::MenuManagerInternalInterface* m_menuManagerInternalInterface = nullptr;
  105. AzToolsFramework::ToolBarManagerInterface* m_toolBarManagerInterface = nullptr;
  106. CCryEditApp* m_cryEditApp;
  107. MainWindow* m_mainWindow;
  108. QtViewPaneManager* m_qtViewPaneManager;
  109. EditorViewportDisplayInfoHandler* m_editorViewportDisplayInfoHandler = nullptr;
  110. AZStd::vector<AZStd::string> m_layoutMenuIdentifiers;
  111. AZStd::vector<AZStd::string> m_toolActionIdentifiers;
  112. AZStd::vector<AZStd::string> m_toolboxMacroActionIdentifiers;
  113. bool m_isPrefabSystemEnabled = false;
  114. };