diff --git a/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.cpp b/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.cpp deleted file mode 100644 index 563fbe1935..0000000000 --- a/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.cpp +++ /dev/null @@ -1,67 +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" - -CommandHierarchyItemToggleIsSelected::CommandHierarchyItemToggleIsSelected(UndoStack* stack, - HierarchyWidget* hierarchy, - HierarchyItem* item) - : QUndoCommand() - , m_stack(stack) - , m_hierarchy(hierarchy) - , m_id(item->GetEntityId()) - , m_toIsSelected(false) -{ - setText(QString("toggle selection of \"%1\"").arg(item->GetElement()->GetName().c_str())); - - EBUS_EVENT_ID_RESULT(m_toIsSelected, m_id, UiEditorBus, GetIsSelected); - m_toIsSelected = !m_toIsSelected; -} - -void CommandHierarchyItemToggleIsSelected::undo() -{ - UndoStackExecutionScope s(m_stack); - - SetIsSelected(!m_toIsSelected); -} - -void CommandHierarchyItemToggleIsSelected::redo() -{ - UndoStackExecutionScope s(m_stack); - - SetIsSelected(m_toIsSelected); -} - -void CommandHierarchyItemToggleIsSelected::SetIsSelected(bool isSelected) -{ - AZ::Entity* element = EntityHelpers::GetEntity(m_id); - if (!element) - { - // The element DOESN'T exist. - // Nothing to do. - return; - } - - // This will do both the Runtime-side and Editor-side. - HierarchyItem::RttiCast(HierarchyHelpers::ElementToItem(m_hierarchy, element, false))->SetIsSelected(isSelected); -} - -void CommandHierarchyItemToggleIsSelected::Push(UndoStack* stack, - HierarchyWidget* hierarchy, - HierarchyItem* item) -{ - if (stack->GetIsExecuting()) - { - // This is a redundant Qt notification. - // Nothing else to do. - return; - } - - stack->push(new CommandHierarchyItemToggleIsSelected(stack, - hierarchy, - item)); -} diff --git a/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.h b/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.h deleted file mode 100644 index 97a988e04b..0000000000 --- a/Gems/LyShine/Code/Editor/CommandHierarchyItemToggleIsSelected.h +++ /dev/null @@ -1,52 +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 CommandHierarchyItemToggleIsSelected - : public QUndoCommand -{ -public: - - void undo() override; - void redo() override; - - // IMPORTANT: We DON'T want this command to support mergeWith(). - // Otherwise we leave commands on the undo stack that have no - // effect (NOOP). - // - // To avoid the NOOPs, we can either: - // - // (1) Delete the NOPs from the undo stack. - // or - // (2) NOT support mergeWith(). - // - // The problem with (1) is that it only allows odd number of - // state changes to be undoable. (2) is more consistent - // by making all state changes undoable. - - static void Push(UndoStack* stack, - HierarchyWidget* hierarchy, - HierarchyItem* item); - -private: - - CommandHierarchyItemToggleIsSelected(UndoStack* stack, - HierarchyWidget* hierarchy, - HierarchyItem* item); - - void SetIsSelected(bool isSelected); - - UndoStack* m_stack; - - HierarchyWidget* m_hierarchy; - - AZ::EntityId m_id; - bool m_toIsSelected; -}; diff --git a/Gems/LyShine/Code/Editor/EditorCommon.h b/Gems/LyShine/Code/Editor/EditorCommon.h index 5a435e7dba..95b0bf753f 100644 --- a/Gems/LyShine/Code/Editor/EditorCommon.h +++ b/Gems/LyShine/Code/Editor/EditorCommon.h @@ -42,7 +42,6 @@ class CommandHierarchyItemRename; class CommandHierarchyItemReparent; class CommandHierarchyItemToggleIsExpanded; class CommandHierarchyItemToggleIsSelectable; -class CommandHierarchyItemToggleIsSelected; class CommandHierarchyItemToggleIsVisible; class CommandPropertiesChange; class CommandViewportInteractionMode; @@ -123,7 +122,6 @@ enum class FusibleCommand #include "CommandHierarchyItemReparent.h" #include "CommandHierarchyItemToggleIsExpanded.h" #include "CommandHierarchyItemToggleIsSelectable.h" -#include "CommandHierarchyItemToggleIsSelected.h" #include "CommandHierarchyItemToggleIsVisible.h" #include "CommandPropertiesChange.h" #include "CommandViewportInteractionMode.h" diff --git a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake index 49fee653be..9750116ad1 100644 --- a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake +++ b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake @@ -50,8 +50,6 @@ set(FILES Editor/CommandHierarchyItemToggleIsExpanded.h Editor/CommandHierarchyItemToggleIsSelectable.cpp Editor/CommandHierarchyItemToggleIsSelectable.h - Editor/CommandHierarchyItemToggleIsSelected.cpp - Editor/CommandHierarchyItemToggleIsSelected.h Editor/CommandHierarchyItemToggleIsVisible.cpp Editor/CommandHierarchyItemToggleIsVisible.h Editor/CommandPropertiesChange.cpp