diff --git a/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.cpp b/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.cpp deleted file mode 100644 index 260ff4c4e4..0000000000 --- a/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "EditorCommon.h" - -CommandViewportInteractionMode::CommandViewportInteractionMode(UndoStack* stack, - ViewportInteraction* viewportInteraction, - QAction* from, - QAction* to) - : QUndoCommand() - , m_stack(stack) - , m_viewportInteraction(viewportInteraction) - , m_from(from) - , m_to(to) -{ - UpdateText(); -} - -void CommandViewportInteractionMode::undo() -{ - UndoStackExecutionScope s(m_stack); - - SetMode(m_from); -} - -void CommandViewportInteractionMode::redo() -{ - UndoStackExecutionScope s(m_stack); - - SetMode(m_to); -} - -int CommandViewportInteractionMode::id() const -{ - return (int)FusibleCommand::kViewportInteractionMode; -} - -bool CommandViewportInteractionMode::mergeWith(const QUndoCommand* other) -{ - if (other->id() != id()) - { - // NOT the same command type. - return false; - } - - const CommandViewportInteractionMode* subsequent = static_cast(other); - AZ_Assert(subsequent, "No command to merge with"); - - if (!((subsequent->m_stack == m_stack) && - (subsequent->m_viewportInteraction == m_viewportInteraction))) - { - // NOT the same context. - return false; - } - - m_to = subsequent->m_to; - - UpdateText(); - - return true; -} - -void CommandViewportInteractionMode::UpdateText() -{ - setText(QString("mode change to %1").arg(ViewportHelpers::InteractionModeToString(m_to->data().toInt()))); -} - -void CommandViewportInteractionMode::SetMode(QAction* action) const -{ - action->trigger(); - - // IMPORTANT: It's NOT necessary to prevent this from executing on the - // first run. We WON'T get a redundant Qt notification by this point. - m_viewportInteraction->SetMode((ViewportInteraction::InteractionMode)action->data().toInt()); -} - -void CommandViewportInteractionMode::Push(UndoStack* stack, - ViewportInteraction* viewportInteraction, - QAction* from, - QAction* to) -{ - if (stack->GetIsExecuting()) - { - // This is a redundant Qt notification. - // Nothing else to do. - return; - } - - stack->push(new CommandViewportInteractionMode(stack, viewportInteraction, from, to)); -} diff --git a/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.h b/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.h deleted file mode 100644 index be6f1bc6ab..0000000000 --- a/Gems/LyShine/Code/Editor/CommandViewportInteractionMode.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include - -class CommandViewportInteractionMode - : public QUndoCommand -{ -public: - - void undo() override; - void redo() override; - - int id() const override; - bool mergeWith(const QUndoCommand* other) override; - - static void Push(UndoStack* stack, - ViewportInteraction* viewportInteraction, - QAction* from, - QAction* to); - -private: - - CommandViewportInteractionMode(UndoStack* stack, - ViewportInteraction* viewportInteraction, - QAction* from, - QAction* to); - - void UpdateText(); - void SetMode(QAction* action) const; - - UndoStack* m_stack; - - ViewportInteraction* m_viewportInteraction; - QAction* m_from; - QAction* m_to; -}; diff --git a/Gems/LyShine/Code/Editor/EditorCommon.h b/Gems/LyShine/Code/Editor/EditorCommon.h index 95b0bf753f..76f883b6ec 100644 --- a/Gems/LyShine/Code/Editor/EditorCommon.h +++ b/Gems/LyShine/Code/Editor/EditorCommon.h @@ -44,7 +44,6 @@ class CommandHierarchyItemToggleIsExpanded; class CommandHierarchyItemToggleIsSelectable; class CommandHierarchyItemToggleIsVisible; class CommandPropertiesChange; -class CommandViewportInteractionMode; class ComponentButton; class CoordinateSystemToolbarSection; class EditorMenu; @@ -124,7 +123,6 @@ enum class FusibleCommand #include "CommandHierarchyItemToggleIsSelectable.h" #include "CommandHierarchyItemToggleIsVisible.h" #include "CommandPropertiesChange.h" -#include "CommandViewportInteractionMode.h" #include "ComponentButton.h" #include "CoordinateSystemToolbarSection.h" #include "EditorWindow.h" diff --git a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake index 9750116ad1..c53891dcfc 100644 --- a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake +++ b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake @@ -54,8 +54,6 @@ set(FILES Editor/CommandHierarchyItemToggleIsVisible.h Editor/CommandPropertiesChange.cpp Editor/CommandPropertiesChange.h - Editor/CommandViewportInteractionMode.cpp - Editor/CommandViewportInteractionMode.h Editor/ComponentAssetHelpers.h Editor/ComponentButton.cpp Editor/ComponentButton.h