From c773c9e9aa512062f097ecf3cbb4211500e462a6 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Tue, 4 Jan 2022 16:39:04 -0600 Subject: [PATCH] Removed some unused classes from Editor/Controls Signed-off-by: Chris Galvan --- Code/Editor/Controls/ConsoleSCBMFC.h | 111 ---- Code/Editor/Controls/ConsoleSCBMFC.ui | 132 ----- Code/Editor/Controls/HotTrackingTreeCtrl.cpp | 48 -- Code/Editor/Controls/HotTrackingTreeCtrl.h | 33 -- Code/Editor/Controls/ImageListCtrl.cpp | 567 ------------------- Code/Editor/Controls/ImageListCtrl.h | 97 ---- Code/Editor/Controls/MultiMonHelper.cpp | 67 --- Code/Editor/Controls/MultiMonHelper.h | 44 -- Code/Editor/Controls/NumberCtrl.cpp | 143 ----- Code/Editor/Controls/NumberCtrl.h | 64 --- Code/Editor/Controls/TextEditorCtrl.cpp | 93 --- Code/Editor/Controls/TextEditorCtrl.h | 42 -- Code/Editor/Controls/TreeCtrlUtils.h | 322 ----------- Code/Editor/EditorPanelUtils.cpp | 542 ------------------ Code/Editor/EditorPanelUtils.h | 16 - Code/Editor/IEditor.h | 3 - Code/Editor/IEditorImpl.cpp | 13 - Code/Editor/IEditorImpl.h | 2 - Code/Editor/IEditorPanelUtils.h | 131 ----- Code/Editor/Lib/Tests/IEditorMock.h | 1 - Code/Editor/editor_lib_files.cmake | 14 - 21 files changed, 2485 deletions(-) delete mode 100644 Code/Editor/Controls/ConsoleSCBMFC.h delete mode 100644 Code/Editor/Controls/ConsoleSCBMFC.ui delete mode 100644 Code/Editor/Controls/HotTrackingTreeCtrl.cpp delete mode 100644 Code/Editor/Controls/HotTrackingTreeCtrl.h delete mode 100644 Code/Editor/Controls/ImageListCtrl.cpp delete mode 100644 Code/Editor/Controls/ImageListCtrl.h delete mode 100644 Code/Editor/Controls/MultiMonHelper.cpp delete mode 100644 Code/Editor/Controls/MultiMonHelper.h delete mode 100644 Code/Editor/Controls/NumberCtrl.cpp delete mode 100644 Code/Editor/Controls/NumberCtrl.h delete mode 100644 Code/Editor/Controls/TextEditorCtrl.cpp delete mode 100644 Code/Editor/Controls/TextEditorCtrl.h delete mode 100644 Code/Editor/Controls/TreeCtrlUtils.h delete mode 100644 Code/Editor/EditorPanelUtils.cpp delete mode 100644 Code/Editor/EditorPanelUtils.h delete mode 100644 Code/Editor/IEditorPanelUtils.h diff --git a/Code/Editor/Controls/ConsoleSCBMFC.h b/Code/Editor/Controls/ConsoleSCBMFC.h deleted file mode 100644 index fcf7f71df7..0000000000 --- a/Code/Editor/Controls/ConsoleSCBMFC.h +++ /dev/null @@ -1,111 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_CONSOLESCBMFC_H -#define CRYINCLUDE_EDITOR_CONTROLS_CONSOLESCBMFC_H -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include - -#include "ConsoleSCB.h" -#endif - -class QMenu; -class ConsoleWidget; -class QFocusEvent; - -namespace Ui { - class ConsoleMFC; -} - -namespace MFC -{ - -struct ConsoleLine -{ - QString text; - bool newLine; -}; -typedef std::deque Lines; - -class ConsoleLineEdit - : public QLineEdit -{ - Q_OBJECT -public: - explicit ConsoleLineEdit(QWidget* parent = nullptr); - -protected: - void mousePressEvent(QMouseEvent* ev) override; - void mouseDoubleClickEvent(QMouseEvent* ev) override; - void keyPressEvent(QKeyEvent* ev) override; - bool event(QEvent* ev) override; - -signals: - void variableEditorRequested(); - void setWindowTitle(const QString&); - -private: - void DisplayHistory(bool bForward); - QStringList m_history; - unsigned int m_historyIndex; - bool m_bReusedHistory; -}; - -class ConsoleTextEdit - : public QTextEdit -{ - Q_OBJECT -public: - explicit ConsoleTextEdit(QWidget* parent = nullptr); -}; - -class CConsoleSCB - : public QWidget -{ - Q_OBJECT -public: - explicit CConsoleSCB(QWidget* parent = nullptr); - ~CConsoleSCB(); - - static void RegisterViewClass(); - void SetInputFocus(); - void AddToConsole(const QString& text, bool bNewLine); - void FlushText(); - void showPopupAndSetTitle(); - QSize sizeHint() const override; - QSize minimumSizeHint() const override; - static CConsoleSCB* GetCreatedInstance(); - - static void AddToPendingLines(const QString& text, bool bNewLine); // call this function instead of AddToConsole() until an instance of CConsoleSCB exists to prevent messages from getting lost - -public Q_SLOTS: - void OnStyleSettingsChanged(); - -private Q_SLOTS: - void showVariableEditor(); - -private: - QScopedPointer ui; - int m_richEditTextLength; - - Lines m_lines; - static Lines s_pendingLines; - - QList m_colorTable; - SEditorSettings::ConsoleColorTheme m_backgroundTheme; -}; - -} // namespace MFC - -#endif // CRYINCLUDE_EDITOR_CONTROLS_CONSOLESCB_H - diff --git a/Code/Editor/Controls/ConsoleSCBMFC.ui b/Code/Editor/Controls/ConsoleSCBMFC.ui deleted file mode 100644 index b9386558ed..0000000000 --- a/Code/Editor/Controls/ConsoleSCBMFC.ui +++ /dev/null @@ -1,132 +0,0 @@ - - - ConsoleMFC - - - - 0 - 0 - 400 - 120 - - - - - 0 - 0 - - - - Console - - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 20 - - - - true - - - - - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 20 - 0 - - - - - 20 - 30 - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - MFC::ConsoleLineEdit - QLineEdit -
ConsoleSCBMFC.h
-
-
- - - - -
diff --git a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp b/Code/Editor/Controls/HotTrackingTreeCtrl.cpp deleted file mode 100644 index 54152a9fd4..0000000000 --- a/Code/Editor/Controls/HotTrackingTreeCtrl.cpp +++ /dev/null @@ -1,48 +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 "EditorDefs.h" - -#include "HotTrackingTreeCtrl.h" - -// Qt -#include - - -CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent) - : QTreeWidget(parent) -{ - setMouseTracking(true); - m_hHoverItem = nullptr; -} - -void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event) -{ - QTreeWidgetItem* hItem = itemAt(event->pos()); - - if (m_hHoverItem != nullptr) - { - QFont font = m_hHoverItem->font(0); - font.setBold(false); - m_hHoverItem->setFont(0, font); - m_hHoverItem = nullptr; - } - - if (hItem != nullptr) - { - QFont font = hItem->font(0); - font.setBold(true); - hItem->setFont(0, font); - m_hHoverItem = hItem; - } - - QTreeWidget::mouseMoveEvent(event); -} - -#include diff --git a/Code/Editor/Controls/HotTrackingTreeCtrl.h b/Code/Editor/Controls/HotTrackingTreeCtrl.h deleted file mode 100644 index 2ca7e11a91..0000000000 --- a/Code/Editor/Controls/HotTrackingTreeCtrl.h +++ /dev/null @@ -1,33 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_HOTTRACKINGTREECTRL_H -#define CRYINCLUDE_EDITOR_CONTROLS_HOTTRACKINGTREECTRL_H -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#endif - -class CHotTrackingTreeCtrl - : public QTreeWidget -{ - Q_OBJECT - -public: - CHotTrackingTreeCtrl(QWidget* parent = 0); - virtual ~CHotTrackingTreeCtrl(){}; - -protected: - void mouseMoveEvent(QMouseEvent* event) override; - -private: - QTreeWidgetItem* m_hHoverItem; -}; -#endif // CRYINCLUDE_EDITOR_CONTROLS_HOTTRACKINGTREECTRL_H diff --git a/Code/Editor/Controls/ImageListCtrl.cpp b/Code/Editor/Controls/ImageListCtrl.cpp deleted file mode 100644 index 9c8451c2e9..0000000000 --- a/Code/Editor/Controls/ImageListCtrl.cpp +++ /dev/null @@ -1,567 +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 "EditorDefs.h" - -#include "ImageListCtrl.h" - -// Qt -#include -#include - -////////////////////////////////////////////////////////////////////////// -CImageListCtrl::CImageListCtrl(QWidget* parent) - : QAbstractItemView(parent) - , m_itemSize(60, 60) - , m_borderSize(4, 4) - , m_style(DefaultStyle) -{ - setItemDelegate(new QImageListDelegate(this)); - setAutoFillBackground(false); - - QPalette p = palette(); - p.setColor(QPalette::Highlight, QColor(255, 55, 50)); - setPalette(p); - - horizontalScrollBar()->setRange(0, 0); - verticalScrollBar()->setRange(0, 0); -} - -////////////////////////////////////////////////////////////////////////// -CImageListCtrl::~CImageListCtrl() -{ -} - -////////////////////////////////////////////////////////////////////////// -CImageListCtrl::ListStyle CImageListCtrl::Style() const -{ - return m_style; -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::SetStyle(ListStyle style) -{ - m_style = style; - scheduleDelayedItemsLayout(); -} - -////////////////////////////////////////////////////////////////////////// -const QSize& CImageListCtrl::ItemSize() const -{ - return m_itemSize; -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::SetItemSize(QSize size) -{ - Q_ASSERT(size.isValid()); - m_itemSize = size; - scheduleDelayedItemsLayout(); -} - -////////////////////////////////////////////////////////////////////////// -const QSize& CImageListCtrl::BorderSize() const -{ - return m_borderSize; -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::SetBorderSize(QSize size) -{ - Q_ASSERT(size.isValid()); - m_borderSize = size; - scheduleDelayedItemsLayout(); -} - -////////////////////////////////////////////////////////////////////////// -QModelIndexList CImageListCtrl::ItemsInRect(const QRect& rect) const -{ - QModelIndexList list; - - if (!model()) - { - return list; - } - - QHash::const_iterator i; - QHash::const_iterator c = m_geometry.cend(); - for (i = m_geometry.cbegin(); i != c; ++i) - { - if (i.value().intersects(rect)) - { - list << model()->index(i.key(), 0, rootIndex()); - } - } - - return list; -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::paintEvent(QPaintEvent* event) -{ - QAbstractItemView::paintEvent(event); - - if (!model()) - { - return; - } - - const int rowCount = model()->rowCount(); - - if (m_geometry.isEmpty() && rowCount) - { - updateGeometries(); - } - - QPainter painter(viewport()); - painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); - painter.setBackground(palette().window()); - painter.setFont(font()); - - QStyleOptionViewItem option; - option.palette = palette(); - option.font = font(); - option.fontMetrics = fontMetrics(); - option.decorationAlignment = Qt::AlignCenter; - - const QRect visibleRect(QPoint(horizontalOffset(), verticalOffset()), viewport()->contentsRect().size()); - - painter.translate(-horizontalOffset(), -verticalOffset()); - - for (int r = 0; r < rowCount; ++r) - { - const QModelIndex& index = model()->index(r, 0, rootIndex()); - - option.rect = m_geometry.value(r); - if (!option.rect.intersects(visibleRect)) - { - continue; - } - - option.state = QStyle::State_None; - - if (selectionModel()->isSelected(index)) - { - option.state |= QStyle::State_Selected; - } - - if (currentIndex() == index) - { - option.state |= QStyle::State_HasFocus; - } - - QAbstractItemDelegate* idt = itemDelegate(index); - idt->paint(&painter, option, index); - } -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::rowsInserted(const QModelIndex& parent, int start, int end) -{ - QAbstractItemView::rowsInserted(parent, start, end); - - if (isVisible()) - { - scheduleDelayedItemsLayout(); - } -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::updateGeometries() -{ - ClearItemGeometries(); - - if (!model()) - { - return; - } - - const int rowCount = model()->rowCount(); - - const int nPageHorz = viewport()->width(); - const int nPageVert = viewport()->height(); - - if (nPageHorz == 0 || nPageVert == 0 || rowCount <= 0) - { - return; - } - - int x = m_borderSize.width(); - int y = m_borderSize.height(); - - const int nItemWidth = m_itemSize.width() + m_borderSize.width(); - - if (m_style == HorizontalStyle) - { - for (int row = 0; row < rowCount; ++row) - { - m_geometry.insert(row, QRect(QPoint(x, y), m_itemSize)); - x += nItemWidth; - } - - horizontalScrollBar()->setPageStep(viewport()->width()); - horizontalScrollBar()->setRange(0, x - viewport()->width()); - } - else - { - const int nTextHeight = fontMetrics().height(); - const int nItemHeight = m_itemSize.height() + m_borderSize.height() + nTextHeight; - - int nNumOfHorzItems = nPageHorz / nItemWidth; - if (nNumOfHorzItems <= 0) - { - nNumOfHorzItems = 1; - } - - for (int row = 0; row < rowCount; ++row) - { - m_geometry.insert(row, QRect(QPoint(x, y), m_itemSize)); - - if ((row + 1) % nNumOfHorzItems == 0) - { - y += nItemHeight; - x = m_borderSize.width(); - } - else - { - x += nItemWidth; - } - } - - verticalScrollBar()->setPageStep(viewport()->height()); - verticalScrollBar()->setRange(0, (y + nItemHeight) - viewport()->height()); - } -} - -////////////////////////////////////////////////////////////////////////// -QModelIndex CImageListCtrl::indexAt(const QPoint& point) const -{ - if (!model()) - { - return QModelIndex(); - } - - const QPoint p = point + - QPoint(horizontalOffset(), verticalOffset()); - - QHash::const_iterator i; - QHash::const_iterator c = m_geometry.cend(); - for (i = m_geometry.cbegin(); i != c; ++i) - { - if (i.value().contains(p)) - { - return model()->index(i.key(), 0, rootIndex()); - } - } - - return QModelIndex(); -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::scrollTo(const QModelIndex& index, ScrollHint hint) -{ - if (!index.isValid()) - { - return; - } - - QRect rect = m_geometry.value(index.row()); - - switch (hint) - { - case EnsureVisible: - if (horizontalOffset() > rect.right()) - { - horizontalScrollBar()->setValue(rect.left()); - } - else if ((horizontalOffset() + viewport()->width()) < rect.left()) - { - horizontalScrollBar()->setValue(rect.right() - viewport()->width()); - } - - if (verticalOffset() > rect.bottom()) - { - verticalScrollBar()->setValue(rect.top()); - } - else if ((verticalOffset() + viewport()->height()) < rect.top()) - { - verticalScrollBar()->setValue(rect.bottom() - viewport()->height()); - } - break; - - case PositionAtTop: - horizontalScrollBar()->setValue(rect.left()); - verticalScrollBar()->setValue(rect.top()); - break; - - case PositionAtBottom: - horizontalScrollBar()->setValue(rect.right() - viewport()->width()); - verticalScrollBar()->setValue(rect.bottom() - viewport()->height()); - break; - - case PositionAtCenter: - horizontalScrollBar()->setValue(rect.center().x() - (viewport()->width() / 2)); - verticalScrollBar()->setValue(rect.center().y() - (viewport()->height() / 2)); - break; - } -} - -////////////////////////////////////////////////////////////////////////// -QRect CImageListCtrl::visualRect(const QModelIndex& index) const -{ - if (!index.isValid()) - { - return QRect(); - } - - - if (!m_geometry.contains(index.row())) - { - return QRect(); - } - - return m_geometry.value(index.row()) - .translated(-horizontalOffset(), -verticalOffset()); -} - -////////////////////////////////////////////////////////////////////////// -QRect CImageListCtrl::ItemGeometry(const QModelIndex& index) const -{ - Q_ASSERT(index.model() == model()); - Q_ASSERT(m_geometry.contains(index.row())); - - return m_geometry.value(index.row()); -} - -void CImageListCtrl::SetItemGeometry(const QModelIndex& index, const QRect& rect) -{ - Q_ASSERT(index.model() == model()); - m_geometry.insert(index.row(), rect); - update(rect); -} - -void CImageListCtrl::ClearItemGeometries() -{ - m_geometry.clear(); -} - -////////////////////////////////////////////////////////////////////////// -int CImageListCtrl::horizontalOffset() const -{ - return horizontalScrollBar()->value(); -} - -////////////////////////////////////////////////////////////////////////// -int CImageListCtrl::verticalOffset() const -{ - return verticalScrollBar()->value(); -} - -////////////////////////////////////////////////////////////////////////// -bool CImageListCtrl::isIndexHidden([[maybe_unused]] const QModelIndex& index) const -{ - return false; /* not supported */ -} - -////////////////////////////////////////////////////////////////////////// -QModelIndex CImageListCtrl::moveCursor(CursorAction cursorAction, [[maybe_unused]] Qt::KeyboardModifiers modifiers) -{ - if (!model()) - { - return QModelIndex(); - } - - const int rowCount = model()->rowCount(); - - if (0 == rowCount) - { - return QModelIndex(); - } - - switch (cursorAction) - { - case MoveHome: - return model()->index(0, 0, rootIndex()); - - case MoveEnd: - return model()->index(rowCount - 1, 0, rootIndex()); - - case MovePrevious: - { - QModelIndex current = currentIndex(); - if (current.isValid()) - { - return model()->index((current.row() - 1) % rowCount, 0, rootIndex()); - } - } break; - - case MoveNext: - { - QModelIndex current = currentIndex(); - if (current.isValid()) - { - return model()->index((current.row() + 1) % rowCount, 0, rootIndex()); - } - } break; - - case MoveUp: - case MoveDown: - case MoveLeft: - case MoveRight: - case MovePageUp: - case MovePageDown: - /* TODO */ - break; - } - return QModelIndex(); -} - -////////////////////////////////////////////////////////////////////////// -void CImageListCtrl::setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) -{ - if (!model()) - { - return; - } - - const QRect lrect = - rect.translated(horizontalOffset(), verticalOffset()); - - QHash::const_iterator i; - QHash::const_iterator c = m_geometry.cend(); - for (i = m_geometry.cbegin(); i != c; ++i) - { - if (i.value().intersects(lrect)) - { - selectionModel()->select(model()->index(i.key(), 0, rootIndex()), flags); - } - } -} - -////////////////////////////////////////////////////////////////////////// -QRegion CImageListCtrl::visualRegionForSelection(const QItemSelection& selection) const -{ - QRegion region; - - foreach(const QModelIndex &index, selection.indexes()) - { - region += visualRect(index); - } - - return region; -} - -////////////////////////////////////////////////////////////////////////// -QImageListDelegate::QImageListDelegate(QObject* parent) - : QAbstractItemDelegate(parent) -{ -} - -////////////////////////////////////////////////////////////////////////// -void QImageListDelegate::paint(QPainter* painter, - const QStyleOptionViewItem& option, const QModelIndex& index) const -{ - painter->save(); - - painter->setFont(option.font); - - if (option.rect.isValid()) - { - painter->setClipRect(option.rect); - } - - QRect innerRect = option.rect.adjusted(1, 1, -1, -1); - - QRect textRect(innerRect.left(), innerRect.bottom() - option.fontMetrics.height(), - innerRect.width(), option.fontMetrics.height() + 1); - - /* fill item background */ - - painter->fillRect(option.rect, option.palette.color(QPalette::Base)); - - /* draw image */ - - if (index.data(Qt::DecorationRole).isValid()) - { - const QPixmap& p = index.data(Qt::DecorationRole).value(); - if (p.isNull() || p.size() == QSize(1, 1)) - { - emit InvalidPixmapGenerated(index); - } - else - { - painter->drawPixmap(innerRect, p); - } - } - - /* draw text */ - - const QColor trColor = option.palette.color(QPalette::Shadow); - painter->fillRect(textRect, (option.state & QStyle::State_Selected) ? - trColor.lighter() : trColor); - - if (option.state & QStyle::State_Selected) - { - painter->setPen(QPen(option.palette.color(QPalette::HighlightedText))); - - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - } - else - { - painter->setPen(QPen(option.palette.color(QPalette::Text))); - } - - painter->drawText(textRect, index.data(Qt::DisplayRole).toString(), - QTextOption(option.decorationAlignment)); - - painter->setPen(QPen(option.palette.color(QPalette::Shadow))); - painter->drawRect(textRect); - - /* draw border */ - - if (option.state & QStyle::State_Selected) - { - QPen pen(option.palette.color(QPalette::Highlight)); - pen.setWidth(2); - painter->setPen(pen); - painter->drawRect(innerRect); - } - else - { - painter->setPen(QPen(option.palette.color(QPalette::Shadow))); - painter->drawRect(option.rect); - } - - if (option.state & QStyle::State_HasFocus) - { - QPen pen(Qt::DotLine); - pen.setColor(option.palette.color(QPalette::AlternateBase)); - painter->setPen(pen); - painter->drawRect(option.rect); - } - - painter->restore(); -} - -////////////////////////////////////////////////////////////////////////// -QSize QImageListDelegate::sizeHint(const QStyleOptionViewItem& option, - [[maybe_unused]] const QModelIndex& index) const -{ - return option.rect.size(); -} - -////////////////////////////////////////////////////////////////////////// -QVector QImageListDelegate::paintingRoles() const -{ - return QVector() << Qt::DecorationRole << Qt::DisplayRole; -} - -#include diff --git a/Code/Editor/Controls/ImageListCtrl.h b/Code/Editor/Controls/ImageListCtrl.h deleted file mode 100644 index db393c8497..0000000000 --- a/Code/Editor/Controls/ImageListCtrl.h +++ /dev/null @@ -1,97 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H -#define CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H -#pragma once - -#if !defined(Q_MOC_RUN) -#include - -#include -#endif - -////////////////////////////////////////////////////////////////////////// -// Custom control to display list of images. -////////////////////////////////////////////////////////////////////////// -class CImageListCtrl - : public QAbstractItemView -{ - Q_OBJECT -public: - enum ListStyle - { - DefaultStyle, - HorizontalStyle - }; - -public: - CImageListCtrl(QWidget* parent = nullptr); - ~CImageListCtrl(); - - ListStyle Style() const; - void SetStyle(ListStyle style); - - const QSize& ItemSize() const; - void SetItemSize(QSize size); - - const QSize& BorderSize() const; - void SetBorderSize(QSize size); - - // Get all items inside specified rectangle. - QModelIndexList ItemsInRect(const QRect& rect) const; - - QModelIndex indexAt(const QPoint& point) const override; - void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible) override; - QRect visualRect(const QModelIndex& index) const override; - -protected: - QRect ItemGeometry(const QModelIndex& index) const; - void SetItemGeometry(const QModelIndex& index, const QRect& rect); - void ClearItemGeometries(); - - int horizontalOffset() const override; - int verticalOffset() const override; - bool isIndexHidden(const QModelIndex& index) const override; - QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override; - void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) override; - QRegion visualRegionForSelection(const QItemSelection& selection) const override; - - void paintEvent(QPaintEvent* event) override; - void rowsInserted(const QModelIndex& parent, int start, int end) override; - - void updateGeometries() override; - -private: - QHash m_geometry; - QSize m_itemSize; - QSize m_borderSize; - ListStyle m_style; -}; - -class QImageListDelegate - : public QAbstractItemDelegate -{ - Q_OBJECT -signals: - void InvalidPixmapGenerated(const QModelIndex& index) const; -public: - QImageListDelegate(QObject* parent = nullptr); - - void paint(QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index) const override; - - QSize sizeHint(const QStyleOptionViewItem& option, - const QModelIndex& index) const override; - - QVector paintingRoles() const override; -}; - -#endif // CRYINCLUDE_EDITOR_CONTROLS_IMAGELISTCTRL_H diff --git a/Code/Editor/Controls/MultiMonHelper.cpp b/Code/Editor/Controls/MultiMonHelper.cpp deleted file mode 100644 index 5b3ed3a204..0000000000 --- a/Code/Editor/Controls/MultiMonHelper.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 "EditorDefs.h" - -#include "MultiMonHelper.h" - -// Qt -#include - -//////////////////////////////////////////////////////////////////////////// -void ClipOrCenterRectToMonitor(QRect *prc, const UINT flags) -{ - const QScreen* currentScreen = nullptr; - QRect rc; - - Q_ASSERT(prc); - - const auto screens = qApp->screens(); - for (auto screen : screens) - { - if (screen->geometry().contains(prc->center())) - { - currentScreen = screen; - break; - } - } - - if (!currentScreen) - { - return; - } - - const int w = prc->width(); - const int h = prc->height(); - - if (flags & MONITOR_WORKAREA) - { - rc = currentScreen->availableGeometry(); - } - else - { - rc = currentScreen->geometry(); - } - - // center or clip the passed rect to the monitor rect - if (flags & MONITOR_CENTER) - { - prc->setLeft(rc.left() + (rc.right() - rc.left() - w) / 2); - prc->setTop(rc.top() + (rc.bottom() - rc.top() - h) / 2); - prc->setRight(prc->left() + w); - prc->setBottom(prc->top() + h); - } - else - { - prc->setLeft(qMax(rc.left(), qMin(rc.right() - w, prc->left()))); - prc->setTop(qMax(rc.top(), qMin(rc.bottom() - h, prc->top()))); - prc->setRight(prc->left() + w); - prc->setBottom(prc->top() + h); - } -} diff --git a/Code/Editor/Controls/MultiMonHelper.h b/Code/Editor/Controls/MultiMonHelper.h deleted file mode 100644 index 54e47bf022..0000000000 --- a/Code/Editor/Controls/MultiMonHelper.h +++ /dev/null @@ -1,44 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_MULTIMONHELPER_H -#define CRYINCLUDE_EDITOR_CONTROLS_MULTIMONHELPER_H -#pragma once - -// Taken from: http://msdn.microsoft.com/en-us/library/dd162826(v=vs.85).aspx -#define MONITOR_CENTER 0x0001 // center rect to monitor -#define MONITOR_CLIP 0x0000 // clip rect to monitor -#define MONITOR_WORKAREA 0x0002 // use monitor work area -#define MONITOR_AREA 0x0000 // use monitor entire area - -// -// ClipOrCenterRectToMonitor -// -// The most common problem apps have when running on a -// multimonitor system is that they "clip" or "pin" windows -// based on the SM_CXSCREEN and SM_CYSCREEN system metrics. -// Because of app compatibility reasons these system metrics -// return the size of the primary monitor. -// -// This shows how you use the multi-monitor functions -// to do the same thing. -// -// params: -// prc : pointer to QRect to modify -// flags : some combination of the MONITOR_* flags above -// -// example: -// -// ClipOrCenterRectToMonitor(&aRect, MONITOR_CLIP | MONITOR_WORKAREA); -// -// Takes parameter pointer to RECT "aRect" and flags MONITOR_CLIP | MONITOR_WORKAREA -// This will modify aRect without resizing it so that it remains within the on-screen boundaries. -void ClipOrCenterRectToMonitor(QRect *prc, const UINT flags); - -#endif // CRYINCLUDE_EDITOR_CONTROLS_MULTIMONHELPER_H diff --git a/Code/Editor/Controls/NumberCtrl.cpp b/Code/Editor/Controls/NumberCtrl.cpp deleted file mode 100644 index 473dd7e4af..0000000000 --- a/Code/Editor/Controls/NumberCtrl.cpp +++ /dev/null @@ -1,143 +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 "EditorDefs.h" - -#include "NumberCtrl.h" - - -QNumberCtrl::QNumberCtrl(QWidget* parent) - : QDoubleSpinBox(parent) - , m_bMouseDown(false) - , m_bDragged(false) - , m_bUndoEnabled(false) - , m_prevValue(0) -{ - connect(this, &QAbstractSpinBox::editingFinished, this, &QNumberCtrl::onEditingFinished); -} - -void QNumberCtrl::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::EnabledChange) - { - setButtonSymbols(isEnabled() ? UpDownArrows : NoButtons); - } - - QDoubleSpinBox::changeEvent(event); -} - - -void QNumberCtrl::SetRange(double newMin, double newMax) -{ - // Avoid setting this value if its close to the current value, because otherwise qt will pump events into the queue to redraw/etc. - if ( (!AZ::IsClose(this->minimum(), newMin, DBL_EPSILON)) || (!AZ::IsClose(this->maximum(), newMax, DBL_EPSILON)) ) - { - setRange(newMin, newMax); - } -} - - -void QNumberCtrl::mousePressEvent(QMouseEvent* event) -{ - if (event->button() == Qt::LeftButton) - { - emit mousePressed(); - - m_bMouseDown = true; - m_bDragged = false; - m_mousePos = event->pos(); - - if (m_bUndoEnabled && !CUndo::IsRecording()) - { - GetIEditor()->BeginUndo(); - } - - emit dragStarted(); - - grabMouse(); - } - - QDoubleSpinBox::mousePressEvent(event); -} - -void QNumberCtrl::mouseReleaseEvent(QMouseEvent* event) -{ - QDoubleSpinBox::mouseReleaseEvent(event); - - if (event->button() == Qt::LeftButton) - { - m_bMouseDown = m_bDragged = false; - - emit valueUpdated(); - emit valueChanged(); - - if (m_bUndoEnabled && CUndo::IsRecording()) - { - GetIEditor()->AcceptUndo(m_undoText); - } - - emit dragFinished(); - - releaseMouse(); - - m_prevValue = value(); - - emit mouseReleased(); - } -} - -void QNumberCtrl::mouseMoveEvent(QMouseEvent* event) -{ - QDoubleSpinBox::mousePressEvent(event); - - if (m_bMouseDown) - { - m_bDragged = true; - - int dy = event->pos().y() - m_mousePos.y(); - setValue(value() - singleStep() * dy); - - emit valueUpdated(); - - m_mousePos = event->pos(); - } -} - -void QNumberCtrl::EnableUndo(const QString& undoText) -{ - m_undoText = undoText; - m_bUndoEnabled = true; -} - -void QNumberCtrl::focusInEvent(QFocusEvent* event) -{ - m_prevValue = value(); - QDoubleSpinBox::focusInEvent(event); -} - -void QNumberCtrl::onEditingFinished() -{ - bool undo = m_bUndoEnabled && !CUndo::IsRecording() && m_prevValue != value(); - if (undo) - { - GetIEditor()->BeginUndo(); - } - - emit valueUpdated(); - emit valueChanged(); - - if (undo) - { - GetIEditor()->AcceptUndo(m_undoText); - } - - m_prevValue = value(); -} - -#include diff --git a/Code/Editor/Controls/NumberCtrl.h b/Code/Editor/Controls/NumberCtrl.h deleted file mode 100644 index 22ee7b867f..0000000000 --- a/Code/Editor/Controls/NumberCtrl.h +++ /dev/null @@ -1,64 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H -#define CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H -#pragma once - -// NumberCtrl.h : header file -// - -#if !defined(Q_MOC_RUN) -#include -#endif - -class QNumberCtrl - : public QDoubleSpinBox -{ - Q_OBJECT - -public: - QNumberCtrl(QWidget* parent = nullptr); - - bool IsDragging() const { return m_bDragged; } - - //! If called will enable undo with given text when control is modified. - void EnableUndo(const QString& undoText); - void SetRange(double newMin, double maxRange); - -Q_SIGNALS: - void dragStarted(); - void dragFinished(); - - void valueUpdated(); - void valueChanged(); - - void mouseReleased(); - void mousePressed(); - -protected: - void changeEvent(QEvent* event) override; - void focusInEvent(QFocusEvent* event) override; - void mousePressEvent(QMouseEvent* event) override; - void mouseMoveEvent(QMouseEvent* event) override; - void mouseReleaseEvent(QMouseEvent* event) override; - -private: - void onEditingFinished(); - void onValueChanged(double d); - - bool m_bMouseDown; - bool m_bDragged; - QPoint m_mousePos; - bool m_bUndoEnabled; - double m_prevValue; - QString m_undoText; -}; - -#endif // CRYINCLUDE_EDITOR_CONTROLS_NUMBERCTRL_H diff --git a/Code/Editor/Controls/TextEditorCtrl.cpp b/Code/Editor/Controls/TextEditorCtrl.cpp deleted file mode 100644 index c372138d80..0000000000 --- a/Code/Editor/Controls/TextEditorCtrl.cpp +++ /dev/null @@ -1,93 +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 "EditorDefs.h" - -#include "TextEditorCtrl.h" - - -// CTextEditorCtrl -CTextEditorCtrl::CTextEditorCtrl(QWidget* pParent) - : QTextEdit(pParent) -{ - m_bModified = true; - - QFont font; - font.setFamily("Courier New"); - font.setFixedPitch(true); - font.setPointSize(10); - setFont(font); - - setLineWrapMode(NoWrap); - - connect(this, &QTextEdit::textChanged, this, &CTextEditorCtrl::OnChange); -} - -CTextEditorCtrl::~CTextEditorCtrl() -{ -} - - -// CTextEditorCtrl message handlers - -void CTextEditorCtrl::LoadFile(const QString& sFileName) -{ - if (m_filename == sFileName) - { - return; - } - - m_filename = sFileName; - - clear(); - - CCryFile file(sFileName.toUtf8().data(), "rb"); - if (file.Open(sFileName.toUtf8().data(), "rb")) - { - size_t length = file.GetLength(); - - QByteArray text; - text.resize(static_cast(length)); - file.ReadRaw(text.data(), length); - - setPlainText(text); - } - - m_bModified = false; -} - -////////////////////////////////////////////////////////////////////////// -void CTextEditorCtrl::SaveFile(const QString& sFileName) -{ - if (sFileName.isEmpty()) - { - return; - } - - if (!CFileUtil::OverwriteFile(sFileName.toUtf8().data())) - { - return; - } - - QFile file(sFileName); - file.open(QFile::WriteOnly); - - file.write(toPlainText().toUtf8()); - - m_bModified = false; -} - -////////////////////////////////////////////////////////////////////////// -void CTextEditorCtrl::OnChange() -{ - - m_bModified = true; -} - -#include diff --git a/Code/Editor/Controls/TextEditorCtrl.h b/Code/Editor/Controls/TextEditorCtrl.h deleted file mode 100644 index e155185f90..0000000000 --- a/Code/Editor/Controls/TextEditorCtrl.h +++ /dev/null @@ -1,42 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_TEXTEDITORCTRL_H -#define CRYINCLUDE_EDITOR_CONTROLS_TEXTEDITORCTRL_H -#pragma once - -// CTextEditorCtrl -#if !defined(Q_MOC_RUN) -#include -#endif - -class CTextEditorCtrl - : public QTextEdit -{ - Q_OBJECT - -public: - CTextEditorCtrl(QWidget* pParent = nullptr); - virtual ~CTextEditorCtrl(); - - void LoadFile(const QString& sFileName); - void SaveFile(const QString& sFileName); - QString GetFilename() const { return m_filename; } - - bool IsModified() const { return m_bModified; } - - //! Must be called after OnChange message. - void OnChange(); - -protected: - QString m_filename; - bool m_bModified; -}; - -#endif // CRYINCLUDE_EDITOR_CONTROLS_TEXTEDITORCTRL_H diff --git a/Code/Editor/Controls/TreeCtrlUtils.h b/Code/Editor/Controls/TreeCtrlUtils.h deleted file mode 100644 index 7498360d2e..0000000000 --- a/Code/Editor/Controls/TreeCtrlUtils.h +++ /dev/null @@ -1,322 +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 - * - */ - - -#ifndef CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H -#define CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H -#pragma once - -#include - -namespace TreeCtrlUtils -{ - template - class TreeItemIterator - : public P - { - public: - typedef P Traits; - - //iterator traits, required by STL - typedef ptrdiff_t difference_type; - typedef HTREEITEM value_type; - typedef HTREEITEM* pointer; - typedef HTREEITEM& reference; - typedef std::forward_iterator_tag iterator_category; - - TreeItemIterator() - : pCtrl(0) - , hItem(0) {} - explicit TreeItemIterator(const P& traits) - : P(traits) - , pCtrl(0) - , hItem(0) {} - TreeItemIterator(const TreeItemIterator& other) - : P(other) - , pCtrl(other.pCtrl) - , hItem(other.hItem) {} - TreeItemIterator(CTreeCtrl* pCtrl, HTREEITEM hItem) - : pCtrl(pCtrl) - , hItem(hItem) {} - TreeItemIterator(CTreeCtrl* pCtrl, HTREEITEM hItem, const P& traits) - : P(traits) - , pCtrl(pCtrl) - , hItem(hItem) {} - - HTREEITEM operator*() {return hItem; } - bool operator==(const TreeItemIterator& other) const {return pCtrl == other.pCtrl && hItem == other.hItem; } - bool operator!=(const TreeItemIterator& other) const {return pCtrl != other.pCtrl || hItem != other.hItem; } - - TreeItemIterator& operator++() - { - HTREEITEM hNextItem = 0; - if (RecurseToChildren(hItem)) - { - hNextItem = (pCtrl ? pCtrl->GetChildItem(hItem) : 0); - } - while (pCtrl && hItem && !hNextItem) - { - hNextItem = pCtrl->GetNextSiblingItem(hItem); - if (!hNextItem) - { - hItem = pCtrl->GetParentItem(hItem); - } - } - hItem = hNextItem; - - return *this; - } - - TreeItemIterator operator++(int) {TreeItemIterator old = *this; ++(*this); return old; } - - CTreeCtrl* pCtrl; - HTREEITEM hItem; - }; - - class NonRecursiveTreeItemIteratorTraits - { - public: - bool RecurseToChildren(HTREEITEM hItem) {return false; } - }; - typedef TreeItemIterator NonRecursiveTreeItemIterator; - - class RecursiveTreeItemIteratorTraits - { - public: - bool RecurseToChildren(HTREEITEM hItem) {return true; } - }; - typedef TreeItemIterator RecursiveTreeItemIterator; - - inline RecursiveTreeItemIterator BeginTreeItemsRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - if (hItem == 0) - { - hItem = (pCtrl ? pCtrl->GetRootItem() : 0); - } - return RecursiveTreeItemIterator(pCtrl, hItem); - } - - inline RecursiveTreeItemIterator EndTreeItemsRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - HTREEITEM hEndItem = 0; - HTREEITEM hParent = hItem; - do - { - if (hParent) - { - hEndItem = pCtrl->GetNextSiblingItem(hParent); - } - hParent = (pCtrl && hParent ? pCtrl->GetParentItem(hParent) : 0); - } - while (hParent && !hEndItem); - return RecursiveTreeItemIterator(pCtrl, hEndItem); - } - - inline NonRecursiveTreeItemIterator BeginTreeItemsNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - if (hItem == 0) - { - hItem = (pCtrl ? pCtrl->GetRootItem() : 0); - } - if (hItem) - { - hItem = pCtrl->GetChildItem(hItem); - } - return NonRecursiveTreeItemIterator(pCtrl, hItem); - } - - inline NonRecursiveTreeItemIterator EndTreeItemsNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - HTREEITEM hEndItem = 0; - HTREEITEM hParent = 0; - while (hParent && !hEndItem) - { - hParent = (pCtrl && hItem ? pCtrl->GetParentItem(hItem) : 0); - if (hParent) - { - hEndItem = pCtrl->GetNextSiblingItem(hParent); - } - } - return NonRecursiveTreeItemIterator(pCtrl, hEndItem); - } - - template - class TreeItemDataIterator - { - public: - typedef T Type; - typedef TreeItemIterator

InternalIterator; - - //iterator traits, required by STL - typedef ptrdiff_t difference_type; - typedef Type* value_type; - typedef Type** pointer; - typedef Type*& reference; - typedef std::forward_iterator_tag iterator_category; - - TreeItemDataIterator() {} - TreeItemDataIterator(const TreeItemDataIterator& other) - : iterator(other.iterator) {AdvanceToValidIterator(); } - explicit TreeItemDataIterator(const InternalIterator& iterator) - : iterator(iterator) {AdvanceToValidIterator(); } - - Type* operator*() {return reinterpret_cast(iterator.pCtrl->GetItemData(iterator.hItem)); } - bool operator==(const TreeItemDataIterator& other) const {return iterator == other.iterator; } - bool operator!=(const TreeItemDataIterator& other) const {return iterator != other.iterator; } - - HTREEITEM GetTreeItem() {return iterator.hItem; } - - TreeItemDataIterator& operator++() - { - ++iterator; - AdvanceToValidIterator(); - return *this; - } - - TreeItemDataIterator operator++(int) {TreeItemDataIterator old = *this; ++(*this); return old; } - - private: - void AdvanceToValidIterator() - { - while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem)) - { - ++iterator; - } - } - - InternalIterator iterator; - }; - - template - class RecursiveItemDataIteratorType - { - public: typedef TreeItemDataIterator type; - }; - template - inline TreeItemDataIterator BeginTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - return TreeItemDataIterator(BeginTreeItemsRecursive(pCtrl, hItem)); - } - - template - inline TreeItemDataIterator EndTreeItemDataRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - return TreeItemDataIterator(EndTreeItemsRecursive(pCtrl, hItem)); - } - - template - class NonRecursiveItemDataIteratorType - { - typedef TreeItemDataIterator type; - }; - template - inline TreeItemDataIterator BeginTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - return TreeItemDataIterator(BeginTreeItemsNonRecursive(pCtrl, hItem)); - } - - template - inline TreeItemDataIterator EndTreeItemDataNonRecursive(CTreeCtrl* pCtrl, HTREEITEM hItem = 0) - { - return TreeItemDataIterator(EndTreeItemsNonRecursive(pCtrl, hItem)); - } - - class SelectedTreeItemIterator - { - public: - SelectedTreeItemIterator() - : pCtrl(0) - , hItem(0) {} - SelectedTreeItemIterator(const SelectedTreeItemIterator& other) - : pCtrl(other.pCtrl) - , hItem(other.hItem) {} - SelectedTreeItemIterator(CXTTreeCtrl* pCtrl, HTREEITEM hItem) - : pCtrl(pCtrl) - , hItem(hItem) {} - - HTREEITEM operator*() {return hItem; } - bool operator==(const SelectedTreeItemIterator& other) const {return pCtrl == other.pCtrl && hItem == other.hItem; } - bool operator!=(const SelectedTreeItemIterator& other) const {return pCtrl != other.pCtrl || hItem != other.hItem; } - - SelectedTreeItemIterator& operator++() - { - hItem = (pCtrl ? pCtrl->GetNextSelectedItem(hItem) : 0); - - return *this; - } - - SelectedTreeItemIterator operator++(int) {SelectedTreeItemIterator old = *this; ++(*this); return old; } - - CXTTreeCtrl* pCtrl; - HTREEITEM hItem; - }; - - SelectedTreeItemIterator BeginSelectedTreeItems(CXTTreeCtrl* pCtrl) - { - return SelectedTreeItemIterator(pCtrl, (pCtrl ? pCtrl->GetFirstSelectedItem() : 0)); - } - - SelectedTreeItemIterator EndSelectedTreeItems(CXTTreeCtrl* pCtrl) - { - return SelectedTreeItemIterator(pCtrl, 0); - } - - template - class SelectedTreeItemDataIterator - { - public: - typedef T Type; - typedef SelectedTreeItemIterator InternalIterator; - - SelectedTreeItemDataIterator() {} - SelectedTreeItemDataIterator(const SelectedTreeItemDataIterator& other) - : iterator(other.iterator) {AdvanceToValidIterator(); } - explicit SelectedTreeItemDataIterator(const InternalIterator& iterator) - : iterator(iterator) {AdvanceToValidIterator(); } - - Type* operator*() {return reinterpret_cast(iterator.pCtrl->GetItemData(iterator.hItem)); } - bool operator==(const SelectedTreeItemDataIterator& other) const {return iterator == other.iterator; } - bool operator!=(const SelectedTreeItemDataIterator& other) const {return iterator != other.iterator; } - - HTREEITEM GetTreeItem() {return iterator.hItem; } - - SelectedTreeItemDataIterator& operator++() - { - ++iterator; - AdvanceToValidIterator(); - return *this; - } - - SelectedTreeItemDataIterator operator++(int) {SelectedTreeItemDataIterator old = *this; ++(*this); return old; } - - private: - void AdvanceToValidIterator() - { - while (iterator.pCtrl && iterator.hItem && !iterator.pCtrl->GetItemData(iterator.hItem)) - { - ++iterator; - } - } - - InternalIterator iterator; - }; - - template - SelectedTreeItemDataIterator BeginSelectedTreeItemData(CXTTreeCtrl* pCtrl) - { - return SelectedTreeItemDataIterator(BeginSelectedTreeItems(pCtrl)); - } - - template - SelectedTreeItemDataIterator EndSelectedTreeItemData(CXTTreeCtrl* pCtrl) - { - return SelectedTreeItemDataIterator(EndSelectedTreeItems(pCtrl)); - } -} - -#endif // CRYINCLUDE_EDITOR_CONTROLS_TREECTRLUTILS_H diff --git a/Code/Editor/EditorPanelUtils.cpp b/Code/Editor/EditorPanelUtils.cpp deleted file mode 100644 index 1a3c9bcb4a..0000000000 --- a/Code/Editor/EditorPanelUtils.cpp +++ /dev/null @@ -1,542 +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 "EditorDefs.h" - -#include "EditorPanelUtils.h" - -#include - -// Qt -#include -#include -#include - -// Editor -#include "IEditorPanelUtils.h" -#include "Objects/EntityObject.h" -#include "CryEditDoc.h" -#include "ViewManager.h" -#include "Controls/QToolTipWidget.h" -#include "Objects/SelectionGroup.h" - - - -#ifndef PI -#define PI 3.14159265358979323f -#endif - - -struct ToolTip -{ - bool isValid; - QString title; - QString content; - QString specialContent; - QString disabledContent; -}; - -// internal implementation for better compile times - should also never be used externally, use IParticleEditorUtils interface for that. -class CEditorPanelUtils_Impl - : public IEditorPanelUtils -{ -public: - void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override - { - for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++) - { - GetIEditor()->GetViewManager()->GetView(i)->SetGlobalDropCallback(dropCallback, custom); - } - } - -public: - - int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override - { - CRY_ASSERT(settings); - return settings->GetDebugFlags(); - } - - void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override - { - CRY_ASSERT(settings); - settings->SetDebugFlags(flags); - } - -protected: - QVector hotkeys; - bool m_hotkeysAreEnabled; -public: - - bool HotKey_Import() override - { - QVector > keys; - QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load", - QString(), "HotKey Config Files (*.hkxml)"); - QFile file(filepath); - if (!file.open(QIODevice::ReadOnly)) - { - return false; - } - QXmlStreamReader stream(&file); - bool result = true; - - while (!stream.isEndDocument()) - { - if (stream.isStartElement()) - { - if (stream.name() == "HotKey") - { - QPair key; - QXmlStreamAttributes att = stream.attributes(); - for (QXmlStreamAttribute attr : att) - { - if (attr.name().compare(QLatin1String("path"), Qt::CaseInsensitive) == 0) - { - key.first = attr.value().toString(); - } - if (attr.name().compare(QLatin1String("sequence"), Qt::CaseInsensitive) == 0) - { - key.second = attr.value().toString(); - } - } - if (!key.first.isEmpty()) - { - keys.push_back(key); // we allow blank key sequences for unassigned shortcuts - } - else - { - result = false; //but not blank paths! - } - } - } - stream.readNext(); - } - file.close(); - - if (result) - { - HotKey_BuildDefaults(); - for (QPair key : keys) - { - for (int j = 0; j < hotkeys.count(); j++) - { - if (hotkeys[j].path.compare(key.first, Qt::CaseInsensitive) == 0) - { - hotkeys[j].SetPath(key.first.toStdString().c_str()); - hotkeys[j].SetSequenceFromString(key.second.toStdString().c_str()); - } - } - } - } - return result; - } - - void HotKey_Export() override - { - auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings"; - QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)"); - QFile file(filepath); - if (!file.open(QIODevice::WriteOnly)) - { - return; - } - - QXmlStreamWriter stream(&file); - stream.setAutoFormatting(true); - stream.writeStartDocument(); - stream.writeStartElement("HotKeys"); - - for (HotKey key : hotkeys) - { - stream.writeStartElement("HotKey"); - stream.writeAttribute("path", key.path); - stream.writeAttribute("sequence", key.sequence.toString()); - stream.writeEndElement(); - } - stream.writeEndElement(); - stream.writeEndDocument(); - file.close(); - } - - QKeySequence HotKey_GetShortcut(const char* path) override - { - for (HotKey combo : hotkeys) - { - if (combo.IsMatch(path)) - { - return combo.sequence; - } - } - return QKeySequence(); - } - - bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override - { - if (!m_hotkeysAreEnabled) - { - return false; - } - unsigned int keyInt = 0; - //Capture any modifiers - Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); - if (modifiers & Qt::ShiftModifier) - { - keyInt += Qt::SHIFT; - } - if (modifiers & Qt::ControlModifier) - { - keyInt += Qt::CTRL; - } - if (modifiers & Qt::AltModifier) - { - keyInt += Qt::ALT; - } - if (modifiers & Qt::MetaModifier) - { - keyInt += Qt::META; - } - //Capture any key - keyInt += event->key(); - - QString t0 = QKeySequence(keyInt).toString(); - QString t1 = HotKey_GetShortcut(path).toString(); - - //if strings match then shortcut is pressed - if (t1.compare(t0, Qt::CaseInsensitive) == 0) - { - return true; - } - return false; - } - - bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override - { - if (!m_hotkeysAreEnabled) - { - return false; - } - - QString t0 = event->key().toString(); - QString t1 = HotKey_GetShortcut(path).toString(); - - //if strings match then shortcut is pressed - if (t1.compare(t0, Qt::CaseInsensitive) == 0) - { - return true; - } - return false; - } - - bool HotKey_LoadExisting() override - { - QSettings settings("O3DE", "O3DE"); - QString group = "Hotkeys/"; - - HotKey_BuildDefaults(); - - int size = settings.beginReadArray(group); - - for (int i = 0; i < size; i++) - { - settings.setArrayIndex(i); - QPair hotkey; - hotkey.first = settings.value("name").toString(); - hotkey.second = settings.value("keySequence").toString(); - if (!hotkey.first.isEmpty()) - { - for (int j = 0; j < hotkeys.count(); j++) - { - if (hotkeys[j].path.compare(hotkey.first, Qt::CaseInsensitive) == 0) - { - hotkeys[j].SetPath(hotkey.first.toStdString().c_str()); - hotkeys[j].SetSequenceFromString(hotkey.second.toStdString().c_str()); - } - } - } - } - - settings.endArray(); - if (hotkeys.isEmpty()) - { - return false; - } - return true; - } - - void HotKey_SaveCurrent() override - { - QSettings settings("O3DE", "O3DE"); - QString group = "Hotkeys/"; - settings.remove("Hotkeys/"); - settings.sync(); - settings.beginWriteArray(group); - int saveIndex = 0; - for (HotKey key : hotkeys) - { - if (!key.path.isEmpty()) - { - settings.setArrayIndex(saveIndex++); - settings.setValue("name", key.path); - settings.setValue("keySequence", key.sequence.toString()); - } - } - settings.endArray(); - settings.sync(); - } - - void HotKey_BuildDefaults() override - { - m_hotkeysAreEnabled = true; - QVector > keys; - while (hotkeys.count() > 0) - { - hotkeys.takeAt(0); - } - - //MENU SELECTION SHORTCUTS//////////////////////////////////////////////// - keys.push_back(QPair("Menus.File Menu", "Alt+F")); - keys.push_back(QPair("Menus.Edit Menu", "Alt+E")); - keys.push_back(QPair("Menus.View Menu", "Alt+V")); - //FILE MENU SHORTCUTS///////////////////////////////////////////////////// - keys.push_back(QPair("File Menu.Create new emitter", "Ctrl+N")); - keys.push_back(QPair("File Menu.Create new library", "Ctrl+Shift+N")); - keys.push_back(QPair("File Menu.Create new folder", "")); - keys.push_back(QPair("File Menu.Import", "Ctrl+I")); - keys.push_back(QPair("File Menu.Import level library", "Ctrl+Shift+I")); - keys.push_back(QPair("File Menu.Save", "Ctrl+S")); - keys.push_back(QPair("File Menu.Close", "Ctrl+Q")); - //EDIT MENU SHORTCUTS///////////////////////////////////////////////////// - keys.push_back(QPair("Edit Menu.Copy", "Ctrl+C")); - keys.push_back(QPair("Edit Menu.Paste", "Ctrl+V")); - keys.push_back(QPair("Edit Menu.Duplicate", "Ctrl+D")); - keys.push_back(QPair("Edit Menu.Undo", "Ctrl+Z")); - keys.push_back(QPair("Edit Menu.Redo", "Ctrl+Shift+Z")); - keys.push_back(QPair("Edit Menu.Group", "Ctrl+Alt+O")); - keys.push_back(QPair("Edit Menu.Ungroup", "Ctrl+Alt+P")); - keys.push_back(QPair("Edit Menu.Rename", "Ctrl+R")); - keys.push_back(QPair("Edit Menu.Reset", "")); - keys.push_back(QPair("Edit Menu.Edit Hotkeys", "")); - keys.push_back(QPair("Edit Menu.Assign to selected", "Ctrl+Space")); - keys.push_back(QPair("Edit Menu.Insert Comment", "Ctrl+Alt+M")); - keys.push_back(QPair("Edit Menu.Enable/Disable Emitter", "Ctrl+E")); - keys.push_back(QPair("File Menu.Enable All", "")); - keys.push_back(QPair("File Menu.Disable All", "")); - keys.push_back(QPair("Edit Menu.Delete", "Del")); - //VIEW MENU SHORTCUTS///////////////////////////////////////////////////// - keys.push_back(QPair("View Menu.Reset Layout", "")); - //PLAYBACK CONTROL//////////////////////////////////////////////////////// - keys.push_back(QPair("Previewer.Play/Pause Toggle", "Space")); - keys.push_back(QPair("Previewer.Step forward through time", "c")); - keys.push_back(QPair("Previewer.Loop Toggle", "z")); - keys.push_back(QPair("Previewer.Reset Playback", "x")); - keys.push_back(QPair("Previewer.Focus", "Ctrl+F")); - keys.push_back(QPair("Previewer.Zoom In", "w")); - keys.push_back(QPair("Previewer.Zoom Out", "s")); - keys.push_back(QPair("Previewer.Pan Left", "a")); - keys.push_back(QPair("Previewer.Pan Right", "d")); - - for (QPair key : keys) - { - unsigned int index = hotkeys.count(); - hotkeys.push_back(HotKey()); - hotkeys[index].SetPath(key.first.toStdString().c_str()); - hotkeys[index].SetSequenceFromString(key.second.toStdString().c_str()); - } - } - - void HotKey_SetKeys(QVector keys) override - { - hotkeys = keys; - } - - QVector HotKey_GetKeys() override - { - return hotkeys; - } - - QString HotKey_GetPressedHotkey(const QKeyEvent* event) override - { - if (!m_hotkeysAreEnabled) - { - return ""; - } - for (HotKey key : hotkeys) - { - if (HotKey_IsPressed(event, key.path.toUtf8())) - { - return key.path; - } - } - return ""; - } - QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override - { - if (!m_hotkeysAreEnabled) - { - return ""; - } - for (HotKey key : hotkeys) - { - if (HotKey_IsPressed(event, key.path.toUtf8())) - { - return key.path; - } - } - return ""; - } - //building the default hotkey list re-enables hotkeys - //do not use this when rebuilding the default list is a possibility. - void HotKey_SetEnabled(bool val) override - { - m_hotkeysAreEnabled = val; - } - - bool HotKey_IsEnabled() const override - { - return m_hotkeysAreEnabled; - } - -protected: - QMap m_tooltips; - - void ToolTip_ParseNode(XmlNodeRef node) - { - if (QString(node->getTag()).compare("tooltip", Qt::CaseInsensitive) != 0) - { - unsigned int childCount = node->getChildCount(); - - for (unsigned int i = 0; i < childCount; i++) - { - ToolTip_ParseNode(node->getChild(i)); - } - } - - QString title = node->getAttr("title"); - QString content = node->getAttr("content"); - QString specialContent = node->getAttr("special_content"); - QString disabledContent = node->getAttr("disabled_content"); - - QMap::iterator itr = m_tooltips.insert(node->getAttr("path"), ToolTip()); - itr->isValid = true; - itr->title = title; - itr->content = content; - itr->specialContent = specialContent; - itr->disabledContent = disabledContent; - - unsigned int childCount = node->getChildCount(); - - for (unsigned int i = 0; i < childCount; i++) - { - ToolTip_ParseNode(node->getChild(i)); - } - } - - ToolTip GetToolTip(QString path) - { - if (m_tooltips.contains(path)) - { - return m_tooltips[path]; - } - ToolTip temp; - temp.isValid = false; - return temp; - } - -public: - void ToolTip_LoadConfigXML(QString filepath) override - { - XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str()); - ToolTip_ParseNode(node); - } - - void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override - { - AZ_Assert(tooltip, "tooltip cannot be null"); - - QString title = ToolTip_GetTitle(path, option); - QString content = ToolTip_GetContent(path, option); - QString specialContent = ToolTip_GetSpecialContentType(path, option); - QString disabledContent = ToolTip_GetDisabledContent(path, option); - - // Even if these items are empty, we set them anyway to clear out any data that was left over from when the tooltip was used for a different object. - tooltip->SetTitle(title); - tooltip->SetContent(content); - - //this only handles simple creation...if you need complex call this then add specials separate - if (!specialContent.contains("::")) - { - tooltip->AddSpecialContent(specialContent, optionalData); - } - - if (!isEnabled) // If disabled, add disabled value - { - tooltip->AppendContent(disabledContent); - } - } - - QString ToolTip_GetTitle(QString path, QString option) override - { - if (!option.isEmpty() && GetToolTip(path + "." + option).isValid) - { - return GetToolTip(path + "." + option).title; - } - if (!option.isEmpty() && GetToolTip("Options." + option).isValid) - { - return GetToolTip("Options." + option).title; - } - return GetToolTip(path).title; - } - - QString ToolTip_GetContent(QString path, QString option) override - { - if (!option.isEmpty() && GetToolTip(path + "." + option).isValid) - { - return GetToolTip(path + "." + option).content; - } - if (!option.isEmpty() && GetToolTip("Options." + option).isValid) - { - return GetToolTip("Options." + option).content; - } - return GetToolTip(path).content; - } - - QString ToolTip_GetSpecialContentType(QString path, QString option) override - { - if (!option.isEmpty() && GetToolTip(path + "." + option).isValid) - { - return GetToolTip(path + "." + option).specialContent; - } - if (!option.isEmpty() && GetToolTip("Options." + option).isValid) - { - return GetToolTip("Options." + option).specialContent; - } - return GetToolTip(path).specialContent; - } - - QString ToolTip_GetDisabledContent(QString path, QString option) override - { - if (!option.isEmpty() && GetToolTip(path + "." + option).isValid) - { - return GetToolTip(path + "." + option).disabledContent; - } - if (!option.isEmpty() && GetToolTip("Options." + option).isValid) - { - return GetToolTip("Options." + option).disabledContent; - } - return GetToolTip(path).disabledContent; - } -}; - -IEditorPanelUtils* CreateEditorPanelUtils() -{ - return new CEditorPanelUtils_Impl(); -} - diff --git a/Code/Editor/EditorPanelUtils.h b/Code/Editor/EditorPanelUtils.h deleted file mode 100644 index 6ac15ebfc9..0000000000 --- a/Code/Editor/EditorPanelUtils.h +++ /dev/null @@ -1,16 +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 - * - */ -// Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. -#ifndef CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H -#define CRYINCLUDE_CRYEDITOR_EDITORPANELUTILS_H -#pragma once - -struct IEditorPanelUtils; -IEditorPanelUtils* CreateEditorPanelUtils(); - -#endif diff --git a/Code/Editor/IEditor.h b/Code/Editor/IEditor.h index c6f72a7dbc..d2d4998187 100644 --- a/Code/Editor/IEditor.h +++ b/Code/Editor/IEditor.h @@ -69,7 +69,6 @@ class CSelectionTreeManager; struct SEditorSettings; class CGameExporter; class IAWSResourceManager; -struct IEditorPanelUtils; namespace WinWidget { @@ -526,8 +525,6 @@ struct IEditor virtual IEditorMaterialManager* GetIEditorMaterialManager() = 0; // Vladimir@Conffx //! Returns IconManager. virtual IIconManager* GetIconManager() = 0; - //! Get Panel Editor Utilities - virtual IEditorPanelUtils* GetEditorPanelUtils() = 0; //! Get Music Manager. virtual CMusicManager* GetMusicManager() = 0; virtual float GetTerrainElevation(float x, float y) = 0; diff --git a/Code/Editor/IEditorImpl.cpp b/Code/Editor/IEditorImpl.cpp index 5bd816174c..0846cf8a9e 100644 --- a/Code/Editor/IEditorImpl.cpp +++ b/Code/Editor/IEditorImpl.cpp @@ -81,9 +81,6 @@ AZ_POP_DISABLE_WARNING // AWSNativeSDK #include -#include "IEditorPanelUtils.h" -#include "EditorPanelUtils.h" - #include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication static CCryEditDoc * theDocument; @@ -143,7 +140,6 @@ CEditorImpl::CEditorImpl() , m_QtApplication(static_cast(qApp)) , m_pImageUtil(nullptr) , m_pLogFile(nullptr) - , m_panelEditorUtils(nullptr) { // note that this is a call into EditorCore.dll, which stores the g_pEditorPointer for all shared modules that share EditorCore.dll // this means that they don't need to do SetIEditor(...) themselves and its available immediately @@ -167,8 +163,6 @@ CEditorImpl::CEditorImpl() m_pDisplaySettings->LoadRegistry(); m_pPluginManager = new CPluginManager; - m_panelEditorUtils = CreateEditorPanelUtils(); - m_pObjectManager = new CObjectManager; m_pViewManager = new CViewManager; m_pIconManager = new CIconManager; @@ -301,8 +295,6 @@ CEditorImpl::~CEditorImpl() SAFE_DELETE(m_pViewManager) SAFE_DELETE(m_pObjectManager) // relies on prefab manager - SAFE_DELETE(m_panelEditorUtils); - // some plugins may be exporter - this must be above plugin manager delete. SAFE_DELETE(m_pExportManager); @@ -1658,8 +1650,3 @@ void CEditorImpl::DestroyQMimeData(QMimeData* data) const { delete data; } - -IEditorPanelUtils* CEditorImpl::GetEditorPanelUtils() -{ - return m_panelEditorUtils; -} diff --git a/Code/Editor/IEditorImpl.h b/Code/Editor/IEditorImpl.h index 4976c0c1ca..d99b8ae802 100644 --- a/Code/Editor/IEditorImpl.h +++ b/Code/Editor/IEditorImpl.h @@ -298,7 +298,6 @@ public: IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx IImageUtil* GetImageUtil() override; // Vladimir@conffx SEditorSettings* GetEditorSettings() override; - IEditorPanelUtils* GetEditorPanelUtils() override; ILogFile* GetLogFile() override { return m_pLogFile; } void UnloadPlugins() override; @@ -356,7 +355,6 @@ protected: CErrorsDlg* m_pErrorsDlg; //! Source control interface. ISourceControl* m_pSourceControl; - IEditorPanelUtils* m_panelEditorUtils; CSelectionTreeManager* m_pSelectionTreeManager; diff --git a/Code/Editor/IEditorPanelUtils.h b/Code/Editor/IEditorPanelUtils.h deleted file mode 100644 index 4649213ae7..0000000000 --- a/Code/Editor/IEditorPanelUtils.h +++ /dev/null @@ -1,131 +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 - */ - -#ifndef CRYINCLUDE_CRYEDITOR_IPANELEDITORUTILS_H -#define CRYINCLUDE_CRYEDITOR_IPANELEDITORUTILS_H -#pragma once - -#include "Cry_Vector3.h" - -#include "DisplaySettings.h" -#include "Include/IDisplayViewport.h" -#include "Include/IIconManager.h" -#include -#include -#include -#include - -class CBaseObject; -class CViewport; -class IQToolTip; - -struct HotKey -{ - HotKey() - : path("") - , sequence(QKeySequence()) - { - } - void CopyFrom(const HotKey& other) - { - path = other.path; - sequence = other.sequence; - } - void SetPath(const char* _path) - { - path = QString(_path); - } - void SetSequenceFromString(const char* _sequence) - { - sequence = QKeySequence::fromString(_sequence); - } - void SetSequence(const QKeySequence& other) - { - sequence = other; - } - bool IsMatch(QString _path) - { - return path.compare(_path, Qt::CaseInsensitive) == 0; - } - bool IsMatch(QKeySequence _sequence) - { - return sequence.matches(_sequence); - } - bool operator < (const HotKey& other) const - { - //split the paths into lists compare per level - QStringList m_categories = path.split('.'); - QStringList o_categories = other.path.split('.'); - int m_catSize = m_categories.size(); - int o_catSize = o_categories.size(); - int size = (m_catSize < o_catSize) ? m_catSize : o_catSize; - - //sort categories to keep them together - for (int i = 0; i < size; i++) - { - if (m_categories[i] < o_categories[i]) - { - return true; - } - if (m_categories[i] > o_categories[i]) - { - return false; - } - } - //if comparing a category and a item in that category the category is < item - return m_catSize > o_catSize; - } - QKeySequence sequence; - QString path; -}; - -struct IEditorPanelUtils -{ - virtual ~IEditorPanelUtils() {} - virtual void SetViewportDragOperation(void(*)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) = 0; - - //PREVIEW WINDOW UTILS//////////////////////////////////////////////////// - virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) = 0; - virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) = 0; - - //HOTKEY UTILS//////////////////////////////////////////////////////////// - virtual bool HotKey_Import() = 0; - virtual void HotKey_Export() = 0; - virtual QKeySequence HotKey_GetShortcut(const char* path) = 0; - virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) = 0; - virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) = 0; - virtual bool HotKey_LoadExisting() = 0; - virtual void HotKey_SaveCurrent() = 0; - virtual void HotKey_BuildDefaults() = 0; - virtual void HotKey_SetKeys(QVector keys) = 0; - virtual QVector HotKey_GetKeys() = 0; - virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) = 0; - virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) = 0; - virtual void HotKey_SetEnabled(bool val) = 0; - virtual bool HotKey_IsEnabled() const = 0; - - //TOOLTIP UTILS/////////////////////////////////////////////////////////// - - //! Loads a table of tooltip configuration data from an xml file. - virtual void ToolTip_LoadConfigXML(QString filepath) = 0; - - //! Initializes a QToolTipWidget from loaded configuration data (see ToolTip_LoadConfigXML()) - //! \param tooltip Will be initialized using loaded configuration data - //! \param path Variable serialization path. Will be used as the key for looking up data in the configuration table. (ex: "Rotation.Rotation_Rate_X") - //! \param option Name of a sub-option of the variable specified by "path". (ex: "Emitter_Strength" will look up the tooltip data for "Rotation.Rotation_Rate_X.Emitter_Strength") - //! \param optionalData The argument to be used with "special_content" feature. See ToolTip_GetSpecialContentType() and QToolTipWidget::AddSpecialContent(). - //! \param isEnabled If false, the tooltip will indicate the reason why the widget is disabled. - virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) = 0; - - virtual QString ToolTip_GetTitle(QString path, QString option = "") = 0; - virtual QString ToolTip_GetContent(QString path, QString option = "") = 0; - virtual QString ToolTip_GetSpecialContentType(QString path, QString option = "") = 0; - virtual QString ToolTip_GetDisabledContent(QString path, QString option = "") = 0; -}; - - -#endif diff --git a/Code/Editor/Lib/Tests/IEditorMock.h b/Code/Editor/Lib/Tests/IEditorMock.h index 390ffebe79..590f98e6d7 100644 --- a/Code/Editor/Lib/Tests/IEditorMock.h +++ b/Code/Editor/Lib/Tests/IEditorMock.h @@ -187,6 +187,5 @@ public: MOCK_METHOD0(UnloadPlugins, void()); MOCK_METHOD0(LoadPlugins, void()); MOCK_METHOD1(GetSearchPath, QString(EEditorPathName)); - MOCK_METHOD0(GetEditorPanelUtils, IEditorPanelUtils* ()); }; diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index a63a74f01d..a018333925 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -334,23 +334,12 @@ set(FILES Controls/ConsoleSCB.qrc Controls/FolderTreeCtrl.cpp Controls/FolderTreeCtrl.h - Controls/HotTrackingTreeCtrl.cpp - Controls/HotTrackingTreeCtrl.h Controls/ImageHistogramCtrl.cpp Controls/ImageHistogramCtrl.h - Controls/ImageListCtrl.cpp - Controls/ImageListCtrl.h - Controls/MultiMonHelper.cpp - Controls/MultiMonHelper.h - Controls/NumberCtrl.cpp - Controls/NumberCtrl.h - Controls/NumberCtrl.h Controls/SplineCtrl.cpp Controls/SplineCtrl.h Controls/SplineCtrlEx.cpp Controls/SplineCtrlEx.h - Controls/TextEditorCtrl.cpp - Controls/TextEditorCtrl.h Controls/TimelineCtrl.cpp Controls/TimelineCtrl.h Controls/WndGridHelper.h @@ -796,9 +785,6 @@ set(FILES ViewportTitleDlg.h EditorEnvironment.cpp EditorEnvironment.h - IEditorPanelUtils.h - EditorPanelUtils.h - EditorPanelUtils.cpp )