summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-05-31 14:09:33 +0300
committerTomi Korpipää <tomi.korpipaa@qt.io>2018-06-01 04:11:48 +0000
commit828c18fbe3b29d7e3571037f678ec43dd0ae1cba (patch)
treefff682ad098862e660e9900d9181ca75cff0bfa6
parent8fc0026450fbd9c4591561874578001483cabacb (diff)
Clean up old controls
Remove unused controls from Authoring/Studio/Controls and some ancillary files elsewhere. Task-number: QT3DS-1828 Change-Id: I6461112a02cc24ef0c169b3a99de26b034065040 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDataDrivenChangeListener.h64
-rw-r--r--src/Authoring/Client/Code/Core/Doc/IDragable.h1
-rw-r--r--src/Authoring/Client/Code/Core/Utility/HotKeys.cpp16
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp528
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioPreferences.h65
-rw-r--r--src/Authoring/Common/Code/Literals.h2
-rw-r--r--src/Authoring/Studio/Application/StudioColors.h137
-rw-r--r--src/Authoring/Studio/Application/StudioConst.h116
-rw-r--r--src/Authoring/Studio/Controls/BaseMeasure.cpp206
-rw-r--r--src/Authoring/Studio/Controls/BaseMeasure.h81
-rw-r--r--src/Authoring/Studio/Controls/BlankControl.cpp118
-rw-r--r--src/Authoring/Studio/Controls/BlankControl.h57
-rw-r--r--src/Authoring/Studio/Controls/BreadCrumbControl.cpp328
-rw-r--r--src/Authoring/Studio/Controls/BreadCrumbControl.h94
-rw-r--r--src/Authoring/Studio/Controls/ButtonControl.cpp425
-rw-r--r--src/Authoring/Studio/Controls/ButtonControl.h123
-rw-r--r--src/Authoring/Studio/Controls/ComboTextBox.h65
-rw-r--r--src/Authoring/Studio/Controls/EditInPlace.h280
-rw-r--r--src/Authoring/Studio/Controls/FloatEdit.cpp519
-rw-r--r--src/Authoring/Studio/Controls/FloatEdit.h115
-rw-r--r--src/Authoring/Studio/Controls/FlowLayout.cpp1009
-rw-r--r--src/Authoring/Studio/Controls/FlowLayout.h140
-rw-r--r--src/Authoring/Studio/Controls/GenericComboDropDown.h99
-rw-r--r--src/Authoring/Studio/Controls/GenericEdit.h94
-rw-r--r--src/Authoring/Studio/Controls/InsertionLine.cpp142
-rw-r--r--src/Authoring/Studio/Controls/InsertionLine.h76
-rw-r--r--src/Authoring/Studio/Controls/InsertionOverlay.cpp112
-rw-r--r--src/Authoring/Studio/Controls/InsertionOverlay.h74
-rw-r--r--src/Authoring/Studio/Controls/LazyFlow.cpp318
-rw-r--r--src/Authoring/Studio/Controls/LazyFlow.h262
-rw-r--r--src/Authoring/Studio/Controls/ListBoxItem.cpp277
-rw-r--r--src/Authoring/Studio/Controls/ListBoxItem.h101
-rw-r--r--src/Authoring/Studio/Controls/ListBoxStringItem.cpp108
-rw-r--r--src/Authoring/Studio/Controls/ListBoxStringItem.h72
-rw-r--r--src/Authoring/Studio/Controls/ListLayout.cpp185
-rw-r--r--src/Authoring/Studio/Controls/ListLayout.h60
-rw-r--r--src/Authoring/Studio/Controls/NameEdit.cpp137
-rw-r--r--src/Authoring/Studio/Controls/NameEdit.h70
-rw-r--r--src/Authoring/Studio/Controls/OverlayControl.cpp240
-rw-r--r--src/Authoring/Studio/Controls/OverlayControl.h83
-rw-r--r--src/Authoring/Studio/Controls/ProceduralButton.h569
-rw-r--r--src/Authoring/Studio/Controls/SIcon.cpp165
-rw-r--r--src/Authoring/Studio/Controls/SIcon.h74
-rw-r--r--src/Authoring/Studio/Controls/ScrollController.cpp203
-rw-r--r--src/Authoring/Studio/Controls/ScrollController.h82
-rw-r--r--src/Authoring/Studio/Controls/Scroller.cpp829
-rw-r--r--src/Authoring/Studio/Controls/Scroller.h171
-rw-r--r--src/Authoring/Studio/Controls/ScrollerBackground.cpp182
-rw-r--r--src/Authoring/Studio/Controls/ScrollerBackground.h69
-rw-r--r--src/Authoring/Studio/Controls/ScrollerBar.cpp318
-rw-r--r--src/Authoring/Studio/Controls/ScrollerBar.h120
-rw-r--r--src/Authoring/Studio/Controls/ScrollerButtonControl.cpp96
-rw-r--r--src/Authoring/Studio/Controls/ScrollerButtonControl.h76
-rw-r--r--src/Authoring/Studio/Controls/ScrollerThumb.cpp148
-rw-r--r--src/Authoring/Studio/Controls/ScrollerThumb.h76
-rw-r--r--src/Authoring/Studio/Controls/SplashControl.cpp104
-rw-r--r--src/Authoring/Studio/Controls/SplashControl.h66
-rw-r--r--src/Authoring/Studio/Controls/SplitBar.cpp216
-rw-r--r--src/Authoring/Studio/Controls/SplitBar.h98
-rw-r--r--src/Authoring/Studio/Controls/Splitter.cpp419
-rw-r--r--src/Authoring/Studio/Controls/Splitter.h74
-rw-r--r--src/Authoring/Studio/Controls/StringEdit.cpp246
-rw-r--r--src/Authoring/Studio/Controls/StringEdit.h73
-rw-r--r--src/Authoring/Studio/Controls/TextButton.h348
-rw-r--r--src/Authoring/Studio/Controls/TextEdit.cpp1498
-rw-r--r--src/Authoring/Studio/Controls/TextEdit.h216
-rw-r--r--src/Authoring/Studio/Controls/TextEditContextMenu.cpp135
-rw-r--r--src/Authoring/Studio/Controls/TextEditContextMenu.h77
-rw-r--r--src/Authoring/Studio/Controls/TextEditInPlace.cpp326
-rw-r--r--src/Authoring/Studio/Controls/TextEditInPlace.h92
-rw-r--r--src/Authoring/Studio/Controls/TimeEdit.cpp195
-rw-r--r--src/Authoring/Studio/Controls/TimeEdit.h81
-rw-r--r--src/Authoring/Studio/Controls/ToggleButton.cpp140
-rw-r--r--src/Authoring/Studio/Controls/ToggleButton.h91
-rw-r--r--src/Authoring/Studio/Controls/TreeControl.cpp766
-rw-r--r--src/Authoring/Studio/Controls/TreeControl.h140
-rw-r--r--src/Authoring/Studio/Controls/TreeItem.cpp953
-rw-r--r--src/Authoring/Studio/Controls/TreeItem.h159
-rw-r--r--src/Authoring/Studio/Controls/WinRenderer.h2
-rw-r--r--src/Authoring/Studio/Docs/CmdLineOptions.txt27
-rw-r--r--src/Authoring/Studio/DragAndDrop/DropProxy.cpp12
-rw-r--r--src/Authoring/Studio/DragAndDrop/DropSource.cpp10
-rw-r--r--src/Authoring/Studio/DragAndDrop/ListBoxDropSource.cpp83
-rw-r--r--src/Authoring/Studio/DragAndDrop/ListBoxDropSource.h60
-rw-r--r--src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.cpp116
-rw-r--r--src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.h65
-rw-r--r--src/Authoring/Studio/DragAndDrop/TimelineDropSource.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/IEasyInspectorRowListener.h48
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/Qt3DSDMInspectorRow.h2
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/Qt3DSDMMaterialInspectable.cpp135
-rw-r--r--src/Authoring/Studio/Palettes/PaletteManager.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp2
-rw-r--r--src/Authoring/Studio/Qt3DStudio.pro40
96 files changed, 20 insertions, 17280 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/IDataDrivenChangeListener.h b/src/Authoring/Client/Code/Core/Doc/IDataDrivenChangeListener.h
deleted file mode 100644
index 149e8cc5..00000000
--- a/src/Authoring/Client/Code/Core/Doc/IDataDrivenChangeListener.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_DATADRIVENCHANGE_LISTENER_H
-#define INCLUDED_DATADRIVENCHANGE_LISTENER_H 1
-
-#pragma once
-
-//==============================================================================
-/**
- * @class IDataDrivenChangeListener
- * @brief Provides an interface for notifying listeners that the data driven property (not
- *the value) has changed.
- */
-class IDataDrivenChangeListener
-{
-public:
- virtual ~IDataDrivenChangeListener() {}
- //==============================================================================
- /**
- * @param inIsDataDriven will be true if an item was set to data driven and false otherwise.
- * @param inPropName property that is affected
- */
- virtual void OnDataDrivenChange(bool /*inIsDataDriven*/,
- const Q3DStudio::CString & /*inPropName*/) = 0;
-
- //==============================================================================
- /**
- * Called when if the data drive link is changed
- * @param inPropName property that is affected
- */
- virtual void OnDataDrivenLinkValueChange(const Q3DStudio::CString & /*inPropName*/) = 0;
-};
-
-#endif // INCLUDED_DATADRIVENCHANGE_LISTENER_H
diff --git a/src/Authoring/Client/Code/Core/Doc/IDragable.h b/src/Authoring/Client/Code/Core/Doc/IDragable.h
index 817649df..52d5b7bf 100644
--- a/src/Authoring/Client/Code/Core/Doc/IDragable.h
+++ b/src/Authoring/Client/Code/Core/Doc/IDragable.h
@@ -47,7 +47,6 @@
enum QT3DS_FLAVOR {
QT3DS_FLAVOR_FILE = 15,
QT3DS_FLAVOR_TEXT = 1,
- QT3DS_FLAVOR_LISTBOX = 'LBOX',
QT3DS_FLAVOR_BASIC_OBJECTS = 'UIBO',
QT3DS_FLAVOR_ASSET_LIB = 'UILB',
QT3DS_FLAVOR_ASSET_TL = 'UITL',
diff --git a/src/Authoring/Client/Code/Core/Utility/HotKeys.cpp b/src/Authoring/Client/Code/Core/Utility/HotKeys.cpp
index c5fc7a0a..542d5370 100644
--- a/src/Authoring/Client/Code/Core/Utility/HotKeys.cpp
+++ b/src/Authoring/Client/Code/Core/Utility/HotKeys.cpp
@@ -40,8 +40,6 @@
#include "Studio/UI/SceneView.h"
#include "Studio/MainFrm.h"
-#include "Studio/Controls/TextEdit.h"
-#include "Studio/Controls/WidgetControl.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/qevent.h>
@@ -50,6 +48,8 @@
#include <QtQuick/qquickitem.h>
#include <QtWidgets/qcombobox.h>
#include <QtWidgets/qabstractbutton.h>
+#include <QtWidgets/qgraphicsview.h>
+#include <QtWidgets/qgraphicsitem.h>
class KeyEventFilter : public QObject
{
@@ -93,7 +93,7 @@ public:
return false;
}
- // Ignore global shortcuts if we are in an "old" style textedit or qml control that
+ // Ignore global shortcuts if we are in a text control that
// wants key events.
if (m_hotkeys->isFocusOnControlThatWantsKeys())
return false;
@@ -585,12 +585,12 @@ Qt::KeyboardModifiers CHotKeys::GetCurrentKeyModifiers()
bool CHotKeys::isFocusOnControlThatWantsKeys()
{
- auto widgetControl = dynamic_cast<WidgetControl *>(qApp->focusObject());
- if (widgetControl) {
- auto control = widgetControl->getControl();
+ auto gview = qobject_cast<QGraphicsView *>(qApp->focusObject());
+ if (gview) {
+ auto control = gview->scene()->focusItem();
if (control) {
- auto te = dynamic_cast<CTextEdit *>(control->FocusedChild());
- if (te && !te->IsReadOnly())
+ auto obj = qobject_cast<QGraphicsTextItem *>(control->toGraphicsObject());
+ if (obj)
return true;
}
} else {
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
index 8d711fd4..c910dc16 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
+++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.cpp
@@ -27,9 +27,6 @@
**
****************************************************************************/
-//==============================================================================
-// Prefix
-//==============================================================================
#include "stdafx.h"
#include "StudioPreferences.h"
@@ -38,9 +35,6 @@
#include "MasterP.h"
#include "CommonConstants.h"
-// using namespace Q3DStudio; <-- Do not do this here because it will conflict with CList and make
-// the template generator go blah
-
#include <QtGui/qpalette.h>
#include <QtQml/qqmlcontext.h>
@@ -49,28 +43,7 @@
::CColor s_NormalColor;
::CColor s_MasterColor;
::CColor s_MouseOverHighlightColor;
-::CColor s_SelectColor;
::CColor s_ButtonDownColor;
-::CColor s_TopRowColor;
-::CColor s_LayerBackgroundColor;
-::CColor s_LayerHighlightBGColor;
-::CColor s_ExtendedLockedLightColor;
-::CColor s_LockedBorderColor;
-::CColor s_ScrollBGColor;
-::CColor s_TextBoxBGColorWithFocus;
-::CColor s_ControlRectBottomLineDarkColor;
-::CColor s_ControlRectBottomLineColor;
-::CColor s_ControlRectSideLineColor;
-::CColor s_ControlRectTopLineColor;
-::CColor s_ExtendedObjectLightColor;
-::CColor s_ComboEditBoxGradientStartColor;
-::CColor s_TimebarBorderColor;
-::CColor s_RowTopColor;
-::CColor s_ButtonHighlightColor;
-::CColor s_PropertyFloorColor;
-::CColor s_ButtonShadowColor;
-::CColor s_TreeFloorColor;
-::CColor s_TabButtonDownColor;
::CColor s_DisabledTextColor;
QColor s_studioColor1;
@@ -89,8 +62,6 @@ int s_idWidth;
int s_valueWidth;
QSize s_browserPopupSize;
-bool CStudioPreferences::m_SudoMode = false;
-
#define STRINGIFY(x) STRINGIFY2(x)
#define STRINGIFY2(x) #x
@@ -126,68 +97,10 @@ void CStudioPreferences::LoadPreferences()
s_MouseOverHighlightColor = s_BaseColor;
s_MouseOverHighlightColor.SetLuminance(s_MouseOverHighlightColor.GetLuminance() - 0.05f);
- s_SelectColor = s_BaseColor;
- s_SelectColor.SetLuminance(s_SelectColor.GetLuminance() - 0.10f);
-
s_ButtonDownColor = s_DarkBaseColor; // CPreferences::GetUserPreferences( "Preferences"
// ).GetColorValue( "ButtonDownColor", ::CColor( 118, 202,
// 8 ) );
- m_SudoMode = CPreferences::GetUserPreferences().GetValue("sudo", false);
-
- s_TopRowColor = s_BaseColor;
- s_TopRowColor.SetLuminance(s_TopRowColor.GetLuminance() - 0.10f);
-
- s_ExtendedLockedLightColor = s_BaseColor;
- s_ExtendedLockedLightColor.SetLuminance(s_ExtendedLockedLightColor.GetLuminance() + 0.07f);
-
- s_LockedBorderColor = s_BaseColor;
- s_LockedBorderColor.SetLuminance(s_LockedBorderColor.GetLuminance() - 0.07f);
-
- s_ScrollBGColor = s_BaseColor;
-
- s_TextBoxBGColorWithFocus = s_BaseColor;
- s_TextBoxBGColorWithFocus.SetLuminance(s_TextBoxBGColorWithFocus.GetLuminance() + 0.20f);
-
- s_ControlRectBottomLineDarkColor = s_BaseColor;
- s_ControlRectBottomLineDarkColor.SetLuminance(s_ControlRectBottomLineDarkColor.GetLuminance()
- - 0.50f);
-
- s_ControlRectBottomLineColor = s_BaseColor;
- s_ControlRectBottomLineColor.SetLuminance(s_ControlRectBottomLineColor.GetLuminance() - 0.20f);
-
- s_ControlRectSideLineColor = s_BaseColor;
- s_ControlRectSideLineColor.SetLuminance(s_ControlRectSideLineColor.GetLuminance() - 0.20f);
-
- s_ControlRectTopLineColor = s_BaseColor;
- s_ControlRectTopLineColor.SetLuminance(s_ControlRectTopLineColor.GetLuminance() - 0.30f);
-
- s_ExtendedObjectLightColor = s_BaseColor;
- s_ExtendedObjectLightColor.SetLuminance(s_ExtendedObjectLightColor.GetLuminance() + 0.13f);
-
- s_ComboEditBoxGradientStartColor = s_BaseColor;
- s_ComboEditBoxGradientStartColor.SetLuminance(s_ComboEditBoxGradientStartColor.GetLuminance()
- + 0.14f);
-
- s_TimebarBorderColor = s_BaseColor;
- s_TimebarBorderColor.SetLuminance(s_TimebarBorderColor.GetLuminance() - 0.45f);
-
- s_RowTopColor = s_BaseColor;
- s_RowTopColor.SetLuminance(s_RowTopColor.GetLuminance() - 0.45f);
-
- s_ButtonHighlightColor = s_BaseColor;
- s_ButtonHighlightColor.SetLuminance(s_ButtonHighlightColor.GetLuminance() + 0.14f);
-
- s_PropertyFloorColor = s_BaseColor;
- s_PropertyFloorColor.SetLuminance(s_PropertyFloorColor.GetLuminance() - 0.07f);
-
- s_ButtonShadowColor = s_BaseColor;
- s_ButtonShadowColor.SetLuminance(s_ButtonShadowColor.GetLuminance() - 0.45f);
-
- s_TreeFloorColor = s_BaseColor;
- s_TreeFloorColor.SetLuminance(s_TreeFloorColor.GetLuminance() - 0.07f);
-
- s_TabButtonDownColor = ::CColor(175, 175, 175); // rgb value is 249, 255, 195
s_DisabledTextColor = ::CColor(128, 128, 128);
s_studioColor1 = QColor("#262829");
@@ -445,16 +358,6 @@ void CStudioPreferences::SetShowTooltips(bool inShowTooltips)
//==============================================================================
/**
- * @return the color to use for the background of a tooltip
- */
-::CColor CStudioPreferences::GetTooltipBackgroundColor()
-{
- ::CColor theTooltipBGColor(255, 255, 225);
- return theTooltipBGColor;
-}
-
-//==============================================================================
-/**
* Returns the preferred location of the timeline's splitter bar.
*/
long CStudioPreferences::GetTimelineSplitterLocation()
@@ -736,55 +639,6 @@ void CStudioPreferences::SetBigTimeAdvanceAmount(long inTime)
CPreferences::GetUserPreferences().SetLongValue("BigTimeAdvance", inTime);
}
-//==============================================================================
-/**
- * Color used in between most tree items in the timeline.
- */
-::CColor CStudioPreferences::GetTreeFloorColor()
-{
- return s_BaseColor;
-}
-
-//==============================================================================
-/**
- * @return darker shadow color for use around the edges of most controls
- */
-::CColor CStudioPreferences::GetButtonShadowColor()
-{
- return s_BaseColor;
-}
-
-//==============================================================================
-/**
- * Color to use between property rows and as the darker color behind the highlights
- * within the timeline.
- */
-::CColor CStudioPreferences::GetPropertyFloorColor()
-{
- return s_BaseColor;
-}
-
-::CColor CStudioPreferences::GetButtonHighlightColor()
-{
- return s_BaseColor;
-}
-
-//==============================================================================
-/**
- * Retrieves the color that should be used when the mouse goes over a row, such
- * as in the timeline or inspector palettes.
- */
-::CColor CStudioPreferences::GetSelectColor()
-{
- return ::CColor("#46a2da");
-}
-
-::CColor CStudioPreferences::GetTimelineSelectColor()
-{
- return s_selectionColor; // The normal select color (#46a2da) does not work with master color
-}
-
-//==============================================================================
/**
* Retrieves the color that should be used when the mouse goes over a row, such
* as in the timeline or inspector palettes.
@@ -793,76 +647,7 @@ void CStudioPreferences::SetBigTimeAdvanceAmount(long inTime)
{
return s_MouseOverHighlightColor;
}
-//==============================================================================
-/**
- * @return the fill color of the top-most row of a palette (for instance, the fill color behind the
- * time measure)
- */
-::CColor CStudioPreferences::GetRowTopColor()
-{
- return s_RowTopColor;
-}
-::CColor CStudioPreferences::GetTimeBarBorderColor()
-{
- return s_TimebarBorderColor;
-}
-
-//=============================================================================
-/**
- * @return color to use for the background of a property row in the timeline
- */
-::CColor CStudioPreferences::GetPropertyBackgroundColor()
-{
- return s_BaseColor;
-}
-
-//=============================================================================
-/**
- * @return color to use for the background of a property row in the timeline
- * when the mouse is over the row
- */
-::CColor CStudioPreferences::GetPropertyMouseOverColor()
-{
- return CStudioPreferences::GetMouseOverHighlightColor();
-}
-
-//=============================================================================
-/**
- * @return color to use for the background of a property row in the timeline
- */
-::CColor CStudioPreferences::GetComboEditBoxGradientStartColor()
-{
- return s_ComboEditBoxGradientStartColor;
-}
-
-::CColor CStudioPreferences::GetPropertyTimbarLeft()
-{
- return s_BaseColor;
-}
-
-//=============================================================================
-/**
- * Returns the base color which is what most of the other colors derive from.
- * The base color is also used to fill in empty areas of some controls and
- * palettes.
- * @return Base color from which most of the other colors are derived
- */
-::CColor CStudioPreferences::GetBaseColor()
-{
- return s_BaseColor;
-}
-
-//=============================================================================
-/**
- * @return a darker version of the base color
- */
-::CColor CStudioPreferences::GetDarkBaseColor()
-{
- return s_DarkBaseColor;
-}
-
-//=============================================================================
/**
* Returns the normal color used for non-master items and text throughout the UI
*/
@@ -889,211 +674,6 @@ void CStudioPreferences::SetBigTimeAdvanceAmount(long inTime)
return s_disabledColor;
}
-//=============================================================================
-/**
- * Returns the background color of the toolbars. This is now just the base color.
- */
-::CColor CStudioPreferences::GetToolBarBaseColor()
-{
- return GetBaseColor();
-}
-
-//=============================================================================
-/**
- * Returns the background color of the menu bar
- * sk - Ideally this would be the BaseColor (what the palettes are using) but there is a border with
- * the windows color that
- * I have not figured where it can be customized, so for the time being, that this fallback on the
- * old window system color (jason prefers that anyways)
- * This should be equivalent to if the associated code that uses this color, do not exist, but this
- * will allow us to easily change the color when we want to.
- */
-::CColor CStudioPreferences::GetMenuBarBaseColor()
-{
- QColor theWinColor = QPalette().color(QPalette::Background);
- return ::CColor(theWinColor.red(), theWinColor.green(), theWinColor.blue());
-}
-
-//=============================================================================
-/**
- * Returns the "button down color" used by some procedurally drawn CButtonControls.
- */
-::CColor CStudioPreferences::GetButtonDownColor()
-{
- return s_ButtonDownColor;
-}
-
-::CColor CStudioPreferences::GetExtendedObjectLightColor()
-{
- return s_ExtendedObjectLightColor;
-}
-
-::CColor CStudioPreferences::GetExtendedObjectDarkColor()
-{
- return GetBaseColor();
-}
-
-//=============================================================================
-/**
- * Controls, such as CTextEdit draw rects with different color sides around the
- * control. This function retrieves the color for the top line of the rect.
- */
-::CColor CStudioPreferences::GetControlRectTopLineColor()
-{
- return s_ControlRectTopLineColor;
-}
-
-//=============================================================================
-/**
- * Controls, such as CTextEdit draw rects with different color sides around the
- * control. This function retrieves the color for the left and right lines of
- * the rect.
- */
-::CColor CStudioPreferences::GetControlRectSideLineColor()
-{
- return s_ControlRectSideLineColor;
-}
-
-//=============================================================================
-/**
- * Controls, such as CTextEdit draw rects with different color sides around the
- * control. This function retrieves the color for the bottom line of the rect.
- */
-::CColor CStudioPreferences::GetControlRectBottomLineColor()
-{
- return s_ControlRectBottomLineColor;
-}
-
-//=============================================================================
-/**
- * Controls, such as CTextEdit draw rects with different color sides around the
- * control. This function retrieves the color for the bottom line of the rect,
- * for certain controls that have a darker bottom line (see CComboTextBox).
- */
-::CColor CStudioPreferences::GetControlRectBottomLineDarkColor()
-{
- return s_ControlRectBottomLineDarkColor;
-}
-
-//=============================================================================
-/**
- * Controls sometimes have a drop-shadow on the top of the control (an indented
- * control) or on the bottom (an outdented control). This function returns the
- * appropriate color.
- */
-::CColor CStudioPreferences::GetControlShadowColor()
-{
- ::CColor theColor = GetBaseColor();
- return theColor;
-}
-
-//=============================================================================
-/**
- * Fill color for text boxes that do not have focus.
- */
-::CColor CStudioPreferences::GetTextBoxBGColorNoFocus()
-{
- return s_BaseColor;
-}
-
-//=============================================================================
-/**
- * Fill color for text boxes that do have focus.
- */
-::CColor CStudioPreferences::GetTextBoxBGColorWithFocus()
-{
- return s_TextBoxBGColorWithFocus;
-}
-
-//=============================================================================
-/**
- * @return background color for scroll bars (behind thumb)
- */
-::CColor CStudioPreferences::GetScrollBGColor()
-{
- return s_ScrollBGColor;
-}
-
-//=============================================================================
-/**
- * @return color of the scroll bar thumb
- */
-::CColor CStudioPreferences::GetScrollThumbBGColor()
-{
- return CColor("#999A9B");
-}
-
-//=============================================================================
-/**
- * @return color of the scalable handle of the thumb
- */
-::CColor CStudioPreferences::GetScrollThumbHighlightColor()
-{
- return s_studioColor2;
-}
-
-//=============================================================================
-/**
- * @return color for the outline of the scroll bar thumb (opposite side of the highlight)
- */
-::CColor CStudioPreferences::GetLockedTimebarColor()
-{
- return GetBaseColor();
-}
-
-::CColor CStudioPreferences::GetLockedBorderColor()
-{
- return s_LockedBorderColor;
-}
-
-::CColor CStudioPreferences::GetExtendedLockedLightColor()
-{
- return s_ExtendedLockedLightColor;
-}
-
-::CColor CStudioPreferences::GetExtendedLockedDarkColor()
-{
- return GetLockedBorderColor();
-}
-
-//=============================================================================
-/**
- * @return color for disabled (locked) text
- */
-::CColor CStudioPreferences::GetLockedTextColor()
-{
- return s_disabledColor;
-}
-
-//=============================================================================
-/**
- * @return color for background of layer rows in the timeline
- */
-::CColor CStudioPreferences::GetLayerBackgroundColor()
-{
- return s_backgroundColor;
-}
-
-//=============================================================================
-/**
- * @return color of timeline row background for layers when mouse is over
- */
-::CColor CStudioPreferences::GetGroupBackgroundColor()
-{
- return s_studioColor2;
-}
-
-//=============================================================================
-/**
- * @return default color for rows in the timeline (if not specified by one of these other color
- * functions)
- */
-::CColor CStudioPreferences::GetObjectBackgroundColor()
-{
- return s_studioColor2;
-}
-
-//=============================================================================
/**
* @return default color for object timebars in the timeline (if not specified by one of these other
* functions)
@@ -1112,25 +692,6 @@ void CStudioPreferences::SetBigTimeAdvanceAmount(long inTime)
return ::CColor("#e7e0cd");
}
-//==============================================================================
-/**
- * Color for the top row of the inspector and timeline palettes (title row color).
- */
-::CColor CStudioPreferences::GetTopRowColor()
-{
- return s_TopRowColor;
-}
-
-//==============================================================================
-/**
- * Color when the button is down on a tab control
- */
-::CColor CStudioPreferences::GetTabButtonDownColor()
-{
- return s_TabButtonDownColor;
-}
-
-//==============================================================================
/**
* Color when text is disabled
*/
@@ -1153,12 +714,6 @@ void CStudioPreferences::SetBigTimeAdvanceAmount(long inTime)
return ::CColor("#ff0000");
}
-::CColor CStudioPreferences::GetLightBoundingBoxColor()
-{
- return ::CColor("#ffff00");
-}
-
-//==============================================================================
/**
* Colors for rulers and guides
*/
@@ -1223,89 +778,6 @@ void CStudioPreferences::setSelectorLineLength(float length)
CPreferences::GetUserPreferences().SetLongValue("SelectorLineLength", int(length));
}
-//==============================================================================
-/**
- * Return the standard timeline row height
- */
-long CStudioPreferences::GetRowSize()
-{
- return 20;
-}
-
-//==============================================================================
-/**
- * Return the timebar tip size for the tip that lies outside the timebar.
- */
-long CStudioPreferences::GetTimebarTipSize()
-{
- return 6;
-}
-
-//==============================================================================
-/**
- * Return the timebar tip size for the tip that lies inside the timebar.
- */
-long CStudioPreferences::GetTimebarInnerTipSize()
-{
- return 3;
-}
-
-//==============================================================================
-/**
- * Return the timeline name text size
- */
-long CStudioPreferences::GetTimelineNameSize()
-{
- return 400;
-}
-
-//==============================================================================
-/**
- * Return the default comment size
- */
-long CStudioPreferences::GetDefaultCommentSize()
-{
- return 1500;
-}
-
-//==============================================================================
-/**
- * @return the default height of a text edit box
- */
-long CStudioPreferences::GetDefaultTextEditSize()
-{
- long theReturnValue = 15;
- return theReturnValue;
-}
-
-long CStudioPreferences::GetDefaultButtonWidth()
-{
- return 16;
-}
-
-//==============================================================================
-/**
- * @return The gutter size on the right and left edges of the inspector palette.
- */
-long CStudioPreferences::GetInspectorGutterSize()
-{
- return 5;
-}
-
-//==============================================================================
-/**
- * @return The height of the top row of the timeline and inspector palettes.
- */
-long CStudioPreferences::GetHeaderHeight()
-{
- return 21;
-}
-
-bool CStudioPreferences::IsSudoMode()
-{
- return m_SudoMode;
-}
-
void CStudioPreferences::setQmlContextProperties(QQmlContext *qml)
{
qml->setContextProperty(QStringLiteral("_studioColor1"), s_studioColor1);
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
index bad5ca2a..9e2f79a7 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
+++ b/src/Authoring/Client/Code/Core/Utility/StudioPreferences.h
@@ -58,8 +58,6 @@ public:
static ESnapGridResolution GetTimelineSnappingGridResolution();
static void SetTimelineSnappingGridResolution(ESnapGridResolution inResolution);
- static CPreferences GetTrialSettings(const Q3DStudio::CString &inKeyName);
-
static ::CColor GetEditViewBackgroundColor();
static void SetEditViewBackgroundColor(::CColor inColor);
@@ -84,8 +82,6 @@ public:
static bool ShouldShowTooltips();
static void SetShowTooltips(bool inShowTooltips);
- static ::CColor GetTooltipBackgroundColor();
-
static long GetTimelineSplitterLocation();
static void SetTimelineSplitterLocation(long inLocation);
@@ -129,62 +125,18 @@ public:
static void SetPreviewProperty(const Q3DStudio::CString &inName,
const Q3DStudio::CString &inValue);
- static ::CColor GetBaseColor();
- static ::CColor GetDarkBaseColor();
-
static ::CColor GetNormalColor();
static ::CColor GetMasterColor();
static ::CColor GetInactiveColor();
static ::CColor GetMouseOverHighlightColor();
- static ::CColor GetSelectColor();
- static ::CColor GetTimelineSelectColor();
-
- static ::CColor GetToolBarBaseColor();
- static ::CColor GetMenuBarBaseColor();
-
- static ::CColor GetButtonDownColor();
- static ::CColor GetTreeFloorColor();
- static ::CColor GetButtonShadowColor();
- static ::CColor GetPropertyFloorColor();
- static ::CColor GetButtonHighlightColor();
- static ::CColor GetRowSelectedColor();
- static ::CColor GetRowTopColor();
- static ::CColor GetTimeBarBorderColor();
- static ::CColor GetPropertyBackgroundColor();
- static ::CColor GetPropertyMouseOverColor();
- static ::CColor GetPropertyTimbarLeft();
- static ::CColor GetExtendedObjectLightColor();
- static ::CColor GetExtendedObjectDarkColor();
- static ::CColor GetControlRectTopLineColor();
- static ::CColor GetControlRectSideLineColor();
- static ::CColor GetControlRectBottomLineColor();
- static ::CColor GetControlRectBottomLineDarkColor();
- static ::CColor GetControlShadowColor();
- static ::CColor GetTextBoxBGColorNoFocus();
- static ::CColor GetTextBoxBGColorWithFocus();
- static ::CColor GetScrollBGColor();
- static ::CColor GetScrollThumbBGColor();
- static ::CColor GetScrollThumbHighlightColor();
- static ::CColor GetComboEditBoxGradientStartColor();
-
- static ::CColor GetLockedTimebarColor();
- static ::CColor GetLockedBorderColor();
- static ::CColor GetExtendedLockedLightColor();
- static ::CColor GetExtendedLockedDarkColor();
- static ::CColor GetLockedTextColor();
- static ::CColor GetLayerBackgroundColor();
- static ::CColor GetGroupBackgroundColor();
- static ::CColor GetObjectBackgroundColor();
+
static ::CColor GetObjectTimebarColor();
static ::CColor GetLayerTimebarColor();
- static ::CColor GetTopRowColor();
- static ::CColor GetTabButtonDownColor();
static ::CColor GetDisabledTextColor();
static ::CColor GetSingleBoundingBoxColor();
static ::CColor GetGroupBoundingBoxColor();
- static ::CColor GetLightBoundingBoxColor();
static ::CColor GetRulerBackgroundColor();
static ::CColor GetRulerTickColor();
@@ -200,18 +152,6 @@ public:
static float getSelectorLineLength();
static void setSelectorLineLength(float length);
- static long GetRowSize();
- static long GetTimebarTipSize();
- static long GetTimebarInnerTipSize();
- static long GetTimelineNameSize();
- static long GetDefaultCommentSize();
- static long GetDefaultTextEditSize();
- static long GetDefaultButtonWidth();
- static long GetInspectorGutterSize();
- static long GetHeaderHeight();
-
- static bool IsSudoMode();
-
static void setQmlContextProperties(QQmlContext *qml);
static QColor studioColor1();
static QColor studioColor2();
@@ -242,8 +182,5 @@ public:
static const long DEFAULT_SELECTOR_WIDTH = 30;
static const long DEFAULT_SELECTOR_LENGTH = 50;
static const long DEFAULT_AUTOSAVE_DELAY = 600;
-
-protected:
- static bool m_SudoMode;
};
#endif // INCLUDED_STUDIO_PREFERENCES_H
diff --git a/src/Authoring/Common/Code/Literals.h b/src/Authoring/Common/Code/Literals.h
index 764a6639..d176219e 100644
--- a/src/Authoring/Common/Code/Literals.h
+++ b/src/Authoring/Common/Code/Literals.h
@@ -36,7 +36,7 @@ constexpr
#endif
QLatin1String operator"" _L1 (const char *str, std::size_t len)
{
- return QLatin1String(str, len);
+ return QLatin1String(str, int(len));
}
inline
diff --git a/src/Authoring/Studio/Application/StudioColors.h b/src/Authoring/Studio/Application/StudioColors.h
deleted file mode 100644
index 776047a5..00000000
--- a/src/Authoring/Studio/Application/StudioColors.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 Anark Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_STUDIOCOLORS_H
-#define INCLUDED_STUDIOCOLORS_H
-
-#pragma once
-
-//==============================================================================
-// Studio colors
-//==============================================================================
-
-const COLORREF STUDIO_MATTE_COLOR = RGB(119, 122, 125); // GetSysColor( COLOR_APPWORKSPACE );
-const COLORREF MENU_IMAGELIST_BACKCOLOR = RGB(255, 0, 255); // RGB( 255, 128, 0 );
-
-//==============================================================================
-// TimeBar colors
-//==============================================================================
-
-// TimeBar pen colors
-
-const COLORREF TIMEBAR_PEN_COLOR_INNER = RGB(254, 254, 254);
-const COLORREF TIMEBAR_PEN_COLOR_INACTIVE = RGB(132, 130, 132);
-const COLORREF TIMEBAR_PEN_COLOR_ACTIVE = RGB(0, 0, 0);
-
-// TimeBar shadow colors
-
-const COLORREF TIMEBAR_INACTIVE_SHADOW_COLOR = RGB(0xC4, 0xC4, 0xC4);
-const COLORREF TIMEBAR_ACTIVE_SHADOW_COLOR = RGB(0x84, 0x84, 0x84);
-
-// TimeBar comment colors
-
-const COLORREF TIMEBAR_COMMENT_ACTIVE_TC = RGB(0x00, 0x00, 0x00);
-const COLORREF TIMEBAR_COMMENT_INACTIVE_TC = RGB(0x72, 0x72, 0x72);
-
-const COLORREF COLOR_TIMEBAR_DISABLED = RGB(207, 207, 207);
-const COLORREF COLOR_TIMEBAR_BEHAVIOR =
- RGB(148, 189, 150); // RGB( 92, 164, 131 );//RGB( 243, 243, 243 );
-const COLORREF COLOR_TIMEBAR_MATERIAL =
- RGB(194, 155, 181); // RGB( 190, 184, 152 ); //RGB( 239, 230, 210 );
-const COLORREF COLOR_TIMEBAR_IMAGE =
- RGB(194, 155, 181); // RGB( 190, 184, 152 ); //RGB( 198, 225, 199 );
-const COLORREF COLOR_TIMEBAR_LOCKED = RGB(228, 228, 228);
-
-const COLORREF TIMEBAR_COLOR_TRANSPARENT = RGB(255, 0, 255);
-
-// A constant to represent color for inner white rectangle of center bar
-const COLORREF COLOR_INNER_BAR_RECTANGLE = RGB(253, 253, 254);
-// Default timebar fill color
-const COLORREF COLOR_TIMEBAR_DEFAULT_FILL = RGB(
- 163, 178, 227); // RGB( 174, 183, 210 ); //RGB( 148, 166, 189 ); //RGB( 211, 226, 240 );
-
-// Selected time bar colors
-
-const COLORREF COLOR_TIMEBAR_SELECTED = RGB(75, 75, 75); // RGB( 14, 49, 98 );
-const COLORREF COLOR_TIMEBAR_SELECTED_TEXT = RGB(255, 255, 255);
-const COLORREF COLOR_TIMEBAR_SELECTED_BEHAVIOR = RGB(174, 216, 176);
-const COLORREF COLOR_TIMEBAR_SELECTED_HIGHLIGHT = RGB(27, 73, 136);
-
-// const COLORREF COLOR_SELECTED_TIMEBAR_3DOBJECT = RGB( 190, 191, 202
-// );
-
-const COLORREF COLOR_TIMEBAR_HIGHLIGHT = RGB(190, 191, 202);
-const COLORREF COLOR_TIMEBAR_HIGHLIGHT_GROUP = RGB(174, 216, 176);
-
-const COLORREF COLOR_PLAYHEADSCRUBTIME = RGB(0, 85, 0);
-
-//==============================================================================
-// Timeline colors
-//==============================================================================
-
-const BOOL INVERT_TIMELINE_TEXT_COLOR = TRUE;
-
-const COLORREF COLOR_SELECTEDTEXT = RGB(255, 255, 255);
-const COLORREF COLOR_SELECTEDTEXTBKGRND = RGB(14, 49, 98);
-const COLORREF COLOR_DRAGDROPTARGETTEXT = RGB(255, 255, 255);
-const COLORREF COLOR_DRAGDROPTARGETBKGRND = RGB(24, 98, 198);
-
-const COLORREF COLOR_SHADOW = RGB(165, 162, 161); // RGB( 132, 130, 132 );
-
-const COLORREF COLOR_PLAYHEADLINE = RGB(0xDD, 0x04, 0x05);
-const COLORREF COLOR_BACKGRND =
- GetSysColor(COLOR_3DFACE); // RGB( 206, 203, 198 ); //RGB( 0xE7, 0xE7, 0xE7 );
-const COLORREF COLOR_SELECTED = RGB(255, 255, 255);
-const COLORREF COLOR_DEFAULTOBJECTS = RGB(206, 203, 198); // RGB( 0xE7, 0xE7, 0xE7 );
-const COLORREF COLOR_3DOBJECTS = RGB(206, 203, 198); // RGB( 0xC7, 0xD4, 0xE1 );
-const COLORREF COLOR_DEFAULTOBJECTHIGHLIGHT = RGB(222, 223, 222); // RGB( 255, 255, 255 );
-const COLORREF COLOR_DRAGHIGHLIGHT = RGB(255, 255, 255);
-const COLORREF COLOR_INSERTMARK = RGB(0x00, 0x00, 0x00);
-const COLORREF COLOR_TIMELINEINSERTMARK = RGB(0x00, 0x00, 0xFF);
-const COLORREF COLOR_TEXTCOLOR = RGB(0x00, 0x00, 0x00);
-const COLORREF COLOR_CONTAINERTEXTCOLOR = RGB(80, 80, 140);
-const COLORREF COLOR_LOCKEDTEXTCOLOR = RGB(0x80, 0x80, 0x80);
-const COLORREF COLOR_INDEPENDENTOBJECT = RGB(0x80, 0x80, 0x80);
-const COLORREF COLOR_SPLITLINE = RGB(0x00, 0x00, 0x7F);
-const COLORREF COLOR_SEPARATORLINE = RGB(0x00, 0x00, 0x20);
-const COLORREF COLOR_LIGHTMODEL = RGB(206, 203, 198); // RGB( 198, 211, 224 );
-const COLORREF COLOR_GROUP =
- RGB(206, 203, 198); // RGB( 198, 211, 224 ); //RGB( 199, 220, 193 );
-const COLORREF COLOR_PROPERTY = RGB(228, 225, 219); // RGB( 241, 241, 241 );
-const COLORREF COLOR_CHANNEL = RGB(228, 225, 219); // RGB( 241, 241, 241 );
-const COLORREF COLOR_CONTAINER =
- RGB(228, 225, 219); // RGB( 206, 203, 198 ); //RGB( 231, 231, 231 );
-const COLORREF COLOR_MATERIAL = RGB(210, 210, 210); // RGB( 170, 224, 170 );
-const COLORREF COLOR_CONTAINERHIGHLIGHT = RGB(193, 180, 180);
-const COLORREF COLOR_BEHAVIOR = RGB(199, 220, 193);
-const COLORREF COLOR_BEHAVIORHIGHLIGHT = RGB(255, 255, 255);
-const COLORREF COLOR_IMGLISTTRANSPARENT = RGB(0xFF, 0x00, 0xFF);
-const COLORREF COLOR_TIMEMEASURE = GetSysColor(COLOR_3DFACE); // RGB( 170, 166, 160 );
-
-#endif
diff --git a/src/Authoring/Studio/Application/StudioConst.h b/src/Authoring/Studio/Application/StudioConst.h
index 489025f9..93a91835 100644
--- a/src/Authoring/Studio/Application/StudioConst.h
+++ b/src/Authoring/Studio/Application/StudioConst.h
@@ -32,129 +32,13 @@
#ifndef WM_APP
#define WM_APP 0x8000
#endif
-#define WM_STUDIO_INITIALIZE_PALETTES (WM_APP + 1)
-#define WM_STUDIO_DUPLICATE_SERIAL (WM_APP + 2)
-#define WM_STUDIO_SHOWCOMPRESSION (WM_APP + 3)
-#define WM_STUDIO_LOADPROGRESS (WM_APP + 4)
-#define WM_STUDIO_NOTIFYLOADCOMPLETE (WM_APP + 5)
#define WM_STUDIO_TIMER (WM_APP + 6)
-#define WM_STUDIO_MESSAGE_ROUTER (WM_APP + 7)
-#define WM_STUDIO_OPEN_RECENT_MIN (WM_APP + 9)
-#define WM_STUDIO_OPEN_RECENT_MAX (WM_APP + 19)
-#define WM_STUDIO_QUICKSTART_MIN (WM_APP + 31)
-#define WM_STUDIO_QUICKSTART_MAX (WM_APP + 44)
-#define WM_CUSTOMIZE_TOOLBAR (WM_APP + 45)
-
-enum EPreviewApplication { INTERNET_EXPLORER = 0, QT3DS_MEDIA_PLAYER, WINDOWS_MEDIA_PLAYER };
// property pages
const long PAGE_STUDIOAPPPREFERENCES = 0;
const long PAGE_STUDIOPROJECTSETTINGS = 1;
-// Playhead moving with keyboard:
-const long SHIFT_PLAYHEAD_SMALL_TICK = 0;
-const long SHIFT_PLAYHEAD_LARGE_TICK = 1;
-
// Used to reset default preferences
const long PREFS_SETTINGS_RESTART = 997;
const long PREFS_RESET_LAYOUT = 998;
const long PREFS_RESET_DEFAULTS = 999;
-
-// Message values
-#define STUDIO_PLAYHEADUPDATEONLY -1
-#define STUDIO_PLAYHEADSYNCPRESENTATION -2
-
-const unsigned long PARAMINDEX_RED = 0;
-const unsigned long PARAMINDEX_GREEN = 1;
-const unsigned long PARAMINDEX_BLUE = 2;
-const unsigned long PARAMINDEX_ALPHA = 3;
-
-const unsigned long PARAMINDEX_X = 0;
-const unsigned long PARAMINDEX_Y = 1;
-const unsigned long PARAMINDEX_Z = 2;
-
-// These are the new operation update masks
-namespace FILTERMASK {
-const long FILTER_MODELS = 0x02; // Mask for filtering out Models
-const long FILTER_IMAGES = 0x20; // Mask for filtering out Images
-const long FILTER_ALL = 0xff; // Used for adding all files back to display mode
-}
-
-// Used for timebar display - should we display Comments or Time Start/End/Duration information?
-const long TIMEBAR_COMMENTS = 1;
-const long TIMEBAR_TIMEINFO = 2;
-
-// Used to set the number of decimal places in the float dialog boxes.
-const long FLOAT_NUM_DECIMAL_PLACES = 3;
-
-// Default palette positions
-const long DEFAULT_MAINFRM_STARTWIDTH = 25;
-const long DEFAULT_MAINFRM_WIDTH = 50;
-const long DEFAULT_MAINFRM_STARTHEIGHT = 0;
-const long DEFAULT_MAINFRM_HEIGHT = 50;
-
-const long DEFAULT_INSPECTOR_STARTHEIGHT = 50;
-const long DEFAULT_INSPECTOR_HEIGHT = 50;
-const long DEFAULT_INSPECTOR_STARTWIDTH = 0;
-const long DEFAULT_INSPECTOR_WIDTH = 25;
-
-const long DEFAULT_LIBRARY_STARTHEIGHT = 0;
-const long DEFAULT_LIBRARY_HEIGHT = 50;
-const long DEFAULT_LIBRARY_STARTWIDTH = 0;
-const long DEFAULT_LIBRARY_WIDTH = 25;
-
-const long DEFAULT_TIMELINE_STARTHEIGHT = 50;
-const long DEFAULT_TIMELINE_HEIGHT = 50;
-const long DEFAULT_TIMELINE_STARTWIDTH = 25;
-const long DEFAULT_TIMELINE_WIDTH = 75;
-
-const long DEFAULT_HISTORY_STARTHEIGHT = 0;
-const long DEFAULT_HISTORY_HEIGHT = 50;
-const long DEFAULT_HISTORY_STARTWIDTH = 75;
-const long DEFAULT_HISTORY_WIDTH = 25;
-
-const long DEFAULT_STORAGE_STARTHEIGHT = 0;
-const long DEFAULT_STORAGE_HEIGHT = 50;
-const long DEFAULT_STORAGE_STARTWIDTH = 75;
-const long DEFAULT_STORAGE_WIDTH = 25;
-
-const long DEFAULT_HELP_STARTHEIGHT = 25;
-const long DEFAULT_HELP_HEIGHT = 50;
-const long DEFAULT_HELP_STARTWIDTH = 25;
-const long DEFAULT_HELP_WIDTH = 50;
-
-// Port number for serial number verification on the LAN
-const long SERIAL_NUMBER_PORT = 3133;
-const long SERIAL_NUMBER_BASE = 10;
-const long NUMBER_SERIAL_DIGITS_CHECK = 12;
-
-// Constants for AKTRACE statements
-// These are bitmasks - must be sequential and not overlap.
-const long TRACE_STUDIO_OBJECT = 0x0001;
-const long TRACE_TIMELINE = 0x0002;
-const long TRACE_KEYFRAMEDATA = 0x0004;
-const long TRACE_ANIMTRACKS = 0x0008;
-const long TRACE_UNDOREDO = 0x0010;
-const long TRACE_LIBRARY = 0x0020;
-const long TRACE_MSGHANDLER = 0x0040;
-const long TRACE_SNAPPING = 0x0080;
-const long TRACE_INSPECTOR = 0x0100;
-const long TRACE_CLIENT = 0x0200;
-const long TRACE_STORAGE = 0x0400;
-const long TRACE_TESTING = 0x0800;
-const long TRACE_HELPVIEW = 0x1000;
-const long TRACE_STUDIODOC = 0x2000;
-const long TRACE_MAINFRAME = 0x4000;
-const long TRACE_ALL = 0xffff;
-
-const char CLIENT_CORE_DLL_NAME[] = "AKCore.dll";
-
-// Timeline icon dimensions
-const long TREEICON_WIDTH = 14;
-const long TREEICON_HEIGHT = 14;
-const long TIMER_DRAGHOVEREXPAND = 2;
-const long TIMER_DRAGDROPSCROLL = 1;
-const long DRAGSCROLL_DIRECTION_UP = 1;
-const long DRAGSCROLL_DIRECTION_DOWN = 2;
-const long TIMER_DRAGDROPSCROLL_DELAY = 20;
-const long TIMER_DRAGHOVEREXPAND_DELAY = 1500; // 2000; // 3-second delay
diff --git a/src/Authoring/Studio/Controls/BaseMeasure.cpp b/src/Authoring/Studio/Controls/BaseMeasure.cpp
deleted file mode 100644
index 25d5c204..00000000
--- a/src/Authoring/Studio/Controls/BaseMeasure.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stdafx.h"
-
-#include "BaseMeasure.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Create a new measure.
- * @param inRatio the current ratio.
- * @param inFillBackground true if the background of this control is to be drawn.
- */
-CBaseMeasure::CBaseMeasure(double inRatio, bool inFillBackground /*= true */)
- : m_SmallHashInterval(0)
- , m_MediumHashInterval(0)
- , m_LargeHashInterval(0)
- , m_Ratio(inRatio)
- , m_Offset(0)
- , m_EdgeMargin(0)
- , m_LargeHashOffset(0)
- , m_MediumHashOffset(6)
- , m_SmallHashOffset(3)
- , m_FillBackground(inFillBackground)
-{
- m_BackgroundColor = CStudioPreferences::GetBaseColor();
-}
-
-CBaseMeasure::~CBaseMeasure()
-{
-}
-
-//=============================================================================
-/**
- * Overrides the control to set up clipping rects.
- * @param inRenderer the renderer to be rendered to.
- * @param inDirtyRect the resulting dirty rect.
- * @param inIgnoreValidation true if everything needs to be drawn.
- */
-void CBaseMeasure::OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation)
-{
- inRenderer->PushClippingRect(CRct(GetSize()));
-
- CControl::OnDraw(inRenderer, inDirtyRect, inIgnoreValidation);
-
- inRenderer->PopClippingRect();
-}
-
-//=============================================================================
-/**
- * Draw the measure.
- * @param inRenderer the renderer to draw to.
- */
-void CBaseMeasure::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
-
- if (m_FillBackground)
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
-
- long theLength = GetDisplayLength();
- long theHeight = GetDisplayHeight();
-
- double theTotalMeasure = theLength / m_Ratio;
- long thePos;
-
- long theNumLargeHashes = (long)(theTotalMeasure / m_LargeHashInterval) + 1;
-
- inRenderer->PushPen(CStudioPreferences::GetRulerTickColor());
-
- long theOffset = m_Offset - (m_Offset % ::dtol(m_LargeHashInterval));
-
- for (long i = 0; i < theNumLargeHashes + 1; ++i) {
- double theMeasure = m_LargeHashInterval * i + theOffset;
-
- thePos = CalculatePos(theMeasure - m_Offset);
-
- if (thePos > 0)
- DrawLine(inRenderer, thePos, theHeight, theHeight - m_LargeHashOffset);
-
- DrawMeasureText(inRenderer, thePos, long(theMeasure));
-
- // sanity check
- if (m_MediumHashInterval > 0) {
- // in cases where the medium and small hashes must be filled up to the right of the
- // first Large hash
- if (m_Offset < 0 && i == 0) {
- thePos = CalculatePos(theMeasure - m_Offset - m_MediumHashInterval);
- if (thePos > 0)
- DrawLine(inRenderer, thePos, theHeight, theHeight - m_MediumHashOffset);
-
- for (double theSmallInterval = 0; theSmallInterval < m_LargeHashInterval;
- theSmallInterval += m_SmallHashInterval) {
- thePos = CalculatePos(theMeasure - m_Offset - theSmallInterval);
- if (thePos > 0)
- DrawLine(inRenderer, thePos, theHeight, theHeight - m_SmallHashOffset);
- }
- }
-
- thePos = CalculatePos(theMeasure - m_Offset + m_MediumHashInterval);
- if (thePos > 0)
- DrawLine(inRenderer, thePos, theHeight, theHeight - m_MediumHashOffset);
-
- for (double theSmallInterval = 0; theSmallInterval < m_LargeHashInterval;
- theSmallInterval += m_SmallHashInterval) {
- thePos = CalculatePos(theMeasure - m_Offset + theSmallInterval);
-
- if (thePos > 0)
- DrawLine(inRenderer, thePos, theHeight, theHeight - m_SmallHashOffset);
- }
- } // if medium is valid
- }
- // Draws the top outline
- DrawOutline(inRenderer, theHeight, 0, theLength);
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- // Draws the bottom outline
- DrawOutline(inRenderer, theHeight + 1, 0, theLength);
- inRenderer->PopPen();
-
- // Dark line at left and right ends of the measure
- inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor());
- DrawLine(inRenderer, theRect.size.x - 1, 0, theRect.size.y - 1);
-
- // Dark line across the top of the measure
- DrawOutline(inRenderer, 0, 0, theRect.size.x - 1);
- inRenderer->PopPen();
-
- // pop for the first PushPen
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Return the display length, by default, this is horizontal and returns the x
- */
-long CBaseMeasure::GetDisplayLength()
-{
- return GetSize().x;
-}
-
-//=============================================================================
-/**
- * Return the display height, by default, this is horizontal and returns the y
- */
-long CBaseMeasure::GetDisplayHeight()
-{
- return GetSize().y - m_EdgeMargin;
-}
-
-//=============================================================================
-/**
- * By default, this draws a vertical line.
- * A subclass can override this and draw a horizontal one, if its orientation requires so.
- * @parma inRenderer the renderer
- * @param inPos the position that in the x-coordinate
- * @param inStart start position of the line
- * @param inEnd end position of the line
- */
-void CBaseMeasure::DrawLine(CRenderer *inRenderer, long inPos, long inStart, long inEnd)
-{
- inRenderer->MoveTo(CPt(inPos, inStart));
- inRenderer->LineTo(CPt(inPos, inEnd));
-}
-
-//=============================================================================
-/**
- * This draws a horizontal outline
- * A subclass can override this and draw a vertical one, if its orientation requires so.
- * @parma inRenderer the renderer
- * @param inPos the position that in the x-coordinate
- * @param inStart start position of the line
- * @param inEnd end position of the line
- */
-void CBaseMeasure::DrawOutline(CRenderer *inRenderer, long inPos, long inStart, long inEnd)
-{
- inRenderer->MoveTo(CPt(inStart, inPos));
- inRenderer->LineTo(CPt(inEnd, inPos));
-}
diff --git a/src/Authoring/Studio/Controls/BaseMeasure.h b/src/Authoring/Studio/Controls/BaseMeasure.h
deleted file mode 100644
index 25916198..00000000
--- a/src/Authoring/Studio/Controls/BaseMeasure.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_BASE_MEASURE_H
-#define INCLUDED_BASE_MEASURE_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "CColor.h"
-#include "CoreUtils.h"
-#include <vector>
-
-class CBaseMarker;
-class CSnapper;
-
-class CBaseMeasure : public CControl
-{
-public:
- CBaseMeasure(double inRatio, bool inFillBackground = true);
- virtual ~CBaseMeasure();
-
- virtual void OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation = false);
-
- virtual void Draw(CRenderer *inRenderer);
-
- // inline these
- long GetLargeHashInterval() const { return ::dtol(m_LargeHashInterval); }
- long GetMediumHashInterval() const { return ::dtol(m_MediumHashInterval); }
- long GetSmallHashInterval() const { return ::dtol(m_SmallHashInterval); }
-
-protected:
- virtual void DrawMeasureText(CRenderer *inRenderer, long inPosition, long inMeasure) = 0;
- virtual long CalculatePos(double inNewValue) = 0;
- virtual long GetDisplayLength();
- virtual long GetDisplayHeight();
- virtual void DrawLine(CRenderer *inRenderer, long inPos, long inStart, long inEnd);
- virtual void DrawOutline(CRenderer *inRenderer, long inPos, long inStart, long inEnd);
-
- double m_SmallHashInterval; ///< the measurement represented by a small hash
- double m_MediumHashInterval; ///< the measurement represented by a medium hash
- double m_LargeHashInterval; ///< the measurement represented by a large hash
- double m_Ratio; ///< Ratio that is used to calculate the size of the large hash
- long m_Offset; ///< Offset of the point 0 from left or top
- ::CColor m_BackgroundColor; ///< Background of this control
-
- // Tickmarks
- long m_EdgeMargin; ///< Margin from the edge, so that no line draws all the way through
- long m_LargeHashOffset; ///< Offset from the margin for the large hash
- long m_MediumHashOffset; ///< Offset from the margin for the medium hash
- long m_SmallHashOffset; ///< Offset from the margin for the small hash
-
- bool m_FillBackground; ///< true to fill the background (i.e. its not transparent)
-};
-#endif // INCLUDED_BASE_MEASURE_H
diff --git a/src/Authoring/Studio/Controls/BlankControl.cpp b/src/Authoring/Studio/Controls/BlankControl.cpp
deleted file mode 100644
index 492bc630..00000000
--- a/src/Authoring/Studio/Controls/BlankControl.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BlankControl.h"
-#include "Renderer.h"
-#include "SystemPreferences.h"
-
-//=============================================================================
-/**
- * constructor
- */
-CBlankControl::CBlankControl(CColor inColor)
- : m_DrawBorder(false)
- , m_FillBackground(true)
-{
- SetColor(inColor);
-}
-
-//=============================================================================
-/**
- * destructor
- */
-CBlankControl::~CBlankControl()
-{
-}
-
-//=============================================================================
-/**
- * Draws this control
- */
-void CBlankControl::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
-
- if (m_FillBackground)
- inRenderer->FillSolidRect(theRect, m_Color);
-
- if (m_DrawBorder) {
- // Get the normal colors for the 3D border
- CColor theShadowColor = CStudioPreferences::GetButtonShadowColor();
- CColor theHiliteColor = CStudioPreferences::GetButtonHighlightColor();
-
- // Draw a frame around the button
- inRenderer->Draw3dRect(
- CRct(theRect.position.x + 1, theRect.position.y, theRect.size.x, theRect.size.y),
- theHiliteColor, theShadowColor);
- inRenderer->PushPen(theShadowColor);
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(0, theRect.size.y));
- inRenderer->PopPen();
- }
-}
-
-//=============================================================================
-/**
- * Sets the color for this control
- */
-void CBlankControl::SetColor(CColor inColor)
-{
- if (m_Color == inColor)
- return;
-
- m_Color = inColor;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * @param inDrawBorder true if we should draw the border
- */
-void CBlankControl::SetDrawBorder(bool inDrawBorder)
-{
- m_DrawBorder = inDrawBorder;
-}
-
-//=============================================================================
-/**
- * @param inFillBackground true if we should draw the background
- */
-void CBlankControl::SetFillBackground(bool inFillBackground)
-{
- m_FillBackground = inFillBackground;
-}
diff --git a/src/Authoring/Studio/Controls/BlankControl.h b/src/Authoring/Studio/Controls/BlankControl.h
deleted file mode 100644
index b04337b0..00000000
--- a/src/Authoring/Studio/Controls/BlankControl.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_BLANKCONTROL_H
-#define INCLUDED_BLANKCONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "StudioPreferences.h"
-
-class CBlankControl : public CControl
-{
-public:
- CBlankControl(::CColor inColor = CStudioPreferences::GetBaseColor());
- virtual ~CBlankControl();
- void Draw(CRenderer *inRenderer) override;
- void SetColor(::CColor inColor);
- void SetDrawBorder(bool inDrawBorder);
- void SetFillBackground(bool inFillBackground);
-
-protected:
- ::CColor m_Color;
- bool m_DrawBorder;
- bool m_FillBackground;
-};
-
-#endif // INCLUDED_BLANKCONTROL_H
diff --git a/src/Authoring/Studio/Controls/BreadCrumbControl.cpp b/src/Authoring/Studio/Controls/BreadCrumbControl.cpp
deleted file mode 100644
index 3a912b43..00000000
--- a/src/Authoring/Studio/Controls/BreadCrumbControl.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2004 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BreadCrumbControl.h"
-#include "StudioPreferences.h"
-#include "Bindings/IBreadCrumbProvider.h"
-
-#include <QtGui/qpixmap.h>
-
-IMPLEMENT_OBJECT_COUNTER(CBreadCrumbControl)
-
-//==============================================================================
-// Internal Classes
-//==============================================================================
-
-//=============================================================================
-/**
- * Constructor
- */
-CBreadCrumbControl::CBreadCrumbControl()
- : m_BreadCrumbProvider(nullptr)
-{
- ADDTO_OBJECT_COUNTER(CBreadCrumbControl)
-
- SetName("BreadCrumbControl");
- SetAutoMin(false);
- SetFlowDirection(FLOW_HORIZONTAL);
- SetAlignment(ALIGN_TOP, ALIGN_LEFT);
- SetTopMargin(0);
- SetBottomMargin(0);
- SetLeftMargin(0);
- SetRightMargin(0);
- SetGapBetweenChildren(0);
-
- long theHeaderHeight = CStudioPreferences::GetHeaderHeight();
- SetMaximumSize(CPt(LONG_MAX, theHeaderHeight));
- SetMinimumSize(CPt(0, theHeaderHeight));
- SetSize(CPt(LONG_MAX, theHeaderHeight));
- SetPosition(CPt(0, 0));
-}
-
-//=============================================================================
-/**
- * destructor
- */
-CBreadCrumbControl::~CBreadCrumbControl()
-{
- RemoveAllButtons();
- REMOVEFROM_OBJECT_COUNTER(CBreadCrumbControl)
-}
-
-//=============================================================================
-/**
- * Helper class to create the colon separator button
- */
-static inline CBreadCrumbControl::TSeparatorButtonType *CreateSeparatorButton(const QPixmap &inImage)
-{
- CBreadCrumbControl::TSeparatorButtonType *theButton =
- new CBreadCrumbControl::TSeparatorButtonType;
- theButton->SetAutoSize(true);
- theButton->SetUpImage(inImage);
- theButton->SetSize(CPt(12, 24));
- theButton->SetMinimumSize(CPt(12, 24));
- theButton->SetMaximumSize(CPt(12, 24));
- theButton->SetCenterImage(true, false);
- return theButton;
-}
-
-//=============================================================================
-/**
- * Helper function to create a new button to be placed on the breadcrumb bar
- * @param inButtonName Name of the button to be displayed and stored
- * inImageName The specific .png file to load in for the button
- * @return TButtonType returns the newly created button
- */
-static inline CBreadCrumbControl::TButtonType *CreateButton(const QPixmap &inImage)
-{
- CBreadCrumbControl::TButtonType *theButton = new CBreadCrumbControl::TButtonType();
- theButton->SetAutoSize(true);
- theButton->SetUpImage(inImage);
- CBreadCrumbControl::TButtonType::SBorderOptions theBorderOptions(false, false, false, false);
- theButton->SetBorderVisibilityAll(theBorderOptions);
- theButton->SetFillStyleUp(CBreadCrumbControl::TButtonType::EFILLSTYLE_FLOOD);
- theButton->SetFillStyleOver(CBreadCrumbControl::TButtonType::EFILLSTYLE_FLOOD);
- theButton->SetFillColorUp(CStudioPreferences::GetBaseColor());
- theButton->SetFillColorDown(CStudioPreferences::GetBaseColor());
- theButton->SetFillColorOver(CStudioPreferences::GetMouseOverHighlightColor());
- theButton->SetMinimumSize(CPt(16, 24));
- theButton->SetMaximumSize(CPt(125, 24));
- theButton->SetCenterImage(true, false);
- return theButton;
-}
-
-//=============================================================================
-/**
- * Generate/Reset the text appearing on the breadcrumb which is currently
- * appending the slide name as well.
- * @param inBreadCrumb containing color/text info for display
- * @param inButton The button to be modified
- */
-void CBreadCrumbControl::GenerateButtonText(const SBreadCrumb &inBreadCrumb, TButtonType *inButton)
-{
- QString theDisplayName(inBreadCrumb.m_String);
- inButton->SetTextColorUp(CStudioPreferences::GetNormalColor());
- inButton->SetTextColorDown(CStudioPreferences::GetNormalColor());
- inButton->SetText(theDisplayName);
- inButton->SetName(theDisplayName);
-}
-
-//=============================================================================
-/**
- * Draws this control
- */
-void CBreadCrumbControl::Draw(CRenderer *inRenderer)
-{
- const auto size = GetSize();
-
- // Fill in the background
- inRenderer->FillSolidRect(QRect(0, 0, size.x, size.y), CStudioPreferences::GetBaseColor());
-
- // Outline the control
- CColor theOutlineColor = CStudioPreferences::GetButtonShadowColor();
- inRenderer->DrawRectOutline(QRect(0, 0, size.x, size.y -1), theOutlineColor, theOutlineColor,
- theOutlineColor, theOutlineColor);
-
- // Draw the highlight at the bottom
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(QPoint(0, size.y - 1));
- inRenderer->LineTo(QPoint(size.x - 1, size.y - 1));
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Update the entire bread crumb trail. This will 'reuse' created controls, creating more if
- *trail is longer than previous, and deleting extra if shorter.
- */
-void CBreadCrumbControl::RefreshTrail(IBreadCrumbProvider *inBreadCrumbProvider)
-{
- bool theChangedProvider = m_BreadCrumbProvider != inBreadCrumbProvider;
- if (theChangedProvider && m_BreadCrumbProvider)
- QObject::disconnect(m_BreadCrumbProvider, &IBreadCrumbProvider::SigBreadCrumbUpdate, 0, 0);
-
- m_BreadCrumbProvider = inBreadCrumbProvider;
-
- SuspendRecalcLayout(true);
- size_t theIndex = 0;
-
- if (m_BreadCrumbProvider) {
- // listen for single breadcrumb update (i.e. name changes)
- if (theChangedProvider) {
- QObject::connect(m_BreadCrumbProvider, &IBreadCrumbProvider::SigBreadCrumbUpdate,
- std::bind(&CBreadCrumbControl::OnUpdateBreadCrumb, this));
- }
-
- const IBreadCrumbProvider::TTrailList &theList = m_BreadCrumbProvider->GetTrail();
- // By design, if this is only 1 item in the list, nothing is shown.
- if (theList.size() > 1) {
- for (; theIndex < theList.size(); ++theIndex) {
- TButtonType *theButton = nullptr;
- if (theIndex < m_BreadCrumbList.size())
- theButton = m_BreadCrumbList[theIndex].m_BreadCrumb;
- else // create new
- {
- theButton =
- CreateButton((theIndex == 0) ? m_BreadCrumbProvider->GetRootImage()
- : m_BreadCrumbProvider->GetBreadCrumbImage());
- QObject::connect(theButton,&CToggleButton::SigToggle,
- std::bind(&CBreadCrumbControl::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
-
- TSeparatorButtonType *theSeparator =
- CreateSeparatorButton(m_BreadCrumbProvider->GetSeparatorImage());
-
- // the ":" is always added as a pair
- m_BreadCrumbList.push_back(SBreadCrumbItem(theButton, theSeparator));
- AddChild(theButton);
- AddChild(theSeparator);
- }
- // Update text and color
- GenerateButtonText(theList[theIndex], theButton);
-
- // Refresh all properties that might be outdated since buttons are reused
- QPixmap theImage;
- bool theEnabled = true;
- if (theIndex
- == theList.size()
- - 1) { // The last button is displayed differently (grayed-out)
- theButton->SetTextColorUp(CColor(94, 91, 85));
- theButton->SetTextColorDown(CColor(94, 91, 85));
- theImage = m_BreadCrumbProvider->GetActiveBreadCrumbImage();
-
- theEnabled = false; // the last item being the 'active' is disabled.
- } else if (theIndex > 0)
- theImage = m_BreadCrumbProvider->GetBreadCrumbImage();
-
- if (!theImage.isNull())
- theButton->SetUpImage(theImage);
-
- theButton->SetToggleState(!theEnabled);
- theButton->SetEnabled(theEnabled);
- // the separator is hidden for the last one
- m_BreadCrumbList[theIndex].m_Separator->SetVisible(theEnabled);
-
- theButton->Invalidate();
- }
- }
- }
- // Discard 'extras' OR if this is no provider, this will remove all breadcrumbs
- while (m_BreadCrumbList.size() > theIndex) {
- RemoveButton(m_BreadCrumbList.back());
- m_BreadCrumbList.pop_back();
- }
- SuspendRecalcLayout(false);
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Check for changes in the existing list and update.
- */
-void CBreadCrumbControl::OnUpdateBreadCrumb()
-{
- ASSERT(m_BreadCrumbProvider);
- bool theUpdated = false;
-
- const IBreadCrumbProvider::TTrailList &theList = m_BreadCrumbProvider->GetTrail(false);
- ASSERT(m_BreadCrumbList.size() == theList.size()
- || (m_BreadCrumbList.size() == 0
- && theList.size()
- == 1)); // By design, if this is only 1 item in the list, nothing is shown.
-
- for (size_t theIndex = 0; theIndex < m_BreadCrumbList.size(); ++theIndex) {
- TButtonType *theButton = m_BreadCrumbList[theIndex].m_BreadCrumb;
- if (theButton->GetText() != theList[theIndex].m_String
- || theButton->GetTextColorUp().getQColor() != theList[theIndex].m_Color) {
- GenerateButtonText(theList[theIndex], theButton);
- theUpdated = true;
- }
- }
-
- if (theUpdated) // Make sure that this entire BreadCrumbControl has room for extraneous length
- // buttons
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Removes and clean up button
- */
-void CBreadCrumbControl::RemoveButton(SBreadCrumbItem &inBreadCrumb)
-{
- QObject::disconnect(inBreadCrumb.m_BreadCrumb, &CToggleButton::SigToggle, 0, 0);
- RemoveChild(inBreadCrumb.m_BreadCrumb);
- RemoveChild(inBreadCrumb.m_Separator);
- delete inBreadCrumb.m_BreadCrumb;
- delete inBreadCrumb.m_Separator;
-}
-
-//=============================================================================
-/**
- * Removes all buttons (trail and separators)
- */
-void CBreadCrumbControl::RemoveAllButtons()
-{
- while (!m_BreadCrumbList.empty()) {
- RemoveButton(m_BreadCrumbList.back());
- m_BreadCrumbList.pop_back();
- }
-}
-
-//=============================================================================
-/**
- * Handles turning a filter on or off in response to a button being pressed.
- * @param inButton button that generated the event
- * @param inState new state of the button after being toggled
- */
-void CBreadCrumbControl::OnButtonToggled(CToggleButton *inButton,
- CButtonControl::EButtonState inState)
-{
- Q_UNUSED(inState);
-
- ASSERT(m_BreadCrumbProvider);
-
- // Find the index into the trail list
- size_t theIndex = 0;
- for (; theIndex < m_BreadCrumbList.size(); ++theIndex) {
- if (m_BreadCrumbList[theIndex].m_BreadCrumb == inButton)
- break;
- }
- ASSERT(theIndex < m_BreadCrumbList.size()); // sanity check
-
- m_BreadCrumbProvider->OnBreadCrumbClicked((long)theIndex);
-}
diff --git a/src/Authoring/Studio/Controls/BreadCrumbControl.h b/src/Authoring/Studio/Controls/BreadCrumbControl.h
deleted file mode 100644
index 8e20357c..00000000
--- a/src/Authoring/Studio/Controls/BreadCrumbControl.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2004 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_BREADCRUMBCONTROL_H
-#define INCLUDED_BREADCRUMBCONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "FlowLayout.h"
-#include "ProceduralButton.h"
-#include "ToggleButton.h"
-#include "TextButton.h"
-#include "Bindings/IBreadCrumbProvider.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class IDoc;
-class CRenderer;
-
-class CBreadCrumbControl : public CFlowLayout
-{
-public:
- typedef CProceduralButton<CTextButton<CToggleButton>> TButtonType;
- typedef CTextButton<CButtonControl> TSeparatorButtonType;
- struct SBreadCrumbItem
- {
- TButtonType *m_BreadCrumb;
- TSeparatorButtonType *m_Separator;
-
- SBreadCrumbItem(TButtonType *inBreadCrumb, TSeparatorButtonType *inSeparator)
- {
- m_BreadCrumb = inBreadCrumb;
- m_Separator = inSeparator;
- }
- };
- typedef std::vector<SBreadCrumbItem> TBreadCrumbList;
-
- // Construction
-public:
- CBreadCrumbControl();
- virtual ~CBreadCrumbControl();
-
- DEFINE_OBJECT_COUNTER(CBreadCrumbControl)
-
- // CControl
-public:
- virtual void Draw(CRenderer *inRenderer);
-
- void RefreshTrail(IBreadCrumbProvider *inBreadCrumbProvider);
- void OnUpdateBreadCrumb();
-
- // Implementation
-protected:
- void GenerateButtonText(const SBreadCrumb &inBreadCrumb, TButtonType *inButton);
- void OnButtonToggled(CToggleButton *inButton, CButtonControl::EButtonState inState);
- void RemoveButton(SBreadCrumbItem &inBreadCrumb);
- void RemoveAllButtons();
-
-protected:
- IBreadCrumbProvider *m_BreadCrumbProvider;
- TBreadCrumbList m_BreadCrumbList;
-};
-
-#endif // INCLUDED_BREADCRUMBCONTROL_H
diff --git a/src/Authoring/Studio/Controls/ButtonControl.cpp b/src/Authoring/Studio/Controls/ButtonControl.cpp
deleted file mode 100644
index d7470808..00000000
--- a/src/Authoring/Studio/Controls/ButtonControl.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ButtonControl.h"
-#include "Renderer.h"
-#include "ResourceCache.h"
-
-//=============================================================================
-/**
- * Constructor
- *
- * @param inToggleButton true if this is suppose to be a toggle button. Toggle
- * buttons stay pressed when clicked on and have to be clicked again in order
- * to release. Normal buttons return to the up state when the button is released.
- */
-CButtonControl::CButtonControl()
- : m_State(EBUTTONSTATE_UP)
- , m_AutoSize(true)
- , m_MouseEnter(true)
- , m_IsMouseDown(false)
- , m_VCenterImage(false)
- , m_HCenterImage(false)
- , m_Margin(0)
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CButtonControl::~CButtonControl()
-{
-}
-
-//=============================================================================
-/**
- * Returns the current state of the button. A button can be "up", "down", or
- * "indeterminate". The up state is the normal state of the button. The down
- * state is when the mouse is pressing the button. The indeterminate state is
- * provided for subclasses and not used here.
- * @return the button's current state
- */
-CButtonControl::EButtonState CButtonControl::GetButtonState() const
-{
- return m_State;
-}
-
-//=============================================================================
-/**
- * Sets the current state of the button. No listeners are notified.
- * @param inState new state of the button
- */
-void CButtonControl::SetButtonState(EButtonState inState)
-{
- if (m_State == inState)
- return;
-
- m_State = inState;
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is in the up state. A button is "up"
- * if it is not disabled, not depressed, and the mouse is not over it.
- * @param inImage image to be loaded when this button is up
- */
-void CButtonControl::SetUpImage(const QPixmap &inImage)
-{
- m_ImageUp = inImage;
- Resize();
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is in the up state. A button is "up"
- * if it is not disabled, not depressed, and the mouse is not over it.
- * @param inImageName name of the image to be loaded when this button is up
- */
-void CButtonControl::SetUpImage(const QString &inImageName)
-{
- QPixmap theImage ;
- if (!inImageName.isEmpty())
- theImage = CResourceCache::GetInstance()->GetBitmap(inImageName);
- SetUpImage(theImage);
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is in the down state.
- * @param inImage image to be loaded when this button is down
- */
-void CButtonControl::SetDownImage(const QPixmap &inImage)
-{
- m_ImageDown = inImage;
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is in the down state.
- * @param inImageName name of the image to be loaded when this button is down
- */
-void CButtonControl::SetDownImage(const QString &inImageName)
-{
- QPixmap theImage;
- if (!inImageName.isEmpty())
- theImage = CResourceCache::GetInstance()->GetBitmap(inImageName);
- SetDownImage(theImage);
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button the mouse is over the button. To
- * leave the button displaying the "up" state, pass NULL to this function.
- * @param inImage image to be loaded when the mouse is over this button
- */
-void CButtonControl::SetOverImage(const QPixmap &inImage)
-{
- m_ImageOver = inImage;
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button the mouse is over the button. To
- * leave the button displaying the "up" state, pass an empty string to this function.
- * @param inImageName name of the image to be loaded when the mouse is over this button
- */
-void CButtonControl::SetOverImage(const QString &inImageName)
-{
- QPixmap theImage;
- if (!inImageName.isEmpty())
- theImage = CResourceCache::GetInstance()->GetBitmap(inImageName);
- SetOverImage(theImage);
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is disabled, when the button is in a DOWN state
- * @param inImage image to be loaded when this button is disabled
- */
-void CButtonControl::SetDisabledImage(const QPixmap &inImage)
-{
- m_ImageDownDisabled = inImage;
-}
-
-//=============================================================================
-/**
- * Sets the image to use when this button is in the disabled state.
- * @param inImageName name of the image to be loaded when this button is disabled
- */
-void CButtonControl::SetDisabledImage(const QString &inImageName)
-{
- QPixmap theImage;
- if (!inImageName.isEmpty())
- theImage = CResourceCache::GetInstance()->GetBitmap(inImageName);
- SetDisabledImage(theImage);
-}
-
-//=============================================================================
-/**
- * In cases, where there is a different (disabled) image for button UP state
- */
-void CButtonControl::SetUpDisabledImage(const QString &inImageName)
-{
- if (!inImageName.isEmpty())
- m_ImageUpDisabled = CResourceCache::GetInstance()->GetBitmap(inImageName);
-}
-
-//=============================================================================
-/**
- * Allows you to enable or disable auto sizing for this button. Auto sizing
- * causes the button's size to change whenever the "Up" image is changed for
- * this button. Button size does NOT change as the button state changes.
- * @return true if this button is currently in Auto Size mode
- */
-void CButtonControl::SetAutoSize(bool inEnableAutoSize)
-{
- m_AutoSize = inEnableAutoSize;
- Resize();
-}
-
-//=============================================================================
-/**
- * Determines if this button will auto size or not. Auto sizing causes the
- * button's size to change whenever the "Up" image is changed for this button.
- * Button size does NOT change as the button state changes.
- * @return true if this button is currently in Auto Size mode
- */
-bool CButtonControl::GetAutoSize()
-{
- return m_AutoSize;
-}
-
-void CButtonControl::SetCenterImage(bool inVCenter, bool inHCenter)
-{
- if (m_VCenterImage == inVCenter && m_HCenterImage == inHCenter)
- return;
- m_VCenterImage = inVCenter;
- m_HCenterImage = inHCenter;
- Invalidate();
-}
-
-void CButtonControl::SetMarginImage(long inMargin)
-{
- m_Margin = inMargin;
-}
-
-//=============================================================================
-/**
- * Draws the button based on the current state
- */
-void CButtonControl::Draw(CRenderer *inRenderer)
-{
- Render(inRenderer);
-}
-
-//=============================================================================
-/**
- * Handles mouse down on the button. Flags the button as down which results
- * in some possible drawing changes.
- */
-bool CButtonControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_IsMouseDown = true;
- SetButtonState(EBUTTONSTATE_DOWN);
- Q_EMIT SigButtonDown(this);
- Invalidate();
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Handles mouse up on the button. Sets the button to the "up" state and fires
- * an event to interested listeners.
- * @param inPoint location of the mouse when the event occurred
- * @param inFlags state of the modifier keys when this event occurred
- */
-void CButtonControl::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
-
- SetButtonState(EBUTTONSTATE_UP);
-
- if (IsMouseOver()) {
- Q_EMIT SigButtonUp(this);
- if (m_IsMouseDown)
- Q_EMIT SigClicked(this);
- }
- m_IsMouseDown = false;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * This function is called when the mouse passes over this button. The button
- * is invalidated so that any custom drawing for when the mouse is over the
- * button can occurr.
- * @param inPoint location of the mouse when the event occurred
- * @param inFlags state of the modifier keys when this event occurred
- */
-void CButtonControl::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- // Only invalidate the first time the mouse enters this control
- if (m_MouseEnter) {
- Invalidate();
- m_MouseEnter = false;
- }
-}
-
-//=============================================================================
-/**
- * This function is called when the mouse exits the bounds of this button. The
- * button is invalidated so that any custom drawing caused by the OnMouseOver
- * event can be undone.
- * @param inPoint location of the mouse when the event occurred
- * @param inFlags state of the modifier keys when this event occurred
- */
-void CButtonControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
- Invalidate();
- // Change the flag so that next time we get a mouse over event, we know to invalidate this
- // button
- m_MouseEnter = true;
-}
-
-//=============================================================================
-/**
- * Gets the current bitmap depending on the state of the button, postion of the
- * mouse, etc. Returns the image for the up state by default.
- * @return the currently displayed image or NULL if there is no image on this button
- */
-QPixmap CButtonControl::GetCurrentImage() const
-{
- // Default to the up state
- auto theImage = m_ImageUp;
-
- EButtonState theState = GetButtonState();
-
- // If the mouse is over the button, switch to the mouse over image
- if (IsMouseOver() && !m_ImageOver.isNull())
- theImage = m_ImageOver;
-
- // If the button is currently pressed, this cancels the up and over states, so return the down
- // image
- if (theState == EBUTTONSTATE_DOWN && !m_ImageDown.isNull())
- theImage = m_ImageDown;
-
- // If this button is disabled just return the disabled image (overrides any other states)
- if (!IsEnabled()) { // use the specified butuon UP disabled if specified, otherwise fall back on
- // the DOWN ( that's how the legacy system does it )
- if (theState == EBUTTONSTATE_UP && !m_ImageUpDisabled.isNull())
- theImage = m_ImageUpDisabled;
- else if (!m_ImageDownDisabled.isNull())
- theImage = m_ImageDownDisabled;
- }
- return theImage;
-}
-
-//=============================================================================
-/**
- * Get the size of the image that this control is currently using.
- * @return the size of the ImageUp image.
- */
-QSize CButtonControl::GetImageSize() const
-{
- // Get the image map.
- QPixmap theImage = GetCurrentImage();
-
- return theImage.size();
-}
-
-//=============================================================================
-/**
- * Override of invalidate to invalidate the parent as well.
- * @param inIsInvalidated true if this is to be invalidated.
- */
-void CButtonControl::Invalidate(bool inIsInvalidated /* = true */)
-{
- // Since the button is transparent the parent needs to be drawn as well.
- if (inIsInvalidated && GetParent() != nullptr)
- GetParent()->Invalidate();
-
- CControl::Invalidate(inIsInvalidated);
-}
-
-//=============================================================================
-/**
- * Draws the appropriate image for the current button state to the renderer.
- * @param inRenderer the renderer to draw to
- */
-void CButtonControl::Render(CRenderer *inRenderer)
-{
- CPt thePos(0, 0);
- const auto theImage = GetCurrentImage();
-
- if (m_VCenterImage || m_HCenterImage) {
- const auto theSize = theImage.size();
-
- if (m_HCenterImage)
- thePos.x = (GetSize().x / 2) - (theSize.width() / 2);
-
- if (m_VCenterImage)
- thePos.y = (GetSize().y / 2) - (theSize.height() / 2);
- }
-
- thePos.x += m_Margin;
-
- if (!theImage.isNull())
- inRenderer->DrawBitmap(thePos, theImage);
-}
-
-//=============================================================================
-/**
- * If auto sizing is enabled, this function resizes the button to be the same
- * size as the image that it contains. Note: it does not set the Min/Max sizes.
- */
-void CButtonControl::Resize()
-{
- if (m_AutoSize) {
- auto theSize = m_ImageUp.size();
-
- SetSize(CPt(theSize.width(), theSize.height()));
- }
-}
diff --git a/src/Authoring/Studio/Controls/ButtonControl.h b/src/Authoring/Studio/Controls/ButtonControl.h
deleted file mode 100644
index 36282050..00000000
--- a/src/Authoring/Studio/Controls/ButtonControl.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_BUTTON_CONTROL_H
-#define INCLUDED_BUTTON_CONTROL_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "Multicaster.h"
-
-#include <QPixmap>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-//=============================================================================
-/**
- * Base class for creating button controls.
- */
-class CButtonControl : public QObject, public CControl
-{
- Q_OBJECT
-public:
- /// States for procedural buttons that might result in drawing changes
- enum EButtonState {
- EBUTTONSTATE_UP, ///< Indicates that the button is currently in the up position
- EBUTTONSTATE_DOWN, ///< Indicates that the button is currently in the up position
- EBUTTONSTATE_INDETERMINATE ///< Not used yet; provided for sub-classes to implement a
- ///tri-state functionality
- };
-
-protected:
- EButtonState m_State; ///< Specifies what state the button is currently in; state changes as the
- ///button is clicked on
- QPixmap m_ImageUp; ///< The image for the button in its normal state
- QPixmap m_ImageDown; ///< The image for the button while it is being clicked
- QPixmap m_ImageOver; ///< The image for the button while the mouse is over
- QPixmap m_ImageUpDisabled; ///< The image for the button when it is disabled and unavailable
- ///to the user
- QPixmap m_ImageDownDisabled; ///< The image for the button when it is disabled and unavailable
- ///to the user
- bool m_AutoSize; ///< true if the button will automatically resize itself
- bool m_MouseEnter; ///< Flag for determining mouse enter/exit status so that the number of
- ///invalidations is minimized. See OnMouseOver and OnMouseOut.
- bool m_IsMouseDown;
- bool m_VCenterImage;
- bool m_HCenterImage;
- long m_Margin;
-
-public:
- CButtonControl();
- virtual ~CButtonControl();
-
- EButtonState GetButtonState() const;
- virtual void SetButtonState(EButtonState inState);
-
- void SetUpImage(const QPixmap &inImage);
- void SetUpImage(const QString &inImageName);
- void SetDownImage(const QPixmap &inImage);
- void SetDownImage(const QString &inImageName);
- void SetOverImage(const QPixmap &inImage);
- void SetOverImage(const QString &inImageName);
- void SetDisabledImage(const QPixmap &inImage);
- void SetDisabledImage(const QString &inImageName);
- void SetUpDisabledImage(const QString &inImageName);
- QSize GetImageSize() const;
-
- void SetAutoSize(bool inEnableAutoSize);
- bool GetAutoSize();
-
- void SetCenterImage(bool inVCenter, bool inHCenter);
- void SetMarginImage(long inMargin);
-
- void Draw(CRenderer *inRenderer) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void Invalidate(bool inIsInvalidated = true) override;
-Q_SIGNALS:
- void SigButtonDown(CControl*);
- void SigButtonUp(CControl*);
- void SigClicked(CControl*);
-
-protected:
- virtual void Render(CRenderer *inRenderer);
- virtual QPixmap GetCurrentImage() const;
- virtual void Resize();
-};
-
-#endif // INCLUDED_BUTTON_CONTROL_H
diff --git a/src/Authoring/Studio/Controls/ComboTextBox.h b/src/Authoring/Studio/Controls/ComboTextBox.h
deleted file mode 100644
index dbb3f199..00000000
--- a/src/Authoring/Studio/Controls/ComboTextBox.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_COMBO_TEXT_BOX_H
-#define INCLUDED_COMBO_TEXT_BOX_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "StringEdit.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//==============================================================================
-/**
- * @class CComboTextBox extends CTextEdit to handle custom drawing, etc.
- */
-class CComboTextBox : public CStringEdit
-{
-public:
- CComboTextBox();
- virtual ~CComboTextBox();
- void Draw(CRenderer *inRenderer) override;
- bool OnMouseDown(CPt inLocation, Qt::KeyboardModifiers inFlags) override;
- bool CanAcceptChar(const Q3DStudio::CString &inCheckString, unsigned int inChar,
- unsigned int inPosition) override;
-
-protected:
-};
-
-#endif // INCLUDED_COMBO_TEXT_BOX_H
diff --git a/src/Authoring/Studio/Controls/EditInPlace.h b/src/Authoring/Studio/Controls/EditInPlace.h
deleted file mode 100644
index f4497210..00000000
--- a/src/Authoring/Studio/Controls/EditInPlace.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 Anark Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#ifndef INCLUDED_EDIT_IN_PLACE_H
-#define INCLUDED_EDIT_IN_PLACE_H 1
-
-#pragma once
-
-#include "Renderer.h"
-#include "Pt.h"
-#include "StudioPreferences.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-template <class T>
-class CEditInPlace : public T
-{
-public:
- CEditInPlace();
- virtual ~CEditInPlace();
-
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnLoseFocus() override;
- void OnGainFocus() override;
- void Draw(CRenderer *inRenderer) override;
- void SetEditable(bool inIsEditable);
- void SetEditMode(bool inEditMode);
- void EnterText(bool inHighlight) override;
- void Invalidate(bool inInvalidate = true) override;
- bool GetEditMode();
- static long GetRightBuffer();
-
-protected:
- bool m_IsInEditMode; ///< If in edit mode, the user is currently editing the control
- bool m_IsEditable; ///< Can only enter edit mode when the control is editable
-
-private:
- static const long s_RightBuffer = 6;
-};
-
-template <class T>
-CEditInPlace<T>::CEditInPlace()
- : T()
- , m_IsInEditMode(false)
- , m_IsEditable(true)
-{
- T::SetReadOnly(true);
- T::SetFillBackground(false);
-}
-
-template <class T>
-CEditInPlace<T>::~CEditInPlace()
-{
-}
-
-//==============================================================================
-/**
- * Handles the mouse double-click event. Enters the text into edit mode so that
- * the user can change its value.
- * @param inPoint location of the mouse
- * @param inFlags modifier flags for the mouse
- * @return true if this message should not be passed to any other children, otherwise false
- */
-template <class T>
-bool CEditInPlace<T>::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (m_IsEditable && CStudioPreferences::IsSudoMode()) {
- SetEditMode(true);
- this->SetSelection(0, T::GetString().Length());
- return true;
- }
- return T::OnMouseDoubleClick(inPoint, inFlags);
-}
-
-template <class T>
-bool CEditInPlace<T>::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (T::GetParent()->HasFocus(this) && !(inFlags & CHotKeys::MOUSE_RBUTTON))
- SetEditMode(true);
- return T::OnMouseDown(inPoint, inFlags);
-}
-
-//==============================================================================
-/**
- * Called when this control loses focus. Turns off edit mode and redraws the
- * control.
- */
-template <class T>
-void CEditInPlace<T>::OnLoseFocus()
-{
- T::OnLoseFocus();
- SetEditMode(false);
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Handles most of the drawing, with some help from the parent class.
- * @param inRenderer Renderer to draw to
- */
-template <class T>
-void CEditInPlace<T>::Draw(CRenderer *inRenderer)
-{
- CRct theRect = CRct(T::GetSize()); // CRct( CPt( 0, 0 ), CPt( CalculateCharWidths( inRenderer ) +
- // s_RightBuffer, GetSize( ).y ) );
- CColor theOutlineColor = CColor(0, 0, 0);
-
- T::SetAbsoluteSize(theRect.size);
-
- bool theFillFlag = T::m_FillBackground;
-
- if (theFillFlag && !m_IsInEditMode) {
- T::SetFillBackground(false);
- inRenderer->FillSolidRect(theRect, T::m_BackgroundColorNoFocus);
- }
-
- if (m_IsInEditMode)
- T::SetTextColor(CColor(0, 0, 0));
-
- inRenderer->PushClippingRect(theRect);
- T::Draw(inRenderer);
- inRenderer->PopClippingRect();
-
- if (!m_IsInEditMode)
- T::SetFillBackground(theFillFlag);
-
- if (m_IsInEditMode)
- inRenderer->DrawRectOutline(theRect, theOutlineColor, theOutlineColor, theOutlineColor,
- theOutlineColor);
-}
-
-//==============================================================================
-/**
- * Enables or disables this control from being able to enter "Edit Mode" when
- * SetEditMode() is called.
- * @param inIsEditable true if you want the control to be editable when double-clicked, otherwise
- * false
- */
-template <class T>
-void CEditInPlace<T>::SetEditable(bool inIsEditable)
-{
- m_IsEditable = inIsEditable;
-
- if (!m_IsEditable && m_IsInEditMode)
- SetEditMode(false);
-}
-
-//==============================================================================
-/**
- * Starts or stops "Edit Mode". While in Edit Mode, the user can change the
- * text, move the caret, and highlight the text. An edit box is also drawn
- * around the text.
- * @param inEditMode true to turn on Edit Mode, false to turn off Edit Mode
- */
-template <class T>
-void CEditInPlace<T>::SetEditMode(bool inEditMode)
-{
- if (m_IsEditable) {
- m_IsInEditMode = inEditMode;
- T::SetFillBackground(!m_IsInEditMode);
- T::SetReadOnly(!m_IsInEditMode);
- if (!m_IsInEditMode)
- T::FireCommitEvent();
- }
-}
-
-//==============================================================================
-/**
- * Overriden from the parent to cause this control to lose focus when the Enter
- * button is pressed on the keyboard.
- * @param inHighlight true to highlight all of the text, false to just change the string
- */
-template <class T>
-void CEditInPlace<T>::EnterText(bool inHighlight)
-{
- T::EnterText(inHighlight);
- OnLoseFocus();
-}
-
-//==============================================================================
-/**
- * Overriden to also invalidate/validate the parent.
- * @param inInvalidate true to invalidate this control and the parent control
- */
-/*
-template<class T>
-void CEditInPlace<T>::Invalidate( bool inInvalidate )
-{
- if ( inInvalidate && GetParent() )
- GetParent()->Invalidate( inInvalidate );
-
- CControl::Invalidate( inInvalidate );
-}*/
-
-//==============================================================================
-/**
- * Override to avoid selecting all the text unless in edit mode.
- */
-template <class T>
-void CEditInPlace<T>::OnGainFocus()
-{
- if (m_IsInEditMode && m_IsEditable)
- T::OnGainFocus();
-}
-
-template <class T>
-bool CEditInPlace<T>::GetEditMode()
-{
- return m_IsInEditMode;
-}
-
-template <class T>
-long CEditInPlace<T>::GetRightBuffer()
-{
- return s_RightBuffer;
-}
-
-template <class T>
-bool CEditInPlace<T>::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers)
-{
- bool theReturn = false;
-
- if (m_IsInEditMode) {
- T::DisplayContextMenu(inPoint);
- theReturn = true;
- }
-
- return theReturn;
-}
-
-//==============================================================================
-/**
- * Overriden to also invalidate/validate the parent.
- * @param inInvalidate true to invalidate this control and the parent control
- */
-template <class T>
-void CEditInPlace<T>::Invalidate(bool inInvalidate)
-{
- if (inInvalidate && T::GetParent())
- T::GetParent()->Invalidate(inInvalidate);
-
- T::Invalidate(inInvalidate);
-}
-
-#endif // INCLUDED_EDIT_IN_PLACE_H
diff --git a/src/Authoring/Studio/Controls/FloatEdit.cpp b/src/Authoring/Studio/Controls/FloatEdit.cpp
deleted file mode 100644
index 01f9696e..00000000
--- a/src/Authoring/Studio/Controls/FloatEdit.cpp
+++ /dev/null
@@ -1,519 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#include "stdafx.h"
-
-//==============================================================================
-// Include
-//==============================================================================
-#include "FloatEdit.h"
-#include "MouseCursor.h"
-#include "ResourceCache.h"
-#include "StudioClipboard.h"
-#include "ControlData.h"
-#include "Qt3DSMath.h"
-
-#include <QtWidgets/qapplication.h>
-// using namespace Q3DStudio; <-- Do not do this here because it will conflict with CList and make
-// the template generator go blah
-
-//==============================================================================
-/**
- * Constructor
- */
-CFloatEdit::CFloatEdit()
- : m_NumDecimalPlaces(3)
- , m_FixedPlaces(-1)
- , m_IsMouseDown(false)
- , m_Min(-FLT_MAX)
- , m_Max(FLT_MAX)
- , m_EditMode(false)
- , m_RevertListener(NULL)
-{
- m_ControlData->SetMouseWheelEnabled(true);
- // Set the default string
- SetData(0.0f, false);
-
- SetReadOnly(true);
- SetName("FloatEdit");
-
- // TODO: Used only for timeline palette timebar. It is not editable, we do not need
- // to register any events. Registering minus here will prevent it from working for zooming
- // out in the timeline.
- // TODO: This whole class will most likely be removed when timeline is converted to Qt.
- // m_CommandHandler.RegisterKeyEvent(
- // new CDynHotKeyConsumer<CFloatEdit>(this, &CFloatEdit::AddCharNegative), 0, '-');
- // m_CommandHandler.RegisterKeyEvent(
- // new CDynHotKeyConsumer<CFloatEdit>(this, &CFloatEdit::AddCharPeriod), 0, '.');
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CFloatEdit::~CFloatEdit()
-{
-}
-
-void CFloatEdit::AddCharNegative()
-{
- unsigned int theMinus = '-';
-
- InsertChar(theMinus);
-}
-
-void CFloatEdit::AddCharPeriod()
-{
- unsigned int thePeriod = '.';
-
- InsertChar(thePeriod);
-}
-
-void CFloatEdit::FormatString()
-{
- Q3DStudio::CString theFormatString;
- if (m_FixedPlaces == -1)
- theFormatString.Format(_LSTR("%%.%df"), m_NumDecimalPlaces);
- else
- theFormatString.Format(_LSTR("%%0%d.%df"), m_FixedPlaces, m_NumDecimalPlaces);
-
- m_ValueString.Format(theFormatString, m_Value);
-}
-
-//==============================================================================
-/**
- * Converts the internal (float) data of this control into a string that can be
- * displayed. The parent class (CTextEdit) calls this function when it needs
- * to redraw the control and the text within it.
- *
- * @return the string to be displayed.
- */
-Q3DStudio::CString CFloatEdit::GetString()
-{
- return m_ValueString;
-}
-
-//==============================================================================
-/**
- * Sets the internal data of this control the specified value and marks the
- * control as dirty so that it gets redrawn during the next free cycle.
- *
- * @param inValue the new value for this control
- * @param inFireEvent true to fire a property change event
- */
-void CFloatEdit::SetData(float inValue, bool inFireEvent /* = true */)
-{
- m_Value = inValue;
-
- FormatString();
- SetDisplayString(GetString(), inFireEvent);
- if (inFireEvent)
- SetDirty(true);
-}
-
-//==============================================================================
-/**
- * Attempts to set the internal data of this control to the specified string.
- *
- * @param inData a string containing the new data
- */
-void CFloatEdit::SetData(const Q3DStudio::CString &inData, bool inFireEvent /*= true*/)
-{
- m_Value = static_cast<float>(::atof(inData.GetCharStar()));
-
- FormatString();
- // The string needs to be set precisely here, otherwise
- // we end up truncating - and . from the floats
- SetDisplayString(inData, inFireEvent);
- SetDirty(true);
-}
-
-//==============================================================================
-/**
- * Determines if the specified character can be inserted into the string. This
- * control only accepts numbers, decimals, and minus signs. Further, a minus
- * sign may only be inserted at the front of the string if there is not already
- * one in the string and a decimal may only be inserted if there is not one in
- * the string already.
- *
- * @param inCheckString the string that is to be checked (in case a lenght requirement is exceeded)
- * @param inChar the character that was pressed
- * @param inPosition character index where we are attempting to insert inChar into inCheckString
- * @return true if this control can accept the character into the string, otherwise false
- */
-bool CFloatEdit::CanAcceptChar(const Q3DStudio::CString &inCheckString, unsigned int inChar,
- unsigned int inPosition)
-{
- bool theRetVal = false;
-
- unsigned int thePeriod = '.';
- unsigned int theMinus = '-';
-
- if ((CTextEdit::CanAcceptChar(inCheckString, inChar, inPosition) && inCheckString.Length() < 10)
- || inChar == thePeriod || inChar == theMinus) {
- if (inChar >= '0' && inChar <= '9')
- theRetVal = true;
- if (!theRetVal) {
- if (thePeriod == inChar) {
- if (inCheckString.Find(char(thePeriod)) == Q3DStudio::CString::ENDOFSTRING)
- theRetVal = true;
- else
- theRetVal = false;
- } else if (theMinus == inChar) {
- if ((inCheckString.Find(char(theMinus)) == Q3DStudio::CString::ENDOFSTRING)
- && (inPosition == 0)) {
- theRetVal = true;
- }
- }
- }
- }
- return theRetVal;
-}
-
-bool CFloatEdit::HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool isLargeStep = inFlags & CHotKeys::MODIFIER_SHIFT ? true : false;
- bool isSmallStep = inFlags & CHotKeys::MODIFIER_CONTROL ? true : false;
-
- bool wasHandled = false;
- switch (inChar) {
- case Qt::Key_Up:
- if (isLargeStep)
- SetFloatValue(m_Value + 10.0f);
- else if (isSmallStep)
- SetFloatValue(static_cast<float>(m_Value + 0.1f));
- else
- SetFloatValue(static_cast<float>(m_Value + 1.0f));
- wasHandled = true;
- break;
-
- case Qt::Key_Down:
- if (isLargeStep)
- SetFloatValue(static_cast<float>(m_Value - 10.0f));
- else if (isSmallStep)
- SetFloatValue(static_cast<float>(m_Value - 0.1f));
- else
- SetFloatValue(m_Value - 1.0f);
- wasHandled = true;
- break;
-
- case Qt::Key_Enter:
- ExitEditMode();
- wasHandled = true;
- CTextEdit::OnLoseFocus();
- break;
-
- case Qt::Key_Escape:
- if (m_RevertListener)
- m_RevertListener->OnDiscardChanges(this);
- ExitEditMode();
- wasHandled = true;
- CTextEdit::OnLoseFocus();
- break;
-
- /*
- case CHotKeys::KEY_SUBTRACT:
- case CHotKeys::KEY_SUBTRACT_OEM:
- case CHotKeys::KEY_PERIOD_OEM:
- wasHandled = true;
- break;
- */
- }
-
- if (!wasHandled)
- wasHandled = CTextEdit::HandleSpecialChar(inChar, inFlags);
-
- return wasHandled;
-}
-
-float CFloatEdit::GetData()
-{
- return m_Value;
-}
-
-float CFloatEdit::GetDisplayData()
-{
- float theFloat = static_cast<float>(::atof(GetDisplayString().GetCharStar()));
- return theFloat;
-}
-
-void CFloatEdit::OnLoseFocus()
-{
- ExitEditMode();
- CTextEdit::OnLoseFocus();
-}
-
-void CFloatEdit::OnGainFocus()
-{
- if (!m_IsMouseDown && IsEnabled())
- SetReadOnly(false);
- CTextEdit::OnGainFocus();
-}
-
-bool CFloatEdit::CanGainFocus()
-{
- return true;
-}
-
-void CFloatEdit::ExitEditMode()
-{
- m_EditMode = false;
- SetReadOnly(true);
-}
-
-void CFloatEdit::EnterEditMode()
-{
- m_EditMode = true;
- SetReadOnly(false);
-}
-
-//==============================================================================
-/**
- * Handles the dynamic dragging of float values.
- */
-void CFloatEdit::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (m_IsMouseDown && !m_EditMode) {
- // If we haven't started handling selecting or dragging figure out which one to do
- if (!m_Trapping) {
- // If moved outside of the safety zone start dragging the value.
- if (::labs(inPoint.y - m_MouseStartPos.y) > 2) {
- m_Trapping = true;
- // In Mac there's no infinite mouse, so don't hide it.
- setCursorIfNotSet(CMouseCursor::CURSOR_BLANK);
- }
- }
- // If in trapping mode then do the value drag processing.
- if (m_Trapping) {
- float theDiff = static_cast<float>(m_MouseStartPos.y - inPoint.y);
-
- if (inFlags & CHotKeys::MODIFIER_CONTROL)
- theDiff *= 0.1f;
- else if (inFlags & CHotKeys::MODIFIER_SHIFT)
- theDiff *= 10.0f;
-
- SetFloatValue(theDiff + m_StartDragVal);
-
- CPt theMouseLoc = CControl::ClientToScreen(m_MouseStartPos);
- getCursor().setPos(theMouseLoc.x, theMouseLoc.y);
-
- m_StartDragVal = GetData();
- }
- } else {
- CTextEdit::OnMouseMove(inPoint, inFlags);
- }
-}
-
-void CFloatEdit::SetFloatValue(float inValue)
-{
- // If the min and max are both zero, special case, don't bother capping the value to the
- // min/max.
- if (m_Min != 0 || m_Max != 0) {
- if (inValue > m_Max)
- inValue = m_Max;
- else if (inValue < m_Min)
- inValue = m_Min;
- }
-
- SetData(inValue);
- ReloadData();
- Q3DStudio::CString theNewValue = GetString();
- SetData(theNewValue);
-}
-
-//==============================================================================
-/**
- * Handler to start mouse dragging actions on this.
- */
-bool CFloatEdit::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (IsEnabled()) {
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- if (m_EditMode)
- CTextEdit::OnMouseDown(inPoint, inFlags);
-
- m_IsMouseDown = true;
- m_Trapping = false;
- m_StartDragVal = GetData();
-
- m_MouseStartPos = inPoint;
- }
- }
-
- return true;
-}
-
-//==============================================================================
-/**
- * Handler to finish the mouse dragging actions.
- */
-void CFloatEdit::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (m_IsMouseDown && !m_Trapping && m_IsReadOnly) {
- SetReadOnly(false);
- SelectAllText();
- EnterEditMode();
- }
-
- CTextEdit::OnMouseUp(inPoint, inFlags);
-
- resetCursor();
- m_IsMouseDown = false;
-
- if (m_Trapping)
- FireFocusEvent(true);
-}
-
-//==============================================================================
-/**
- * Set the minimum value allowed in this edit field.
- */
-void CFloatEdit::SetMin(float inMin)
-{
- m_Min = inMin;
-}
-
-//==============================================================================
-/**
- * Set the maximum value allowed in this field.
- */
-void CFloatEdit::SetMax(float inMax)
-{
- m_Max = inMax;
-}
-
-//==============================================================================
-/**
- * Handle mouse wheel messages to allow scrolling of the values.
- */
-bool CFloatEdit::OnMouseWheel(CPt inPoint, long inAmount, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- bool theRet = false;
- if (GetParent() && GetParent()->HasFocus(this)) {
- float theDiff = 1.0f;
- if (inFlags & CHotKeys::MODIFIER_CONTROL)
- theDiff = 0.1f;
- else if (inFlags & CHotKeys::MODIFIER_SHIFT)
- theDiff = 10.0f;
-
- if (inAmount < 0)
- theDiff *= -1.0f;
-
- SetFloatValue(GetData() + theDiff);
-
- theRet = true;
- }
- return theRet;
-}
-
-//==============================================================================
-/**
- * Set the number of decimal places to be displayed in this.
- */
-void CFloatEdit::SetNumDecimalPlaces(short inNumDecimalPlaces)
-{
- m_NumDecimalPlaces = inNumDecimalPlaces;
- FormatString();
-}
-
-//==============================================================================
-/**
- * Set the number of fill places before the start of the number to fill if the number
- * is too short. This defaults to -1 which means none.
- */
-void CFloatEdit::SetFixedPlaces(short inFixedPlaces)
-{
- m_FixedPlaces = inFixedPlaces;
-}
-
-//==============================================================================
-/**
- * Ensure that the text from clipboard can be pasted into this control
- */
-bool CFloatEdit::CanPaste()
-{
- bool theValid = false;
-
- const auto text = Q3DStudio::CString::fromQString(CStudioClipboard::GetTextFromClipboard());
- if (m_Caret.show) {
- Q3DStudio::CString theNewString(m_DisplayString);
- long theCaret = m_Caret.position;
-
- if (HasSelectedText()) {
- theNewString.Delete(GetSelectionLeft(), GetSelectionRight() - GetSelectionLeft());
- theCaret = Q3DStudio::MIN(GetSelectionLeft(), GetSelectionRight());
- }
- theNewString.Insert(theCaret, text);
- theValid = Validate(theNewString);
- } else {
- theValid = Validate(text);
- }
-
- return theValid;
-}
-
-//==============================================================================
-/**
- * Returns true if the given string can be pasted into the control
- */
-bool CFloatEdit::Validate(const Q3DStudio::CString &inString)
-{
- Q3DStudio::CString theCheckString("");
- Q3DStudio::CString theTemp;
- bool theRetVal = true;
- long theIter;
-
- for (theIter = 0; theIter < inString.Length(); ++theIter) {
- theTemp = inString.Extract(theIter, 1);
-
- if (!CanAcceptChar(theCheckString, theTemp[0], theIter)) {
- theRetVal = false;
- break;
- } else {
- theCheckString += inString.Extract(theIter, 1);
- }
- }
-
- return theRetVal;
-}
-
-//==============================================================================
-/**
- * Refreshes the display string from the internal data
- */
-void CFloatEdit::RefreshDisplayFromData()
-{
- SetDisplayString(GetString());
- Invalidate();
-}
diff --git a/src/Authoring/Studio/Controls/FloatEdit.h b/src/Authoring/Studio/Controls/FloatEdit.h
deleted file mode 100644
index 8643eb81..00000000
--- a/src/Authoring/Studio/Controls/FloatEdit.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_FLOAT_EDIT_H
-#define INCLUDED_FLOAT_EDIT_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TextEdit.h"
-
-#include <QtGui/qcursor.h>
-
-GENERIC_FUNCTOR_1(CRevertListener, OnDiscardChanges, CControl *);
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CMouseCursor;
-
-class CFloatEdit : public CTextEdit
-{
-protected:
- float m_Value; ///<
- short m_NumDecimalPlaces; ///<
- short m_FixedPlaces; ///<
- bool m_IsMouseDown; ///<
- bool m_Trapping; ///<
- float m_StartDragVal; ///<
- float m_Min; ///<
- float m_Max; ///<
- bool m_EditMode; ///<
- Q3DStudio::CString m_ValueString; ///<
- CPt m_MouseStartPos; ///< Used to reset the mouse pos when dragging values.
- CRevertListener *m_RevertListener; ///< Used when user presses escape.
-
-public:
- CFloatEdit();
- virtual ~CFloatEdit();
-
- Q3DStudio::CString GetString() override;
- virtual void SetData(float inValue, bool inFireEvent = true);
- void SetData(const Q3DStudio::CString &inData, bool inFireEvent = true) override;
- bool CanAcceptChar(const Q3DStudio::CString &inCheckString, unsigned int inChar,
- unsigned int inPosition) override;
- bool CanPaste() override;
-
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseWheel(CPt inPoint, long inAmount, Qt::KeyboardModifiers inFlags) override;
-
- virtual void SetMin(float inMin);
- virtual void SetMax(float inMax);
-
- void OnLoseFocus() override;
- void OnGainFocus() override;
- bool CanGainFocus() override;
-
- float GetData();
- float GetDisplayData();
-
- void SetNumDecimalPlaces(short inNumDecimalPlaces);
- void SetFixedPlaces(short inFixedPlaces);
- void RefreshDisplayFromData() override;
-
- virtual void SetRevertListener(CRevertListener *inListener) { m_RevertListener = inListener; }
-
-protected:
- bool HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags) override;
-
- void SetFloatValue(float inValue);
- bool Validate(const Q3DStudio::CString &inString);
-
- void EnterEditMode();
- void ExitEditMode();
-
- void FormatString();
-
- void AddCharNegative();
- void AddCharPeriod();
-};
-
-#endif // INCLUDED_FLOAT_EDIT_H
diff --git a/src/Authoring/Studio/Controls/FlowLayout.cpp b/src/Authoring/Studio/Controls/FlowLayout.cpp
deleted file mode 100644
index 5f750691..00000000
--- a/src/Authoring/Studio/Controls/FlowLayout.cpp
+++ /dev/null
@@ -1,1009 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "FlowLayout.h"
-#include "Renderer.h"
-#include "MasterP.h"
-#include "ControlData.h"
-#include "CoreUtils.h"
-#include "Qt3DSMath.h"
-// using namespace Q3DStudio; <-- Do not do this here because it will conflict with CList and make
-// the template generator go blah
-
-using namespace Q3DStudio::Control;
-
-//=============================================================================
-/**
- * Checks to see if this has hit it's max X
- */
-bool CanBeExpandedX(CControl *inControl)
-{
- bool theRetVal = false;
- CPt theSize = inControl->GetSize();
- CPt theMaxSize = inControl->GetMaximumSize();
- if (theSize.x < theMaxSize.x) {
- theRetVal = true;
- }
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * Checks to see if this has hit it's max Y
- */
-bool CanBeExpandedY(CControl *inControl)
-{
- bool theRetVal = false;
- CPt theSize = inControl->GetSize();
- CPt theMaxSize = inControl->GetMaximumSize();
- if (theSize.y < theMaxSize.y) {
- theRetVal = true;
- }
- return theRetVal;
-}
-
-IMPLEMENT_OBJECT_COUNTER(CFlowLayout)
-
-//=============================================================================
-/**
- * Constructs a new FlowLayout flowing vertically (down).
- */
-CFlowLayout::CFlowLayout(CControl *inControl, bool inUseControl)
- : m_FlowDirection(FLOW_VERTICAL)
- , m_VerticalAlignment(ALIGN_TOP)
- , m_HorizontalAlignment(ALIGN_LEFT)
- , m_ResizingChildren(false)
- , m_LeftMargin(0)
- , m_RightMargin(0)
- , m_TopMargin(0)
- , m_BottomMargin(0)
- , m_ChildGap(0)
- , m_DebugFlag(false)
- , m_AutoMin(true)
- , m_SuspendRecalcLayout(false)
-{
- ADDTO_OBJECT_COUNTER(CFlowLayout)
-
- m_BlankDisable = false;
- m_HasUnusedSpace = false;
-
- if (inControl != nullptr) {
- m_BlankControl = inControl;
- } else if (inUseControl) {
- m_BlankControl = new CBlankControl();
- } else {
- m_BlankControl = nullptr;
- }
-
- SetMaximumSize(CPt(LONG_MAX, LONG_MAX));
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CFlowLayout::~CFlowLayout()
-{
- delete m_BlankControl;
-
- REMOVEFROM_OBJECT_COUNTER(CFlowLayout)
-}
-
-//=============================================================================
-/**
- * The left margin is the gap on the left side of the flow layout where no
- * controls are drawn. The default left margin of a flow layout is zero. If
- * you have a horizontal flow layout with left alignment, you can use the margin
- * to push all the child controls over by a fixed amount.
- * @param inMargin Width in pixels of the left margin
- * @return the previous width of the left margin
- */
-long CFlowLayout::SetLeftMargin(long inMargin)
-{
- long theOldMargin = m_LeftMargin;
- m_LeftMargin = inMargin;
- ResetMinMaxPref();
- RecalcLayout();
- return theOldMargin;
-}
-
-//=============================================================================
-/**
- * The left margin is the gap on the left side of the flow layout where no
- * controls are drawn. The default left margin of a flow layout is zero. Only
- * valid with a horizontal flow layout with left alignment.
- * @return the gap on the left side of this flow, in pixels
- */
-long CFlowLayout::GetLeftMargin() const
-{
- return m_LeftMargin;
-}
-
-long CFlowLayout::GetRightMargin() const
-{
- return m_RightMargin;
-}
-
-long CFlowLayout::GetTopMargin() const
-{
- return m_TopMargin;
-}
-
-long CFlowLayout::GetBottomMargin() const
-{
- return m_BottomMargin;
-}
-
-//=============================================================================
-/**
- * Disables the drawing of blank rectangles in blank areas on the screen
- * @param NONE
- * @return NONE
- */
-void CFlowLayout::DisableBlank()
-{
- m_BlankDisable = true;
-}
-
-//=============================================================================
-/**
- * The right margin is the gap on the rgiht side of the flow layout where no
- * controls are drawn. The default right margin of a flow layout is zero. If
- * you have a horizontal flow layout with right alignment, you can use the margin
- * to push all the child controls over by a fixed amount.
- * @param inMargin Width in pixels of the right margin
- * @return the previous width of the right margin
- */
-long CFlowLayout::SetRightMargin(long inMargin)
-{
- long theOldMargin = m_RightMargin;
- m_RightMargin = inMargin;
- ResetMinMaxPref();
- RecalcLayout();
- return theOldMargin;
-}
-
-//=============================================================================
-/**
- * The top margin is the gap on the top of the flow layout where no controls
- * are drawn. The default top margin of a flow layout is zero. If you have
- * a vertical flow layout with top alignment, you can use the margin to push
- * all the child controls down by a fixed amount.
- * @param inMargin Height in pixels of the top margin
- * @return the previous height of the top margin
- */
-long CFlowLayout::SetTopMargin(long inMargin)
-{
- long theOldMargin = m_TopMargin;
- m_TopMargin = inMargin;
- ResetMinMaxPref();
- RecalcLayout();
- return theOldMargin;
-}
-
-//=============================================================================
-/**
- * The bottom margin is the gap on the bottom of the flow layout where no
- * controls are drawn. The default bottom margin of a flow layout is zero. If
- * you have a vertical flow layout with bottom alignment, you can use the margin
- * to push all the child controls up by a fixed amount.
- * @param inMargin Height in pixels of the bottom margin
- * @return the previous height of the bottom margin
- */
-long CFlowLayout::SetBottomMargin(long inMargin)
-{
- long theOldMargin = m_BottomMargin;
- m_BottomMargin = inMargin;
- ResetMinMaxPref();
- RecalcLayout();
- return theOldMargin;
-}
-
-//=============================================================================
-/**
- * This functions sets a fixed gap between children of the flow layout.
- * @param inGap pixel gap between each child of the flow layout
- * @return the previous pixel gap between children
- */
-long CFlowLayout::SetGapBetweenChildren(long inGap)
-{
- long theOldGap = m_ChildGap;
- m_ChildGap = inGap;
- ResetMinMaxPref();
- RecalcLayout();
- return theOldGap;
-}
-
-//=============================================================================
-/**
- * Get the preferred size of this control.
- * The preferred size is the sum of all the preferred sizes of all the children.
- * @return the preferred size of this control.
- */
-// CPt CFlowLayout::GetPreferredSize( )
-//{
-// return m_PreferredSize;
-//}
-
-//=============================================================================
-/**
- * Get the minimum size of this control.
- * The minimum size is the sum of all the minimum sizes of all the children in
- * the flow direction, and the largest minimum size in the non-flow direction.
- * @return the minimum size of this control.
- */
-// CPt CFlowLayout::GetMinimumSize( )
-//{
-// return m_MinimumSize;
-//}
-
-//=============================================================================
-/**
- * Get the maximum size of this control.
- * The maximum size is the sum of all the maximum sizes of all the children in
- * the flow direction, and the smallest maximum size in the non-flow direction.
- * @return the maximum size of this control.
- */
-// CPt CFlowLayout::GetMaximumSize( )
-//{
-// return m_MaximumSize;
-//}
-
-//=============================================================================
-/**
- * Set the direction the components are flowing.
- * Vertical means the components will be positioned one on top of the other,
- * starting at the top and flowing down.
- * Horizontal means the components will be positions side by side, starting on
- * the left and flowing right.
- * @param inFlowDirection the new flow direction.
- */
-void CFlowLayout::SetFlowDirection(EFlowDirection inFlowDirection)
-{
- if (inFlowDirection != m_FlowDirection) {
- m_FlowDirection = inFlowDirection;
-
- RecalcLayout();
- }
-}
-
-//=============================================================================
-/**
- * Add a child control to this control.
- * This adds the child control to this and includes it in the layout.
- * @param inControl the control to be added.
- * @param inInsertBefore the location to insert the control, nullptr = end.
- */
-void CFlowLayout::AddChild(CControl *inControl, CControl *inInsertBefore /*= nullptr*/)
-{
- CControl::AddChild(inControl, inInsertBefore);
-
- if (GetParent() != nullptr) {
- ResetMinMaxPref();
- GetParent()->OnChildSizeChanged(this);
- }
-
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Remove a child from this control.
- * @param inControl the control to be removed.
- */
-void CFlowLayout::RemoveChild(CControl *inControl)
-{
- CControl::RemoveChild(inControl);
-
- if (GetParent() != nullptr) {
- ResetMinMaxPref();
- GetParent()->OnChildSizeChanged(this);
- }
-
- RecalcLayout();
-}
-
-/**
- * Sets the flag on whether to suspend the recalculation of the layout.
- * Recalc is expensive, especially when there are many children.
- * if you need to add lots of children items to this control, do this:
- * SuspendRecalcLayout( true ); AddLotsOFItems( ); SuspendRecalcLayout( false );
- * DoSomethingThatWillTriggerRecalcLayout( );
- * @param inSuspendFlag true would suspend recalc
- * @see RecalcLayout
- * @see CListBoxControl
-*/
-void CFlowLayout::SuspendRecalcLayout(bool inSuspendFlag)
-{
- m_SuspendRecalcLayout = inSuspendFlag;
-}
-
-//=============================================================================
-/**
- * Recalculate the positions of all the child controls of this control.
- * This does the work of all the layout of the children and figures out where
- * everything belongs.
- */
-void CFlowLayout::RecalcLayout()
-{
- QT3DS_PROFILE(RecalcLayout);
-
- // if you need to add lots of children items to this control, do this:
- // SuspendRecalcLayout( true ); AddLotsOFItems( ); SuspendRecalcLayout( false );
- // DoSomethingThatWillTriggerRecalcLayout( );
- if (m_SuspendRecalcLayout)
- return;
-
- m_ResizingChildren = true;
-
- CPt thePosition(0, 0);
- CPt theCurSize = GetSize();
- long theNumExpandableY = 0;
- long theNumExpandableX = 0;
- m_HasUnusedSpace = false;
-
- if ((m_FlowDirection == FLOW_HORIZONTAL && m_HorizontalAlignment != ALIGN_RIGHT)
- || (m_FlowDirection == FLOW_VERTICAL && m_VerticalAlignment != ALIGN_BOTTOM)) {
- thePosition.x = m_LeftMargin;
- thePosition.y = m_TopMargin;
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = *thePos;
- RecalcChild(theChild->GetControl(), thePosition, theNumExpandableX, theNumExpandableY);
-
- if (m_FlowDirection == FLOW_HORIZONTAL)
- thePosition += CPt(m_ChildGap, 0);
- else
- thePosition += CPt(0, m_ChildGap);
- }
- } else {
- // thePosition.x = m_RightMargin;
- // thePosition.y = m_BottomMargin;
- ControlGraph::SReverseIterator thePos = GetReverseChildren();
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = *thePos;
- RecalcChild(theChild->GetControl(), thePosition, theNumExpandableX, theNumExpandableY);
-
- if (m_FlowDirection == FLOW_HORIZONTAL)
- thePosition -= CPt(m_ChildGap, 0);
- else
- thePosition -= CPt(0, m_ChildGap);
- }
- }
-
- // If there is extra space and there are items able to expand still
- if (thePosition.y < theCurSize.y && m_FlowDirection == FLOW_VERTICAL) {
- if (theNumExpandableY > 0)
- ResizeExpandableControlsY((theCurSize.y - thePosition.y), theNumExpandableY);
- else
- m_HasUnusedSpace = true;
-
- // SDJ: See below
- // ResetChildPositions( );
- } else if (thePosition.x < theCurSize.x && m_FlowDirection == FLOW_HORIZONTAL) {
- if (theNumExpandableX > 0)
- ResizeExpandableControlsX((theCurSize.x - thePosition.x), theNumExpandableX);
- else
- m_HasUnusedSpace = true;
-
- // SDJ: See below
- // ResetChildPositions( );
- }
-
- // SDJ: There is a case where the top margin is not properly calculated when
- // neither of the above conditions is met. Calling ResetChildPositions fixes
- // this, but might be ineffiecient. If you attempt to fix this, replace the
- // commented out calls to ResetChildPositions above.
- ResetChildPositions();
-
- m_ResizingChildren = false;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * XXX
- */
-void CFlowLayout::RecalcChild(CControl *inChild, CPt &ioPosition, long &ioNumExpandableX,
- long &ioNumExpandableY)
-{
- CPt theTotalPrefSizes = GetTotalPreferredSizes();
- CPt theCurSize = GetSize();
- CPt theChildSize = theCurSize;
-
- theCurSize.x -= m_RightMargin;
- theCurSize.y -= m_BottomMargin;
-
- if (inChild->IsVisible()) {
- inChild->ResetMinMaxPref();
- CPt thePrefSize = inChild->GetPreferredSize();
- CPt theMinSize = inChild->GetMinimumSize();
- CPt theMaxSize = inChild->GetMaximumSize();
-
- if (theMaxSize.x > theCurSize.x - ioPosition.x)
- theMaxSize.x = theCurSize.x - ioPosition.x;
- if (theMaxSize.x < 0)
- theMaxSize.x = 0;
- if (theMaxSize.y > theCurSize.y - ioPosition.y)
- theMaxSize.y = theCurSize.y - ioPosition.y;
- if (theMaxSize.y < 0)
- theMaxSize.y = 0;
-
- if (m_FlowDirection == FLOW_VERTICAL) {
- CPt theChildPosition;
- theChildPosition.y = ioPosition.y;
- theChildPosition.x = 0;
- theChildSize.x = theCurSize.x;
- ///*
- // SDJ; Why is this commented out?
- switch (m_HorizontalAlignment) {
- case ALIGN_LEFT:
- theChildPosition.x = 0;
- break;
-
- case ALIGN_RIGHT:
- theChildPosition.x =
- (GetSize().x - (m_LeftMargin + m_RightMargin)) - inChild->GetSize().x;
- break;
-
- case ALIGN_MIDDLE:
- theChildPosition.x = (GetSize().x / 2) - (inChild->GetSize().x / 2);
- break;
-
- case ALIGN_HORIZ_NEITHER:
- // NO BREAK
- default:
- theChildPosition.x = inChild->GetPosition().x;
- break;
- }
- //*/
-
- inChild->SetPosition(theChildPosition);
-
- if (theTotalPrefSizes.y) {
- float theModifier = ((float)thePrefSize.y) / ((float)theTotalPrefSizes.y);
- // Check to see if they have hit their min or max
- if (theMinSize.y > ::dtol(theCurSize.y * theModifier)) {
- theChildSize.y = theMinSize.y;
- ++ioNumExpandableY;
-
- } else if (theMaxSize.y < ::dtol(theCurSize.y * theModifier)) {
- theChildSize.y = theMaxSize.y;
- } else {
- // This item can be expanded
- ++ioNumExpandableY;
- theChildSize.y = inChild->GetSize().y;
- }
- }
-
- // If the child cannot be expanded, maintain its current width
- // if ( !CanBeExpandedX( inChild ) )
- // theChildSize.x = inChild->GetSize( ).x;
-
- theChildSize.x = Q3DStudio::MAX(theChildSize.x, theMinSize.x);
- theChildSize.y = Q3DStudio::MAX(theChildSize.y, theMinSize.y);
-
- theChildSize.x = Q3DStudio::MIN(theChildSize.x, theMaxSize.x);
- theChildSize.y = Q3DStudio::MIN(theChildSize.y, theMaxSize.y);
-
- inChild->SetSize(theChildSize);
- ioPosition.y += theChildSize.y;
- } else {
- CPt theChildPosition;
- theChildPosition.x = ioPosition.x;
-
- switch (m_VerticalAlignment) {
- case ALIGN_TOP:
- theChildPosition.y = m_TopMargin;
- break;
-
- case ALIGN_BOTTOM:
- theChildPosition.y = GetSize().y - inChild->GetSize().y;
- break;
-
- case ALIGN_CENTER:
- theChildPosition.y = (GetSize().y / 2) - (inChild->GetSize().y / 2);
- break;
-
- case ALIGN_VERT_NEITHER:
- // NO BREAK
- default:
- theChildPosition.y = inChild->GetPosition().y;
- break;
- }
-
- inChild->SetPosition(theChildPosition);
-
- if (theTotalPrefSizes.x) {
- float theModifier = ((float)thePrefSize.x) / ((float)theTotalPrefSizes.x);
- // Check to see if they have hit their min or max
- if (theMinSize.x > ::dtol(theCurSize.x * theModifier)) {
- theChildSize.x = theMinSize.x;
- ++ioNumExpandableX;
-
- } else if (theMaxSize.x < ::dtol(theCurSize.x * theModifier)) {
- theChildSize.x = theMaxSize.x;
- } else {
- // This item can be expanded
- theChildSize.x = ::dtol((theCurSize.x * theModifier));
- ++ioNumExpandableX;
- }
- }
-
- // If the child cannot by expanded, maintain the same height
- if (!CanBeExpandedY(inChild))
- theChildSize.y = inChild->GetSize().y;
-
- theChildSize.x = Q3DStudio::MAX(theChildSize.x, theMinSize.x);
- theChildSize.y = Q3DStudio::MAX(theChildSize.y, theMinSize.y);
-
- theChildSize.x = Q3DStudio::MIN(theChildSize.x, theMaxSize.x);
- theChildSize.y = Q3DStudio::MIN(theChildSize.y, theMaxSize.y);
-
- inChild->SetSize(theChildSize);
- ioPosition.x += theChildSize.x;
- }
- }
-}
-
-//==============================================================================
-/**
- * Resets all child positions accd to their size
- */
-void CFlowLayout::ResetChildPositions()
-{
- if ((m_FlowDirection == FLOW_HORIZONTAL && m_HorizontalAlignment != ALIGN_RIGHT)
- || (m_FlowDirection == FLOW_VERTICAL && m_VerticalAlignment != ALIGN_BOTTOM)) {
- CPt thePosition(m_LeftMargin, m_TopMargin);
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
- if (theChild->IsVisible()) {
- CPt theChildSize = theChild->GetSize();
- if (m_FlowDirection == FLOW_VERTICAL) {
- thePosition.x = theChild->GetPosition().x + m_LeftMargin;
- theChild->SetPosition(thePosition);
- thePosition.y = thePosition.y + theChildSize.y + m_ChildGap;
- } else {
- thePosition.y = theChild->GetPosition().y + m_TopMargin;
- theChild->SetPosition(thePosition);
- thePosition.x = thePosition.x + theChildSize.x + m_ChildGap;
- }
- }
- }
-
- if (m_HasUnusedSpace && m_BlankControl) {
- CPt theBlankPosition;
- if (m_FlowDirection == FLOW_HORIZONTAL) {
- theBlankPosition.x = thePosition.x;
- theBlankPosition.y = 0;
- } else {
- theBlankPosition.x = 0;
- theBlankPosition.y = thePosition.y;
- }
- m_BlankControl->SetPosition(theBlankPosition);
- m_BlankControl->SetSize(GetSize() - theBlankPosition);
- }
- } else {
- CPt thePosition(GetSize() - CPt(m_RightMargin, m_BottomMargin));
- ControlGraph::SReverseIterator thePos = GetReverseChildren();
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
- if (theChild->IsVisible()) {
- CPt theChildSize = theChild->GetSize();
- if (m_FlowDirection == FLOW_VERTICAL) {
- thePosition.x = theChild->GetPosition().x - m_RightMargin;
- thePosition.y = thePosition.y - theChildSize.y - m_ChildGap;
- theChild->SetPosition(thePosition);
- } else {
- thePosition.y = theChild->GetPosition().y - m_BottomMargin;
- thePosition.x = thePosition.x - theChildSize.x - m_ChildGap;
- theChild->SetPosition(thePosition);
- }
- }
- }
-
- if (m_HasUnusedSpace && m_BlankControl) {
- CPt theBlankSize;
- if (m_FlowDirection == FLOW_HORIZONTAL) {
- theBlankSize.x = thePosition.x;
- theBlankSize.y = GetSize().y;
- } else {
- theBlankSize.x = GetSize().x;
- theBlankSize.y = thePosition.y;
- }
- m_BlankControl->SetPosition(CPt(0, 0));
- m_BlankControl->SetSize(theBlankSize);
- }
- }
-}
-
-//==============================================================================
-/**
- * Resizes any expandable Controls in the Y Dir
- *
- * @param inExtraSpace the Amount left
- * @param inNumExpandable used to calc percentages
- */
-void CFlowLayout::ResizeExpandableControlsY(long inExtraSpace, long inNumExpandable)
-{
- m_HasUnusedSpace = false;
- long theSpaceDistributed = 0;
- if (inExtraSpace / inNumExpandable < 1) {
- this->DistributeRemaining(inExtraSpace);
- } else {
- ControlGraph::SIterator thePos = GetChildren();
- long theNumExpandable = 0;
-
- // Loop through teh children for items that can expand
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
-
- // If this item can be expanded then expand accd to new percent
- if (CanBeExpandedY(theChild->GetControl()) && theChild->IsVisible()) {
- CPt theMaxSize = theChild->GetMaximumSize();
- CPt theChildSize = theChild->GetSize();
- float theModifier = (float)1 / inNumExpandable;
- if (theMaxSize.y < ::dtol((inExtraSpace * theModifier) + theChildSize.y)) {
- theSpaceDistributed += theMaxSize.y - theChildSize.y;
- theChildSize.y = theMaxSize.y;
- } else {
- theSpaceDistributed += ::dtol((inExtraSpace * theModifier));
- theChildSize.y += ::dtol((inExtraSpace * theModifier));
- ++theNumExpandable;
- }
-
- theChild->SetSize(theChildSize);
- }
- }
-
- // If there is extra space and there are items able to expand still
- if ((inExtraSpace - theSpaceDistributed) > 0) {
- if (theNumExpandable > 0) {
- this->ResizeExpandableControlsY((inExtraSpace - theSpaceDistributed),
- theNumExpandable);
- } else {
- m_HasUnusedSpace = true;
- }
- }
- }
-}
-
-//==============================================================================
-/**
- * Resizes any expandable Controls in the X Dir
- *
- * @param inExtraSpace the Amount left
- * @param inNumExpandable used to calc percentages
- */
-void CFlowLayout::ResizeExpandableControlsX(long inExtraSpace, long inNumExpandable)
-{
- m_HasUnusedSpace = false;
- long theSpaceDistributed = 0;
- if (inExtraSpace / inNumExpandable < 1) {
- this->DistributeRemaining(inExtraSpace);
- } else {
- long theNumExpandable = 0;
- ControlGraph::SIterator thePos = GetChildren();
- // Loop through teh children for items that can expand
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
-
- // If this item can be expanded then expand accd to new percent
- if (CanBeExpandedX(theChild->GetControl()) && theChild->IsVisible()) {
- CPt theMaxSize = theChild->GetMaximumSize();
- CPt theChildSize = theChild->GetSize();
- float theModifier = (float)1 / inNumExpandable;
- if (theMaxSize.x < ::dtol((inExtraSpace * theModifier) + theChildSize.x)) {
- theSpaceDistributed += theMaxSize.x - theChildSize.x;
- theChildSize.x = theMaxSize.x;
- } else {
- theSpaceDistributed += ::dtol((inExtraSpace * theModifier));
- theChildSize.x += ::dtol((inExtraSpace * theModifier));
- ++theNumExpandable;
- }
-
- theChild->SetSize(theChildSize);
- }
- }
-
- // If there is extra space and there are items able to expand still
- if ((inExtraSpace - theSpaceDistributed) > 0) {
- if (theNumExpandable > 0) {
- this->ResizeExpandableControlsX((inExtraSpace - theSpaceDistributed),
- theNumExpandable);
- } else {
- m_HasUnusedSpace = true;
- }
- }
- }
-}
-
-//==============================================================================
-/**
- * Distributes remaining size to items that can be expanded.
- * this should only be called when theNumExpandable items > the extra space
- */
-void CFlowLayout::DistributeRemaining(long inExtraSpace)
-{
- long theNumToDistribute = inExtraSpace;
- if (m_FlowDirection == FLOW_VERTICAL) {
- ControlGraph::SIterator thePos = GetChildren();
- // Loop through teh children for items that can expand
- for (; thePos.HasNext() && theNumToDistribute > 0; ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
-
- // If this item can be expanded then expand accd to new percent
- if (CanBeExpandedY(theChild->GetControl()) && theChild->IsVisible()) {
- CPt theChildSize = theChild->GetSize();
- theChildSize.y++;
- theChild->SetSize(theChildSize.x, theChildSize.y);
- theNumToDistribute--;
- }
- }
- } else {
- ControlGraph::SIterator thePos = GetChildren();
- // Loop through teh children for items that can expand
- for (; thePos.HasNext() && theNumToDistribute > 0; ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
-
- // If this item can be expanded then expand accd to new percent
- if (CanBeExpandedX(theChild->GetControl()) && theChild->IsVisible()) {
- CPt theChildSize = theChild->GetSize();
- theChildSize.x++;
- theChild->SetSize(theChildSize.x, theChildSize.y);
- theNumToDistribute--;
- }
- }
- }
-}
-
-//==============================================================================
-/**
- * Gets the total prefered sizes of the children
- */
-CPt CFlowLayout::GetTotalPreferredSizes()
-{
- CPt theTotalPrefSizes(0, 0);
-
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
- if (theChild->IsVisible()) {
- theTotalPrefSizes += theChild->GetPreferredSize();
- }
- }
-
- return theTotalPrefSizes;
-}
-
-//==============================================================================
-/**
- * sets the size and does a recalc
- */
-void CFlowLayout::SetSize(CPt inSize)
-{
- if (inSize != GetSize()) {
- CControl::SetSize(inSize);
-
- RecalcLayout();
- }
-}
-
-void CFlowLayout::SetLayout(CPt inSize, CPt inPosition)
-{
- CControl::SetLayout(inSize, inPosition);
-
- RecalcLayout();
-}
-//==============================================================================
-/**
- * override to force a recalc when the parent is changed
- */
-void CFlowLayout::OnParentChanged(CControl *inParent)
-{
- CControl::OnParentChanged(inParent);
- RecalcLayout();
-}
-
-//==============================================================================
-/**
- * Sets this object's alignment
- */
-void CFlowLayout::SetAlignment(EVerticalAlignment inVertical, EHorizontalAlignment inHorizontal)
-{
- m_VerticalAlignment = inVertical;
- m_HorizontalAlignment = inHorizontal;
-
- RecalcLayout();
-}
-
-//==============================================================================
-/**
- * Overloaded draw function. Draws the extra control if it is needed
- */
-void CFlowLayout::Draw(CRenderer *inRenderer)
-{
- // If there is unused space in this control, then use the blank control
- if (m_HasUnusedSpace && m_BlankControl) {
- if (m_BlankControl->IsVisible()) {
- inRenderer->PushTranslation(m_BlankControl->GetPosition());
- if (!m_BlankDisable)
- m_BlankControl->Draw(inRenderer);
- inRenderer->PopTranslation();
- }
- }
-}
-
-//==============================================================================
-/**
- * called when a child's size changes
- */
-void CFlowLayout::OnChildSizeChanged(CControl *inChild)
-{
- Q_UNUSED(inChild);
-
- if (!m_ResizingChildren) {
- ResetMinMaxPref();
-
- if (GetParent() != nullptr)
- GetParent()->OnChildSizeChanged(this);
-
- RecalcLayout();
- }
-}
-
-//==============================================================================
-/**
- * Called to calc the min/max/and pre size of this layout. NOTE: this function
- * no longer adjusts the max size of the flow layout. The max size is not dictated
- * by the size of the children, so it can be set independently with a call to
- * SetMaximumSize().
- */
-void CFlowLayout::ResetMinMaxPref()
-{
- if (m_AutoMin) {
- CPt thePreferredSize(0, 0);
- CPt theMinimumSize(0, 0);
-
- thePreferredSize = theMinimumSize;
-
- // Keep track of the largest, minimum size of all the children for use later
- CPt theBiggestChildMinSize(0, 0);
-
- // Go through all the children and find their maximum sizes.
- ControlGraph::SIterator thePos = GetChildren();
-
- for (; thePos.HasNext(); ++thePos) {
- std::shared_ptr<CControlData> theChild = (*thePos);
- if (theChild->IsVisible()) {
- theChild->ResetMinMaxPref();
- CPt theChildPrefSize = theChild->GetPreferredSize();
- CPt theChildMinSize = theChild->GetMinimumSize();
-
- // use the sum of the children in the flow direction and the smallest size
- // in the non-flow direction.
- if (m_FlowDirection == FLOW_VERTICAL) {
- thePreferredSize.y += theChildPrefSize.y;
-
- theMinimumSize.y += theChildMinSize.y;
-
- if (theChildMinSize.x > theBiggestChildMinSize.x)
- theBiggestChildMinSize = theChildMinSize;
- } else {
- thePreferredSize.x += theChildPrefSize.x;
-
- theMinimumSize.x += theChildMinSize.x;
-
- if (theChildMinSize.y > theBiggestChildMinSize.y)
- theBiggestChildMinSize = theChildMinSize;
- }
- }
- }
-
- // If this is a vertical flow
- if (m_FlowDirection == FLOW_VERTICAL) {
- // The width is determined by minimum size of the largest child
- theMinimumSize.x = theBiggestChildMinSize.x;
-
- // If the flow is aligned to top, the top margin must be added to the minimum height
- if (m_VerticalAlignment == ALIGN_TOP)
- theMinimumSize.y += m_TopMargin;
- // If the flow is aligned to bottom, the bottom margin must be added to the minimum
- // height
- else if (m_VerticalAlignment == ALIGN_BOTTOM)
- theMinimumSize.y += m_BottomMargin;
-
- theMinimumSize.y += (m_ChildGap * GetChildCount());
- }
- // If this is a horzontal flow
- else {
- // The height is determined by minimum size of the largest child
- theMinimumSize.y = theBiggestChildMinSize.y;
-
- // If the flow is left aligned, the left margin must be added to the minimum width
- if (m_HorizontalAlignment == ALIGN_LEFT)
- theMinimumSize.x += m_LeftMargin;
- // If the flow is right aligned, the right margin must be added to the minimum width
- else if (m_HorizontalAlignment == ALIGN_RIGHT)
- theMinimumSize.x += m_RightMargin;
-
- theMinimumSize.x += (m_ChildGap * GetChildCount());
- }
-
- thePreferredSize.x = max(thePreferredSize.x, theMinimumSize.x);
- thePreferredSize.y = max(thePreferredSize.y, theMinimumSize.y);
-
- SetMinimumSize(theMinimumSize);
- SetPreferredSize(thePreferredSize);
- }
-}
-
-//=============================================================================
-/**
- * Override the default in case the blank control was hit
- * @param inPoint where the mouse was clicked, in local coordinates.
- * @param inFlags Modifier keys that are down at time of event. Can be any
- * @return true if the mouse event is processed.
- */
-bool CFlowLayout::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theRetVal = CControl::OnMouseDown(inPoint, inFlags);
- if (!theRetVal) {
- if (m_BlankControl && m_BlankControl->HitTest(inPoint))
- GrabFocus(nullptr);
- }
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * Override the default in case the blank control was hit
- * @param inPoint where the mouse was clicked, in local coordinates.
- * @param inFlags Modifier keys that are down at time of event. Can be any
- * @return true if the mouse event is processed.
- */
-bool CFlowLayout::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theRetVal = CControl::OnMouseRDown(inPoint, inFlags);
- if (!theRetVal) {
- if (m_BlankControl && m_BlankControl->HitTest(inPoint))
- GrabFocus(nullptr);
- }
- return theRetVal;
-}
diff --git a/src/Authoring/Studio/Controls/FlowLayout.h b/src/Authoring/Studio/Controls/FlowLayout.h
deleted file mode 100644
index 1f7523a1..00000000
--- a/src/Authoring/Studio/Controls/FlowLayout.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_FLOW_LAYOUT_H
-#define INCLUDED_FLOW_LAYOUT_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "BlankControl.h"
-
-//==============================================================================
-// Classes
-//==============================================================================
-
-//==============================================================================
-/**
-* @class CFlowLayout
-* @brief CHRIS.EDWARDS needs to enter a brief description here.
-*
-* CHRIS.EDWARDS needs to enter a long description here.
-*/
-class CFlowLayout : public CControl
-{
-public:
- enum EFlowDirection {
- FLOW_VERTICAL,
- FLOW_HORIZONTAL,
- };
-
- enum EVerticalAlignment {
- ALIGN_TOP,
- ALIGN_BOTTOM,
- ALIGN_CENTER,
- ALIGN_VERT_NEITHER,
- };
-
- enum EHorizontalAlignment {
- ALIGN_LEFT,
- ALIGN_RIGHT,
- ALIGN_MIDDLE,
- ALIGN_HORIZ_NEITHER,
- };
-
- CFlowLayout(CControl *inControl = nullptr, bool inUseControl = true);
- virtual ~CFlowLayout();
-
- DEFINE_OBJECT_COUNTER(CFlowLayout)
-
- void SetSize(CPt inSize) override;
- void SetLayout(CPt inSize, CPt inPosition) override;
- void OnParentChanged(CControl *inParent) override;
-
- void SetAlignment(EVerticalAlignment inVertical, EHorizontalAlignment inHorizontal);
- long SetLeftMargin(long inMargin);
- long GetLeftMargin() const;
- long SetRightMargin(long inMargin);
- long GetRightMargin() const;
- long SetTopMargin(long inMargin);
- long GetTopMargin() const;
- long SetBottomMargin(long inMargin);
- long GetBottomMargin() const;
- long SetGapBetweenChildren(long inGap);
- void SetDebug(bool inFlag) { m_DebugFlag = inFlag; }
- void SetAutoMin(bool inFlag) { m_AutoMin = inFlag; }
-
- virtual void SetFlowDirection(EFlowDirection inFlowDirection);
- void AddChild(CControl *inControl, CControl *inInsertBefore = nullptr) override;
- void RemoveChild(CControl *inControl) override;
- void Draw(CRenderer *inRenderer) override;
- virtual void DisableBlank();
- void OnChildSizeChanged(CControl *inControl) override;
-
- virtual void RecalcLayout();
- void SuspendRecalcLayout(bool inSuspendFlag);
- void ResetMinMaxPref() override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
-protected:
- CPt GetTotalPreferredSizes();
- void ResizeExpandableControlsY(long inExtraSpace, long inNumExpandable);
- void ResizeExpandableControlsX(long inExtraSpace, long inNumExpandable);
- void ResetChildPositions();
- void DistributeRemaining(long inExtraSpace);
- void RecalcChild(CControl *inChild, CPt &ioPosition, long &ioNumExpandableX,
- long &ioNumExpandableY);
-
- bool m_HasUnusedSpace;
- bool m_BlankDisable;
- EFlowDirection m_FlowDirection;
- EVerticalAlignment m_VerticalAlignment;
- EHorizontalAlignment m_HorizontalAlignment;
- bool m_ResizingChildren;
- long m_LeftMargin; ///< gap at left of this control
- long m_RightMargin; ///< gap at right of this control
- long m_TopMargin; ///< gap at top of this control
- long m_BottomMargin; ///< gap at bottom of this control
- long m_ChildGap; ///< gap between each child control when laying out everything
- bool m_DebugFlag;
- bool m_AutoMin;
-
- bool m_SuspendRecalcLayout; ///< flag to suspend recalculation of the layout; slow down is
- ///noticeable if this control has many children
-
-private:
- CControl *m_BlankControl; ///< used when all items are at their max and there si still space
-};
-
-#endif // INCLUDED_FLOW_LAYOUT_H
diff --git a/src/Authoring/Studio/Controls/GenericComboDropDown.h b/src/Authoring/Studio/Controls/GenericComboDropDown.h
deleted file mode 100644
index cd95b3a2..00000000
--- a/src/Authoring/Studio/Controls/GenericComboDropDown.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_GENERIC_COMBO_DROP_DOWN_H
-#define INCLUDED_GENERIC_COMBO_DROP_DOWN_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "GenericEdit.h"
-#include "ComboTextBox.h"
-
-#include <QMenu>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CButtonControl;
-class CButtonUpListener;
-
-//==============================================================================
-/**
- * Combo-box GUI element. Allows user to choose from a list of strings, and the
- * selected string is displayed in a box.
- */
-class CGenericComboDropDown : public CGenericEdit, public IChangeDataListener
-{
-public:
- CGenericComboDropDown(const bool inUseFloat = false);
- virtual ~CGenericComboDropDown();
-
- void OnDropDownSelect();
- void OnButtonUp(CControl *inButton);
- bool CanGainFocus() override;
- void AddItem(const Q3DStudio::CString &inString, bool inEnable = true);
- void RemoveAllItems();
- void SelectItem(long inIndex, bool inFireChangeEvent = true);
- long GetSelectedItem();
- long GetItemCount();
- Q3DStudio::CString GetItemText(long inIndex);
- Q3DStudio::CString GetCurrentText();
-
- virtual long DoDropDownMenu();
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseWheel(CPt inPoint, long inAmount, Qt::KeyboardModifiers inFlags) override;
- bool OnKeyDown(unsigned int inChar, Qt::KeyboardModifiers inFlags) override;
- void LayoutChildren() override { CGenericEdit::LayoutChildren(); }
-
- // IChangeDataListener
- void OnChangeData(const Q3DStudio::CString &inOldString,
- const Q3DStudio::CString &inNewString) override;
-
-protected:
- virtual void ChangeSelection(long inNewSelection);
- virtual void OffsetSelection(long inAmount);
- void SetDisplayText(const Q3DStudio::CString &inString, bool inFireChangeEvent = true);
- void UpdateReadOnly(bool inReadOnlyFlag);
-
- long m_SelectedItem;
- Q3DStudio::CString m_CurrentText;
- CComboTextBox *m_TextBox; ///< ComboTextBox (StringEdit derivative) that processes text data
- CButtonControl *m_Button;
- QMenu m_DropDownMenu; ///< Context menu used to display a list of options for the control
- QActionGroup m_actionGroup;
- bool m_ReverseOffset; ///< True if we want the mousewheel to scroll the other direction in the
- ///list;useful for numerical lists like
-};
-
-#endif // INCLUDED_GENERIC_COMBO_DROP_DOWN_H
diff --git a/src/Authoring/Studio/Controls/GenericEdit.h b/src/Authoring/Studio/Controls/GenericEdit.h
deleted file mode 100644
index 5af96a6b..00000000
--- a/src/Authoring/Studio/Controls/GenericEdit.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_GENERIC_EDIT_H
-#define INCLUDED_GENERIC_EDIT_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "LazyFlow.h"
-#include "Multicaster.h"
-#include "CColor.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//==============================================================================
-// Functors
-//==============================================================================
-/// Function to be called when the edit control changes
-GENERIC_FUNCTOR(CGenericEditCommitListener, OnCommitData);
-GENERIC_FUNCTOR(CGenericEditChangeListener, OnChangeData);
-GENERIC_FUNCTOR(CGenericEditRevertListener, OnRevertData);
-
-//==============================================================================
-/**
- * Base class for most edit controls. Provides functions for adding/removing/
- * notifying listeners when the control's value changes. Implements some
- * common functionality across all edit controls.
- */
-class CGenericEdit : public Q3DStudio::Control::CRuntimeLazyFlow
-{
-public:
- CGenericEdit();
- virtual ~CGenericEdit();
-
- void AddCommitListener(CGenericEditCommitListener *inListener);
- void RemoveCommitListener(CGenericEditCommitListener *inListener);
- void FireCommitDataEvent();
-
- void AddChangeListener(CGenericEditChangeListener *inListener);
- void RemoveChangeListener(CGenericEditChangeListener *inListener);
- void FireChangeDataEvent();
-
- void AddRevertListener(CGenericEditRevertListener *inListener);
- void RemoveRevertListener(CGenericEditRevertListener *inListener);
- void FireRevertDataEvent();
-
- void SetFillBackground(bool inFill);
- void SetBackgroundColor(const ::CColor &inColor);
-
- // CControl
- void Draw(CRenderer *inRenderer);
-
-protected:
- CMulticaster<CGenericEditCommitListener *> m_CommitListeners;
- CMulticaster<CGenericEditChangeListener *> m_ChangeListeners;
- CMulticaster<CGenericEditRevertListener *> m_RevertListeners;
- bool m_FillBackground;
- ::CColor m_BackgroundColor;
-};
-
-#endif // INCLUDED_GENERIC_EDIT_H
diff --git a/src/Authoring/Studio/Controls/InsertionLine.cpp b/src/Authoring/Studio/Controls/InsertionLine.cpp
deleted file mode 100644
index 5edbcd93..00000000
--- a/src/Authoring/Studio/Controls/InsertionLine.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "InsertionLine.h"
-#include "Renderer.h"
-#include "ResourceCache.h"
-#include "StudioUtils.h"
-#include "CColor.h"
-#include "CoreUtils.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CInsertionLine::CInsertionLine()
- : m_LineWidth(0)
- , m_LineHeight(2)
- , m_LineColor(CColor(0, 0, 0))
-{
- SetVisible(false);
-
- m_InsertLeftImage = CResourceCache::GetInstance()->GetBitmap("Insert-Rearrange-Left.png");
- m_InsertRightImage = CResourceCache::GetInstance()->GetBitmap("Insert-Rearrange-Right.png");
-
- const auto theLeftSize = m_InsertLeftImage.size();
- const auto theRightSize = m_InsertRightImage.size();
-
- if (theLeftSize.height() >= theRightSize.width()) {
- SetSize(CPt(theLeftSize.width() + theRightSize.width(), theLeftSize.height()));
- SetMaximumSize(CPt(LONG_MAX, theLeftSize.height()));
- } else {
- SetSize(CPt(theLeftSize.width() + theRightSize.width(), theRightSize.height()));
- SetMaximumSize(CPt(LONG_MAX, theLeftSize.height()));
- }
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CInsertionLine::~CInsertionLine()
-{
-}
-
-//=============================================================================
-/**
- * Sets the position of the line. Overridden since the line is technically
- * drawn in the middle of the area specified as the size of this control, so
- * we have to adjust the point accordingly. If you specify that the line should
- * be drawn at inPoint = ( 100, 100 ), the line will be drawn there, but the
- * actual control will be positioned at y = 100 - m_LineHeight.
- * @param inPoint starting point of the line to be drawn
- */
-void CInsertionLine::SetPosition(CPt inPoint)
-{
- inPoint.y -= m_LineHeight;
- COverlayControl::SetPosition(inPoint);
-}
-
-//=============================================================================
-/**
- * Sets the width of the horizontal line. The arrows on the ends will
- * automatically overlap this line. Thus the control will be exactly as wide
- * as you specify here. You should call this method instead of SetSize.
- * @param inWidth The new width of the line
- */
-void CInsertionLine::SetLineWidth(long inWidth)
-{
- m_LineWidth = inWidth;
-
- SetSize(CPt(m_LineWidth, GetSize().y));
-}
-
-//=============================================================================
-/**
- * Draws the insertion line at the current position.
- * @param inRenderer Renderer to draw to
- */
-void CInsertionLine::Draw(CRenderer *inRenderer)
-{
- // Actual insertion line
- CPt theTotalSize = GetSize();
- inRenderer->FillSolidRect(
- CRct(CPt(0, ::dtol(theTotalSize.y / 2.0f) - ::dtol(m_LineHeight / 2.0f)),
- CPt(m_LineWidth, m_LineHeight)),
- m_LineColor);
-
- // Left arrow (draws on top of the left side of the line)
- inRenderer->DrawBitmap(QPoint(0, 0), m_InsertLeftImage);
-
- // Right arrow (draws on top of the right side of the line)
- const auto theRightSize = m_InsertRightImage.size();
- inRenderer->DrawBitmap(QPoint(theTotalSize.x - theRightSize.width(), 0), m_InsertRightImage);
-}
-
-//=============================================================================
-/**
- * Check to see if inPoint is over this control or not. Overridden so that
- * this overlay control does not interfere with drag-and-drop.
- * @param inPoint not used
- * @return false
- */
-bool CInsertionLine::HitTest(const CPt &inPoint) const
-{
- Q_UNUSED(inPoint);
-
- return false;
-}
diff --git a/src/Authoring/Studio/Controls/InsertionLine.h b/src/Authoring/Studio/Controls/InsertionLine.h
deleted file mode 100644
index 60ec01bf..00000000
--- a/src/Authoring/Studio/Controls/InsertionLine.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_INSERTION_LINE_H
-#define INCLUDED_INSERTION_LINE_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "OverlayControl.h"
-#include "CColor.h"
-
-#include <QPixmap>
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//=============================================================================
-/**
- * Class for drawing a horizontal insertion line on top of other controls.
- * Useful for indicating drag-and-drop locations. Example usage: Item is
- * being inserted between Item1 and Item2.
- * Item1
- * >----<
- * Item2
- */
-class CInsertionLine : public COverlayControl
-{
-public:
- CInsertionLine();
- virtual ~CInsertionLine();
- virtual void SetPosition(CPt inPoint);
- void SetLineWidth(long inWidth);
- virtual void Draw(CRenderer *inRenderer);
- virtual bool HitTest(const CPt &inPoint) const;
-
-protected:
- long m_LineWidth;
- long m_LineHeight;
- CColor m_LineColor;
- QPixmap m_InsertLeftImage;
- QPixmap m_InsertRightImage;
-};
-#endif // INCLUDED_INSERTION_LINE_H
diff --git a/src/Authoring/Studio/Controls/InsertionOverlay.cpp b/src/Authoring/Studio/Controls/InsertionOverlay.cpp
deleted file mode 100644
index fc26f68c..00000000
--- a/src/Authoring/Studio/Controls/InsertionOverlay.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "InsertionOverlay.h"
-#include "Renderer.h"
-#include "ResourceCache.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CInsertionOverlay::CInsertionOverlay()
- : m_Width(0)
-{
- SetVisible(false);
-
- m_InsertLeftImage = CResourceCache::GetInstance()->GetBitmap("Insert-Left.png");
- m_InsertRightImage = CResourceCache::GetInstance()->GetBitmap("Insert-Right.png");
-
- const auto theLeftSize = m_InsertLeftImage.size();
- const auto theRightSize = m_InsertRightImage.size();
-
- if (theLeftSize.height() >= theRightSize.height())
- SetSize(CPt(theLeftSize.width() + theRightSize.width(), theLeftSize.height()));
- else
- SetSize(CPt(theLeftSize.width() + theRightSize.width(), theRightSize.height()));
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CInsertionOverlay::~CInsertionOverlay()
-{
-}
-
-//=============================================================================
-/**
- * Sets the width of the control. The arrows are always drawn at the left
- * and right side of the control, as defined by this width.
- * @param inWidth total width of the control
- */
-void CInsertionOverlay::SetWidth(long inWidth)
-{
- m_Width = inWidth;
-
- SetSize(CPt(m_Width, GetSize().y));
-}
-
-//=============================================================================
-/**
- * Draws the insertion markers.
- * Draws arrows at the left and right sides of the control, as defined by m_Width.
- * @param inRenderer Renderer to draw to
- */
-void CInsertionOverlay::Draw(CRenderer *inRenderer)
-{
- // Left arrow
- inRenderer->DrawBitmap(CPt(0, 0), m_InsertLeftImage);
-
- // Right arrow
- const auto theRightSize = m_InsertRightImage.size();
- inRenderer->DrawBitmap(QPoint(m_Width - theRightSize.width(), 0), m_InsertRightImage);
-}
-
-//=============================================================================
-/**
- * Check to see if inPoint is over this control or not. Overridden so that
- * this overlay control does not interfere with drag-and-drop.
- * @param inPoint not used
- * @return false
- */
-bool CInsertionOverlay::HitTest(const CPt &inPoint) const
-{
- Q_UNUSED(inPoint);
-
- return false;
-}
diff --git a/src/Authoring/Studio/Controls/InsertionOverlay.h b/src/Authoring/Studio/Controls/InsertionOverlay.h
deleted file mode 100644
index 0e43af3b..00000000
--- a/src/Authoring/Studio/Controls/InsertionOverlay.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_INSERTION_OVERLAY_H
-#define INCLUDED_INSERTION_OVERLAY_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "OverlayControl.h"
-
-#include <QPixmap>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-
-//=============================================================================
-/**
- * In drag-and-drop operations it's often desirable to indicate when you are
- * dropping an item onto another item. This control gives that visual
- * representation by drawing an arrow at either side. Example: Item2 is selected.
- * + Item1
- * > + Item2 <
- * + Item3
- */
-class CInsertionOverlay : public COverlayControl
-{
-public:
- CInsertionOverlay();
- virtual ~CInsertionOverlay();
- void SetWidth(long inWidth);
- virtual void Draw(CRenderer *inRenderer);
- virtual bool HitTest(const CPt &inPoint) const;
-
-protected:
- long m_Width;
- QPixmap m_InsertLeftImage;
- QPixmap m_InsertRightImage;
-};
-#endif // INCLUDED_INSERTION_OVERLAY_H
diff --git a/src/Authoring/Studio/Controls/LazyFlow.cpp b/src/Authoring/Studio/Controls/LazyFlow.cpp
deleted file mode 100644
index 8b8e74fe..00000000
--- a/src/Authoring/Studio/Controls/LazyFlow.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "stdafx.h"
-#include "LazyFlow.h"
-#include "ControlData.h"
-
-using namespace Q3DStudio::Control;
-
-template <typename TIteratorType>
-struct SVisibleFilteredIterator
-{
- TIteratorType m_BaseIterator;
- SVisibleFilteredIterator(TIteratorType inIter)
- : m_BaseIterator(inIter)
- {
- FindNextValidItem();
- }
- void FindNextValidItem()
- {
- while (m_BaseIterator.IsDone() == false
- && m_BaseIterator.GetCurrent()->IsVisible() == false)
- ++m_BaseIterator;
- }
-
- SVisibleFilteredIterator<TIteratorType> &operator++()
- {
- ++m_BaseIterator;
- FindNextValidItem();
- return *this;
- }
- std::shared_ptr<CControlData> operator*() { return *m_BaseIterator; }
- bool IsDone() { return m_BaseIterator.IsDone(); }
-};
-
-struct SaneMinMaxPref : public SSizeGroup
-{
- SaneMinMaxPref(const SSizeGroup &inData)
- : SSizeGroup(inData)
- {
- // ensure max and pref are greater than or equal to minimum
- m_Pref.x = max(m_Pref.x, m_Min.x);
- m_Pref.y = max(m_Pref.y, m_Min.y);
- m_Max.x = max(m_Max.x, m_Min.x);
- m_Max.y = max(m_Max.y, m_Min.y);
-
- // Ensure the maximum has valid information
- if (m_Max.x == 0)
- m_Max.x = m_Pref.x;
- if (m_Max.y == 0)
- m_Max.y = m_Pref.y;
-
- // Ensure preference is no greater than the maximum
- m_Pref.x = min(m_Pref.x, m_Max.x);
- m_Pref.y = min(m_Pref.y, m_Max.y);
- }
-};
-
-CPt CLazyFlowBase::GetMinimumSize()
-{
- MaybeRecalcMinMaxPerf();
- return CControl::GetMinimumSize();
-}
-CPt CLazyFlowBase::GetPreferredSize()
-{
- MaybeRecalcMinMaxPerf();
- return CControl::GetPreferredSize();
-}
-CPt CLazyFlowBase::GetMaximumSize()
-{
- MaybeRecalcMinMaxPerf();
- return CControl::GetMaximumSize();
-}
-
-void CLazyFlowBase::LayoutChildren()
-{
- TControlSizeList theSizeList;
- DistributeChildSizes(theSizeList);
- PerformLayout(theSizeList);
- Invalidate();
-}
-
-void CLazyFlowBase::MarkChildrenNeedLayout()
-{
- m_MinMaxPreferredDirty = true;
- CControl::MarkChildrenNeedLayout();
-}
-
-void CLazyFlowBase::NotifyParentNeedsLayout()
-{
- if (m_CalculatingMinMaxPref == false)
- CControl::NotifyParentNeedsLayout();
-}
-
-void CLazyFlowBase::SetLayout(CPt inSize, CPt inPosition)
-{
- bool wasDirty = m_MinMaxPreferredDirty;
- CControl::SetLayout(inSize, inPosition);
- m_MinMaxPreferredDirty = wasDirty;
-}
-
-long CLazyFlowBase::GetGapTotal()
-{
- long theNumVisibleChildren = 0;
-
- // Ensure we don't count any gaps for children that are invisible
- for (SVisibleFilteredIterator<ControlGraph::SIterator> theIter = GetChildren();
- theIter.IsDone() == false; ++theIter, ++theNumVisibleChildren) {
- }
-
- if (theNumVisibleChildren > 0)
- return m_ChildGap * theNumVisibleChildren;
-
- return 0;
-}
-
-void CLazyFlowBase::DistributeChildSizes(TControlSizeList &ioList)
-{
- ILazyFlowLayoutSpecializer &theSpecializer(GetSpecializer());
- SSizeGroup theChildSizes(CalcChildrenMinMaxPref());
- CPt theMin(theChildSizes.m_Min);
- CPt thePref(theChildSizes.m_Pref);
-
- CPt theSize = GetSize();
- long &theSizeSum(theSpecializer.GetSummedVariable(theSize));
- long &theSizeMax = theSpecializer.GetMaxedVariable(theSize);
-
- long theTotalInlineMargin =
- ILazyFlowLayoutSpecializer::SafeSum(GetBeginMargin(), GetEndMargin());
- // long theTotalBesideMargin = ILazyFlowLayoutSpecializer::SafeSum( GetBeforeRowMargin(),
- // GetAfterRowMargin() );
- long theGapTotal(GetGapTotal());
- // Remove child independent size information.
- theSizeSum = theSizeSum - theGapTotal - theTotalInlineMargin;
- theSizeMax = theSizeMax - GetBeforeRowMargin() - GetAfterRowMargin();
-
- // sanitize the size after we remove the child indepedent size information
- theSize.x = max(theMin.x, theSize.x);
- theSize.y = max(theMin.y, theSize.y);
-
- // If we have more space than we can use.
- if (theSizeSum >= theSpecializer.GetSummedVariable(thePref)) {
- vector<long> theResizeableChildren;
- long theIndex = 0;
- CPt theLayoutRect;
- for (SVisibleFilteredIterator<ControlGraph::SIterator> theIter = GetChildren();
- theIter.IsDone() == false; ++theIter, ++theIndex) {
- std::shared_ptr<CControlData> theChildControl(*theIter);
- SaneMinMaxPref saneSizes(GetChildSizes(*theIter));
- long theSaneMax(theSpecializer.GetMaxedVariable(saneSizes.m_Max));
- CPt newSize(theSpecializer.ToPoint(theSpecializer.GetSummedVariable(saneSizes.m_Pref),
- min(theSizeMax, theSaneMax)));
- theLayoutRect = theSpecializer.SumMax(theLayoutRect, newSize);
- ioList.push_back(make_pair(theChildControl, newSize));
- if (theSpecializer.GetSummedVariable(saneSizes.m_Max) == LONG_MAX)
- theResizeableChildren.push_back(theIndex);
- }
-
- long theRectSum = theSpecializer.GetSummedVariable(theLayoutRect);
- if (theResizeableChildren.size() && theSizeSum > theRectSum) {
- long extra = (theSizeSum - theRectSum) / (long)theResizeableChildren.size();
- for (vector<long>::iterator theIter = theResizeableChildren.begin(),
- theEnd = theResizeableChildren.end();
- theIter != theEnd; ++theIter) {
- pair<std::shared_ptr<CControlData>, CPt> &theChildAndSize(ioList[*theIter]);
- CPt theNewSize = theChildAndSize.second;
- theNewSize =
- theSpecializer.ToPoint(theSpecializer.GetSummedVariable(theNewSize) + extra,
- theSpecializer.GetMaxedVariable(theNewSize));
- theChildAndSize.second = theNewSize;
- }
- }
- } else {
- long theMinSum = theSpecializer.GetSummedVariable(theMin);
- long thePrefSum = theSpecializer.GetSummedVariable(thePref);
- long minSizeX = max(theMinSum, theSizeSum);
- // We know that we got less than the pref size.
- long requestRange = thePrefSum - theMinSum;
- long actualRange = minSizeX - theMinSum;
- float ratio = 0.0f;
- if (requestRange != 0)
- ratio = (float)actualRange / (float)requestRange;
-
- // so we distribute the remaining to each object based on the ratio between
- // its preferred size to its minimums size, thus reducing each object equally
- // but on terms of the ratio between it's preferred size and minimum size.
- for (SVisibleFilteredIterator<ControlGraph::SIterator> theIter = GetChildren();
- theIter.IsDone() == false; ++theIter) {
- SaneMinMaxPref saneSizes(GetChildSizes(*theIter));
- std::shared_ptr<CControlData> theChildControl(*theIter);
- CPt childPref(saneSizes.m_Pref);
- CPt childMin(saneSizes.m_Min);
- long range = theSpecializer.GetSummedVariable(childPref)
- - theSpecializer.GetSummedVariable(childMin);
- long newRange = (long)((float)range * ratio + .5f);
- long newMin = theSpecializer.GetSummedVariable(childMin);
- CPt newSize = theSpecializer.ToPoint(newMin + newRange, theSizeMax);
- ioList.push_back(make_pair(theChildControl, newSize));
- }
- }
-}
-
-void CLazyFlowBase::PerformLayout(TControlSizeList &ioList)
-{
- ILazyFlowLayoutSpecializer &theSpecializer(GetSpecializer());
- CPt thePos(theSpecializer.ToPoint(GetBeginMargin(), GetBeforeRowMargin()));
- long &theSummedVar = theSpecializer.GetSummedVariable(thePos);
-
- for (TControlSizeList::iterator iter = ioList.begin(), end = ioList.end(); iter != end;
- ++iter) {
- iter->first->SetLayout(iter->second, thePos);
- // Bump the position out to the next object
- theSummedVar += theSpecializer.GetSummedVariable(iter->second) + m_ChildGap;
- }
-}
-
-// Ignoring margins, calculate the min,max, and preferred sizes of the aggregate of our children
-SSizeGroup CLazyFlowBase::CalcChildrenMinMaxPref()
-{
- ILazyFlowLayoutSpecializer &theSpecializer(GetSpecializer());
- SSizeGroup retval;
- for (SVisibleFilteredIterator<ControlGraph::SIterator> theIter = GetChildren();
- theIter.IsDone() == false; ++theIter) {
- SaneMinMaxPref saneSizes(GetChildSizes(*theIter));
- retval.m_Min = theSpecializer.SumMax(retval.m_Min, saneSizes.m_Min);
- retval.m_Max = theSpecializer.SumMax(retval.m_Max, saneSizes.m_Max);
- retval.m_Pref = theSpecializer.SumMax(retval.m_Pref, saneSizes.m_Pref);
- }
- return retval;
-}
-
-void CLazyFlowBase::RecalcMinMaxPref()
-{
- ILazyFlowLayoutSpecializer &theSpecializer(GetSpecializer());
- // Vertical means that we take the max of the x widths
- // and sum the y heights;
- // ensuring that LONG_MAX always sums to LONG_MAX
- long theRowMargin =
- ILazyFlowLayoutSpecializer::SafeSum(GetBeforeRowMargin(), GetAfterRowMargin());
- CPt theMin(theSpecializer.ToPoint(GetBeginMargin() + GetEndMargin(), theRowMargin));
- CPt theMax(theMin);
- CPt thePref(theMin);
- SSizeGroup theChildSizes(CalcChildrenMinMaxPref());
- theMin = theSpecializer.SumMax(theChildSizes.m_Min, theMin);
- theMax = theSpecializer.SumMax(theChildSizes.m_Max, theMax);
- thePref = theSpecializer.SumMax(theChildSizes.m_Pref, thePref);
-
- long theGapTotal(GetGapTotal());
- theMin = theSpecializer.ToPoint(
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetSummedVariable(theMin), theGapTotal),
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetMaxedVariable(theMin), theRowMargin));
-
- thePref = theSpecializer.ToPoint(
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetSummedVariable(thePref), theGapTotal),
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetMaxedVariable(thePref),
- theRowMargin));
-
- theMax = theSpecializer.ToPoint(
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetSummedVariable(theMax), theGapTotal),
- ILazyFlowLayoutSpecializer::SafeSum(theSpecializer.GetMaxedVariable(theMax), theRowMargin));
-
- // Let's ensure we keep sane min,max,etc.
- thePref.x = max(thePref.x, theMin.x);
- thePref.y = max(thePref.y, theMin.y);
- theMax.x = max(theMax.x, theMin.x);
- theMax.y = max(theMax.y, theMin.y);
-
- SetMinimumSize(theMin);
- SetPreferredSize(thePref);
- SetMaximumSize(theMax);
-}
-
-void CLazyFlowBase::MaybeRecalcMinMaxPerf() const
-{
- if (m_MinMaxPreferredDirty) {
- m_MinMaxPreferredDirty = false;
- if (m_AutoMinMaxPref) {
- m_CalculatingMinMaxPref = true;
- CLazyFlowBase &flow(const_cast<CLazyFlowBase &>(*this));
- flow.RecalcMinMaxPref();
- m_CalculatingMinMaxPref = false;
- }
- }
-}
-
-SSizeGroup CLazyFlowBase::GetChildSizes(std::shared_ptr<CControlData> inControl)
-{
- SSizeGroup theGroup;
- theGroup.m_Min = inControl->GetMinimumSize();
- theGroup.m_Max = inControl->GetMaximumSize();
- theGroup.m_Pref = inControl->GetPreferredSize();
- return theGroup;
-}
diff --git a/src/Authoring/Studio/Controls/LazyFlow.h b/src/Authoring/Studio/Controls/LazyFlow.h
deleted file mode 100644
index 3c639012..00000000
--- a/src/Authoring/Studio/Controls/LazyFlow.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#pragma once
-#ifndef LAZYFLOWH
-#define LAZYFLOWH
-#include "Control.h"
-
-#ifdef WIN32
-#include <minmax.h>
-#endif
-
-namespace Q3DStudio {
-namespace Control {
-
- // Specializers used to specialize the layout algorithm in the X or Y direction.
- // You could, in fact, specialzie the algorithm in any arbitrary direction including
- // 3d where components are sumed in the chosen direction and maxed in any other
- // orthogonal non-chosen directions.
-
- // Specializes the general layout algorithm in the x or y direction.
- struct ILazyFlowLayoutSpecializer
- {
- protected:
- virtual ~ILazyFlowLayoutSpecializer() {}
-
- public:
- static inline long SafeSum(long lhs, long rhs)
- {
- if (lhs == LONG_MAX || rhs == LONG_MAX)
- return LONG_MAX;
- return lhs + rhs;
- }
- // These functions allow us to apply the lazy flow layout algorithm to
- // either horizontal or vertical layouts.
- // Sum the variable in the direction we are going, and max any other variables
- CPt SumMax(const CPt &inCurrentSum, const CPt &inOther)
- {
- long curSum = GetSummedVariable(inCurrentSum);
- long nextSum = GetSummedVariable(inOther);
- long resultSum = SafeSum(curSum, nextSum);
- long resultMax = qMax(GetMaxedVariable(inCurrentSum), GetMaxedVariable(inOther));
- return ToPoint(resultSum, resultMax);
- }
- // Return the summed variable
- virtual long &GetSummedVariable(CPt &inPt) = 0;
- const long &GetSummedVariable(const CPt &inPt)
- {
- return GetSummedVariable(const_cast<CPt &>(inPt));
- }
- // return the maxed variable
- virtual long &GetMaxedVariable(CPt &inPt) = 0;
- const long &GetMaxedVariable(const CPt &inPt)
- {
- return GetMaxedVariable(const_cast<CPt &>(inPt));
- }
- // Create a new point from the combination of a summed variable and a maxed variable.
- virtual CPt ToPoint(long inSummedVariable, long inMaxedVariable) = 0;
- };
-
- struct SVerticalLayoutSpecializer : public ILazyFlowLayoutSpecializer
- {
- long &GetSummedVariable(CPt &inPt) override { return inPt.y; }
- long &GetMaxedVariable(CPt &inPt) override { return inPt.x; }
- CPt ToPoint(long inSummedVariable, long inMaxedVariable) override
- {
- return CPt(inMaxedVariable, inSummedVariable);
- }
- };
-
- struct SHorizontalLayoutSpecializer : public ILazyFlowLayoutSpecializer
- {
- long &GetSummedVariable(CPt &inPt) override { return inPt.x; }
- long &GetMaxedVariable(CPt &inPt) override { return inPt.y; }
- CPt ToPoint(long inSummedVariable, long inMaxedVariable) override
- {
- return CPt(inSummedVariable, inMaxedVariable);
- }
- };
-
- struct SSizeGroup
- {
- CPt m_Min;
- CPt m_Max;
- CPt m_Pref;
- };
-
- class CLazyFlowBase : public CControl
- {
- mutable bool m_MinMaxPreferredDirty;
- mutable bool m_CalculatingMinMaxPref;
- bool m_AutoMinMaxPref;
- CPt m_BeginMargin;
- CPt m_EndMargin;
-
- public:
- typedef vector<pair<std::shared_ptr<CControlData>, CPt>> TControlSizeList;
-
- CLazyFlowBase()
- : m_MinMaxPreferredDirty(true)
- , m_CalculatingMinMaxPref(false)
- , m_AutoMinMaxPref(true)
- , m_ChildGap(0)
- {
- }
-
- CPt GetMinimumSize() override;
- CPt GetPreferredSize() override;
- CPt GetMaximumSize() override;
-
- virtual void SetGapBetweenChildren(long inGap)
- {
- m_ChildGap = inGap;
- MarkChildrenNeedLayout();
- }
- virtual long GetGapBetweenChildren() const { return m_ChildGap; }
-
- // Also sets min max preferred dirty.
- void LayoutChildren() override;
- void MarkChildrenNeedLayout() override;
- void NotifyParentNeedsLayout() override;
- void SetLayout(CPt inSize, CPt inPosition) override;
-
- virtual void SetAutoMinMaxPref(bool inAuto) { m_AutoMinMaxPref = inAuto; }
- bool GetAutoMinMaxPref() const { return m_AutoMinMaxPref; }
-
- // Legacy with FlowLayout.
- virtual void SetAutoMin(bool inAuto) { m_AutoMinMaxPref = inAuto; }
-
- virtual void SetTopMargin(long inPixels)
- {
- m_BeginMargin.y = inPixels;
- MarkChildrenNeedLayout();
- }
- virtual long GetTopMargin() const { return m_BeginMargin.y; }
-
- virtual void SetLeftMargin(long inPixels)
- {
- m_BeginMargin.x = inPixels;
- MarkChildrenNeedLayout();
- }
- virtual long GetLeftMargin() const { return m_BeginMargin.x; }
-
- virtual void SetBottomMargin(long inPixels)
- {
- m_EndMargin.y = inPixels;
- MarkChildrenNeedLayout();
- }
- virtual long GetBottomMargin() const { return m_EndMargin.y; }
-
- virtual void SetRightMargin(long inPixels)
- {
- m_EndMargin.x = inPixels;
- MarkChildrenNeedLayout();
- }
- virtual long GetRightMargin() const { return m_EndMargin.x; }
-
- protected:
- void SetMinMaxPrefDirty() { m_MinMaxPreferredDirty = true; }
- virtual ILazyFlowLayoutSpecializer &GetSpecializer() = 0;
-
- long m_ChildGap;
- long GetGapTotal();
- // Margins are begin/end meaning before any children, after any children
- long GetBeginMargin() { return GetSpecializer().GetSummedVariable(m_BeginMargin); }
- long GetEndMargin() { return GetSpecializer().GetSummedVariable(m_EndMargin); }
- // And then margines that are beside the row of children, either before the row or after it.
- long GetBeforeRowMargin() { return GetSpecializer().GetMaxedVariable(m_BeginMargin); }
- long GetAfterRowMargin() { return GetSpecializer().GetMaxedVariable(m_EndMargin); }
-
- // I only implement these algorithms once, and I use a specializer to make them apply
- // to either a left-to-right or a top-to-bottom layout.
- void DistributeChildSizes(TControlSizeList &ioList);
- void PerformLayout(TControlSizeList &ioList);
- SSizeGroup CalcChildrenMinMaxPref();
-
- virtual SSizeGroup GetChildSizes(std::shared_ptr<CControlData> inControl);
-
- void RecalcMinMaxPref();
- void MaybeRecalcMinMaxPerf() const;
- };
-
- template <typename TSpecializerType>
- class TLazyFlowBase : public CLazyFlowBase
- {
- TSpecializerType m_Specializer;
-
- public:
- ILazyFlowLayoutSpecializer &GetSpecializer() override { return m_Specializer; }
- };
-
- struct SVerticalLazyFlow : public TLazyFlowBase<SVerticalLayoutSpecializer>
- {
- };
-
- struct SHorizontalLazyFlow : public TLazyFlowBase<SHorizontalLayoutSpecializer>
- {
- };
-
- class CRuntimeLazyFlow : public CLazyFlowBase
- {
- public:
- enum EFlowDirection {
- FLOW_VERTICAL,
- FLOW_HORIZONTAL,
- };
-
- private:
- SHorizontalLayoutSpecializer m_HorizontalSpecifier;
- SVerticalLayoutSpecializer m_VerticalSpecifier;
- EFlowDirection m_FlowDirection;
-
- public:
- CRuntimeLazyFlow()
- : m_FlowDirection(FLOW_VERTICAL)
- {
- }
-
- virtual void SetFlowDirection(EFlowDirection inFlowDirection)
- {
- m_FlowDirection = inFlowDirection;
- MarkChildrenNeedLayout();
- }
-
- protected:
- ILazyFlowLayoutSpecializer &GetSpecializer() override
- {
- if (m_FlowDirection == FLOW_VERTICAL)
- return m_VerticalSpecifier;
- return m_HorizontalSpecifier;
- }
- };
-}
-}
-
-#endif
diff --git a/src/Authoring/Studio/Controls/ListBoxItem.cpp b/src/Authoring/Studio/Controls/ListBoxItem.cpp
deleted file mode 100644
index 885d8f87..00000000
--- a/src/Authoring/Studio/Controls/ListBoxItem.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ListBoxItem.h"
-#include "Renderer.h"
-#include "HotKeys.h"
-#include "SystemPreferences.h"
-#include "StudioPreferences.h"
-
-IMPLEMENT_OBJECT_COUNTER(CListBoxItem)
-
-//==============================================================================
-/**
- * Constructor
- */
-CListBoxItem::CListBoxItem()
- : m_Selected(false)
- , m_BorderColor(CStudioPreferences::GetControlRectSideLineColor())
- , m_BackgroundColorSelected(CSystemPreferences::GetSelectedItemColor())
- , m_BackgroundColorUnselected(CColor(255, 255, 255))
-{
- ADDTO_OBJECT_COUNTER(CListBoxItem)
-
- // this reserves the minimum height for the ListBoxItem in the ListBox first
- SetAbsoluteSize(CPt(0, CStudioPreferences::GetDefaultTextEditSize()));
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CListBoxItem::~CListBoxItem()
-{
- REMOVEFROM_OBJECT_COUNTER(CListBoxItem)
-}
-
-//==============================================================================
-/**
- * Draws the bounding rectangle and white edit box for the List Box Item class.
- *
- * @param inRenderer The renderer that is responsible for drawing this Item.
- */
-void CListBoxItem::Draw(CRenderer *inRenderer)
-{
- const auto rect = QRect(QPoint(0, 0), GetSize());
- inRenderer->PushClippingRect(rect);
-
- // Fill the interior of the ListBoxItem
- CColor theFillColor = m_BackgroundColorUnselected;
-
- // If this ListBox is selected
- if (m_Selected)
- theFillColor = m_BackgroundColorSelected;
-
- inRenderer->FillSolidRect(rect, theFillColor);
-
- /*
- CRct theRect = GetSize();
- CPt theLowerRight( theRect.position.x + theRect.size.x - 1, theRect.position.y + theRect.size.y
- - 1 );
- CPt theLowerLeft( theRect.position.x, theLowerRight.y );
-
- // draw the bottom line for this item;
- // the top will be drawn by the prev item, otherwise it's the bounding box for the ListBox
- inRenderer->PushPen( m_BorderColor, 1 );
- inRenderer->MoveTo( theLowerLeft );
- inRenderer->LineTo( theLowerRight );
- inRenderer->PopPen();
- */
-
- inRenderer->PopClippingRect();
-}
-
-//=============================================================================
-/**
- * Handles Mouse down events on this CListBoxItem. When a Mouse Click occurs
- * on this ListBoxItem, fire off a SelectionEvent, to let the parent
- * CListBoxControl know that this is selected, and to perform neccesary selection
- * actions, e.g. Single Selection, or Multiple Selection.
- *
- * @param inPoint where the mouse was clicked, in local coordinates.
- * @param inFlags Modifier keys that are down at time of event. Can be any
- * combination of the following: MODIFIER_CONTROL | MODIFIER_SHIFT |
- * MODIFIER_ALT | MOUSE_LBUTTON | MOUSE_RBUTTON | MOUSE_MBUTTON
- */
-bool CListBoxItem::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theIsHandled = CControl::OnMouseDown(inPoint, inFlags);
- m_SelectionListeners.FireEvent(&CListBoxSelectionListener::OnSelectItem, this, inFlags);
- return theIsHandled;
-}
-
-//==============================================================================
-/**
- * Overridden to help recalc the minimum size of the item
- */
-void CListBoxItem::OnParentChanged(CControl *inParent)
-{
- CControl::OnParentChanged(inParent);
- RecalcMinimumSize();
-}
-
-//==============================================================================
-/**
- * Overridden to help recalc the minimum size of the item
- */
-void CListBoxItem::SetMinimumSize(CPt inSize)
-{
- CControl::SetMinimumSize(inSize);
- RecalcMinimumSize();
-}
-
-//==============================================================================
-/**
- * Set the minimum width of the item based on the size of the parent
- */
-void CListBoxItem::RecalcMinimumSize()
-{
- if (GetParent()) {
- CPt theSize = CControl::GetMinimumSize();
- CPt theParentSize = GetParent()->GetSize();
-
- // If the minimum width of the item is less than the
- // current width of the parent, set the size to be the
- // width of the parent
- if (theParentSize.x > (theSize.x - GetPosition().x))
- theSize.x = theParentSize.x - GetPosition().x;
-
- CControl::SetMinimumSize(theSize);
- }
-}
-
-//==============================================================================
-/**
- * Sets this ListBoxItem to be selected or unselected.
- *
- * @param inSelected True if this CListBoxItem is selected.
- */
-void CListBoxItem::SetSelectedState(bool inSelected)
-{
- m_Selected = inSelected;
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Returns true if this ListBoxItem is selected.
- *
- * @return true if this CListBoxItem is selected.
- */
-bool CListBoxItem::IsSelected() const
-{
- return m_Selected;
-}
-
-//==============================================================================
-/**
- * Sets the color of this control's border. Defines the color of the bounding
- * rectangle.
- *
- * @param inColor the Color of this control's border.
- */
-void CListBoxItem::SetBorderColor(const CColor &inColor)
-{
- m_BorderColor = inColor;
-}
-
-//==============================================================================
-/**
- * Returns the color of this control's border.
- *
- * @return the color of the border of this control.
- */
-CColor CListBoxItem::GetBorderColor() const
-{
- return m_BorderColor;
-}
-
-//==============================================================================
-/**
- * Sets the background color for the ListBoxItem when it is selected.
- *
- * @param inColor the background color for the ListBoxItem when it is selected.
- */
-void CListBoxItem::SetBGColorSelected(const CColor &inColor)
-{
- m_BackgroundColorSelected = inColor;
-}
-
-//==============================================================================
-/**
- * Returns the background color for the ListBoxItem when it is selected.
- *
- * @return the background color for the ListBoxItem when it is selected.
- */
-CColor CListBoxItem::GetBGColorSelected() const
-{
- return m_BackgroundColorSelected;
-}
-
-//==============================================================================
-/**
- * Sets the background color for the ListBoxItem when it is not selected.
- *
- * @param inColor the background color for the ListBoxItem when it is not selected.
- */
-void CListBoxItem::SetBGColorUnselected(const CColor &inColor)
-{
- m_BackgroundColorUnselected = inColor;
-}
-
-//==============================================================================
-/**
- * Returns the background color for the ListBoxItem when it is not selected.
- *
- * @return the background color for the ListBoxItem when it is not selected.
- */
-CColor CListBoxItem::GetBGColorUnselected() const
-{
- return m_BackgroundColorUnselected;
-}
-
-//==============================================================================
-/**
- * Add a SelectionListener to this control's list of SelectionListeners.
- *
- * @param inListener The SelectionListener to add to the list of SelectionListeners
- */
-void CListBoxItem::AddSelectionListener(CListBoxSelectionListener *inListener)
-{
- m_SelectionListeners.AddListener(inListener);
-}
-
-//==============================================================================
-/**
- * Remove a SelectionListener from this control's list of SelectionListeners.
- *
- * @param inListener The SelectionListener to remove from the list of SelectionListeners
- */
-void CListBoxItem::RemoveSelectionListener(CListBoxSelectionListener *inListener)
-{
- m_SelectionListeners.RemoveListener(inListener);
-}
diff --git a/src/Authoring/Studio/Controls/ListBoxItem.h b/src/Authoring/Studio/Controls/ListBoxItem.h
deleted file mode 100644
index 26e1ecb9..00000000
--- a/src/Authoring/Studio/Controls/ListBoxItem.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2005 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_LIST_BOX_ITEM_H
-#define INCLUDED_LIST_BOX_ITEM_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "FlowLayout.h"
-#include "Multicaster.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-class CListBoxItem;
-
-//==============================================================================
-// Functor
-//==============================================================================
-GENERIC_FUNCTOR_2(CListBoxSelectionListener, OnSelectItem, CListBoxItem *, long);
-
-//==============================================================================
-/**
- * abstract CListBoxItem base class that all other ListBoxItem classes
- * must inherit from. e.g. CListBoxStringItem, CActionListBoxItem
- */
-class CListBoxItem : public CControl
-{
-public:
- CListBoxItem();
- virtual ~CListBoxItem();
-
- DEFINE_OBJECT_COUNTER(CListBoxItem)
-
- virtual Q3DStudio::CString GetString() = 0; ///< returns the string representation of this item
-
- void Draw(CRenderer *inRenderer) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnParentChanged(CControl *inParent) override;
- void SetMinimumSize(CPt inSize) override;
-
- virtual void SetSelectedState(bool inSelected);
- virtual void RecalcMinimumSize();
- bool IsSelected() const;
-
- // Color Accessors / Mutators
- void SetBorderColor(const CColor &inColor);
- CColor GetBorderColor() const;
- void SetBGColorSelected(const CColor &inColor);
- CColor GetBGColorSelected() const;
- void SetBGColorUnselected(const CColor &inColor);
- CColor GetBGColorUnselected() const;
-
- // SelectionListener methods
- void AddSelectionListener(CListBoxSelectionListener *inListener);
- void RemoveSelectionListener(CListBoxSelectionListener *inListener);
-
-protected:
- bool m_Selected;
- CColor m_BorderColor;
- QColor m_BackgroundColorSelected;
- CColor m_BackgroundColorUnselected;
- CMulticaster<CListBoxSelectionListener *>
- m_SelectionListeners; ///< Usually only just the ListBoxControl owning this item
-};
-
-#endif // INCLUDED_LIST_BOX_ITEM_H
diff --git a/src/Authoring/Studio/Controls/ListBoxStringItem.cpp b/src/Authoring/Studio/Controls/ListBoxStringItem.cpp
deleted file mode 100644
index d8efe02b..00000000
--- a/src/Authoring/Studio/Controls/ListBoxStringItem.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Include
-//==============================================================================
-#include "ListBoxStringItem.h"
-#include "Renderer.h"
-#include "SystemPreferences.h"
-
-//==============================================================================
-/**
- * Constructor
- *
- * A ListBoxStringItem contains an immutable StringEdit, extending the base
- * class ListBoxItem to give basic String display and containing funtionality.
- * TODO: Need to implement some way to set the alignment of the text.
- * Right now, setting the alignment makes the drawing of the control
- * all dirty. That's why it's taken out, for now.
- *
- * @param inString the String which this ListBoxStringItem is to hold
- */
-CListBoxStringItem::CListBoxStringItem()
- : m_TextColor(0, 0, 0)
- , m_SelectedTextColor(CSystemPreferences::GetSelectedTextColor())
-{
- m_StringEdit.SetReadOnly(true);
- m_StringEdit.AllowAutoSize(true);
- m_StringEdit.SetAlignment(CTextEdit::LEFT);
- m_StringEdit.SetFillBackground(false);
- m_StringEdit.SetTextColor(m_TextColor);
- AddChild(&m_StringEdit);
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CListBoxStringItem::~CListBoxStringItem()
-{
-}
-
-//==============================================================================
-/**
- * @return the String that this ListBoxStringItem contains
- */
-void CListBoxStringItem::SetString(const Q3DStudio::CString &inString)
-{
- m_StringEdit.SetData(inString, false);
-
- SetMinimumSize(m_StringEdit.GetSize());
- SetSize(m_StringEdit.GetSize());
-}
-
-//==============================================================================
-/**
- * @return the String that this ListBoxStringItem contains
- */
-Q3DStudio::CString CListBoxStringItem::GetString()
-{
- return m_StringEdit.GetString();
-}
-
-//=============================================================================
-/**
- * Overridden so that we can change the color of the text based upon selection.
- * @param inSelected true to select this item, false to deselect it
- */
-void CListBoxStringItem::SetSelectedState(bool inSelected)
-{
- CListBoxItem::SetSelectedState(inSelected);
-
- if (inSelected)
- m_StringEdit.SetTextColor(m_SelectedTextColor);
- else
- m_StringEdit.SetTextColor(m_TextColor);
-}
diff --git a/src/Authoring/Studio/Controls/ListBoxStringItem.h b/src/Authoring/Studio/Controls/ListBoxStringItem.h
deleted file mode 100644
index e950d494..00000000
--- a/src/Authoring/Studio/Controls/ListBoxStringItem.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_LIST_BOX_STRING_ITEM_H
-#define INCLUDED_LIST_BOX_STRING_ITEM_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "ListBoxItem.h"
-#include "StringEdit.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-//==============================================================================
-/**
- * CListBoxStringItem contains an immutable StringEdit, extending the base
- * class ListBoxItem to give basic String displaying and storage.
- */
-class CListBoxStringItem : public CListBoxItem
-{
-public:
- CListBoxStringItem();
- virtual ~CListBoxStringItem();
-
- virtual void SetString(const Q3DStudio::CString &inString);
- virtual Q3DStudio::CString GetString(); ///< returns the string representation of this item
-
- virtual void SetSelectedState(bool inSelected); ///< Overridden so that we can change the color
- ///of the text based upon selection
-
-protected:
- CStringEdit m_StringEdit;
- CColor m_TextColor;
- CColor m_SelectedTextColor;
-};
-
-#endif // INCLUDED_LIST_BOX_STRING_ITEM_H \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/ListLayout.cpp b/src/Authoring/Studio/Controls/ListLayout.cpp
deleted file mode 100644
index 0410e2d4..00000000
--- a/src/Authoring/Studio/Controls/ListLayout.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stdafx.h"
-
-#include "ListLayout.h"
-#include "MasterP.h"
-#include "ControlData.h"
-
-using namespace Q3DStudio;
-using namespace Q3DStudio::Control;
-
-CListLayout::CListLayout(bool inAlignChildrenLength /*= false */)
- : m_IsResizing(false)
- , m_AlignChildrenLength(inAlignChildrenLength)
-{
-}
-
-CListLayout::~CListLayout()
-{
-}
-
-//=============================================================================
-/**
- * Add a child to this control.
- * Overrides to make the layout get recalculated as well.
- * @param inChild the child to be added.
- * @param inInsertBefore the location to be added.
- * @see CControl::AddChild.
- */
-void CListLayout::AddChild(CControl *inChild, CControl *inInsertBefore /*= nullptr*/)
-{
- CControl::AddChild(inChild, inInsertBefore);
-
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Remove a child from this control.
- * Overrides to make the layout get recalculated as well.
- * @param inChild the child to be removed.
- * @see CControl::RemoveChild.
- */
-void CListLayout::RemoveChild(CControl *inChild)
-{
- CControl::RemoveChild(inChild);
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Set the size of this control.
- * Overrides CControl::SetSize to propagate down to children too.
- * @param inSize the new size.
- */
-void CListLayout::SetSize(CPt inSize)
-{
- if (inSize.x != GetSize().x) {
- m_IsResizing = true;
-
- // Go through all the children and set their sizes too
- ControlGraph::SIterator theChildren = GetChildren();
- for (; theChildren.HasNext(); ++theChildren) {
- std::shared_ptr<CControlData> theChild = (*theChildren);
- if (theChild->IsVisible()) {
- // Only care about the width, keep the height the same.
- theChild->SetSize(inSize.x, theChild->GetSize().y);
- }
- }
- m_IsResizing = false;
- }
-
- CControl::SetSize(inSize);
-}
-
-//=============================================================================
-/**
- * Recalculate the layout of all the sub controls.
- * This will resize this control appropriately and reposition all the children.
- */
-void CListLayout::RecalcLayout()
-{
- m_IsResizing = true;
-
- long theHeight = 0;
- CPt theCurrentPos(0, 0);
- long theMinLen = 0;
-
- ControlGraph::SIterator theChildren = GetChildren();
- if (m_AlignChildrenLength) {
- // Go through the first time to determine what is the minimum length for the children
- for (; theChildren.HasNext(); ++theChildren) {
- std::shared_ptr<CControlData> theChild = (*theChildren);
- // Only handle visible children
- if (theChild->IsVisible()) {
- CPt theMinimumSize(theChild->GetMinimumSize());
- if (theMinimumSize.x > theMinLen)
- theMinLen = theMinimumSize.x;
- }
- }
- // reset this
- theChildren = GetChildren();
- }
-
- // Go through all the children and set their position, as well as the minimum length if required
- // to
- for (; theChildren.HasNext(); ++theChildren) {
- std::shared_ptr<CControlData> theChild = (*theChildren);
- // Only handle visible children
- if (theChild->IsVisible()) {
- CPt theChildSize = theChild->GetSize();
- theHeight += theChildSize.y;
-
- if (m_AlignChildrenLength)
- theChild->SetSize(CPt(theMinLen, theChildSize.y));
- else { // this would be the only loop to get the minimum length
- CPt theMinimumSize(theChild->GetMinimumSize());
- if (theMinimumSize.x > theMinLen)
- theMinLen = theMinimumSize.x;
- }
-
- // Update the position
- theChild->SetPosition(theCurrentPos);
- theCurrentPos.y += theChildSize.y;
- }
- }
-
- SetMinimumSize(CPt(theMinLen, theHeight));
- SetMaximumSize(CPt(LONG_MAX, theHeight));
-
- SetSize(CPt(theMinLen, theHeight));
-
- m_IsResizing = false;
-}
-
-//=============================================================================
-/**
- * Notification to this control that one of the child controls has changed size.
- * @param inControl the control that changed size.
- */
-void CListLayout::OnChildSizeChanged(CControl *inControl)
-{
- Q_UNUSED(inControl);
-
- // If we are not actively resizing then redo the layout.
- if (!m_IsResizing) {
- QT3DS_PROFILE(OnChildSizeChanged);
-
- RecalcLayout();
- }
-}
-
-#ifdef _DEBUG
-bool CListLayout::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- return CControl::OnMouseDown(inPoint, inFlags);
-}
-#endif \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/ListLayout.h b/src/Authoring/Studio/Controls/ListLayout.h
deleted file mode 100644
index 3b1d7768..00000000
--- a/src/Authoring/Studio/Controls/ListLayout.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_LIST_LAYOUT_H
-#define INCLUDED_LIST_LAYOUT_H 1
-
-#pragma once
-
-#include "Control.h"
-
-class CListLayout : public CControl
-{
-public:
- CListLayout(bool inAlignChildrenLength = false);
- virtual ~CListLayout();
-
- void SetSize(CPt inSize) override;
-
- void AddChild(CControl *inChild, CControl *inInsertBefore = nullptr) override;
- void RemoveChild(CControl *inChild) override;
-
- void OnChildSizeChanged(CControl *inControl) override;
-
- void RecalcLayout();
-
-#ifdef _DEBUG
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-#endif
-
-protected:
- bool m_IsResizing;
- bool m_AlignChildrenLength; ///< True when all children in this list should align up
-};
-#endif // INCLUDED_LIST_LAYOUT_H
diff --git a/src/Authoring/Studio/Controls/NameEdit.cpp b/src/Authoring/Studio/Controls/NameEdit.cpp
deleted file mode 100644
index 204782b5..00000000
--- a/src/Authoring/Studio/Controls/NameEdit.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "NameEdit.h"
-#include "INamable.h"
-
-//=============================================================================
-/**
- * Constructor
- * @param inPropertyProvider interface that will provide properties by name
- * (such as a CAsset object). Can be nullptr.
- */
-CNameEdit::CNameEdit(INamable *inNamable)
- : m_Namable(inNamable)
- , m_IsSettingData(false)
- , m_LastMoustDown(0, 0)
- , m_LastFocused(true)
- , m_CanEdit(false)
-{
- ASSERT(m_Namable); // if you don't have a namable, use CTextEditInPlace instead.
-
- SetData(m_Namable->GetName(), false);
- AddCommitListener(this);
- AllowAutoSize(true);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CNameEdit::~CNameEdit()
-{
- RemoveCommitListener(this);
-}
-
-//=============================================================================
-/**
- * Called when a CTextEdit control's data is changed. In this case, the name
- * field is being changed, so the new value is pushed down to Client.
- * @param inControl the control that had it's data changed
- */
-void CNameEdit::OnSetData(CControl *inControl)
-{
- if (!m_IsSettingData && inControl == this && m_Namable) {
- if (m_Namable->GetName() != GetString()) {
- m_IsSettingData = true;
- m_Namable->SetName(GetString());
- m_IsSettingData = false;
-
- // Refresh what it is in m_Nameable, because the UI data is already changed and the
- // underlying data model may not agree ( ie not accepting empty or renaming isn't
- // allowed )
- // Ideally UI shouldn't change, it should informing the data model through some kind of
- // transaction (like how blackfish does it)
- SetData(m_Namable->GetName(), false);
- }
- }
-}
-
-//=============================================================================
-/**
- * Called when something on an asset changes, making it dirty. Resets the name
- * displayed by this control, in case it was the name that changed on the asset.
- */
-void CNameEdit::OnDirty()
-{
- SetData(m_Namable->GetName());
- RefreshDisplayFromData();
-}
-
-bool CNameEdit::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_LastMoustDown = inPoint;
- m_CanEdit = !m_LastFocused;
-
- return CTextEditInPlace::OnMouseDown(inPoint, inFlags);
-}
-
-void CNameEdit::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (IsInFocus() && !m_IsInEditMode && !(inFlags & CHotKeys::MOUSE_RBUTTON)) {
- if (m_CanEdit && m_LastMoustDown == inPoint) {
- SetEditMode(true);
- SelectAllText();
- }
- } else {
- CTextEditInPlace::OnMouseUp(inPoint, inFlags);
- }
-
- m_CanEdit = false;
-}
-
-void CNameEdit::OnGainFocus()
-{
- CTextEditInPlace::OnGainFocus();
- m_LastFocused = false;
-}
-
-void CNameEdit::OnLoseFocus()
-{
- m_LastFocused = true;
- CTextEditInPlace::OnLoseFocus();
-}
diff --git a/src/Authoring/Studio/Controls/NameEdit.h b/src/Authoring/Studio/Controls/NameEdit.h
deleted file mode 100644
index cf54bb35..00000000
--- a/src/Authoring/Studio/Controls/NameEdit.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_NAME_EDIT
-#define INCLUDED_NAME_EDIT 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TextEditInPlace.h"
-
-class INamable;
-
-//=============================================================================
-/**
- * @class CNameEdit Edit control for statically displaying a "name" property.
- * Double-clicking on the text enables you to edit it. Changes to the underlying
- * name property are automatically handled by this control.
- */
-class CNameEdit : public CTextEditInPlace, public CCommitDataListener
-{
-public:
- CNameEdit(INamable *inNamable);
- virtual ~CNameEdit();
- void OnSetData(CControl *inControl) override;
- virtual void OnDirty();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnGainFocus() override;
- void OnLoseFocus() override;
-
-protected:
- INamable *m_Namable;
- bool m_IsSettingData;
-
- CPt m_LastMoustDown;
- bool m_LastFocused;
- bool m_CanEdit;
-};
-
-#endif // INCLUDED_NAME_EDIT
diff --git a/src/Authoring/Studio/Controls/OverlayControl.cpp b/src/Authoring/Studio/Controls/OverlayControl.cpp
deleted file mode 100644
index cca9b402..00000000
--- a/src/Authoring/Studio/Controls/OverlayControl.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//=============================================================================
-// Prefix
-//=============================================================================
-#include "stdafx.h"
-
-#include "OverlayControl.h"
-#include "Renderer.h"
-
-IMPLEMENT_OBJECT_COUNTER(COverlayControl)
-
-//=============================================================================
-/**
- * Create a new OverlayControl.
- */
-COverlayControl::COverlayControl()
- : m_HasSizeChanged(false)
- , m_WasVisible(false)
- , m_Alpha(255)
-{
- ADDTO_OBJECT_COUNTER(COverlayControl)
-}
-
-COverlayControl::~COverlayControl()
-{
- REMOVEFROM_OBJECT_COUNTER(COverlayControl)
-}
-
-//=============================================================================
-/**
- * Notification from the parent control that it is going to begin drawing children.
- * This is used to erase this component before the children are drawn.
- * @param inRenderer the renderer that is being drawn to.
- */
-void COverlayControl::BeginDrawChildren(CRenderer *inRenderer)
-{
- const auto size = GetParent()->GetSize();
- QRect theClippingRect(0, 0, size.x, size.y);
-
-// doing this = lockup on MacX.
-// not doing this = playhead redraw errors on Windows
-#ifdef WIN32
- inRenderer->PushClippingRect(theClippingRect);
-#endif
- // If we don't have a renderer then create one.
- if (IsVisible() && m_BufferedRenderer == NULL) {
- m_BufferedRenderer = new CBufferedRenderer(QSize(size.x, size.y));
- }
-
- else if (m_HasSizeChanged && m_BufferedRenderer != NULL) {
- CRct theRect(m_PreviousSize);
- theRect.Offset(-m_PositionOffset + GetPosition());
-
- // Overwrite the current contents, clearing this object's drawing.
- inRenderer->BitBltFrom(theRect, m_BufferedRenderer, 0, 0);
-
- m_HasSizeChanged = false;
-
- m_BufferedRenderer = new CBufferedRenderer(QSize(size.x, size.y));
- }
-
- else {
- if ((IsVisible() || m_WasVisible) && m_BufferedRenderer != NULL) {
- // If this moved since the last begin draw then take in that offset too.
- CRct theRect(GetSize());
- theRect.Offset(-m_PositionOffset + GetPosition());
-
- // Overwrite the current contents, clearing this object's drawing.
- inRenderer->BitBltFrom(theRect, m_BufferedRenderer, 0, 0);
-
- if (m_WasVisible)
- m_BufferedRenderer = nullptr;
-
- m_WasVisible = false;
- }
- }
-
- m_PositionOffset.x = 0;
- m_PositionOffset.y = 0;
-
-#ifdef WIN32
- inRenderer->PopClippingRect();
-#endif
-}
-
-//=============================================================================
-/**
- * Overrides OnDraw to perform custom drawing logic.
- * This basically needs to draw all the time regardless of invalidation.
- * The dirty rect will be properly updated if this is dirty.
- * @param inRenderer the renderer to draw to.
- * @param inDirtyRect the resulting dirty rect from drawing.
- * @param inIgnoreValidation true if this should draw everything.
- */
-void COverlayControl::OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation)
-{
- CRct theClippingRect(-GetPosition(), GetParent()->GetSize());
- inRenderer->PushClippingRect(theClippingRect);
-
- if (IsVisible() && m_BufferedRenderer != nullptr) {
- // Copy the current contents of the background.
- m_BufferedRenderer->BitBltFrom(CRct(GetSize()), inRenderer, 0, 0);
-
- bool isInvalidated = IsInvalidated();
-
- if (isInvalidated || inIgnoreValidation) {
- // If this is invalidated then update the dirty rect appropriately
- CRct theBoundingBox = inRenderer->GetClippingRect();
-
- CRct theRect(GetSize());
- theRect.And(theBoundingBox);
- theRect.Offset(inRenderer->GetTranslation());
- inDirtyRect.Or(theRect);
- }
-
- // if ( m_Alpha != 255 )
- //{
- // DrawAlpha( inRenderer );
- //}
- // else
- {
- // Always draw this component to the renderer, regardless of whether it's dirty or not.
- Draw(inRenderer);
- }
-
- Invalidate(false);
- }
- CControl::OnDraw(inRenderer, inDirtyRect, inIgnoreValidation);
-
- inRenderer->PopClippingRect();
-}
-
-//=============================================================================
-/**
- * Handles drawing this control as being transparent.
- * @param inRenderer the renderer to draw to.
- */
-void COverlayControl::DrawAlpha(CRenderer * /*inRenderer*/)
-{
- /* // Copy the contents of the current background, this will make it so only the areas
- // that are drawn to are actually blended
- BUFFEREDRENDERERTYPE theIntermediate( m_BufferedRenderer,
- m_BufferedRenderer->GetClippingRect() );
- Draw( &theIntermediate );
-
- // Do the transparent draw.
- theIntermediate.TransparentBltTo( inRenderer, m_Alpha );*/
-}
-
-//=============================================================================
-/**
- * Logs the changes in position so that it can properly reset the background.
- * @param inPosition the new position.
- */
-void COverlayControl::SetPosition(CPt inPosition)
-{
- if (inPosition != GetPosition()) {
- // Offset the position, make it relative just in case multiple changes occur per cycle.
- m_PositionOffset += inPosition - GetPosition();
-
- CControl::SetPosition(inPosition);
- }
-}
-
-//=============================================================================
-/**
- * Override of SetSize so that the renderer can be ditched.
- * @param inSize the new size of this control.
- */
-void COverlayControl::SetSize(CPt inSize)
-{
- if (inSize != GetSize()) {
- // Record how big this was so the previous drawing can be erased.
- if (!m_HasSizeChanged && m_BufferedRenderer != nullptr) {
- m_HasSizeChanged = true;
- m_PreviousSize = GetSize();
- }
-
- CControl::SetSize(inSize);
- }
-}
-
-//=============================================================================
-/**
- * Set whether or not this control is visible.
- * Override to handle final clearing of this control when not visible.
- * @param inIsVisible true if this is to be visible.
- */
-void COverlayControl::SetVisible(bool inIsVisible)
-{
- if (!inIsVisible && IsVisible()) {
- m_WasVisible = true;
- }
- CControl::SetVisible(inIsVisible);
-}
-
-//=============================================================================
-/**
- * Set the alpha blend of this control.
- * This defaults to 255 which is opaque, if it is anything other than 255 then
- * this control will be drawn with transparency.
- * @param inAlpha the new opacity, 255 = opaque, 0 = transparent.
- */
-void COverlayControl::SetAlpha(short inAlpha)
-{
- m_Alpha = inAlpha;
-}
-
-bool COverlayControl::IsChildInvalidated() const
-{
- return true;
-}
diff --git a/src/Authoring/Studio/Controls/OverlayControl.h b/src/Authoring/Studio/Controls/OverlayControl.h
deleted file mode 100644
index 74084ef7..00000000
--- a/src/Authoring/Studio/Controls/OverlayControl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//=============================================================================
-// Prefix
-//=============================================================================
-#ifndef INCLUDED_OVERLAY_CONTROL_H
-#define INCLUDED_OVERLAY_CONTROL_H 1
-
-#pragma once
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "Control.h"
-
-//=============================================================================
-// Forwards
-//=============================================================================
-
-#include "BufferedRenderer.h"
-#include "Qt3DSObjectCounter.h"
-
-//=============================================================================
-/**
- * Overlay control provides a way to a control on top of another and move it
- * around. The drawing is handled so that you do not need to invalidate the
- * bottom control and you don't get trails to forming on the bottom control.
- * This is accomplished through the use of a buffered renderer.
- */
-class COverlayControl : public CControl
-{
-public:
- COverlayControl();
- virtual ~COverlayControl();
-
- DEFINE_OBJECT_COUNTER(COverlayControl)
-
- virtual void SetSize(CPt inSize);
- virtual void SetPosition(CPt inPosition);
- virtual void OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation = false);
- virtual void BeginDrawChildren(CRenderer *inRenderer);
- virtual void SetVisible(bool inIsVisible);
- void SetAlpha(short inAlpha);
- virtual bool IsChildInvalidated() const;
-
-protected:
- void DrawAlpha(CRenderer *inRenderer);
-
- CPt m_PositionOffset;
- Q3DStudio::CAutoMemPtr<CBufferedRenderer> m_BufferedRenderer;
- bool m_HasSizeChanged;
- CPt m_PreviousSize;
- bool m_WasVisible;
- short m_Alpha;
-};
-#endif // INCLUDED_OVERLAY_CONTROL_H
diff --git a/src/Authoring/Studio/Controls/ProceduralButton.h b/src/Authoring/Studio/Controls/ProceduralButton.h
deleted file mode 100644
index 47b39046..00000000
--- a/src/Authoring/Studio/Controls/ProceduralButton.h
+++ /dev/null
@@ -1,569 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_PROCEDURAL_BUTTON_H
-#define INCLUDED_PROCEDURAL_BUTTON_H 1
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Renderer.h"
-#include "ButtonControl.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Template class for making procedural buttons. A procedural button has
- * additional drawing options compared to a normal button. You must specify
- * a derivative of CButtonControl as the class for the procedural button to
- * extend.
- */
-template <typename TButton>
-class CProceduralButton : public TButton
-{
-public:
- /// Fill color styles for procedurally drawn buttons
- enum EFillStyle {
- EFILLSTYLE_GRADIENT, ///< Button background is filled using a gradient
- EFILLSTYLE_FLOOD, ///< Button background is filled in a solid color
- EFILLSTYLE_NONE ///< Button background is not filled at all
- };
-
- /// Struct enabling you to specify whether or not to draw each border of the button individually
- struct SBorderOptions
- {
- bool m_DrawLeft; ///< If true, you want the left border to be drawn
- bool m_DrawTop; ///< If true, you want the top border to be drawn
- bool m_DrawRight; ///< If true, you want the right border to be drawn
- bool m_DrawBottom; ///< If true, you want the bottom border to be drawn
-
- /// Default Constructor - makes all borders be drawn
- SBorderOptions()
- {
- m_DrawLeft = true;
- m_DrawTop = true;
- m_DrawRight = true;
- m_DrawBottom = true;
- }
-
- /// Constructor to initialize each member of the struct individually
- SBorderOptions(bool inLeft, bool inTop, bool inRight, bool inBottom)
- {
- m_DrawLeft = inLeft;
- m_DrawTop = inTop;
- m_DrawRight = inRight;
- m_DrawBottom = inBottom;
- }
- };
-
-public:
- CProceduralButton();
- virtual ~CProceduralButton();
-
- void SetFillStyleUp(EFillStyle inStyle);
- void SetFillStyleDown(EFillStyle inStyle);
- void SetFillStyleDisabled(EFillStyle inStyle);
- void SetFillStyleOver(EFillStyle inStyle);
- void SetFillStyleAll(EFillStyle inStyle);
- void SetFillColorUp(const CColor &inColor);
- void SetFillColorDown(const CColor &inColor);
- void SetFillColorDisabled(const CColor &inColor);
- void SetFillColorOver(const CColor &inColor);
-
- void SetBorderVisibilityAll(const SBorderOptions &inBorderOptions);
- void SetBorderVisiblityUp(const SBorderOptions &inBorderOptions);
- void SetBorderVisiblityDown(const SBorderOptions &inBorderOptions);
- void SetBorderVisiblityDisabled(const SBorderOptions &inBorderOptions);
- void SetBorderVisiblityOver(const SBorderOptions &inBorderOptions);
-
- void SetLeftBorderColor(const CColor &inColor);
- void SetTopBorderColor(const CColor &inColor);
- void SetRightBorderColor(const CColor &inColor);
- void SetBottomBorderColor(const CColor &inColor);
-
-protected:
- virtual void Render(CRenderer *inRenderer);
- void DrawBackground(CRenderer *inRenderer);
- void DrawBorder(CRenderer *inRenderer);
- EFillStyle GetCurrentFillStyle();
- CColor GetCurrentBackgroundColor();
- SBorderOptions GetCurrentBorderOptions();
-
-protected:
- EFillStyle m_UpFillStyle;
- EFillStyle m_DownFillStyle;
- EFillStyle m_DisabledFillStyle;
- EFillStyle m_OverFillStyle;
- CColor m_UpColor;
- CColor m_DownColor;
- CColor m_DisabledColor;
- CColor m_OverColor;
- CColor m_LeftBorderColor;
- CColor m_TopBorderColor;
- CColor m_RightBorderColor;
- CColor m_BottomBorderColor;
- SBorderOptions m_UpBorders;
- SBorderOptions m_DownBorders;
- SBorderOptions m_DisabledBorders;
- SBorderOptions m_OverBorders;
-};
-
-//==============================================================================
-// Template implemenations
-//==============================================================================
-
-//=============================================================================
-/**
- * Constructor
- */
-template <typename TButton>
-CProceduralButton<TButton>::CProceduralButton()
- : TButton()
- , m_UpFillStyle(EFILLSTYLE_GRADIENT)
- , m_DownFillStyle(EFILLSTYLE_GRADIENT)
- , m_DisabledFillStyle(EFILLSTYLE_NONE)
- , m_OverFillStyle(EFILLSTYLE_GRADIENT)
- , m_UpColor(CStudioPreferences::GetBaseColor())
- , m_DownColor(CStudioPreferences::GetButtonDownColor())
- , m_DisabledColor(CStudioPreferences::GetBaseColor())
- , m_OverColor(CStudioPreferences::GetBaseColor())
- , m_LeftBorderColor(CStudioPreferences::GetButtonShadowColor())
- , m_TopBorderColor(CStudioPreferences::GetButtonShadowColor())
- , m_RightBorderColor(CStudioPreferences::GetButtonShadowColor())
- , m_BottomBorderColor(CStudioPreferences::GetButtonShadowColor())
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-template <typename TButton>
-CProceduralButton<TButton>::~CProceduralButton()
-{
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillStyleUp(EFillStyle inStyle)
-{
- if (m_UpFillStyle != inStyle) {
- m_UpFillStyle = inStyle;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillStyleDown(EFillStyle inStyle)
-{
- if (m_DownFillStyle != inStyle) {
- m_DownFillStyle = inStyle;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillStyleDisabled(EFillStyle inStyle)
-{
- if (m_DisabledFillStyle != inStyle) {
- m_DisabledFillStyle = inStyle;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillStyleOver(EFillStyle inStyle)
-{
- if (m_OverFillStyle != inStyle) {
- m_OverFillStyle = inStyle;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillStyleAll(EFillStyle inStyle)
-{
- SetFillStyleUp(inStyle);
- SetFillStyleDown(inStyle);
- SetFillStyleDisabled(inStyle);
- SetFillStyleOver(inStyle);
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillColorUp(const CColor &inColor)
-{
- if (m_UpColor != inColor) {
- m_UpColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillColorDown(const CColor &inColor)
-{
- if (m_DownColor != inColor) {
- m_DownColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillColorDisabled(const CColor &inColor)
-{
- if (m_DisabledColor != inColor) {
- m_DisabledColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetFillColorOver(const CColor &inColor)
-{
- if (m_OverColor != inColor) {
- m_OverColor = inColor;
- TButton::Invalidate();
- }
-}
-
-template <typename TButton>
-void CProceduralButton<TButton>::SetBorderVisibilityAll(const SBorderOptions &inBorderOptions)
-{
- SetBorderVisiblityUp(inBorderOptions);
- SetBorderVisiblityDown(inBorderOptions);
- SetBorderVisiblityDisabled(inBorderOptions);
- SetBorderVisiblityOver(inBorderOptions);
-}
-
-template <typename TButton>
-void CProceduralButton<TButton>::SetBorderVisiblityUp(const SBorderOptions &inBorderOptions)
-{
- m_UpBorders = inBorderOptions;
-}
-
-template <typename TButton>
-void CProceduralButton<TButton>::SetBorderVisiblityDown(const SBorderOptions &inBorderOptions)
-{
- m_DownBorders = inBorderOptions;
-}
-
-template <typename TButton>
-void CProceduralButton<TButton>::SetBorderVisiblityDisabled(const SBorderOptions &inBorderOptions)
-{
- m_DisabledBorders = inBorderOptions;
-}
-
-template <typename TButton>
-void CProceduralButton<TButton>::SetBorderVisiblityOver(const SBorderOptions &inBorderOptions)
-{
- m_OverBorders = inBorderOptions;
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetLeftBorderColor(const CColor &inColor)
-{
- if (m_LeftBorderColor != inColor) {
- m_LeftBorderColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetTopBorderColor(const CColor &inColor)
-{
- if (m_TopBorderColor != inColor) {
- m_TopBorderColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetRightBorderColor(const CColor &inColor)
-{
- if (m_RightBorderColor != inColor) {
- m_RightBorderColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::SetBottomBorderColor(const CColor &inColor)
-{
- if (m_BottomBorderColor != inColor) {
- m_BottomBorderColor = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * xxx
- */
-template <typename TButton>
-void CProceduralButton<TButton>::Render(CRenderer *inRenderer)
-{
- // Fill the background if desired
- DrawBackground(inRenderer);
-
- // Draw the button icon
- TButton::Render(inRenderer);
-
- // Draw the border
- DrawBorder(inRenderer);
-}
-
-//=============================================================================
-/**
- * Fills the background of this button with the appropriate color and style.
- * The style is specified by calling "GetCurrentFillStyle" which may indicate
- * not to fill the background at all.
- * @param inRenderer the renderer to draw to
- */
-template <typename TButton>
-void CProceduralButton<TButton>::DrawBackground(CRenderer *inRenderer)
-{
- CPt theSize = TButton::GetSize();
-
- // Fill in the background color if necessary
- EFillStyle theFillStyle = GetCurrentFillStyle();
-
- switch (theFillStyle) {
- // Perform a gradient fill (block of color that varies slightly along the y-axis)
- case EFILLSTYLE_GRADIENT: {
- // The gradient inverts if the button is currently in the down state
- bool theInvertGradientFlag = (TButton::GetButtonState() == TButton::EBUTTONSTATE_DOWN) ? true : false;
- inRenderer->DrawGradientBitmap(QRect(0, 0, theSize.x, theSize.y), GetCurrentBackgroundColor(), theInvertGradientFlag,
- 0.75);
- } break;
-
- // Fill the whole area with a block of solid color
- case EFILLSTYLE_FLOOD:
- inRenderer->FillSolidRect(QRect(0, 0, theSize.x, theSize.y), GetCurrentBackgroundColor());
- break;
-
- // Do not fill the background at all
- case EFILLSTYLE_NONE:
- // No break
- default:
- // No filling in of the background
- break;
- }
-}
-
-//=============================================================================
-/**
- * Draws the borders around this button as specified in the border options for
- * the current state of the button. You can turn border drawing on and off
- * per side of the button, and you can also specify different colors for each
- * side of the button.
- * @param inRenderer renderer to draw to
- */
-template <typename TButton>
-void CProceduralButton<TButton>::DrawBorder(CRenderer *inRenderer)
-{
- CPt theSize = TButton::GetSize();
- SBorderOptions theBorders = CProceduralButton::GetCurrentBorderOptions();
-
- if (theBorders.m_DrawLeft) {
- inRenderer->PushPen(m_LeftBorderColor);
- inRenderer->MoveTo(CPt(0, theSize.y - 1));
- inRenderer->LineTo(CPt(0, 0));
- inRenderer->PopPen();
- }
-
- if (theBorders.m_DrawTop) {
- inRenderer->PushPen(m_TopBorderColor);
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(theSize.x - 1, 0));
- inRenderer->PopPen();
- }
-
- if (theBorders.m_DrawRight) {
- inRenderer->PushPen(m_RightBorderColor);
- if (!theBorders.m_DrawTop)
- inRenderer->MoveTo(CPt(theSize.x - 1, 0));
- else
- inRenderer->MoveTo(CPt(theSize.x - 1, 1));
- inRenderer->LineTo(CPt(theSize.x - 1, theSize.y - 1));
- inRenderer->PopPen();
- }
-
- if (theBorders.m_DrawBottom) {
- inRenderer->PushPen(m_BottomBorderColor);
- inRenderer->MoveTo(CPt(theSize.x - 1, theSize.y - 1));
- if (!theBorders.m_DrawLeft)
- inRenderer->LineTo(CPt(0, theSize.y - 1));
- else
- inRenderer->LineTo(CPt(1, theSize.y - 1));
- inRenderer->PopPen();
- }
-}
-
-//=============================================================================
-/**
- * @return the current fill style based upon state (up, down, mouse over, disabled) of the button
- */
-template <typename TButton>
-typename CProceduralButton<TButton>::EFillStyle
-CProceduralButton<TButton>::GetCurrentFillStyle()
-{
- // Default to the up state
- EFillStyle theFillStyle = m_UpFillStyle;
-
- typename TButton::EButtonState theState = TButton::GetButtonState();
-
- // If the mouse is over the button, switch to the mouse over style
- if (TButton::IsMouseOver())
- theFillStyle = m_OverFillStyle;
-
- // If the button is currently pressed, this cancels the up and over states, so return the down
- // style
- if (theState == TButton::EBUTTONSTATE_DOWN)
- theFillStyle = m_DownFillStyle;
-
- // If this button is disabled just return the disabled style (overrides any other states)
- if (!TButton::IsEnabled())
- theFillStyle = m_DisabledFillStyle;
-
- return theFillStyle;
-}
-
-//=============================================================================
-/**
- * @return the current background color based upon state (up, down, mouse over, disabled) of the
- * button
- */
-template <typename TButton>
-::CColor CProceduralButton<TButton>::GetCurrentBackgroundColor()
-{
- // Default to the up color
- ::CColor theColor = m_UpColor;
-
- typename TButton::EButtonState theState = TButton::GetButtonState();
-
- // If the mouse is over the button, switch to the mouse over color
- if (TButton::IsMouseOver())
- theColor = m_OverColor;
-
- // If the button is currently pressed, this cancels the up and over states, so return the down
- // color
- if (theState == TButton::EBUTTONSTATE_DOWN)
- theColor = m_DownColor;
-
- // If this button is disabled just return the disabled color (overrides any other states)
- if (!TButton::IsEnabled())
- theColor = m_DisabledColor;
-
- return theColor;
-}
-
-//=============================================================================
-/**
- * @return the current border drawing options based upon state (up, down, mouse over, disabled) of
- * the button
- */
-template <typename TButton>
-typename CProceduralButton<TButton>::SBorderOptions
-CProceduralButton<TButton>::GetCurrentBorderOptions()
-{
- SBorderOptions theOptions = m_UpBorders;
- typename TButton::EButtonState theState = TButton::GetButtonState();
-
- // If the mouse is over the button, switch to the mouse over border options
- if (TButton::IsMouseOver())
- theOptions = m_OverBorders;
-
- // If the button is currently pressed, this cancels the up and over states, so return the over
- // border options
- if (theState == TButton::EBUTTONSTATE_DOWN)
- theOptions = m_DownBorders;
-
- // If this button is disabled just return the disabled border options (overrides any other
- // states)
- if (!TButton::IsEnabled())
- theOptions = m_DisabledBorders;
-
- return theOptions;
-}
-
-#endif // INCLUDED_PROCEDURAL_BUTTON_H
diff --git a/src/Authoring/Studio/Controls/SIcon.cpp b/src/Authoring/Studio/Controls/SIcon.cpp
deleted file mode 100644
index 5df99717..00000000
--- a/src/Authoring/Studio/Controls/SIcon.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "SIcon.h"
-#include "Renderer.h"
-#include "MasterP.h"
-#include "ResourceCache.h"
-
-//=============================================================================
-/**
- * Create a new Icon with no image.
- */
-CSIcon::CSIcon()
-{
- SetAbsoluteSize(CPt(0, 0));
- SetImage(QPixmap());
-}
-
-//=============================================================================
-/**
- * Create a new Icon with the specified images loaded from the resource cache.
- * @param inResName Name of the image to be loaded for the normal icon
- * @param inDisabledResName Name of the image to be loaded for the icon when it's disabled
- */
-CSIcon::CSIcon(const QString &inResName, const QString &inDisabledResName /*= ""*/)
-{
- SetAbsoluteSize(CPt(0, 0));
- CResourceCache *theCache = CResourceCache::GetInstance();
- m_EnabledImage = theCache->GetBitmap(inResName);
- m_DisabledImage = theCache->GetBitmap(inDisabledResName);
- SetImage(m_EnabledImage);
-}
-
-//=============================================================================
-/**
- * Create a new Icon with the specified image.
- * Any pixels in the image with the transparent color will not be drawn.
- * The size of this control will be set to the size of the image.
- * @param inResource string specifying what image to draw.
- * @param inDisabledResource string specifying what disabled image to draw
- */
-CSIcon::CSIcon(const QPixmap &inResource, const QPixmap &inDisabledResource /*=NULL*/)
- : m_DisabledImage(inDisabledResource)
- , m_EnabledImage(inResource)
-{
- SetAbsoluteSize(CPt(0, 0));
- SetImage(m_EnabledImage);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CSIcon::~CSIcon()
-{
-}
-
-//=============================================================================
-/**
- * Set the image that this icon is drawing as.
- * Any pixels in the image with the transparent color will not be drawn.
- * The size of this control will be set to the size of the image.
- * @param inResource the resource ID if the new image to draw.
- * @param inPreserveSize false to check and set size ( setting to true can reduce flickering in some
- * cases )
- */
-void CSIcon::SetImage(const QPixmap &inResource, bool inPreserveSize)
-{
- m_Image = inResource;
-
- if (!inPreserveSize) {
- // If we successfully loaded the new image then modify the size.
- if (!m_Image.isNull())
- SetAbsoluteSize(CPt(GetImageSize().width(), GetImageSize().height()));
- else
- SetAbsoluteSize(CPt(0, 0));
- }
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Set image to the one specified
- * @param inResName Name of the image to be loaded for the normal icon
- * @param inPreserveSize false to check and set size ( setting to true can reduce flickering in some
- * cases )
- */
-void CSIcon::SetImage(const QString &inResName, bool inPreserveSize)
-{
- CResourceCache *theCache = CResourceCache::GetInstance();
- SetImage(theCache->GetBitmap(inResName), inPreserveSize);
-}
-
-//=============================================================================
-/**
- * Draw this image.
- * @param inRenderer the renderer to draw to.
- */
-void CSIcon::Draw(CRenderer *inRenderer)
-{
- inRenderer->PushClippingRect(QRect(QPoint(0,0), GetSize()));
- if (!m_Image.isNull()) {
- inRenderer->DrawBitmap(CPt(0, 0), m_Image);
- }
- inRenderer->PopClippingRect();
-}
-
-//=============================================================================
-/**
- * Get the size of this image.
- */
-QSize CSIcon::GetImageSize()
-{
- return m_Image.size();
-}
-
-//=============================================================================
-/**
- * Enables or disables the parent and switches the image to be displayed for
- * this icon to a disabled or enabled image.
- */
-void CSIcon::SetParentEnabled(bool inIsEnabled)
-{
- CControl::SetParentEnabled(inIsEnabled);
- if (!IsEnabled()) {
- SetImage(m_DisabledImage);
- } else {
- SetImage(m_EnabledImage);
- }
- Invalidate();
-}
diff --git a/src/Authoring/Studio/Controls/SIcon.h b/src/Authoring/Studio/Controls/SIcon.h
deleted file mode 100644
index 53201e01..00000000
--- a/src/Authoring/Studio/Controls/SIcon.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_ICON_H
-#define INCLUDED_ICON_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-
-#include <QPixmap>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-//=============================================================================
-/**
- * Class for drawing bitmapped icon controls to the renderer.
- */
-class CSIcon : public CControl
-{
-public:
- CSIcon();
- CSIcon(const QString &inResName, const QString &inDisabledResName = QString());
- CSIcon(const QPixmap &inResource, const QPixmap &inDisabledResource = {});
-
- virtual ~CSIcon();
-
- void SetImage(const QPixmap &inResource, bool inPreserveSize = false);
- void SetImage(const QString &inResName, bool inPreserveSize = false);
- QSize GetImageSize();
- void SetParentEnabled(bool inParentEnabled) override;
-
- void Draw(CRenderer *inRenderer) override;
-
-protected:
- QPixmap m_Image;
- QPixmap m_DisabledImage;
- QPixmap m_EnabledImage;
-};
-#endif // INCLUDED_ICON_H
diff --git a/src/Authoring/Studio/Controls/ScrollController.cpp b/src/Authoring/Studio/Controls/ScrollController.cpp
deleted file mode 100644
index 572e63d4..00000000
--- a/src/Authoring/Studio/Controls/ScrollController.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ScrollController.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "Scroller.h"
-#include "Control.h"
-
-using namespace Q3DStudio;
-
-const long CScrollController::DEFAULT_SCROLL_AMOUNT = 20;
-
-//=============================================================================
-/**
- * Constructor
- */
-CScrollController::CScrollController()
- : m_Orientation(IScrollerBar::VERTICAL)
- , m_ScrollerBar(NULL)
- , m_Control(NULL)
- , m_ScrollingForward(false)
- , m_ScrollingBackward(false)
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CScrollController::~CScrollController()
-{
-}
-
-//=============================================================================
-/**
- * Sets the control. Used to get the check if the mouse is over the control.
- */
-void CScrollController::SetControl(CControl *inControl)
-{
- m_Control = inControl;
-}
-
-//=============================================================================
-/**
- * Sets the scroller bar for this control. Used to get the thumb position in
- * OnMouseDown.
- */
-void CScrollController::SetScrollerBar(IScrollerBar *inScrollerBar)
-{
- m_ScrollerBar = inScrollerBar;
-}
-
-//=============================================================================
-/**
- * Tells this control which way to draw itself.
- * @param inOrientation Direction of the scroller that is using this control
- */
-void CScrollController::SetOrientation(IScrollerBar::EOrientation inOrientation)
-{
- m_Orientation = inOrientation;
-}
-
-//=============================================================================
-/**
- * Returns the amount to scroll
- */
-long CScrollController::DetermineScrollAmount()
-{
- return DEFAULT_SCROLL_AMOUNT;
-}
-
-//=============================================================================
-/**
- * Call to scroll forwards.
- * Forwards is right/down depending on orientation.
- */
-void CScrollController::OnScrollForward(CControl *inButton)
-{
- if (!m_ScrollingForward && inButton) {
- m_ScrollingForward = true;
-
- QString theName = QStringLiteral("CScrollController::OnScrollForward");
- if (m_Control)
- theName += QStringLiteral("::%1").arg(m_Control->GetName());
-
- m_TimerConnection = ITickTock::GetInstance().AddTimer(
- 100, true, std::bind(&CScrollController::OnTimer, this), theName);
- }
-
- Q_UNUSED(inButton);
- CPt theScrollDistance(0, 0);
- long theScrollAmount = DetermineScrollAmount();
-
- if (m_ScrollerBar->GetOrientation() == IScrollerBar::VERTICAL)
- theScrollDistance.y = theScrollAmount;
- else
- theScrollDistance.x = theScrollAmount;
-
- m_ScrollerBar->GetScroller()->SetVisiblePosition(
- m_ScrollerBar->GetScroller()->GetVisiblePosition() + theScrollDistance);
- m_ScrollerBar->RepositionThumb();
-}
-
-//=============================================================================
-/**
- * Call to scroll backwards.
- * Backwards is left/up depending on orientation.
- */
-void CScrollController::OnScrollBackward(CControl *inButton)
-{
- if (!m_ScrollingBackward && inButton) {
- m_ScrollingBackward = true;
-
- QString theName = QStringLiteral("CScrollController::OnScrollBackward");
- if (m_Control)
- theName += QStringLiteral("::%s").arg(m_Control->GetName());
-
- m_TimerConnection = ITickTock::GetInstance().AddTimer(
- 100, true, std::bind(&CScrollController::OnTimer, this), theName);
- }
-
- Q_UNUSED(inButton);
- CPt theScrollDistance(0, 0);
- long theScrollAmount = DetermineScrollAmount();
-
- if (m_ScrollerBar->GetOrientation() == IScrollerBar::VERTICAL)
- theScrollDistance.y = theScrollAmount;
- else
- theScrollDistance.x = theScrollAmount;
-
- m_ScrollerBar->GetScroller()->SetVisiblePosition(
- m_ScrollerBar->GetScroller()->GetVisiblePosition() - theScrollDistance);
- m_ScrollerBar->RepositionThumb();
-}
-
-//=============================================================================
-/**
- * Cancels the scrolling. Removes the timer.
- */
-void CScrollController::OnCancelScrolling(CControl *inButton)
-{
- Q_UNUSED(inButton);
-
- m_ScrollingForward = false;
- m_ScrollingBackward = false;
-
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
-}
-
-//=============================================================================
-/**
- * Overwritten TickTockProc thats called everytime the timer is activated.
- */
-void CScrollController::OnTimer()
-{
- if (m_ScrollingForward) {
- // We want it to scroll only if the mouse is over the control
- if (m_Control->IsMouseOver())
- OnScrollForward(nullptr);
- } else if (m_ScrollingBackward) {
- // We want it to scroll only if the mouse is over the control
- if (m_Control->IsMouseOver())
- OnScrollBackward(nullptr);
- } else {
- // The timer should not be called if we are not scrolling forward nor backwards
- ASSERT(false);
- }
-}
diff --git a/src/Authoring/Studio/Controls/ScrollController.h b/src/Authoring/Studio/Controls/ScrollController.h
deleted file mode 100644
index 08471877..00000000
--- a/src/Authoring/Studio/Controls/ScrollController.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_SCROLL_CONTROLLER_H
-#define INCLUDED_SCROLL_CONTROLLER_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BlankControl.h"
-#include "StudioPreferences.h"
-#include "ITickTock.h"
-#include "ScrollerBar.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-class CControl;
-
-//=============================================================================
-/**
- * Extends the blank control to draw items specific to the scroller control.
- */
-class CScrollController
-{
-public:
- static const long DEFAULT_SCROLL_AMOUNT;
-
- CScrollController();
- virtual ~CScrollController();
- void SetControl(CControl *inControl);
- void SetScrollerBar(IScrollerBar *inScrollerBar);
- void SetOrientation(IScrollerBar::EOrientation inOrientation);
-
- virtual void OnScrollForward(CControl *inControl = nullptr);
- virtual void OnScrollBackward(CControl *inControl = nullptr);
- virtual void OnCancelScrolling(CControl *inControl = nullptr);
-
-protected:
- void OnTimer();
-
- std::shared_ptr<qt3dsdm::ISignalConnection> m_TimerConnection;
- IScrollerBar::EOrientation m_Orientation;
- IScrollerBar *m_ScrollerBar;
- CControl *m_Control;
-
- bool m_ScrollingForward;
- bool m_ScrollingBackward;
-
- virtual long DetermineScrollAmount();
-};
-
-#endif // INCLUDED_SCROLL_CONTROLLER_H
diff --git a/src/Authoring/Studio/Controls/Scroller.cpp b/src/Authoring/Studio/Controls/Scroller.cpp
deleted file mode 100644
index 6cc2e8d9..00000000
--- a/src/Authoring/Studio/Controls/Scroller.cpp
+++ /dev/null
@@ -1,829 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Scroller.h"
-#include "Renderer.h"
-#include "ButtonControl.h"
-#include "MasterP.h"
-#include "Qt3DSDMSignals.h"
-#include "ControlData.h"
-
-#include <QDateTime>
-
-using namespace Q3DStudio;
-const unsigned long ORIGINAL_DELAY_TIME = 200;
-const unsigned long ORIGINAL_OFFSET_AMMOUNT = 205;
-//=============================================================================
-/**
- * Creates a scroller.
- * @param inCreateImmediately used by subclasses, true if using base class of CScroller
- */
-CScroller::CScroller(bool inCreateImmediately /* = true */)
- : m_VisibleSize(0, 0)
- , m_VisiblePosition(0, 0)
- , m_VerticalScrollMode(AS_NEEDED)
- , m_HorizontalScrollMode(AS_NEEDED)
- , m_ResizingChildren(false)
- , m_IsMouseDown(false)
- , m_OffsetAmmount(ORIGINAL_OFFSET_AMMOUNT)
- , m_DelayTime(ORIGINAL_DELAY_TIME)
-{
- if (inCreateImmediately)
- Initialize();
- m_ControlData->SetMouseWheelEnabled(true);
-
- SetName("Scroller");
-}
-
-CScroller::~CScroller()
-{
- delete m_VerticalBar;
- delete m_HorizontalBar;
-}
-
-//=============================================================================
-/**
- * Performed once and only once!
- * Do not call if CScroller was called with the createImmediately flag as true.
- */
-void CScroller::Initialize()
-{
- m_VerticalBar = CreateVerticalBar();
- m_HorizontalBar = CreateHorizontalBar();
-
- AddChild(m_VerticalBar);
- AddChild(m_HorizontalBar);
-}
-
-//=============================================================================
-/**
- * Virtual function to get the vertical scroll bar.
- * This allows overriding so subclasses can subclass the ScrollerBar as well.
- * The created bar will be deleted on the destruction of this class.
- * @return the created scrollerbar.
- */
-CScrollerBar *CScroller::CreateVerticalBar()
-{
- CScrollerBar *theBar = new CScrollerBar(this);
- theBar->SetOrientation(CScrollerBar::VERTICAL);
-
- return theBar;
-}
-
-//=============================================================================
-/**
- * Virtual function to get the horizontal scroll bar.
- * This allows overriding so subclasses can subclass the ScrollerBar as well.
- * The created bar will be deleted on the destruction of this class.
- * @return the created scrollerbar.
- */
-CScrollerBar *CScroller::CreateHorizontalBar()
-{
- CScrollerBar *theBar = new CScrollerBar(this);
- theBar->SetOrientation(CScrollerBar::HORIZONTAL);
-
- return theBar;
-}
-
-void CScroller::OnSizeChanged(CPt /*inSize*/)
-{
- CPt theMaxPoint = GetMaxVisiblePosition();
- CPt theVisPoint = GetVisiblePosition();
- if (theVisPoint.x > theMaxPoint.x)
- theVisPoint.x = theMaxPoint.x;
- if (theVisPoint.y > theMaxPoint.y)
- theVisPoint.y = theMaxPoint.y;
-
- SetVisiblePosition(theVisPoint);
- RecalcLayout();
-}
-//=============================================================================
-/**
- * Sets the size of the scroller.
- * @param inSize the new size for this scroller.
- */
-void CScroller::SetSize(CPt inSize)
-{
- if (inSize != GetSize()) {
- CControl::SetSize(inSize);
- OnSizeChanged(inSize);
- }
-}
-
-void CScroller::SetLayout(CPt inSize, CPt inPosition)
-{
- CControl::SetLayout(inSize, inPosition);
- OnSizeChanged(inSize);
-}
-
-//=============================================================================
-/**
- * Gets the minimum size that this scroller is allowed to be.
- * This is calculated from the minimum size of the child control and the
- * needed size of the scroll bars.
- * @return the minimum size of this object.
- */
-CPt CScroller::GetMinimumSize()
-{
- CPt theSize(0, 0);
- CControl *theChildControl = GetControl();
- if (theChildControl != nullptr) {
- CPt theChildMin = theChildControl->GetMinimumSize();
- // If at zero the scroll bars are up then include them in the size.
- if (theChildMin.x != 0) {
- theSize += m_HorizontalBar->GetMinimumSize();
- }
- if (theChildMin.y != 0) {
- theSize += m_VerticalBar->GetMinimumSize();
- }
- }
-
- return theSize;
-}
-
-//=============================================================================
-/**
- * Get the maximum size of this scroller.
- * This is just the maximum size of the child window, since the scroll bars
- * will not be up when at max size.
- * @return the maximum size of this control.
- */
-CPt CScroller::GetMaximumSize()
-{
- CPt theMaxSize;
- CControl *theChildControl = GetControl();
- if (theChildControl != nullptr)
- theMaxSize = theChildControl->GetMaximumSize();
- else
- theMaxSize = CControl::GetMaximumSize();
-
- return theMaxSize;
-}
-
-//=============================================================================
-/**
- * Add a child control to this control.
- * This is used to add a new child to this control. If there is already a
- * component in the scrolling window then inControl will take the place of the
- * previous control and the previous will be removed as a child of this.
- * @param inControl the control to be added.
- * @param inInsertBefore not used.
- */
-void CScroller::AddChild(CControl *inControl, CControl *inInsertBefore /*= nullptr*/)
-{
- Q_UNUSED(inInsertBefore);
-
- if (GetChildCount() > 3)
- RemoveChild(GetChildren().GetCurrent()->GetControl());
-
- if (GetChildCount() > 0)
- CControl::AddChild(inControl, GetChildren().GetCurrent()->GetControl());
- else
- CControl::AddChild(inControl);
-
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Recalculate the layout of this object.
- * This is used anytime this is changing size or needs to figure out where the
- * controls go. This does all the work of setting the scrollerbar positions and
- * the child window positions.
- */
-void CScroller::RecalcLayout()
-{
- QT3DS_PROFILE(RecalcLayout);
-
- m_ResizingChildren = true;
-
- CPt mySize = GetSize();
- m_VisibleSize = mySize;
-
- // If the side bar should be visible
- if (IsVerticalVisible()) {
- // Make sure the side bar is visible.
- m_VerticalBar->SetVisible(true);
-
- // Set the side bars position
- m_VerticalBar->SetPosition(CPt(mySize.x - m_VerticalBar->GetMinimumSize().x, 0));
- // the width of the vertical bar is subtracted from the visible area.
- m_VisibleSize.x -= m_VerticalBar->GetMinimumSize().x;
-
- if (!IsVerticalScrolling())
- m_VerticalBar->SetEnabled(false);
- else
- m_VerticalBar->SetEnabled(true);
- } else
- m_VerticalBar->SetVisible(false);
-
- if (IsHorizontalVisible()) {
- // Make sure the bottom bar is visible.
- m_HorizontalBar->SetVisible(true);
-
- // Set the bottom bar's position.
- m_HorizontalBar->SetPosition(CPt(0, mySize.y - m_HorizontalBar->GetMinimumSize().y));
- // the height of the horizontal bar is subtracted from the visible area.
- m_VisibleSize.y -= m_HorizontalBar->GetMinimumSize().y;
-
- if (!IsHorizontalScrolling())
- m_HorizontalBar->SetEnabled(false);
- else
- m_HorizontalBar->SetEnabled(true);
- } else
- m_HorizontalBar->SetVisible(false);
-
- SetVisibleSize(m_VisibleSize);
- SetVisiblePosition(GetVisiblePosition());
-
- if (IsVerticalVisible())
- m_VerticalBar->SetSize(CPt(m_VerticalBar->GetMinimumSize().x, m_VisibleSize.y));
- if (IsHorizontalVisible())
- m_HorizontalBar->SetSize(CPt(m_VisibleSize.x, m_HorizontalBar->GetMinimumSize().y));
-
- m_ResizingChildren = false;
-}
-
-//=============================================================================
-/**
- * Set the size of the inner control that is visible.
- * @param inSize the size of the inner control that is to be visible.
- */
-void CScroller::SetVisibleSize(CPt inSize)
-{
- m_VisibleSize = inSize;
-
- // If we have a child then set all of it's properties up.
- CControl *theChild = GetControl();
- if (theChild) {
- CPt theChildSize = m_VisibleSize;
- CPt theMinSize = theChild->GetMinimumSize();
-
- if (theMinSize.x < theChildSize.x)
- theMinSize.x = theChildSize.x;
- if (theMinSize.y < theChildSize.y)
- theMinSize.y = theChildSize.y;
-
- // Set the sizes of the child to be either the size of the control or it's minimum size
- if (theMinSize.x > theChildSize.x)
- theChildSize.x = theMinSize.x;
- if (theMinSize.y > theChildSize.y)
- theChildSize.y = theMinSize.y;
-
- theChild->SetSize(theChildSize);
- }
-}
-
-//=============================================================================
-/**
- * Check to see is the vertical bar should be visible or not.
- * @return true if the vertical bar should be visible.
- */
-bool CScroller::IsVerticalVisible()
-{
- if (m_VerticalScrollMode != NEVER) {
- if (m_VerticalScrollMode == ALWAYS || IsVerticalScrolling()) {
- return true;
- }
- }
- return false;
-}
-
-//=============================================================================
-/**
- * Check to see if the horizontal bar should be visible or not.
- * @return true if the horizontal bar should be visible.
- */
-bool CScroller::IsHorizontalVisible()
-{
- if (m_HorizontalScrollMode != NEVER) {
- if (m_HorizontalScrollMode == ALWAYS || IsHorizontalScrolling()) {
- return true;
- }
- }
- return false;
-}
-
-//=============================================================================
-/**
- * Checks to see if the client view should be scrolled vertically or not.
- * This does not mean that the scroll bar is visible or not, just that the client
- * view can be scrolled vertically.
- * @return true if the client min height larger than this height.
- */
-bool CScroller::IsVerticalScrolling()
-{
- CControl *theChild = GetControl();
- if (theChild != nullptr) {
- CPt mySize = GetSize();
- if (m_HorizontalScrollMode == ALWAYS)
- mySize.y -= m_HorizontalBar->GetSize().y;
-
- CPt theChildSize = theChild->GetMinimumSize();
-
- if (theChildSize.y > mySize.y)
- return true;
- }
- return false;
-}
-
-//=============================================================================
-/**
- * Checks to see if the client view should be scrolled horizontally or not.
- * This does not mean that the scroll bar is visible or not, just that the
- * client view can be scrolled horizontally.
- * @return true if the client min width is larget than this width.
- */
-bool CScroller::IsHorizontalScrolling()
-{
- CControl *theChild = GetControl();
- if (theChild != nullptr) {
- CPt mySize = GetSize();
- if (m_VerticalScrollMode == ALWAYS)
- mySize.x -= m_VerticalBar->GetSize().x;
-
- CPt theChildSize = theChild->GetMinimumSize();
-
- if (theChildSize.x > mySize.x)
- return true;
- }
- return false;
-}
-
-//=============================================================================
-/**
- * Get the child control that this is wrapping.
- * @return the child control, or nullptr if there is not one.
- */
-CControl *CScroller::GetControl()
-{
- if (GetChildCount() > 2)
- return GetChildren().GetCurrent()->GetControl();
- return nullptr;
-}
-
-//=============================================================================
-/**
- * Get the size of this control that the Client is actually visible in.
- * This is not the size of the client, but the size of the area that the client
- * is being drawn to.
- * @return the visible area of the child control.
- */
-CPt CScroller::GetVisibleSize()
-{
- return m_VisibleSize;
-}
-
-//=============================================================================
-/**
- * Get the size of the actual child control.
- * This is the total size of the child, and is always at least the size of
- * the visible size.
- * @return the size of the child control.
- */
-CPt CScroller::GetContaineeSize()
-{
- QT3DS_PROFILE(GetContaineeSize);
-
- CControl *theControl = GetControl();
- CPt theSize;
- if (theControl != nullptr)
- theSize = theControl->GetSize();
- else
- theSize = GetSize();
-
- return theSize;
-}
-
-//=============================================================================
-/**
- * Get the offset of the child control inside of this control.
- * @return the offset location of the child.
- */
-CPt CScroller::GetVisiblePosition()
-{
- return m_VisiblePosition;
-}
-
-//=============================================================================
-/**
- * Set the visible position of the child control.
- * @param inVisiblePosition the visible position of the child control.
- */
-void CScroller::SetVisiblePosition(CPt inVisiblePosition)
-{
- if (inVisiblePosition.x < 0)
- inVisiblePosition.x = 0;
-
- if (inVisiblePosition.y < 0)
- inVisiblePosition.y = 0;
-
- CPt theMaxVisiblePosition = GetMaxVisiblePosition();
-
- if (inVisiblePosition.x > theMaxVisiblePosition.x)
- inVisiblePosition.x = theMaxVisiblePosition.x;
-
- if (inVisiblePosition.y > theMaxVisiblePosition.y)
- inVisiblePosition.y = theMaxVisiblePosition.y;
-
- if (inVisiblePosition != m_VisiblePosition) {
- CPt theScrolledAmount = m_VisiblePosition - inVisiblePosition;
- m_ScrolledAmount += theScrolledAmount;
-
- m_VisiblePosition = inVisiblePosition;
-
- if (IsVerticalScrolling())
- m_VerticalBar->RepositionThumb();
- if (IsHorizontalScrolling())
- m_HorizontalBar->RepositionThumb();
-
- m_ScrollListeners.FireEvent(&CScrollListener::OnScroll, this, theScrolledAmount);
- }
-
- CControl *theChild = GetControl();
- if (theChild != nullptr) {
- theChild->SetPosition(-m_VisiblePosition);
- }
-}
-
-//=============================================================================
-/**
- * Get the maximum allowable offset of the child control.
- * This is where the child would be offset to if the scroll bars were at their
- * far ends.
- * @return the maximum visible position allowed.
- */
-CPt CScroller::GetMaxVisiblePosition()
-{
- CPt theMaxPoint(0, 0);
- CPt mySize = GetSize();
- CControl *theChild = GetControl();
-
- mySize.x -= IsVerticalVisible() ? m_VerticalBar->GetSize().x : 0;
- mySize.y -= IsHorizontalVisible() ? m_HorizontalBar->GetSize().y : 0;
-
- if (theChild != nullptr) {
- CPt theChildSize = theChild->GetSize();
-
- if (theChildSize.x > mySize.x)
- theMaxPoint.x = theChildSize.x - mySize.x;
-
- if (theChildSize.y > mySize.y)
- theMaxPoint.y = theChildSize.y - mySize.y;
- }
-
- return theMaxPoint;
-}
-
-void CScroller::OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation)
-{
- QT3DS_PROFILE(OnDraw);
-
- CRct theDirtyRect;
- bool isInvalidated = IsInvalidated();
-
- if (isInvalidated || inIgnoreValidation || m_VerticalBar->IsChildInvalidated()
- || m_HorizontalBar->IsChildInvalidated()) {
- if (isInvalidated || inIgnoreValidation)
- DrawBackground(inRenderer);
- Draw(inRenderer);
- theDirtyRect.Or(CRct(GetSize()));
- }
-
- CControl *theChild = GetControl();
- if (theChild != nullptr) {
- // Create an off screen buffer to draw the child to, this makes it so the child will draw
- // it's
- // entire self to the offscreen section, then we'll only draw the visible part to the actual
- // renderer
- CRct theClippingRect = m_VisibleSize;
- if (m_AddtlClippingRect.size.x != 0 && m_AddtlClippingRect.size.y != 0)
- theClippingRect.And(m_AddtlClippingRect);
-
- inRenderer->PushClippingRect(theClippingRect);
- inRenderer->PushTranslation(-m_VisiblePosition);
- theChild->OnDraw(inRenderer, theDirtyRect, isInvalidated || inIgnoreValidation);
- inRenderer->PopTranslation();
- inRenderer->PopClippingRect();
-
- m_ScrolledAmount = CPt(0, 0);
- }
-
- Invalidate(false);
-
- CRct theBoundingBox = inRenderer->GetClippingRect();
- theDirtyRect.And(theBoundingBox);
- theDirtyRect.Offset(inRenderer->GetTranslation());
- inDirtyRect.Or(theDirtyRect);
-}
-
-//=============================================================================
-/**
- * Overrides CControl::Draw to handle custom child buffering.
- * This just allows the child to be drawn offset without actually letting it
- * know that it's offset.
- * @param inRenderer the renderer to draw to.
- */
-void CScroller::Draw(CRenderer *inRenderer)
-{
- QT3DS_PROFILE(Draw);
-
- CRct theDirtyRct;
- // Only draw the side bar if it's visible
- if (m_VerticalBar->IsVisible()) {
- inRenderer->PushTranslation(m_VerticalBar->GetPosition());
- m_VerticalBar->OnDraw(inRenderer, theDirtyRct, true);
- inRenderer->PopTranslation();
- }
-
- // only draw the bottom bar if it's visible
- if (m_HorizontalBar->IsVisible()) {
- inRenderer->PushTranslation(m_HorizontalBar->GetPosition());
- m_HorizontalBar->OnDraw(inRenderer, theDirtyRct, true);
- inRenderer->PopTranslation();
- }
-}
-
-//=============================================================================
-/**
- * Gets the horizontal scroll bar of this scroller.
- * @return the horizontal scroll bar of this scroller.
- */
-CScrollerBar *CScroller::GetHorizontalBar()
-{
- return m_HorizontalBar;
-}
-
-//=============================================================================
-/**
- * Gets the vertical scroll bar of this scroller.
- * @return the vertical scroll bar of this scroller.
- */
-CScrollerBar *CScroller::GetVerticalBar()
-{
- return m_VerticalBar;
-}
-
-//=============================================================================
-/**
- * Sets the vertical scroll mode of this scroller.
- * This controls when the scroll bars will be visible and when thes will not be
- * visible.
- * @param inScrollMode the vertical scroll mode.
- */
-void CScroller::SetVerticalScrollMode(EScrollMode inScrollMode)
-{
- m_VerticalScrollMode = inScrollMode;
-}
-
-//=============================================================================
-/**
- * Gets the vertical scroll mode of this scroller.
- * This controls when the scroll bars will be visible and when they will not be
- * visible.
- * @return the vertical scroll mode.
- */
-CScroller::EScrollMode CScroller::GetVerticalScrollMode()
-{
- return m_VerticalScrollMode;
-}
-
-//=============================================================================
-/**
- * Sets the horizontal scroll mode of this scroller.
- * This controls when the scroll bars will be visible and when they will not be
- * visible.
- * @param inScrollMode the vertical scroll mode.
- */
-void CScroller::SetHorizontalScrollMode(EScrollMode inScrollMode)
-{
- m_HorizontalScrollMode = inScrollMode;
-}
-
-//=============================================================================
-/**
- * Gets the horizontal scroll mode of this scroller.
- * This controls when the scroll bars will be visible and when they will not be
- * visible.
- * @return the horizontal scroll mode.
- */
-CScroller::EScrollMode CScroller::GetHorizontalScrollMode()
-{
- return m_HorizontalScrollMode;
-}
-
-void CScroller::OnChildSizeChanged(CControl *inControl)
-{
- QT3DS_PROFILE(OnChildSizeChanged);
-
- CControl *theChild = GetControl();
-
- if (inControl == theChild) {
- CPt theChildSize = theChild->GetSize();
- CPt theMinSize = GetVisibleSize();
- if (theChildSize.x < theMinSize.x) {
- theChild->SetMinimumSize(CPt(theMinSize.x, theChild->GetMinimumSize().y));
- theChildSize.x = theMinSize.x;
- }
- if (theChildSize.y < theMinSize.y) {
- theChild->SetMinimumSize(CPt(theChild->GetMinimumSize().x, theMinSize.y));
- theChildSize.y = theMinSize.y;
- }
-
- if (theChildSize != theChild->GetSize())
- theChild->SetSize(theChildSize);
- else if (!m_ResizingChildren) {
- RecalcLayout();
- Invalidate();
- }
- }
-}
-
-//=============================================================================
-/**
- * Add a listener to get notified when this control scrolls.
- * @param inListener the listener to be notified when this scrolls.
- */
-void CScroller::AddScrollListener(CScrollListener *inListener)
-{
- m_ScrollListeners.AddListener(inListener);
-}
-
-//=============================================================================
-/**
- * Remove a listener from the list of listeners to be notified when this scrolls.
- * @param inListener the listener to be removed from the list of listeners.
- */
-void CScroller::RemoveScrollListener(CScrollListener *inListener)
-{
- m_ScrollListeners.RemoveListener(inListener);
-}
-
-void CScroller::SetAdditionalClippingRect(CRct inAddtlClippingRect)
-{
- m_AddtlClippingRect = inAddtlClippingRect;
-}
-
-bool CScroller::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CPt theVertPoint = inPoint - m_VerticalBar->GetPosition();
- if (!m_VerticalBar->HitTest(inPoint) && !m_HorizontalBar->HitTest(inPoint)) {
- m_IsMouseDown = true;
- }
-
- return CControl::OnMouseDown(inPoint, inFlags);
-}
-
-void CScroller::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (m_IsMouseDown) {
- m_CurrentTickTock = std::shared_ptr<qt3dsdm::ISignalConnection>();
-
- CPt theOffset;
- if ((inPoint.x < 0))
- theOffset.x = inPoint.x;
- else if (inPoint.x > m_VisibleSize.x)
- theOffset.x = inPoint.x - m_VisibleSize.x;
-
- // if ( ( inPoint.y < 0 && inPoint.y < m_PrevMousePoint.y ) || ( inPoint.y >
- //m_VisibleSize.y && inPoint.y > m_PrevMousePoint.y ) )
- // theOffset.y = inPoint.y - m_PrevMousePoint.y;
-
- SetVisiblePosition(m_VisiblePosition + theOffset);
-
- if (theOffset.x != 0) {
- m_ScrollingDir = theOffset;
- m_MousePos = inPoint;
- m_MouseFlags = inFlags;
- m_CurrentTickTock = ITickTock::GetInstance().AddTimer(
- m_DelayTime, true, std::bind(&CScroller::OnTimer, this),
- "CScroller::OnMouseMove::" + GetName());
- // OnTimer( );
- }
- }
-
- CControl::OnMouseMove(inPoint, inFlags);
-}
-
-void CScroller::OnTimer()
-{
- CPt theOffset;
- const auto theBeginCurrentTime = QDateTime::currentMSecsSinceEpoch();
- if (m_ScrollingDir.x > 0)
- theOffset.x = m_OffsetAmmount;
- else if (m_ScrollingDir.x < 0)
- theOffset.x = -m_OffsetAmmount;
-
- SetVisiblePosition(m_VisiblePosition + theOffset);
- CControl::OnMouseMove(m_MousePos, m_MouseFlags);
- const auto theEndCurrentTime = QDateTime::currentMSecsSinceEpoch();
- AdjustDelayTimeAccordingToOnTimerTime(theEndCurrentTime - theBeginCurrentTime);
-}
-
-//=============================================================================
-/**
- * This function will adjust the delay time of the auto scroller depending on how long the timer
- * took
- * the numbers in here are pretty arbitrary and this should be redone at some point.
- * @param inTime the amount of time that the timer took
- */
-void CScroller::AdjustDelayTimeAccordingToOnTimerTime(unsigned long inTime)
-{
- for (long theIndex = 2; theIndex < 6; theIndex++) {
- if ((inTime)*theIndex > m_DelayTime) {
- m_DelayTime = static_cast<unsigned long>(m_DelayTime * 10 / theIndex);
- m_OffsetAmmount = static_cast<unsigned long>(m_OffsetAmmount * 10 / theIndex);
- m_CurrentTickTock = ITickTock::GetInstance().AddTimer(
- m_DelayTime, true, std::bind(&CScroller::OnTimer, this),
- "CScroller::AdjustDelayTimeAccordingToOnTimerTime");
- break;
- }
- }
-}
-
-void CScroller::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_IsMouseDown = false;
-
- CControl::OnMouseUp(inPoint, inFlags);
-
- m_CurrentTickTock = std::shared_ptr<qt3dsdm::ISignalConnection>();
-}
-
-void CScroller::OnLoseFocus()
-{
- m_IsMouseDown = false;
- m_CurrentTickTock = std::shared_ptr<qt3dsdm::ISignalConnection>();
- CControl::OnLoseFocus();
-}
-
-//=============================================================================
-/**
- * Handles mouse wheel messages to scroll the view.
- */
-bool CScroller::OnMouseWheel(CPt inPoint, long inScrollAmount, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseWheel(inPoint, inScrollAmount, inFlags)) {
- if (inScrollAmount < 0)
- SetVisiblePosition(CPt(GetVisiblePosition().x, GetVisiblePosition().y + 60));
- else
- SetVisiblePosition(CPt(GetVisiblePosition().x, GetVisiblePosition().y - 60));
- }
- return true;
-}
-
-//=============================================================================
-/**
- * Handles messages from children to scroll the view to appropriate loc.
- */
-void CScroller::EnsureVisible(CRct inRect)
-{
- CControl *theChild = GetControl();
- inRect.position -= theChild->GetPosition();
-
- CPt theVisSize = GetVisibleSize();
- CPt theVisPos = GetVisiblePosition();
-
- // Check to see if the top is off the top.
- if (inRect.position.y < theVisPos.y)
- theVisPos.y = inRect.position.y;
- // Check to see if the bottom is off the bottom.
- else if (inRect.position.y + inRect.size.y > theVisPos.y + theVisSize.y)
- theVisPos.y = inRect.position.y + inRect.size.y - theVisSize.y;
-
- SetVisiblePosition(theVisPos);
-}
diff --git a/src/Authoring/Studio/Controls/Scroller.h b/src/Authoring/Studio/Controls/Scroller.h
deleted file mode 100644
index 01e16597..00000000
--- a/src/Authoring/Studio/Controls/Scroller.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_SCROLLER_H
-#define INCLUDED_SCROLLER_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "ScrollerBar.h"
-#include "FlowLayout.h"
-#include "GenericFunctor.h"
-#include "Multicaster.h"
-#include "ITickTock.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CButtonControl;
-
-GENERIC_FUNCTOR_2(CScrollListener, OnScroll, CScroller *, CPt);
-
-class IScroller
-{
-protected:
- virtual ~IScroller() {}
-public:
- virtual void SetVisiblePosition(CPt inVisiblePosition) = 0;
- virtual CPt GetVisiblePosition() = 0;
-};
-
-//=============================================================================
-/**
- * Class for creating a scroller.
- */
-class CScroller : public CControl, public IScroller
-{
-public:
- enum EScrollMode {
- NEVER,
- AS_NEEDED,
- ALWAYS,
- };
-
- CScroller(bool inCreateImmediately = true);
- virtual ~CScroller();
-
- void Initialize();
-
- void OnDraw(CRenderer *inRenderer, CRct &inDirtyRect,
- bool inIgnoreValidation /* = false */) override;
- virtual void DrawBackground(CRenderer *) {}
- void Draw(CRenderer *inRenderer) override;
-
- void SetSize(CPt inSize) override;
- void SetLayout(CPt inSize, CPt inPosition) override;
- CPt GetMinimumSize() override;
- CPt GetMaximumSize() override;
-
- void AddChild(CControl *inControl, CControl *inInsertBefore = nullptr) override;
-
- CPt GetVisibleSize();
- CPt GetContaineeSize();
-
- CPt GetVisiblePosition() override;
- void SetVisiblePosition(CPt inVisiblePosition) override;
- CPt GetMaxVisiblePosition();
-
- CScrollerBar *GetHorizontalBar();
- CScrollerBar *GetVerticalBar();
-
- void SetVerticalScrollMode(EScrollMode inScrollMode);
- EScrollMode GetVerticalScrollMode();
-
- void SetHorizontalScrollMode(EScrollMode inScrollMode);
- EScrollMode GetHorizontalScrollMode();
-
- virtual void RecalcLayout();
- void OnChildSizeChanged(CControl *inChild) override;
-
- void AddScrollListener(CScrollListener *inScrollListener);
- void RemoveScrollListener(CScrollListener *inScrollListener);
-
- void SetAdditionalClippingRect(CRct inClippingRect);
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseWheel(CPt inPoint, long inScrollAmount, Qt::KeyboardModifiers inFlags) override;
- void EnsureVisible(CRct inRect) override;
-
- virtual void OnTimer();
- void OnLoseFocus() override;
- void AdjustDelayTimeAccordingToOnTimerTime(unsigned long inTime);
-
-protected:
- void OnSizeChanged(CPt inSize) override;
- virtual bool IsVerticalVisible();
- virtual bool IsHorizontalVisible();
- virtual bool IsVerticalScrolling();
- virtual bool IsHorizontalScrolling();
-
- virtual CScrollerBar *CreateVerticalBar();
- virtual CScrollerBar *CreateHorizontalBar();
-
- virtual void SetVisibleSize(CPt inSize);
-
- virtual CControl *GetControl();
-
- CScrollerBar *m_VerticalBar;
- CScrollerBar *m_HorizontalBar;
-
- CPt m_VisibleSize;
- CPt m_VisiblePosition;
- CPt m_MaxVisiblePosition;
-
- CPt m_ScrolledAmount;
- CPt m_ChildOffset;
-
- CRct m_AddtlClippingRect;
- CPt m_ScrollingDir;
- CPt m_MousePos;
- Qt::KeyboardModifiers m_MouseFlags;
-
- EScrollMode m_VerticalScrollMode;
- EScrollMode m_HorizontalScrollMode;
-
- bool m_ResizingChildren;
-
- CMulticaster<CScrollListener *> m_ScrollListeners;
-
- bool m_IsMouseDown;
- CPt m_PrevMousePoint;
-
- long m_OffsetAmmount;
- unsigned long m_DelayTime;
- std::shared_ptr<qt3dsdm::ISignalConnection> m_CurrentTickTock;
-};
-#endif // INCLUDED_SCROLLER_H
diff --git a/src/Authoring/Studio/Controls/ScrollerBackground.cpp b/src/Authoring/Studio/Controls/ScrollerBackground.cpp
deleted file mode 100644
index 75c4331d..00000000
--- a/src/Authoring/Studio/Controls/ScrollerBackground.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ScrollerBackground.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "Scroller.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CScrollerBackground::CScrollerBackground(CColor inColor)
- : CBlankControl(inColor)
-{
- m_Orientation = CScrollerBar::HORIZONTAL;
- m_ScrollerBar = nullptr;
- m_Control = this;
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CScrollerBackground::~CScrollerBackground()
-{
-}
-
-//=============================================================================
-/**
- * Overrides CBlankControl::Draw to handle scroller-specific drawing.
- */
-void CScrollerBackground::Draw(CRenderer *inRenderer)
-{
- CBlankControl::Draw(inRenderer);
-}
-
-//=============================================================================
-/**
- * Handles mouse down events. Scrolls the thumb to the clicked position.
- * @param inPoint location of the mouse click
- * @param inFlags mouse event flags
- */
-bool CScrollerBackground::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theHandledFlag = CBlankControl::OnMouseDown(inPoint, inFlags);
-
- if (!theHandledFlag && m_ScrollerBar) {
- CPt theThumbPosition = m_ScrollerBar->GetThumb()->GetPosition();
- bool theScrollForwardFlag = false;
-
- if (CScrollerBar::HORIZONTAL == m_Orientation) {
- if (inPoint.x > theThumbPosition.x)
- theScrollForwardFlag = true;
- } else {
- if (inPoint.y > theThumbPosition.y)
- theScrollForwardFlag = true;
- }
-
- m_MousePos = inPoint;
-
- if (theScrollForwardFlag)
- OnScrollForward(this);
- else
- OnScrollBackward(this);
-
- theHandledFlag = true;
- }
-
- return theHandledFlag;
-}
-
-//=============================================================================
-/**
- * Handles mouse up events
- */
-void CScrollerBackground::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CBlankControl::OnMouseUp(inPoint, inFlags);
-
- OnCancelScrolling();
-}
-
-//=============================================================================
-/**
- * Returns the amount to scroll
- */
-long CScrollerBackground::DetermineScrollAmount()
-{
- long theDistance = 0;
- CPt theThumbPosition = m_ScrollerBar->GetThumb()->GetPosition();
- CPt theThumbSize = m_ScrollerBar->GetThumb()->GetSize();
-
- if (CScrollerBar::VERTICAL == m_Orientation) {
- if ((m_ScrollingForward && (m_MousePos.y > theThumbPosition.y + theThumbSize.y))
- || (m_ScrollingBackward && (m_MousePos.y < theThumbPosition.y))) {
- theDistance = theThumbSize.y;
- }
- } else // HORIZONTAL
- {
- if ((m_ScrollingForward && (m_MousePos.x > theThumbPosition.x + theThumbSize.x))
- || (m_ScrollingBackward && (m_MousePos.x < theThumbPosition.x))) {
- theDistance = theThumbSize.x;
- }
- }
-
- return theDistance;
-}
-
-//=============================================================================
-/**
- * Overwrite the MouseMove function. We want to take care of the scenario where
- * it is in a scrolling state, then determine whether to scroll forwards or backwards
- * depending on the mouse position relative to the scroller thumb.
- */
-void CScrollerBackground::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Call the default mouseMove function
- CControl::OnMouseMove(inPoint, inFlags);
-
- // We only want to do stuff if it is currently scrolling
- if (m_ScrollingForward || m_ScrollingBackward) {
- // save the mouse position
- m_MousePos = inPoint;
-
- CPt theThumbPosition = m_ScrollerBar->GetThumb()->GetPosition();
- CPt theThumbSize = m_ScrollerBar->GetThumb()->GetSize();
-
- if (CScrollerBar::VERTICAL == m_Orientation) {
- if (m_MousePos.y > (theThumbPosition.y + theThumbSize.y)) {
- m_ScrollingForward = true;
- m_ScrollingBackward = false;
- } else {
- m_ScrollingForward = false;
- m_ScrollingBackward = true;
- }
- } else // HORIZONTAL
- {
- if (m_MousePos.x > (theThumbPosition.x + theThumbSize.x)) {
- m_ScrollingForward = true;
- m_ScrollingBackward = false;
- } else {
- m_ScrollingForward = false;
- m_ScrollingBackward = true;
- }
- }
- }
-}
diff --git a/src/Authoring/Studio/Controls/ScrollerBackground.h b/src/Authoring/Studio/Controls/ScrollerBackground.h
deleted file mode 100644
index 885d1c88..00000000
--- a/src/Authoring/Studio/Controls/ScrollerBackground.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_SCROLLER_BACKGROUND_H
-#define INCLUDED_SCROLLER_BACKGROUND_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BlankControl.h"
-#include "StudioPreferences.h"
-#include "ScrollerBar.h"
-#include "ScrollController.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//=============================================================================
-/**
- * Extends the blank control to draw items specific to the scroller control.
- */
-class CScrollerBackground : public CBlankControl, public CScrollController
-{
-protected:
- CPt m_MousePos;
-
-public:
- CScrollerBackground(CColor inColor = CStudioPreferences::GetScrollBGColor());
- virtual ~CScrollerBackground();
- virtual void Draw(CRenderer *inRenderer);
- virtual bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags);
- virtual void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags);
- virtual void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags);
-
-protected:
- virtual long DetermineScrollAmount();
-};
-
-#endif // INCLUDED_SCROLLER_BACKGROUND_H \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/ScrollerBar.cpp b/src/Authoring/Studio/Controls/ScrollerBar.cpp
deleted file mode 100644
index d333cdd7..00000000
--- a/src/Authoring/Studio/Controls/ScrollerBar.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ScrollerBar.h"
-#include "Scroller.h"
-#include "Renderer.h"
-#include "ButtonControl.h"
-#include "CoreUtils.h"
-#include "ScrollerBackground.h"
-#include "ScrollerThumb.h"
-#include "StudioPreferences.h"
-#include "Renderer.h"
-#include "SystemPreferences.h"
-#include "StudioUtils.h"
-#include "ScrollerButtonControl.h"
-#include "MasterP.h"
-
-//==============================================================================
-// Static variables
-//==============================================================================
-const long CScrollerBar::DEFAULT_WIDTH = 6;
-const CColor CScrollerBar::DEFAULT_COLOR = CColor(196, 194, 189);
-const CColor CScrollerBar::SCROLLER_TOP = CColor(165, 162, 161);
-
-IMPLEMENT_OBJECT_COUNTER(CScrollerBar)
-
-//=============================================================================
-/**
- * Constructor
- * @param inScroller the scroller on which this is operating.
- * @param inCreateImmediately false for lazy construction, only for subclasses.
- */
-CScrollerBar::CScrollerBar(CScroller *inScroller, bool inCreateImmediately /* = true */)
-{
- ADDTO_OBJECT_COUNTER(CScrollerBar)
-
- m_Scroller = inScroller;
- SetFlowDirection(FLOW_HORIZONTAL);
-
- if (inCreateImmediately)
- Initialize();
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CScrollerBar::~CScrollerBar()
-{
- REMOVEFROM_OBJECT_COUNTER(CScrollerBar)
-}
-
-//=============================================================================
-/**
- * Initialize this scroller bar.
- * This is used for lazy construction of this object by subclasses. If a subclass
- * specifies lazy construction in the constructor of this class then it must call
- * this to put it into a valid state.
- */
-void CScrollerBar::Initialize()
-{
- m_ScrollerThumb = CreateThumb();
-
- // First button
- m_ButtonBackward = new CScrollerButtonControl(this, CScrollerButtonControl::BACKWARD);
-
- // Background
- m_Background = new CScrollerBackground(CStudioPreferences::GetScrollBGColor());
- m_Background->SetScrollerBar(this);
- m_Background->AddChild(m_ScrollerThumb);
-
- m_ScrollerThumb->SetPosition(CPt(0, 0));
-
- // Second button (either right or bottom)
- m_ButtonForward = new CScrollerButtonControl(this, CScrollerButtonControl::FORWARD);
-
- // Determine the placement of the scroll bar arrows based on the system preference
- if (CSystemPreferences::AreScrollArrowsAdjacent()) {
- // Scroll arrows go together at one end of the bar
- AddChild(m_Background);
- AddChild(m_ButtonBackward);
- AddChild(m_ButtonForward);
- } else {
- // Scroll arrows go on each end of the scroll bar
- AddChild(m_ButtonBackward);
- AddChild(m_Background);
- AddChild(m_ButtonForward);
- }
-}
-
-//=============================================================================
-/**
- * Virtual class to create the thumb class.
- * This is used to allow sub-classes to specialize the scroller thumb that they
- * are using.
- * @return the thumb that was created.
- */
-CControl *CScrollerBar::CreateThumb()
-{
- return new CScrollerThumb(this);
-}
-
-//=============================================================================
-/**
- * Set the orientation of this scroller bar.
- * This determines which way this is scrolling.
- */
-void CScrollerBar::SetOrientation(EOrientation inOrientation)
-{
- m_Orientation = inOrientation;
- m_Background->SetOrientation(inOrientation);
-
- if (m_Orientation == VERTICAL)
- SetFlowDirection(FLOW_VERTICAL);
- else
- SetFlowDirection(FLOW_HORIZONTAL);
-}
-
-//=============================================================================
-/**
- * Get the orientation of this scroller bar.
- */
-CScrollerBar::EOrientation CScrollerBar::GetOrientation()
-{
- return m_Orientation;
-}
-
-//=============================================================================
-/**
- * Get the minimum size of this scroller bar.
- * The minumum size is the width or height of both of it's buttons (depending
- * on orientation.
- * @return the minimum allowable size of this bar.
- */
-CPt CScrollerBar::GetMinimumSize()
-{
- if (GetOrientation() == VERTICAL) {
- return CPt(DEFAULT_WIDTH, DEFAULT_WIDTH * 2);
- } else {
- return CPt(DEFAULT_WIDTH * 2, DEFAULT_WIDTH);
- }
-}
-
-//=============================================================================
-/**
- * Set the size of this scroller bar.
- */
-void CScrollerBar::SetSize(CPt inSize)
-{
- CFlowLayout::SetSize(inSize);
-
- RepositionThumb();
-}
-
-//=============================================================================
-/**
- * Recalculate the size and position of the thumb control.
- */
-void CScrollerBar::RepositionThumb()
-{
- long theBarLen;
-
- if (GetOrientation() == VERTICAL) {
- float thePercentage =
- (float)m_Scroller->GetVisibleSize().y / (float)m_Scroller->GetContaineeSize().y;
- theBarLen = (long)(thePercentage * ((float)m_Background->GetSize().y));
-
- if (theBarLen < CScrollerThumb::MIN_LENGTH)
- theBarLen = CScrollerThumb::MIN_LENGTH;
-
- CPt theSize(GetMinimumSize().x, theBarLen);
-
- m_ScrollerThumb->SetSize(theSize);
-
- float theVisPosY = (float)(m_Scroller->GetVisiblePosition().y);
- float theMaxPosY = (float)(m_Scroller->GetMaxVisiblePosition().y);
- long thePosY = 0;
- if (theMaxPosY != 0)
- thePosY = ::dtol((theVisPosY / theMaxPosY)
- * (m_Background->GetSize().y - m_ScrollerThumb->GetSize().y));
-
- m_ScrollerThumb->SetPosition(CPt(0, thePosY));
- } else {
- float thePercentage =
- (float)m_Scroller->GetVisibleSize().x / (float)m_Scroller->GetContaineeSize().x;
- theBarLen = ::dtol(thePercentage * ((float)m_Background->GetSize().x));
- if (theBarLen < CScrollerThumb::MIN_LENGTH)
- theBarLen = CScrollerThumb::MIN_LENGTH;
-
- CPt theSize(theBarLen, GetMinimumSize().y);
-
- m_ScrollerThumb->SetSize(theSize);
-
- float theVisPosX = (float)(m_Scroller->GetVisiblePosition().x);
- float theMaxPosX = (float)(m_Scroller->GetMaxVisiblePosition().x);
- long thePosX = 0;
- if (theMaxPosX != 0)
- thePosX = ::dtol((theVisPosX / theMaxPosX)
- * (m_Background->GetSize().x - m_ScrollerThumb->GetSize().x));
-
- m_ScrollerThumb->SetPosition(CPt(thePosX, 0));
- }
-
- Invalidate();
-}
-
-IScroller *CScrollerBar::GetScroller()
-{
- return m_Scroller;
-};
-
-//=============================================================================
-/**
- * Called by the ScrollerThumb to reposition itself.
- * This is used to reposition the thumb, the positions here are used to derive
- * the position of the visible window, so that this provides absolute positioning
- * of the thumb.
- * @param inPosition the new position of the thumb.
- */
-void CScrollerBar::SetBarPosition(long inPosition)
-{
- long theAvailableSpace;
- if (GetOrientation() == HORIZONTAL) {
- theAvailableSpace = m_Background->GetSize().x - m_ScrollerThumb->GetSize().x;
- } else {
- theAvailableSpace = m_Background->GetSize().y - m_ScrollerThumb->GetSize().y;
- }
-
- if (inPosition > theAvailableSpace)
- inPosition = theAvailableSpace;
- if (inPosition < 0)
- inPosition = 0;
-
- CPt theVisPos = m_Scroller->GetVisiblePosition();
- if (GetOrientation() == HORIZONTAL) {
- m_ScrollerThumb->SetPosition(CPt(inPosition, 0));
- double theMaxPosX = (double)(m_Scroller->GetMaxVisiblePosition().x);
- double theScrollDiff = (double)(m_Background->GetSize().x - m_ScrollerThumb->GetSize().x);
- theVisPos.x = ::dtol((double)inPosition / theScrollDiff * theMaxPosX);
- } else {
- m_ScrollerThumb->SetPosition(CPt(0, inPosition));
- double theMaxPosY = (double)(m_Scroller->GetMaxVisiblePosition().y);
- double theScrollDiff = (double)(m_Background->GetSize().y - m_ScrollerThumb->GetSize().y);
- theVisPos.y = ::dtol((double)inPosition / theScrollDiff * theMaxPosY);
- }
- m_Scroller->SetVisiblePosition(theVisPos);
-
- RepositionThumb();
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Get the current position of the thumb.
- * @return the current position of the thumb.
- */
-long CScrollerBar::GetBarPosition()
-{
- if (GetOrientation() == HORIZONTAL)
- return m_ScrollerThumb->GetPosition().x;
- else
- return m_ScrollerThumb->GetPosition().y;
-}
-
-//=============================================================================
-/**
- * Get the ScrollerThumb.
- * @return the scroller thumb.
- */
-CControl *CScrollerBar::GetThumb()
-{
- return m_ScrollerThumb;
-}
-
-//=============================================================================
-/**
- * Get the background of the thumb.
- * @return the background of the thumb.
- */
-CControl *CScrollerBar::GetThumbBackground()
-{
- return m_Background;
-}
diff --git a/src/Authoring/Studio/Controls/ScrollerBar.h b/src/Authoring/Studio/Controls/ScrollerBar.h
deleted file mode 100644
index 3a8527ef..00000000
--- a/src/Authoring/Studio/Controls/ScrollerBar.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_SCROLLER_BAR_H
-#define INCLUDED_SCROLLER_BAR_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "Control.h"
-#include "FlowLayout.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-class CScroller;
-class CScrollerBar;
-class CScrollerBackground;
-class CRenderer;
-class CScrollerButtonControl;
-
-class IScroller;
-
-class IScrollerBar
-{
-protected:
- virtual ~IScrollerBar() {}
-public:
- enum EOrientation {
- VERTICAL,
- HORIZONTAL,
- };
- virtual EOrientation GetOrientation() = 0;
- virtual void RepositionThumb() = 0;
- virtual IScroller *GetScroller() = 0;
- virtual void SetBarPosition(long inPosition) = 0;
- virtual long GetBarPosition() = 0;
- virtual CControl *GetThumb() = 0;
-};
-
-//=============================================================================
-/**
- * Class for creating a scrollerbar (contains a CScrollerThumb).
- */
-class CScrollerBar : public CFlowLayout, public IScrollerBar
-{
-public:
- static const long DEFAULT_WIDTH;
- static const ::CColor DEFAULT_COLOR;
- static const ::CColor SCROLLER_TOP;
-
- CScrollerBar(CScroller *inScroller, bool inCreateImmediately = true);
- virtual ~CScrollerBar();
-
- DEFINE_OBJECT_COUNTER(CScrollerBar)
-
- void SetOrientation(EOrientation inOrientation);
- EOrientation GetOrientation() override;
-
- CPt GetMinimumSize() override;
-
- void SetScrollerThumbPosition(long inPosition);
- long GetScrollerThumbPosition();
-
- void SetSize(CPt inSize) override;
-
- void SetBarPosition(long inPosition) override;
- long GetBarPosition() override;
-
- CControl *GetThumb() override;
- virtual CControl *GetThumbBackground();
- void RepositionThumb() override;
- IScroller *GetScroller() override;
-
-protected:
- virtual CControl *CreateThumb();
- void Initialize();
- Q3DStudio::CAutoMemPtr<CScrollerButtonControl> m_ButtonBackward;
- Q3DStudio::CAutoMemPtr<CScrollerButtonControl> m_ButtonForward;
- Q3DStudio::CAutoMemPtr<CControl> m_ScrollerThumb;
- Q3DStudio::CAutoMemPtr<CScrollerBackground> m_Background;
-
- EOrientation m_Orientation;
- CScroller *m_Scroller;
-};
-
-#endif // INCLUDED_SCROLLER_BAR_H
diff --git a/src/Authoring/Studio/Controls/ScrollerButtonControl.cpp b/src/Authoring/Studio/Controls/ScrollerButtonControl.cpp
deleted file mode 100644
index 63b5f0ac..00000000
--- a/src/Authoring/Studio/Controls/ScrollerButtonControl.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ScrollerButtonControl.h"
-#include "Scroller.h"
-
-//=============================================================================
-/**
- * Constructor
- *
- * @param inToggleButton true if this is suppose to be a toggle button. Toggle
- * buttons stay pressed when clicked on and have to be clicked again in order
- * to release. Normal buttons return to the up state when the button is released.
- */
-CScrollerButtonControl::CScrollerButtonControl(IScrollerBar *inScrollerBar, EDirection inDirection)
- : m_Direction(inDirection)
-{
- SetAbsoluteSize(CPt(CScrollerBar::DEFAULT_WIDTH, CScrollerBar::DEFAULT_WIDTH));
- SetScrollerBar(inScrollerBar);
- m_Control = this;
-
- Initialize();
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CScrollerButtonControl::~CScrollerButtonControl()
-{
-}
-
-void CScrollerButtonControl::Initialize() {
- // Add the button down listeners
- if (m_Direction == FORWARD) {
- QObject::connect(this, &CButtonControl::SigButtonDown,
- std::bind(&CScrollerButtonControl::OnScrollForward,
- static_cast<CScrollController *>(this), std::placeholders::_1));
- } else {
- QObject::connect(this, &CButtonControl::SigButtonDown,
- std::bind(&CScrollerButtonControl::OnScrollBackward,
- static_cast<CScrollController *>(this), std::placeholders::_1));
- }
- QObject::connect(this, &CButtonControl::SigClicked,
- std::bind(&CScrollerButtonControl::OnCancelScrolling,
- static_cast<CScrollController *>(this), std::placeholders::_1));
-}
-
-//=============================================================================
-/**
- * Handles mouse up on the button.
- */
-void CScrollerButtonControl::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CButtonControl::OnMouseUp(inPoint, inFlags);
-
- // If the mouse is not over this button, the base class will not fire an up event.
- // However, we want to fire this event anyway so that the timer stops (otherwise,
- // the next time you move your mouse over the button, it will start scrolling again).
- if (!IsMouseOver())
- SigButtonUp(this);
-}
diff --git a/src/Authoring/Studio/Controls/ScrollerButtonControl.h b/src/Authoring/Studio/Controls/ScrollerButtonControl.h
deleted file mode 100644
index a7763d8b..00000000
--- a/src/Authoring/Studio/Controls/ScrollerButtonControl.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#ifndef INCLUDED_SCROLLER_BUTTON_CONTROL_H
-#define INCLUDED_SCROLLER_BUTTON_CONTROL_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "ButtonControl.h"
-#include "ScrollerBar.h"
-#include "ScrollController.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-//=============================================================================
-/**
- * Subclassed button control that controls the scroller
- */
-class CScrollerButtonControl : public CButtonControl, public CScrollController
-{
-public:
- enum EDirection {
- FORWARD,
- BACKWARD,
- };
-
-protected:
- EDirection m_Direction;
-
-public:
- CScrollerButtonControl(IScrollerBar *inScrollerBar, EDirection inDirection);
- virtual ~CScrollerButtonControl();
-
- virtual void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags);
-
- EDirection GetDirection() { return m_Direction; };
-
-protected:
- void Initialize();
-};
-
-#endif // INCLUDED_SCROLLER_BUTTON_CONTROL_H
diff --git a/src/Authoring/Studio/Controls/ScrollerThumb.cpp b/src/Authoring/Studio/Controls/ScrollerThumb.cpp
deleted file mode 100644
index 8224feb7..00000000
--- a/src/Authoring/Studio/Controls/ScrollerThumb.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ScrollerThumb.h"
-#include "ScrollerBar.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-
-//==============================================================================
-// Static variables
-//==============================================================================
-const long CScrollerThumb::MIN_LENGTH = 32;
-
-//=============================================================================
-/**
- * Constructor
- * @param inScrollerBar the scroller bar this is operating on.
- */
-CScrollerThumb::CScrollerThumb(IScrollerBar *inScrollerBar)
- : m_MouseDown(false)
-{
- m_ScrollerBar = inScrollerBar;
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CScrollerThumb::~CScrollerThumb()
-{
-}
-
-//=============================================================================
-/**
- * Draw this scroller bar.
- * @param inRenderer the renderer this is to draw to.
- */
-void CScrollerThumb::Draw(CRenderer *inRenderer)
-{
- if (IsEnabled()) {
- CPt theSize = GetSize();
- CRct theRect(theSize);
-
- // Draw the thumb
- inRenderer->FillRoundedRect(theRect, CStudioPreferences::GetScrollThumbBGColor(),
- m_ScrollerBar->GetOrientation() == CScrollerBar::VERTICAL);
- }
-}
-
-//=============================================================================
-/**
- * Listener for the OnMouseDown to allow dragging.
- * Begins dragging of the control.
- */
-bool CScrollerThumb::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_MouseDown = true;
- m_MouseDownPoint = inPoint;
-
- Invalidate();
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Ends dragging of the control.
- */
-void CScrollerThumb::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
- m_MouseDown = false;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Used for dragging the control.
- */
-void CScrollerThumb::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- // Only care if the mouse is down.
- if (m_MouseDown) {
- long theBarPos = m_ScrollerBar->GetBarPosition();
-
- // Adjust the position based on which way we are being dragged.
- if (m_ScrollerBar->GetOrientation() == CScrollerBar::VERTICAL) {
- theBarPos += inPoint.y - m_MouseDownPoint.y;
- } else {
- theBarPos += inPoint.x - m_MouseDownPoint.x;
- }
-
- // Update the position.
- m_ScrollerBar->SetBarPosition(theBarPos);
- }
-}
-
-//=============================================================================
-/**
- * Get the minimum size that this scroller thumb is allowed to be.
- * @return the minimum size that this scroller thumb is allowed to be.
- */
-CPt CScrollerThumb::GetMinimumSize()
-{
- if (m_ScrollerBar->GetOrientation() == CScrollerBar::HORIZONTAL)
- return CPt(MIN_LENGTH, 0);
- else
- return CPt(0, MIN_LENGTH);
-}
diff --git a/src/Authoring/Studio/Controls/ScrollerThumb.h b/src/Authoring/Studio/Controls/ScrollerThumb.h
deleted file mode 100644
index c699c910..00000000
--- a/src/Authoring/Studio/Controls/ScrollerThumb.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_SCROLLER_THUMB_H
-#define INCLUDED_SCROLLER_THUMB_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "FlowLayout.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class IScrollerBar;
-class CRenderer;
-
-//=============================================================================
-/**
- * Class for creating the thumb portion of a scroller.
- */
-class CScrollerThumb : public CControl
-{
-public:
- static const long MIN_LENGTH;
-
- CScrollerThumb(IScrollerBar *inScroller);
- virtual ~CScrollerThumb();
-
- virtual void Draw(CRenderer *inRenderer);
-
- virtual bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags);
- virtual void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags);
- virtual void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags);
-
- virtual CPt GetMinimumSize();
-
-protected:
- IScrollerBar *m_ScrollerBar;
- bool m_MouseDown;
- CPt m_MouseDownPoint;
-};
-
-#endif // INCLUDED_SCROLLER_THUMB_H \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/SplashControl.cpp b/src/Authoring/Studio/Controls/SplashControl.cpp
deleted file mode 100644
index 178c12c7..00000000
--- a/src/Authoring/Studio/Controls/SplashControl.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "SplashControl.h"
-#include "Renderer.h"
-#include "ResourceCache.h"
-#include "StudioPreferences.h"
-#include "OffscreenRenderer.h"
-#include "StudioDefs.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CSplashControl::CSplashControl()
-{
- // Image
- m_Image = CResourceCache::GetInstance()->GetBitmap("obsolete_placeholder.png");
- SetAbsoluteSize(m_Image.rect().bottomRight());
-
- // First line of the copyright statement
- m_CopyrightLine1 = QObject::tr("Copyright %1 The Qt Company. All rights reserved.").arg(
- QString(STUDIO_COPYRIGHT_YEAR));
-
- // Second line of the copyright statement
- m_CopyrightLine2 = QObject::tr("Qt and Qt Logo are trademarks of The Qt Company");
-
- // Version text
- m_VersionInfo = QStringLiteral("Qt 3D Studio v")
- + CStudioPreferences::GetVersionString().toQString();
-
- // Calculate the number of pixels between each line of text
- COffscreenRenderer theOffscreenRenderer(CRct(0, 0, 1, 1));
- auto size = theOffscreenRenderer.GetTextSize(m_CopyrightLine1);
- m_SpaceBetweenLines = size.height();
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CSplashControl::~CSplashControl()
-{
-}
-
-//=============================================================================
-/**
- * Draws the splash screen.
- * @param inRenderer Renderer to draw to
- */
-void CSplashControl::Draw(CRenderer *inRenderer)
-{
- CRct theBounds(GetSize());
- CColor theTextColor(50, 50, 50);
- long theVertOffset = GetSize().y / 2 - 14; ///< Last line of the copyright starts here
-
- // Splash screen bitmap
- inRenderer->DrawBitmap(CPt(0, 0), m_Image);
-
- // Print the copyright text, starting at the last line and going up to the first line (just to
- // make sure that we didn't move where the text ends)
- inRenderer->DrawText(14, static_cast<float>(theVertOffset), m_VersionInfo, theBounds,
- theTextColor);
- theVertOffset -= m_SpaceBetweenLines;
- inRenderer->DrawText(14, static_cast<float>(theVertOffset), m_CopyrightLine2, theBounds,
- theTextColor);
- theVertOffset -= m_SpaceBetweenLines;
- inRenderer->DrawText(14, static_cast<float>(theVertOffset), m_CopyrightLine1, theBounds,
- theTextColor);
-}
diff --git a/src/Authoring/Studio/Controls/SplashControl.h b/src/Authoring/Studio/Controls/SplashControl.h
deleted file mode 100644
index c5d4b8eb..00000000
--- a/src/Authoring/Studio/Controls/SplashControl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_SPLASH_CONTROL_H
-#define INCLUDED_SPLASH_CONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-
-#include <QtGui/qpixmap.h>
-
-//=============================================================================
-/**
- * Class responsible for drawing contents of a splash screen at program start-up.
- */
-class CSplashControl : public CControl
-{
-public:
- CSplashControl();
- virtual ~CSplashControl();
-
- void Draw(CRenderer *inRenderer) override;
-
-protected:
- QPixmap m_Image;
- QString m_CopyrightLine1;
- QString m_CopyrightLine2;
- QString m_VersionInfo;
- long m_SpaceBetweenLines; ///< number of pixels between subsequent lines of the copyright
- ///statement (calculated automatically)
-};
-
-#endif // INCLUDED_SPLASH_CONTROL_H
diff --git a/src/Authoring/Studio/Controls/SplitBar.cpp b/src/Authoring/Studio/Controls/SplitBar.cpp
deleted file mode 100644
index 8ef2b850..00000000
--- a/src/Authoring/Studio/Controls/SplitBar.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//=============================================================================
-// Prefix
-//=============================================================================
-#include "stdafx.h"
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "SplitBar.h"
-#include "Renderer.h"
-#include "ResourceCache.h"
-#include "MouseCursor.h"
-#include "StudioPreferences.h"
-#include "HotKeys.h"
-
-#include <QApplication>
-//=============================================================================
-// Static Variables
-//=============================================================================
-const long CSplitBar::DEFAULT_WIDTH = 5;
-
-//=============================================================================
-/**
- * Constructor
- */
-CSplitBar::CSplitBar(CSplitterBase *inSplitter, const long inWidth /*=DEFAULT_WIDTH*/)
- : m_Splitter(inSplitter)
- , m_Width(inWidth)
- , m_MouseDown(false)
-{
-
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CSplitBar::~CSplitBar()
-{
-}
-
-//=============================================================================
-/**
- * Handles mouse down events, starts the dragging.
- * @param inPoint where the mouse was clicked.
- * @param inFlags the state of the mouse.
- */
-bool CSplitBar::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseDown(inPoint, inFlags);
-
- m_MouseDown = true;
- m_MouseDownPoint = inPoint;
-
- Invalidate();
-
- return true;
-}
-
-//=============================================================================
-/**
- * Handles mouse up events, stops the dragging.
- * @param inPoint where the mouse was let up.
- * @param inFlags the state of the mouse.
- */
-void CSplitBar::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
-
- m_MouseDown = false;
-
- Invalidate();
-
- if (!IsMouseOver())
- resetCursor();
-}
-
-void CSplitBar::OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseRUp(inPoint, inFlags);
-
- if (!IsMouseOver())
- resetCursor();
-}
-
-//=============================================================================
-/**
- * Do the drawing of this splitter.
- * @param inRenderer the renderer to draw to.
- */
-void CSplitBar::Draw(CRenderer *inRenderer)
-{
- CRct theRect(CPt(0, 0), GetSize());
- CRct theHighlightRect;
- CRct theShadowRect;
-
- if (m_Splitter->GetSplitDirection() == CSplitterBase::SPLIT_HORIZONTAL) {
- theHighlightRect.position = CPt(0, 0);
- theHighlightRect.size = CPt(GetSize().x, 1);
- theShadowRect.position = CPt(0, theRect.size.y - 1);
- theShadowRect.size = CPt(theRect.size.x, 1);
- } else {
- theHighlightRect.position = CPt(0, 0);
- theHighlightRect.size = CPt(1, GetSize().y);
- theShadowRect.position = CPt(theRect.size.x - 1, 0);
- theShadowRect.size = CPt(1, theRect.size.y);
- }
-
- inRenderer->FillSolidRect(theRect, CStudioPreferences::GetBaseColor());
- inRenderer->FillSolidRect(theHighlightRect, CStudioPreferences::GetButtonHighlightColor());
- inRenderer->FillSolidRect(theShadowRect, CStudioPreferences::GetButtonShadowColor());
-}
-
-//=============================================================================
-/**
- * Get the width of this splitter bar.
- */
-long CSplitBar::GetWidth()
-{
- return m_Width;
-}
-
-//=============================================================================
-/**
- * Set the width of this splitter bar.
- */
-void CSplitBar::SetWidth(long inWidth)
-{
- m_Width = inWidth;
-}
-
-//=============================================================================
-/**
- * Processes the dragging of the split bar.
- * @param inPoint the position of the mouse.
- * @param inFlags the state of the mouse buttons.
- */
-void CSplitBar::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- const Qt::MouseButtons buttons = QApplication::mouseButtons();
-
- // Don't show the cursor if the mouse is down from someone else.
- if (!(buttons & Qt::LeftButton) && !(buttons & Qt::RightButton)) {
- // If the buttons are not down and the mouse is over this control
- if (HitTest(inPoint + GetPosition())) {
- // Show the appropriate resize cursor
- setCursorIfNotSet(m_Splitter->GetSplitDirection() == CSplitterBase::SPLIT_HORIZONTAL
- ? CMouseCursor::CURSOR_RESIZE_UPDOWN
- : CMouseCursor::CURSOR_RESIZE_LEFTRIGHT);
- } else {
- resetCursor();
- }
- }
-
- // Only care if the mouse is down
- if (m_MouseDown) {
- // When calculating the offsets remember that this object is moving with the mouse
- // and the inPoint is relative to this position, so inPoint's relative position is
- // changing on every drag.
- long theSplitPos = m_Splitter->GetSplitLocation();
-
- if (m_Splitter->GetSplitDirection() == CSplitterBase::SPLIT_HORIZONTAL) {
- theSplitPos += inPoint.y - m_MouseDownPoint.y;
- } else {
- theSplitPos += inPoint.x - m_MouseDownPoint.x;
- }
-
- m_Splitter->SetSplitLocation(theSplitPos);
- }
-}
-
-//=============================================================================
-/**
- * Processes the mouse out event. Changes the cursor if necessary back to normal.
- * @param inPoint the position of the mouse.
- * @param inFlags the state of the mouse buttons.
- */
-void CSplitBar::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- const Qt::MouseButtons buttons = QApplication::mouseButtons();
- // Don't change the cursor if the mouse is down (from someone else or from ourselves)
- if (!m_MouseDown && !(buttons & Qt::LeftButton) && !(buttons & Qt::RightButton))
- resetCursor();
- CControl::OnMouseOut(inPoint, inFlags);
-}
diff --git a/src/Authoring/Studio/Controls/SplitBar.h b/src/Authoring/Studio/Controls/SplitBar.h
deleted file mode 100644
index 9f783a93..00000000
--- a/src/Authoring/Studio/Controls/SplitBar.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//=============================================================================
-// Prefix
-//=============================================================================
-#ifndef INCLUDED_SPLIT_BAR_H
-#define INCLUDED_SPLIT_BAR_H 1
-
-#pragma once
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "Control.h"
-
-#include <QCursor>
-
-//=============================================================================
-// Forwards
-//=============================================================================
-
-//=============================================================================
-/**
- * Abstract class for implementing a splitter control
- */
-class CSplitterBase
-{
-public:
- enum ESplitDirection {
- SPLIT_VERTICAL,
- SPLIT_HORIZONTAL,
- };
-
- virtual void SetSplitLocation(long inPixels) = 0;
- virtual long GetSplitLocation() const = 0;
- virtual ESplitDirection GetSplitDirection() const = 0;
-};
-
-//=============================================================================
-/**
- * Defines the bar used in a splitter control. Handles drawing and cursors for
- * the bar.
- */
-class CSplitBar : public CControl
-{
-public:
- static const long DEFAULT_WIDTH;
-
- CSplitBar(CSplitterBase *inSplitter, long inWidth = DEFAULT_WIDTH);
- virtual ~CSplitBar();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void Draw(CRenderer *inRenderer) override;
-
- virtual long GetWidth();
- virtual void SetWidth(long inWidth);
-
-protected:
- CSplitterBase *m_Splitter;
- long m_Width;
-
- bool m_MouseDown;
- CPt m_MouseDownPoint;
-};
-
-#endif // INCLUDED_SPLIT_BAR_H
diff --git a/src/Authoring/Studio/Controls/Splitter.cpp b/src/Authoring/Studio/Controls/Splitter.cpp
deleted file mode 100644
index b0ae0eb0..00000000
--- a/src/Authoring/Studio/Controls/Splitter.cpp
+++ /dev/null
@@ -1,419 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stdafx.h"
-#include "Splitter.h"
-#include "ControlData.h"
-
-using namespace Q3DStudio;
-using namespace Q3DStudio::Control;
-//=============================================================================
-/**
- * Constructor, creates a Splitter.
- */
-CSplitter::CSplitter()
- : m_SplitDirection(SPLIT_VERTICAL)
- , m_SplitLocation(0)
- , m_InRecalcLayoutFlag(false)
-{
- m_SplitMinMargin = 10;
- m_SplitMaxMargin = 10;
- m_SplitBar = new CSplitBar(this);
- AddChild(m_SplitBar);
-}
-
-CSplitter::~CSplitter()
-{
- RemoveChild(m_SplitBar);
- delete m_SplitBar;
-}
-
-//=============================================================================
-/**
- * Set the size of this splitter.
- * @param inSize the size of this splitter.
- */
-void CSplitter::SetSize(CPt inSize)
-{
- if (inSize != GetSize()) {
- CControl::SetSize(inSize);
-
- RecalcLayout();
- }
-}
-
-void CSplitter::SetLayout(CPt inSize, CPt inPosition)
-{
- CControl::SetLayout(inSize, inPosition);
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Get the preferred size of this splitter.
- * The preferred size is the sum of both the panes.
- * @return the preferred size of this splitter.
- */
-CPt CSplitter::GetPreferredSize()
-{
- CPt theSize = CControl::GetPreferredSize();
-
- if (m_SplitDirection == SPLIT_VERTICAL) {
- theSize.x = m_SplitBar->GetWidth();
-
- // If vertical then sum up x's
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- CPt thePrefSize = (*thePos)->GetPreferredSize();
- theSize.x += thePrefSize.x;
- }
- } else {
- theSize.y = m_SplitBar->GetWidth();
-
- // If horizontal then sum up y's
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- CPt thePrefSize = (*thePos)->GetPreferredSize();
- theSize.y += thePrefSize.y;
- }
- }
-
- return theSize;
-}
-
-//=============================================================================
-/**
- * Get the minimum allowable size of this splitter.
- * The minimum size is the sum of both the minimum sizes in the split direciton
- * and the largest minimum in the non-split direction.
- * @return the minimum size of this control.
- */
-CPt CSplitter::GetMinimumSize()
-{
- CPt theSize(0, 0);
-
- if (m_SplitDirection == SPLIT_VERTICAL) {
- theSize.x += m_SplitBar->GetWidth();
-
- // Sum up in the split direction and take max min size in non-split direction
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- CPt theMinSize = (*thePos)->GetMinimumSize();
- theSize.x += theMinSize.x;
-
- if (theSize.y < theMinSize.y) {
- theSize.y = theMinSize.y;
- }
- }
- } else {
- theSize.y += m_SplitBar->GetWidth();
-
- // Sum up in the split direction and take max min size in non-split direction.
- ControlGraph::SIterator thePos = GetChildren();
- for (; thePos.HasNext(); ++thePos) {
- CPt theMinSize = (*thePos)->GetMinimumSize();
- theSize.y += theMinSize.y;
-
- if (theSize.x > theMinSize.x) {
- theSize.x = theMinSize.x;
- }
- }
- }
-
- return theSize;
-}
-
-//=============================================================================
-/**
- * Get the maximum size that this control should be.
- * The maximum size is the sum of both the maximum sizes in the split direction
- * and the smalled maximum size in the non-split direction.
- * @return the maximum size of this control.
- */
-CPt CSplitter::GetMaximumSize()
-{
- CPt theSize(0, 0);
-
- if (m_SplitDirection == SPLIT_VERTICAL) {
- theSize.x += m_SplitBar->GetWidth();
- theSize.y = LONG_MAX;
-
- // Sum up the split direction and take min max size in non-split direction.
- ControlGraph::SIterator thePos = GetChildren();
- // Skip the separator
- ++thePos;
- for (; thePos.HasNext(); ++thePos) {
- CPt theMaxSize = (*thePos)->GetMaximumSize();
- theSize.x += theMaxSize.x;
-
- if (theSize.y > theMaxSize.y) {
- theSize.y = theMaxSize.y;
- }
- }
- } else {
- theSize.y += m_SplitBar->GetWidth();
- theSize.x = LONG_MAX;
-
- // Sum up the split direction and take min max size in the non-split direction.
- ControlGraph::SIterator thePos = GetChildren();
- // Skip the separator.
- ++thePos;
- for (; thePos.HasNext(); ++thePos) {
- CPt theMaxSize = (*thePos)->GetMaximumSize();
- theSize.y += theMaxSize.y;
-
- if (theSize.x > theMaxSize.x) {
- theSize.x = theMaxSize.x;
- }
- }
- }
-
- return theSize;
-}
-
-//=============================================================================
-/**
- * Set the location of the splitter bar.
- * @param inSplitLocation the location of the splitter bar, in pixels from the right/top.
- */
-void CSplitter::SetSplitLocation(long inSplitLocation)
-{
- ControlGraph::SIterator theChildren = GetChildren();
-
- std::shared_ptr<CControlData> theControl1;
- std::shared_ptr<CControlData> theControl2;
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl1 = *theChildren;
-
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl2 = *theChildren;
- }
- }
- if (m_SplitDirection == SPLIT_VERTICAL && theControl1) {
- CPt theControl1Min = theControl1->GetMinimumSize();
- if (theControl1Min.x > inSplitLocation)
- inSplitLocation = theControl1Min.x;
- } else if (theControl2) {
- CPt theControl1Min = theControl1->GetMinimumSize();
- if (theControl1Min.y > inSplitLocation && theControl2)
- inSplitLocation = theControl1Min.y;
- }
- m_SplitLocation = inSplitLocation;
-
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Get the location of the splitter bar.
- * @return the location of the splitter bar, in pixels from the right/top.
- */
-long CSplitter::GetSplitLocation() const
-{
- long theSplitLocation = m_SplitLocation;
-
- // Enforce the max margin and then the min margin (in that order)
- // this is done on the get so that internally we maintain
- // the correct location of the splitter
- if (m_SplitDirection == SPLIT_VERTICAL) {
- if (m_SplitLocation > GetSize().x - m_SplitMaxMargin /*- m_SplitBar->GetWidth( )*/)
- theSplitLocation = GetSize().x - m_SplitMaxMargin /*- m_SplitBar->GetWidth( )*/;
- } else {
- if (m_SplitLocation > GetSize().y - m_SplitMaxMargin)
- theSplitLocation = GetSize().y - m_SplitMaxMargin;
- }
-
- if (m_SplitLocation < m_SplitMinMargin)
- theSplitLocation = m_SplitMinMargin;
-
- return theSplitLocation;
-}
-
-//=============================================================================
-/**
- * Set the minimum and maximum split location. This will limit the splitter
- * left and right or up and down.
- * @param inSplitMinMargin the number of pixels from the left/top of the pane
- * @param inSplitMaxMargin the number of pixels from the right/bottom of the pane.
- */
-void CSplitter::SetSplitLimits(long inSplitMinMargin, long inSplitMaxMargin)
-{
- m_SplitMinMargin = inSplitMinMargin;
- m_SplitMaxMargin = inSplitMaxMargin;
-}
-
-//=============================================================================
-/**
- * Set the direction that this is being split in.
- * @param inSplitDirection the direction that this is being split in.
- */
-void CSplitter::SetSplitDirection(CSplitterBase::ESplitDirection inSplitDirection)
-{
- m_SplitDirection = inSplitDirection;
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Get the direction that this is being split in.
- * @return the direction that this is being split in.
- */
-CSplitterBase::ESplitDirection CSplitter::GetSplitDirection() const
-{
- return m_SplitDirection;
-}
-
-//=============================================================================
-/**
- * Add a child to this splitter.
- * If more than 2 children are added then this will pop off the last one to be
- * added before inControl.
- * @param inControl the control to add to this.
- * @param inInsertAfter the position to inster the control.
- */
-void CSplitter::AddChild(CControl *inControl, CControl *inInsertAfter /*=nullptr*/)
-{
- CControl::AddChild(inControl, inInsertAfter);
-
- // If there are more than 3 objects then ditch the last one, allows the insert after to still
- // work.
- if (GetChildCount() > 3)
- RemoveChild(GetReverseChildren().GetCurrent()->GetControl());
-
- RecalcLayout();
-}
-
-void CSplitter::RecalcLayout()
-{
- CPt thePoint(0, 0);
- CPt theSize = GetSize();
-
- std::shared_ptr<CControlData> theControl1;
- std::shared_ptr<CControlData> theControl2;
-
- long theSplitLocation = GetSplitLocation();
-
- ControlGraph::SIterator theChildren = GetChildren();
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl1 = *theChildren;
-
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl2 = *theChildren;
- }
- }
-
- // Prevent OnChildSizeChanged from screwing with us
- m_InRecalcLayoutFlag = true;
-
- if (theControl2 != nullptr) {
- CPt theControl1Max = theControl1->GetMaximumSize();
- CPt theControl2Max = theControl2->GetMaximumSize();
-
- if (m_SplitDirection == SPLIT_VERTICAL) {
- CPt theControl1Min = theControl1->GetMinimumSize();
- if (theControl1Min.x > theSplitLocation) {
- theSplitLocation = theControl1Min.x;
- }
- theControl1->SetPosition(CPt(0, 0));
- theControl1->SetSize(CPt(theSplitLocation, min(theSize.y, theControl1Max.y)));
-
- m_SplitBar->SetPosition(CPt(theSplitLocation, 0));
- m_SplitBar->SetSize(CPt(m_SplitBar->GetWidth(), theSize.y));
-
- theControl2->SetPosition(CPt(theSplitLocation + m_SplitBar->GetWidth(), 0));
- theControl2->SetSize(CPt(theSize.x - (theSplitLocation + m_SplitBar->GetWidth()),
- min(theSize.y, theControl2Max.y)));
- } else {
- CPt theControl1Min = theControl1->GetMinimumSize();
- if (theControl1Min.y > theSplitLocation) {
- theSplitLocation = theControl1Min.y;
- }
- theControl1->SetPosition(CPt(0, 0));
- theControl1->SetSize(CPt(min(theSize.x, theControl1Max.x), theSplitLocation));
-
- m_SplitBar->SetPosition(CPt(0, theSplitLocation));
- m_SplitBar->SetSize(CPt(theSize.x, m_SplitBar->GetWidth()));
-
- theControl2->SetPosition(CPt(0, theSplitLocation + m_SplitBar->GetWidth()));
- theControl2->SetSize(CPt(min(theSize.x, theControl2Max.x),
- theSize.y - (theSplitLocation + m_SplitBar->GetWidth())));
- }
- }
-
- m_InRecalcLayoutFlag = false;
-
- Invalidate();
-}
-
-void CSplitter::OnChildSizeChanged(CControl *)
-{
- if (m_InRecalcLayoutFlag == false) {
- std::shared_ptr<CControlData> theControl1;
- std::shared_ptr<CControlData> theControl2;
-
- ControlGraph::SIterator theChildren = GetChildren();
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl1 = *theChildren;
-
- ++theChildren;
- if (theChildren.HasNext()) {
- theControl2 = *theChildren;
- }
- }
-
- CPt theSize = GetSize();
- if (theControl2 != nullptr) {
- CPt theSize1 = theControl1->GetSize();
- CPt theSize2 = theControl2->GetSize();
- if (m_SplitDirection == SPLIT_VERTICAL)
- theSize.y = max(theSize1.y, theSize2.y);
- else
- theSize.x = max(theSize1.x, theSize2.x);
- }
-
- SetSize(theSize);
- SetMaximumSize(theSize);
-
- RecalcLayout();
- }
-
- // Notify the folks
- if (GetParent() != nullptr)
- GetParent()->OnChildSizeChanged(this);
-}
-
-void CSplitter::SetSplitBarWidth(const long inWidth)
-{
- m_SplitBar->SetWidth(inWidth);
-} \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/Splitter.h b/src/Authoring/Studio/Controls/Splitter.h
deleted file mode 100644
index 94c70781..00000000
--- a/src/Authoring/Studio/Controls/Splitter.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_SPLIT_AGENT_H
-#define INCLUDED_SPLIT_AGENT_H 1
-
-#pragma once
-
-#include "SplitBar.h"
-
-class CSplitter : public CControl, public CSplitterBase
-{
-public:
- CSplitter();
- virtual ~CSplitter();
-
- virtual void SetSize(CPt inSize);
- virtual void SetLayout(CPt inSize, CPt inPosition);
- virtual CPt GetPreferredSize();
- virtual CPt GetMinimumSize();
- virtual CPt GetMaximumSize();
-
- // CSplitterBase
- virtual void SetSplitLocation(long inPixels);
- virtual long GetSplitLocation() const;
- virtual ESplitDirection GetSplitDirection() const;
-
- virtual void SetSplitLimits(long inSplitMinMargin, long inSplitMaxMargin);
- virtual void SetSplitDirection(CSplitterBase::ESplitDirection inSplitDirection);
-
- virtual void AddChild(CControl *inControl, CControl *inInsertBefore = nullptr);
-
- virtual void OnChildSizeChanged(CControl *inChild);
-
- virtual void SetSplitBarWidth(const long inWidth);
-
-protected:
- void RecalcLayout();
-
- ESplitDirection m_SplitDirection;
- long m_SplitLocation;
- long m_SplitMinMargin;
- long m_SplitMaxMargin;
- CSplitBar *m_SplitBar;
- bool m_InRecalcLayoutFlag;
-};
-
-#endif // INCLUDED_SPLIT_AGENT_H \ No newline at end of file
diff --git a/src/Authoring/Studio/Controls/StringEdit.cpp b/src/Authoring/Studio/Controls/StringEdit.cpp
deleted file mode 100644
index 330150d2..00000000
--- a/src/Authoring/Studio/Controls/StringEdit.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Include
-//==============================================================================
-#include "StringEdit.h"
-#include "OffscreenRenderer.h"
-#include "CoreUtils.h"
-
-//==============================================================================
-/**
- * Constructor
- */
-CStringEdit::CStringEdit()
- : m_AutoSize(false)
-{
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CStringEdit::~CStringEdit()
-{
-}
-
-//==============================================================================
-/**
- * Returns the string value of the control.
- */
-Q3DStudio::CString CStringEdit::GetString()
-{
- return m_Value;
-}
-
-//==============================================================================
-/**
- * Sets the string value of the control.
- */
-void CStringEdit::SetData(const Q3DStudio::CString &inValue, bool inFireEvent /*= true*/)
-{
- if (m_Value != inValue) {
- m_Value = inValue;
- SetDisplayString(inValue, inFireEvent);
-
- if (inFireEvent)
- SetDirty(true);
- }
-}
-
-//==============================================================================
-/**
- * Commits changes to the value of this control when the control loses focus.
- */
-void CStringEdit::OnLoseFocus()
-{
- CTextEdit::OnLoseFocus();
- FireCommitEvent();
-}
-
-//==============================================================================
-/**
- * Commits changes to the value of this control when the Enter button is pressed.
- * @param inHighlight true to highlight the text after committing it
- */
-void CStringEdit::EnterText(bool inHighlight)
-{
- CTextEdit::EnterText(inHighlight);
- FireCommitEvent();
-}
-
-void CStringEdit::RefreshDisplayFromData()
-{
- SetDisplayString(GetString());
- Invalidate();
-}
-
-bool CStringEdit::CanPaste()
-{
- return true;
-}
-
-//==============================================================================
-/**
- * Enables or disables auto-sizing of this control. If auto-sizing is enabled
- * the size of this control will be automatically set to fit the text that it
- * contains.
- * @param inAllow true to enable auto-sizing, false to disable auto-sizing
- */
-void CStringEdit::AllowAutoSize(bool inAllow)
-{
- m_AutoSize = inAllow;
-}
-
-//==============================================================================
-/**
- * @return true if auto-resizing is enabled, otherwise false
- */
-bool CStringEdit::GetAllowAutoSize()
-{
- return m_AutoSize;
-}
-
-//==============================================================================
-/**
- * If auto-resizing is enabled, this function will resize this control so that
- * it is the same size as the text that it is displaying. Text size is calculated
- * with an offscreen buffer, so this can be done outside of a draw operation.
- */
-void CStringEdit::ResetSize()
-{
- // If auto-resizing of the text field is enabled
- if (m_AutoSize) {
- // Resize the control to fit the text, plus the buffer gap
- COffscreenRenderer theRenderer(CRct(0, 0, 100, 16));
- CPt theSize;
- const auto textSize = theRenderer.GetTextSize(GetDisplayString().toQString());
- theSize.x = textSize.width() + GetBufferLength() * 3;
- theSize.y = textSize.height() + 1;
- SetMinimumSize(theSize);
- SetPreferredSize(theSize);
- SetMaximumSize(theSize);
- }
-}
-
-//==============================================================================
-/**
- * Primarily delegates up to the parent class, but responds by recalculating
- * size of the text box for auto-sized strings.
- *
- * @param inDirty true to mark this control as dirty, which causes the string to be redrawn
- * false to mark the control as not needing to reevaluate its text during next draw cycle
- */
-void CStringEdit::SetDirty(bool inDirty)
-{
- // Allow the parent to handle this situation
- CTextEdit::SetDirty(inDirty);
-
- ResetSize();
-}
-
-//==============================================================================
-/**
- * Reverts the displayed text to the previous text.
- */
-void CStringEdit::RevertText()
-{
- SetData(m_PreviousValue);
- SetDisplayString(m_PreviousValue);
-
- FireCommitEvent();
- SelectAllText();
-}
-
-//==============================================================================
-/**
- * Handles any non-character keys that were pressed and need to be handled.
- *
- * @param inChar The key that was pressed
- * @param inFlags Indicates which modifier keys were down when event occurred
- * @return true if this function handled the character, otherwise false
- */
-bool CStringEdit::HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool theMessageWasHandled = false;
-
- // StringEdit is going to have to handle its own RevertText.
- // This can't be done in TextEdit because FloatEdit ( VectorEdit, etc ) are using the command
- // stack for undo/redo.
- // StringEdit doesn't have command stack set until you hit enter or lose focus.
-
- switch (inChar) {
- // Escape and Ctrl+Z both do basically the same thing for StringEdits,
- // They are special cased in TextEditInPlace though.
- case Qt::Key_Escape:
- RevertText();
- theMessageWasHandled = true;
- break;
- case Qt::Key_Z:
- if (inFlags & Qt::ControlModifier) {
- RevertText();
- theMessageWasHandled = false;
- }
- break;
- default:
- theMessageWasHandled = CTextEdit::HandleSpecialChar(inChar, inFlags);
- }
-
- return theMessageWasHandled;
-}
-
-//==============================================================================
-/**
- * Called when this control gains focus. Shows the caret, clears the current
- * selection and invalidates the control so that it will get redrawn.
- */
-void CStringEdit::OnGainFocus()
-{
- CTextEdit::OnGainFocus();
- m_PreviousValue = GetString();
-}
-
-//=============================================================================
-/**
- * Handles character input from the keyboard.
- *
- * @param inChar Character that was pressed
- * @return true if the character was handled, false if this control does not
- * care about the character that was pressed
- */
-bool CStringEdit::OnChar(const QString &inChar, Qt::KeyboardModifiers inFlags)
-{
- return CTextEdit::OnChar(inChar, inFlags);
-}
diff --git a/src/Authoring/Studio/Controls/StringEdit.h b/src/Authoring/Studio/Controls/StringEdit.h
deleted file mode 100644
index 8f3c34b1..00000000
--- a/src/Authoring/Studio/Controls/StringEdit.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_STRING_EDIT_H
-#define INCLUDED_STRING_EDIT_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "TextEdit.h"
-
-class CStringEdit : public CTextEdit
-{
-public:
- CStringEdit();
- virtual ~CStringEdit();
- Q3DStudio::CString GetString() override;
- void SetData(const Q3DStudio::CString &inValue, bool inFireEvent = true) override;
- void OnLoseFocus() override;
- void EnterText(bool inHighlight) override;
- void RefreshDisplayFromData() override;
- bool CanPaste() override;
- virtual void ResetSize();
- void AllowAutoSize(bool inAllow);
- bool GetAllowAutoSize();
-
- // overload functions
- bool HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags) override;
- void OnGainFocus() override;
- bool OnChar(const QString &inChar, Qt::KeyboardModifiers inFlags) override;
-
-protected:
- Q3DStudio::CString m_Value;
- Q3DStudio::CString m_PreviousValue;
- bool m_AutoSize;
-
- virtual void RevertText();
- void SetDirty(bool inDirty) override;
-};
-
-#endif // INCLUDED_STRING_EDIT_H
diff --git a/src/Authoring/Studio/Controls/TextButton.h b/src/Authoring/Studio/Controls/TextButton.h
deleted file mode 100644
index bceaff58..00000000
--- a/src/Authoring/Studio/Controls/TextButton.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_TEXT_BUTTON_H
-#define INCLUDED_TEXT_BUTTON_H 1
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Renderer.h"
-#include "OffscreenRenderer.h"
-#include "CoreUtils.h"
-#include "StudioPreferences.h"
-#include "ButtonControl.h"
-#include "CColor.h"
-
-#include <QtCore/qsize.h>
-
-const long MARGIN_X = 2;
-const long MARGIN_Y = 0;
-
-//=============================================================================
-/**
- * Template class for making buttons that have text on them. The text can be
- * displayed with or without the button's icon. In order to use this class,
- * you must instantiate it with some sort of CButtonControl to act as the base
- * class.
- */
-template <class TButton>
-class CTextButton : public TButton
-{
- // Enumerations
-public:
- enum EAlignment {
- ALIGNMENT_LEFT,
- ALIGNMENT_CENTER,
- ALIGNMENT_RIGHT,
- ALIGNMENT_VCENTER ///< Only align center vertically
- };
-
- // Constuction/Destruction
-public:
- CTextButton();
- virtual ~CTextButton();
- // Access
-public:
- void SetText(const QString &inText);
- void SetBoldText(const QString &inText);
- QString GetText();
- void SetTextColorUp(const CColor &inColor);
- void SetTextColorDown(const CColor &inColor);
- CColor GetTextColorUp();
- CColor GetTextColorDown();
- void SetTextAlignment(EAlignment inAlignment);
- long GetTextAlignment();
-
- // Implementation
-protected:
- virtual void Render(CRenderer *inRenderer);
- virtual void Resize();
- void SizeToFitTextLen();
-
- // Field members
-protected:
- QString m_Text; ///< Text
- CColor m_TextColorUp; ///< Color of text
- CColor m_TextColorDown; ///< Color of text
- CPt m_TextPos; ///< Position of text
- EAlignment m_TextAlign; ///< Alignment of text
- BOOL m_BoldText;
-};
-
-//==============================================================================
-// Template implemenations
-//==============================================================================
-
-//=============================================================================
-/**
- * Constructor
- */
-template <class TButton>
-CTextButton<TButton>::CTextButton()
- : TButton()
- , m_TextColorUp(CStudioPreferences::GetNormalColor())
- , m_TextColorDown(CStudioPreferences::GetNormalColor())
- , m_TextPos(MARGIN_X, MARGIN_Y / 2)
- , m_TextAlign(ALIGNMENT_LEFT)
- , m_BoldText(FALSE)
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-template <class TButton>
-CTextButton<TButton>::~CTextButton()
-{
-}
-
-//=============================================================================
-/**
- * Sets the text displayed on this button to the specified string.
- * @param inText new text to be displayed on this button
- */
-template <class TButton>
-void CTextButton<TButton>::SetText(const QString &inText)
-{
- if (m_Text != inText) {
- m_Text = inText;
- SizeToFitTextLen();
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Sets the text bold to be displayed on this button to the specified string.
- * @param inText new text to be displayed on this button
- */
-template <class TButton>
-void CTextButton<TButton>::SetBoldText(const QString &inText)
-{
- m_Text = inText;
- m_BoldText = TRUE;
- SizeToFitTextLen();
- TButton::Invalidate();
-}
-
-//=============================================================================
-/**
- * @return the text currently displayed on this button
- */
-template <class TButton>
-QString CTextButton<TButton>::GetText()
-{
- return m_Text;
-}
-
-//=============================================================================
-/**
- * Sets the color of the text displayed on this button in the up state
- * @param inColor new text color
- */
-template <class TButton>
-void CTextButton<TButton>::SetTextColorUp(const CColor &inColor)
-{
- if (m_TextColorUp != inColor) {
- m_TextColorUp = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Sets the color of the text displayed on this button in the down state
- * @param inColor new text color
- */
-template <class TButton>
-void CTextButton<TButton>::SetTextColorDown(const CColor &inColor)
-{
- if (m_TextColorDown != inColor) {
- m_TextColorDown = inColor;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * @return the color of the text displayed on this button in the up state
- */
-template <class TButton>
-CColor CTextButton<TButton>::GetTextColorUp()
-{
- return m_TextColorUp;
-}
-
-//=============================================================================
-/**
- * @return the color of the text displayed on this button in the down state
- */
-template <class TButton>
-CColor CTextButton<TButton>::GetTextColorDown()
-{
- return m_TextColorDown;
-}
-
-//=============================================================================
-/**
- * Set the alignment of the text.
- */
-template <class TButton>
-void CTextButton<TButton>::SetTextAlignment(EAlignment inAlignment)
-{
- if (inAlignment != m_TextAlign) {
- m_TextAlign = inAlignment;
- TButton::Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * @return the alignment of the text displayed on this button
- */
-template <class TButton>
-long CTextButton<TButton>::GetTextAlignment()
-{
- return m_TextAlign;
-}
-
-//=============================================================================
-/**
- * Draws the button, then draws the specified text onto the button.
- * @param inRenderer the renderer to draw to
- */
-template <class TButton>
-void CTextButton<TButton>::Render(CRenderer *inRenderer)
-{
- // Draw the button icon
- TButton::Render(inRenderer);
-
- // Detertmine position of text based off horizontal alignment
- float theTextPosX(static_cast<float>(m_TextPos.x));
- float theTextPosY(static_cast<float>(m_TextPos.y));
-
- long theImageX = 0;
- long theImageY = 0;
- if (!TButton::GetCurrentImage().isNull()) {
- theImageX += TButton::GetCurrentImage().size().width();
- theImageY += TButton::GetCurrentImage().size().height();
- }
-
- switch (m_TextAlign) {
- case ALIGNMENT_CENTER: {
- const auto textSize = inRenderer->GetTextSize(m_Text);
- theTextPosX = (TButton::GetSize().x - textSize.width() + theImageX) / 2;
- theTextPosY = static_cast<float>(m_TextPos.y);
- } break;
-
- case ALIGNMENT_RIGHT: {
- const auto textSize = inRenderer->GetTextSize(m_Text);
- theTextPosX = TButton::GetSize().x - textSize.width();
- theTextPosY = static_cast<float>(m_TextPos.y);
- } break;
-
- case ALIGNMENT_VCENTER: {
- const auto textSize = inRenderer->GetTextSize(m_Text);
- theTextPosY = (TButton::GetSize().y - textSize.height() + theImageY) / 2;
- theTextPosX = static_cast<float>(m_TextPos.x);
- }
- // Default is LEFT justification
- default:
- case ALIGNMENT_LEFT:
- theTextPosX += theImageX;
- break;
- }
-
- typename TButton::EButtonState theState = TButton::GetButtonState();
- ::CColor theTextColor = m_TextColorUp;
- if (theState == CButtonControl::EBUTTONSTATE_DOWN)
- theTextColor = m_TextColorDown;
- if (TButton::IsEnabled() == false)
- theTextColor = CStudioPreferences::GetDisabledTextColor();
-
- inRenderer->PushPen(theTextColor);
-
- // Draw the text
- const auto buttonSize = TButton::GetSize();
- const QRect rect(0, 0, buttonSize.x, buttonSize.y);
- if (m_BoldText && !m_Text.isEmpty())
- inRenderer->DrawBoldText(theTextPosX, theTextPosY, m_Text, rect, theTextColor);
- else if (!m_Text.isEmpty())
- inRenderer->DrawText(theTextPosX, theTextPosY, m_Text, rect, theTextColor);
-
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * this function calculates the text length in the button control and sets the size of the
- *button
- */
-template <class TButton>
-void CTextButton<TButton>::Resize()
-{
- TButton::Resize();
- SizeToFitTextLen();
-}
-
-//=============================================================================
-/**
- * this function calculates the text length in the button control and sets the size of the
- *button
- */
-template <class TButton>
-void CTextButton<TButton>::SizeToFitTextLen()
-{
- // If auto-resizing of the text field is enabled
- if (TButton::m_AutoSize) {
- // Resize the control to fit the text, plus the buffer gap
- COffscreenRenderer theRenderer(CRct(0, 0, 1, 1));
- CPt theSize;
- const auto textSize = theRenderer.GetTextSize(m_Text);
- int theX = textSize.width();
- int theY = textSize.height();
-
- if (!TButton::GetCurrentImage().isNull())
- theX += TButton::GetCurrentImage().size().width();
-
- // MARGIN_LEN * 2 is just to add some space between the text and the button
- theSize.x = ::dtol(theX) + (MARGIN_X * 2);
- theSize.y = static_cast<long>(theY + (MARGIN_Y * 2));
- TButton::SetSize(theSize);
- TButton::SetMaximumSize(theSize);
- TButton::Invalidate();
- }
-}
-#endif // INCLUDED_TEXT_BUTTON_H
diff --git a/src/Authoring/Studio/Controls/TextEdit.cpp b/src/Authoring/Studio/Controls/TextEdit.cpp
deleted file mode 100644
index 1c4554ba..00000000
--- a/src/Authoring/Studio/Controls/TextEdit.cpp
+++ /dev/null
@@ -1,1498 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "TextEdit.h"
-#include "Renderer.h"
-#include "SystemPreferences.h"
-#include "HotKeys.h"
-#include "TextEditContextMenu.h"
-#include "StudioClipboard.h"
-#include "CoreUtils.h"
-#include "Qt3DSMath.h"
-#include "Qt3DSDMSignals.h"
-#include "MouseCursor.h"
-#include "StudioApp.h"
-#include "Core.h"
-
-#include <QtWidgets/qapplication.h>
-
-using namespace Q3DStudio;
-
-//==============================================================================
-// Constants
-//==============================================================================
-const long BLINKSPEED = 700; // Speed of the blinking cursor while editing, measured in milliseconds
-
-IMPLEMENT_OBJECT_COUNTER(CTextEdit)
-
-// using namespace Q3DStudio; <-- Do not do this here because it will conflict with CList and make
-// the template generator go blah
-
-//==============================================================================
-/**
- * Constructor
- */
-CTextEdit::CTextEdit()
- : m_IsStringDirty(true)
- , m_NeedsCommit(false)
- , m_Alignment(RIGHT)
- , m_TotalCharWidth(0)
- , m_BufferLength(2)
- , m_MaxLength(QT3DS_MAX_I32)
- , m_IsReadOnly(false)
- , m_MouseIsDown(false)
- , m_FillBackground(true)
- , m_TextColor(0, 0, 0)
- , m_UseBGColorReadOnly(false)
- , m_BackgroundColorNoFocus(CStudioPreferences::GetTextBoxBGColorNoFocus())
- , m_BackgroundColorFocus(CStudioPreferences::GetTextBoxBGColorWithFocus())
- , m_BoldText(false)
- , m_ScrollAmount(0, 0)
- , m_CommandHandler(g_StudioApp.GetCore()->GetHotKeys())
-{
- ADDTO_OBJECT_COUNTER(CTextEdit)
-
- m_Caret.color = ::CColor(0, 0, 0);
- m_Caret.position = 0;
- m_Caret.show = false;
-
- m_StartDragPt = CPt(0, 0);
- m_SelectionStart = 0;
- m_SelectionEnd = 0;
-
- m_TextColor = CStudioPreferences::GetRulerTickColor();
-
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CTextEdit::~CTextEdit()
-{
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
-
- REMOVEFROM_OBJECT_COUNTER(CTextEdit)
-
- // Added to help debug freeing memory allocated from inside a DLL
- m_DisplayString.Clear();
-}
-
-//==============================================================================
-/**
- * Sets text justification to left, right, or center.
- *
- * @param inAlignment Enumeration describing the t3xt justification
- */
-void CTextEdit::SetAlignment(EAlignment inAlignment)
-{
- m_Alignment = inAlignment;
-}
-
-//==============================================================================
-/**
- * Draws the bounding rectangle and white edit box for the text edit class. Also
- * draws the actual text in the box by calling GetString(), which should be
- * implemented by any class that extends CTextEdit.
- */
-void CTextEdit::Draw(CRenderer *inRenderer)
-{
- inRenderer->PushClippingRect(QRect(0, 0, GetSize().x, GetSize().y));
-
- // If the string has changed since we last drew it, cache the character widths
- if (m_IsStringDirty) {
- CalculateCharWidths(inRenderer);
- SetDirty(false);
- }
-
- DoFillBackground(inRenderer);
-
- // Draw the actual text
- DrawText(inRenderer);
-
- // Draw the caret last
- DrawCaret(inRenderer);
-
- inRenderer->PopClippingRect();
-}
-
-//==============================================================================
-/**
- * Determines the bounding rectangle for the text based on the text justification
- * setting.
- *
- * @return the bounding rectangle for the text being displayed.
- */
-CRct CTextEdit::GetTextRect()
-{
- CRct theTextRect;
-
- switch (m_Alignment) {
- case LEFT:
- theTextRect = CRct(CPt(m_BufferLength, 0), CPt(::dtol(m_TotalCharWidth), GetSize().y));
- break;
-
- case CENTER:
- theTextRect = CRct(CPt(GetSize().x / 2 - ::dtol(m_TotalCharWidth / 2), 0),
- CPt(::dtol(m_TotalCharWidth), GetSize().y));
- break;
-
- case RIGHT:
- // NO BREAK
- default: {
- theTextRect = CRct(CPt(GetSize().x - ::dtol(m_TotalCharWidth + m_BufferLength), 0),
- CPt(::dtol(m_TotalCharWidth), GetSize().y));
- } break;
- }
-
- return theTextRect;
-}
-
-//==============================================================================
-/**
- * Draws the text out to the screen. If any selection is occurring, the
- * appropriate text is rendered out to the screen using the system preferences
- * for selection color.
- *
- * @param inRenderer Renderer to draw the text out to
- */
-void CTextEdit::DrawText(CRenderer *inRenderer)
-{
- Q3DStudio::CString theCompleteString = GetDisplayString();
- Q3DStudio::CString theFirstPart = theCompleteString;
- Q3DStudio::CString theHighlightedString;
- Q3DStudio::CString theLastPart;
-
- float theTextSizeX;
- float theTextSizeY;
-
- if (HasSelectedText()) {
- theFirstPart = theCompleteString.Extract(0, GetSelectionLeft());
- theHighlightedString =
- theCompleteString.Extract(GetSelectionLeft(),
- GetSelectionRight() - GetSelectionLeft());
- theLastPart = theCompleteString.Extract(GetSelectionRight(),
- theCompleteString.Length() - GetSelectionRight());
- }
-
- // Calculate where the upper left corner where text begins (we'll move this point for each part
- // of the text)
- float theUpperLeftX = static_cast<float>(GetTextRect().position.x + m_ScrollAmount.x);
- float theUpperLeftY = static_cast<float>(GetTextRect().position.y + m_ScrollAmount.y);
-
- const QRect sizeRect(0, 0, GetSize().x, GetSize().y);
- CRct theSelectionRect(0, 0, 0, 0);
-
- if (theFirstPart.Length() > 0) {
- if (!m_BoldText) {
- inRenderer->DrawText(theUpperLeftX, theUpperLeftY, theFirstPart.toQString(),
- CRct(GetSize()), m_TextColor);
- } else {
- inRenderer->DrawBoldText(theUpperLeftX, theUpperLeftY, theFirstPart.toQString(),
- CRct(GetSize()), m_TextColor);
- }
-
- // Move the upper left corner
- const auto textSize = inRenderer->GetTextSize(theFirstPart.toQString());
- theTextSizeX = textSize.width();
- theTextSizeY = textSize.height();
- theUpperLeftX += theTextSizeX;
- }
-
- if (theHighlightedString.Length() > 0) {
- // Draw the selection rectangle
- const auto textSize = inRenderer->GetTextSize(theHighlightedString.toQString());
- theTextSizeX = textSize.width();
- theTextSizeY = textSize.height();
- theSelectionRect.position.x = ::dtol(theUpperLeftX);
- theSelectionRect.size = CPt(::dtol(theTextSizeX), ::dtol(theTextSizeY) + 2);
-
- // If the caret is at the far right of the selection, shrink the highlight rect by one
- // pixel. This is so that you can actually see the blinking cursor on the right edge.
- if (static_cast<long>(m_Caret.position) == GetSelectionRight())
- --theSelectionRect.size.x;
-
- inRenderer->FillSolidRect(theSelectionRect, CSystemPreferences::GetSelectedItemColor());
-
- // Draw the actual text in the highlight color
- if (!m_BoldText) {
- inRenderer->DrawText(theUpperLeftX, theUpperLeftY, theHighlightedString.toQString(),
- sizeRect, CSystemPreferences::GetSelectedTextColor());
- } else {
- inRenderer->DrawBoldText(theUpperLeftX, theUpperLeftY, theHighlightedString.toQString(),
- sizeRect, CSystemPreferences::GetSelectedTextColor());
- }
-
- // Move the upper left corner
- theUpperLeftX += theTextSizeX;
- }
-
- if (theLastPart.Length() > 0) {
- if (!m_BoldText) {
- inRenderer->DrawText(theUpperLeftX, theUpperLeftY, theLastPart.toQString(), sizeRect,
- m_TextColor);
- } else {
- inRenderer->DrawBoldText(theUpperLeftX, theUpperLeftY, theLastPart.toQString(),
- sizeRect, m_TextColor);
- }
- }
-}
-
-//==============================================================================
-/**
- * Draws the caret out to the screen.
- *
- * @param inRenderer Renderer to draw the text out to
- */
-void CTextEdit::DrawCaret(CRenderer *inRenderer)
-{
- if (m_Caret.show && m_Caret.visible) {
- CRct theTextRect = GetTextRect();
- CPt theCaretPosition(theTextRect.position.x, 0);
-
- float theSizeX;
- float theSizeY;
-
- const auto textSize = inRenderer->GetTextSize(GetDisplayString().
- Extract(0, m_Caret.position).toQString());
- theSizeX = textSize.width();
- theSizeY = textSize.height();
-
- theCaretPosition.x = ::dtol(theSizeX) + theTextRect.position.x;
-
- // Adjust the caret postion so that it draws just before the current character, instead of
- // on the current character
- theCaretPosition.x--;
-
- theCaretPosition += m_ScrollAmount;
-
- inRenderer->PushPen(::CColor(m_Caret.color));
- theCaretPosition.y = theCaretPosition.y;
- inRenderer->MoveTo(theCaretPosition);
- inRenderer->LineTo(theCaretPosition.x, GetSize().y - 1);
- inRenderer->PopPen();
- }
-}
-
-//=============================================================================
-/**
- * Inserts the specified character into the control
- */
-bool CTextEdit::InsertChar(unsigned int inChar)
-{
- bool theReturnValue = false;
- Q3DStudio::CString theTempString = m_DisplayString;
-
- if (!m_Caret.show)
- SelectAllText();
-
- long theLeftSelection = GetSelectionLeft();
- long theRightSelection = GetSelectionRight();
- long thePosition = m_Caret.position;
-
- if (theLeftSelection != theRightSelection) {
- Q3DStudio::CString theDisplayString = m_DisplayString;
-
- theTempString = "";
- theTempString = theDisplayString.Extract(0, theLeftSelection);
- theTempString += theDisplayString.Extract(theRightSelection,
- theDisplayString.Length() - theRightSelection);
- thePosition = theLeftSelection;
- }
-
- if (CanAcceptChar(theTempString, inChar, thePosition)
- && theTempString.Length() < GetMaxLength()) {
- DeleteCurrentSelection(false);
-
- Q3DStudio::CString theChar = static_cast<wchar_t>(inChar);
- theTempString.Insert(m_Caret.position, theChar);
- SetData(theTempString);
-
- // Advance the caret past the character that we just typed
- MoveCaretTo(m_Caret.position + 1);
-
- ResetBlinkingCursor();
- theReturnValue = true;
- }
-
- return theReturnValue;
-}
-
-//=============================================================================
-/**
- * Handles character input from the keyboard.
- *
- * @param inChar Character that was pressed
- * @return true if the character was handled, false if this control does not
- * care about the character that was pressed
- */
-bool CTextEdit::OnChar(const QString &inChar, Qt::KeyboardModifiers inFlags)
-{
- // 0x7F is a character generated by the delete key
- if (inChar.size() == 0 || inChar[0].unicode() == 0x7F)
- return false;
-
- bool theReturnValue = false;
-
- // Do not process the character if control is down, this will allow
- // app's hotkey to process application hotkeys.
- if (!(inFlags & Qt::ControlModifier)) {
- // Always return true whenever it captures focus and tries insert character.
- // Though InsertChar fails, this is still getting the focus and have processed the
- // event, return true so that no other controls will handle it
- // Refer to Bug 897
- InsertChar(inChar[0].unicode());
- theReturnValue = true;
- }
-
- return theReturnValue;
-}
-
-//=============================================================================
-/**
- * Virtual function that determines if a key recieved via OnChar can actually be
- * processed. Sub-classes should override this implementation and provide their
- * own function for determining what characters they accept.
- *
- * @param inCheckString the string that is to be checked (in case a lenght requirement is exceeded)
- * @param inChar the character that was pressed
- * @param inPosition character index where we are attempting to insert inChar into inCheckString
- * @return true if this control can accept the character into the string, otherwise false
- */
-bool CTextEdit::CanAcceptChar(const Q3DStudio::CString &inCheckString, unsigned int inChar,
- unsigned int inPosition)
-{
- Q_UNUSED(inCheckString);
- Q_UNUSED(inPosition);
-
- bool theAcceptFlag = false;
-
- if (inChar >= 32 && inChar <= 255 && !m_IsReadOnly)
- theAcceptFlag = true;
-
- return theAcceptFlag;
-}
-
-//=============================================================================
-/**
- * Handles key presses. OnKeyDown events pass in non-printable characters
- * such as the arrow keys or Enter. Some of these keys will be handled by this
- * control.
- *
- * @param inChar the character that was pressed
- * @return true if the character was consumed by this control, otherwise false
- */
-bool CTextEdit::OnKeyDown(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool theHandledFlag = false;
- if (!m_IsReadOnly) {
- if (!m_CommandHandler->OnChar(inChar, 1, inFlags)) {
- theHandledFlag = HandleSpecialChar(inChar, inFlags);
-
- // Enter key commits the last change
- if (inChar == Qt::Key_Enter)
- FireCommitEvent();
-
- ResetBlinkingCursor();
- Invalidate();
- } else {
- theHandledFlag = true;
- }
- }
- return theHandledFlag;
-}
-
-//==============================================================================
-/**
- * Handles any non-character keys that were pressed and need to be handled.
- *
- * @param inChar The key that was pressed
- * @param inFlags Indicates which modifier keys were down when event occurred
- * @return true if this function handled the character, otherwise false
- */
-bool CTextEdit::HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool theHandledFlag = true;
- bool isShiftDown = inFlags & Qt::ShiftModifier ? true : false;
- bool isControlDown = inFlags & Qt::ControlModifier ? true : false;
-
- switch (inChar) {
- case Qt::Key_Left:
- // If we are cancelling selection, then we need to change how the caret moves
- if (HasSelectedText() && !isShiftDown)
- MoveCaretTo(GetSelectionLeft(), isShiftDown);
- // Otherwise, just move the caret left by one character
- else
- MoveCaretTo(m_Caret.position - 1, isShiftDown);
- break;
-
- case Qt::Key_Right:
- // If we are cancelling selection, then we need to change how the caret moves
- if (HasSelectedText() && !isShiftDown)
- MoveCaretTo(GetSelectionRight(), isShiftDown);
- // Otherwise, just move the caret right by one character
- else
- MoveCaretTo(m_Caret.position + 1, isShiftDown);
- break;
-
- case Qt::Key_Home:
- MoveCaretTo(0, isShiftDown);
- break;
-
- case Qt::Key_End:
- MoveCaretTo((long)m_CharWidths.size(), isShiftDown);
- break;
-
- case Qt::Key_Backspace:
- if (HasSelectedText())
- DeleteCurrentSelection();
- else
- DeleteCharacter(false);
- break;
-
- case Qt::Key_Delete: {
- if (HasSelectedText())
- DeleteCurrentSelection();
- else
- DeleteCharacter(true);
- } break;
- case Qt::Key_Return:
- EnterText(true);
- break;
- case Qt::Key_C:
- if (isControlDown)
- CopyText();
- else
- theHandledFlag = false;
- break;
- case Qt::Key_V:
- if (isControlDown)
- PasteText();
- else
- theHandledFlag = false;
- break;
- case Qt::Key_X:
- if (isControlDown)
- CutText();
- else
- theHandledFlag = false;
- break;
- case Qt::Key_A:
- if (isControlDown)
- SelectAllText();
- else
- theHandledFlag = false;
- break;
- default:
- theHandledFlag = false;
- break;
- }
-
- return theHandledFlag;
-}
-
-//==============================================================================
-/**
- * Handles mouse down events. Places the caret in the appropriate place based
- * upon the mouse position.
- *
- * @param inLocation Location of the mouse at the time the click occurred
- * @param inFlags Flags indicating various key states (not used)
- * @return true (this control always handles mouse down events)
- */
-void CTextEdit::OnMouseOver(CPt inLocation, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inLocation, inFlags);
-
- if (!m_IsReadOnly)
- setCursorIfNotSet(CMouseCursor::CURSOR_IBEAM);
-}
-
-void CTextEdit::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- resetCursor();
- CControl::OnMouseOut(inPoint, inFlags);
-}
-
-//==============================================================================
-/**
- * Handles mouse down events. Places the caret in the appropriate place based
- * upon the mouse position.
- *
- * @param inLocation Location of the mouse at the time the click occurred
- * @param inFlags Flags indicating various key states (not used)
- * @return true (this control always handles mouse down events)
- */
-bool CTextEdit::OnMouseDown(CPt inLocation, Qt::KeyboardModifiers inFlags)
-{
- bool theReturnValue = CControl::OnMouseDown(inLocation, inFlags);
-
- if (!m_IsReadOnly) {
- // If the text is scrolled, we'll need to adjust for that
- inLocation -= m_ScrollAmount;
-
- m_StartDragPt = inLocation;
- m_MouseIsDown = true;
-
- ClearSelection();
-
- MoveCaretTo(ConvertPositionToIndex(inLocation), false, false);
-
- // Turn the caret on
- m_Caret.show = true;
- m_Caret.visible = true;
-
- ResetBlinkingCursor();
-
- m_TimerConnection =
- ITickTock::GetInstance().AddTimer(1000, true, std::bind(&CTextEdit::OnTimer, this),
- QStringLiteral("CTextEdit::OnMouseDown::")
- + GetDisplayString().toQString());
-
- theReturnValue = true;
- }
-
- return theReturnValue;
-}
-
-//==============================================================================
-/**
- * Called when the mouse button is released. Disables any dragging that may
- * have been occurring.
- *
- * @param inPoint location of the mouse when the event occurred
- * @param inFlags various flags about other key states
- */
-void CTextEdit::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_MouseIsDown = false;
- m_StartDragPt = CPt(0, 0);
- CControl::OnMouseUp(inPoint, inFlags);
-
- if (!IsMouseOver())
- resetCursor();
-}
-
-void CTextEdit::OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseRUp(inPoint, inFlags);
-
- if (!IsMouseOver())
- resetCursor();
-}
-
-//==============================================================================
-/**
- * Handles mouse movement. If the left mouse button is down and the user is
- * dragging the mouse over the text in the edit box, the appropriate text is
- * selected.
- *
- * @param inPoint location of the mouse.
- * @param inFlags not used
- */
-void CTextEdit::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inFlags);
-
- if (!m_IsReadOnly)
- setCursorIfNotSet(CMouseCursor::CURSOR_IBEAM);
-
- if (m_MouseIsDown && !m_IsReadOnly) {
- // The point was scrolled in OnMouseDown, so we have to scroll it when we drag as well so
- // that it lines up
- inPoint -= m_ScrollAmount;
-
- // Figure out what character index inPoint.x translates to
- long theCharOffset = ConvertPositionToIndex(inPoint);
-
- MoveCaretTo(theCharOffset, true);
- }
-}
-
-//==============================================================================
-/**
- * Converts a given pixel position on the screen into an index into the display
- * string.
- *
- * @param inPosition the point to be converted
- * @return the character index derived from inPostion
- */
-long CTextEdit::ConvertPositionToIndex(CPt inPosition)
-{
- CRct theTextRect = GetTextRect();
- long theIndex = 0;
- long theTotalPixels = theTextRect.position.x;
-
- // NOTE: We technically only care about the x-position of the point, so just ignore
- // inPosition.y if it is not within the text area. This may need to be changed in
- // the future (perhaps if vertical alignment is implemented).
- CPt thePositionNoY = CPt(inPosition.x, theTextRect.position.y);
-
- // If the point is within the text area
- if (theTextRect.IsInRect(thePositionNoY)) {
- // Figure out which characters it falls in between
- for (TCharLengths::iterator thePos = m_CharWidths.begin(); thePos != m_CharWidths.end();
- ++thePos) {
- theTotalPixels += ::dtol(*thePos);
- if (inPosition.x < theTotalPixels)
- break;
- theIndex++;
- }
- } else if (theTextRect.position.x > thePositionNoY.x) {
- // If the point is to the left of the text, default the index to the beginning of the text
- theIndex = 0;
- } else {
- // Otherwise, the point must be to the right of the text, so move the index to the end of
- // the text
- theIndex = (long)m_CharWidths.size();
- }
-
- return theIndex;
-}
-
-//==============================================================================
-/**
- * Converts a given character index into a pixel postion on the screen. This
- * function is the inverse of ConvertPositionToIndex.
- * @param inIndex the character index to be converted
- * @return the x-position (in pixels) of character at inIndex
- */
-long CTextEdit::ConvertIndexToPosition(long inIndex)
-{
- long theXPixelOffset = GetTextRect().position.x;
- long theCurrentIndex = 0;
-
- for (TCharLengths::iterator thePos = m_CharWidths.begin(); thePos != m_CharWidths.end();
- ++thePos) {
- theCurrentIndex++;
-
- if (theCurrentIndex > inIndex)
- break;
-
- theXPixelOffset += ::dtol(*thePos);
- }
-
- return theXPixelOffset;
-}
-
-//==============================================================================
-/**
- * Handles double clicks on the control. Highlights all the text in the control.
- *
- * @param inPoint Not used
- * @param inFlags Not used
- * @return true (this control always handles double clicks)
- */
-bool CTextEdit::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theHandledFlag = false;
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
- if (!m_IsReadOnly) {
- SelectAllText();
-
- if (GetParent())
- GetParent()->GrabFocus(this);
-
- theHandledFlag = true;
- }
-
- return theHandledFlag;
-}
-
-//==============================================================================
-/**
- * Selects all the text in the display string
- */
-void CTextEdit::SelectAllText()
-{
- if (!m_IsReadOnly) {
- MoveCaretTo(GetDisplayString().Length());
- SetSelection(0, GetDisplayString().Length());
- // Turn the caret on
- m_Caret.show = true;
- }
-}
-
-//==============================================================================
-/**
- * Marks the string contained by this control as dirty so that it is reevaluated
- * the next time that the control draws itself. Also clears out any selection
- * that may have been present, resetting the selection to the caret position.
- *
- * @param inDirty true to mark this control as dirty, which causes the string to be redrawn
- * false to mark the control as not needing to reevaluate its text during next draw cycle
- */
-void CTextEdit::SetDirty(bool inDirty)
-{
- m_IsStringDirty = inDirty;
- if (m_IsStringDirty) {
- m_NeedsCommit = true;
- ClearSelection();
- Invalidate();
- }
-}
-
-//==============================================================================
-/**
- * @return true if the string is currently dirty and needs to be reevalutated.
- */
-bool CTextEdit::IsDirty() const
-{
- return m_IsStringDirty;
-}
-
-//==============================================================================
-/**
- * Determines the width in pixels of each letter in the display string.
- *
- * @param inRenderer The current renderer being drawn to (since only the renderer
- * knows how to calculate the pixel width of the text in the current font).
- * @return The total width in pixels of the entire display string
- */
-float CTextEdit::CalculateCharWidths(CRenderer *inRenderer)
-{
- Q3DStudio::CString theString = GetDisplayString();
-
- m_CharWidths.clear();
- m_TotalCharWidth = 0;
-
- for (long theCharIndex = 0; theCharIndex < theString.Length(); ++theCharIndex) {
- const auto textSize = inRenderer->GetTextSize(theString.Extract(theCharIndex, 1).toQString());
- m_CharWidths.push_back(textSize.width());
- m_TotalCharWidth += textSize.width();
- }
-
- return m_TotalCharWidth;
-}
-
-//==============================================================================
-/**
- * Sets the number of pixels worth of buffer space to place at the left and
- * right ends of the edit box.
- */
-void CTextEdit::SetBufferLength(long inLength)
-{
- m_BufferLength = inLength;
-}
-
-//==============================================================================
-/**
- * Sets the maximum length of text
- */
-void CTextEdit::SetMaxLength(long inLength)
-{
- m_MaxLength = inLength;
-}
-
-//==============================================================================
-/**
- * Allows you to turn the background fill on and off.
- * @param inFillBackground true to fill the background color when drawing, false to turn it off
- */
-void CTextEdit::SetFillBackground(bool inFillBackground)
-{
- if (m_FillBackground == inFillBackground)
- return;
- m_FillBackground = inFillBackground;
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Called when this control loses focus. Hides the caret, clears the current
- * selection and invalidates the control so that it will get redrawn.
- */
-void CTextEdit::OnLoseFocus()
-{
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
- m_Caret.show = false;
- m_ScrollAmount.x = 0;
- ClearSelection();
- m_IsStringDirty = true;
- FireCommitEvent();
- resetCursor();
- CControl::OnLoseFocus();
-}
-
-//==============================================================================
-/**
- * Called when this control gains focus. Shows the caret, clears the current
- * selection and invalidates the control so that it will get redrawn.
- */
-void CTextEdit::OnGainFocus()
-{
- if (!m_MouseIsDown) {
- m_Caret.position = 0;
- m_Caret.show = !m_IsReadOnly;
- if (!m_IsReadOnly)
- SelectAllText();
-
- if (m_Caret.show) {
- ResetBlinkingCursor();
- m_TimerConnection = ITickTock::GetInstance().AddTimer(
- 1000, true, std::bind(&CTextEdit::OnTimer, this),
- QStringLiteral("CTextEdit::OnGainFocus::")
- + GetDisplayString().toQString());
- }
- }
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Override to set whether or not this can gain focus.
- */
-bool CTextEdit::CanGainFocus()
-{
- return !m_IsReadOnly;
-}
-
-//==============================================================================
-/**
- * If this control has focus, it's display may have a different string then the
- * actual underlying string. This enables us to revert back to the original
- * string if the user presses the Escape while editing the text. So this function
- * should be used to obtain the proper string to work with. If this control has
- * focus, the internally stored string is returned, otherwise the CTextEdit asks
- * its child class to reevaluate the string.
- *
- * @return the string being displayed in the edit box
- */
-Q3DStudio::CString CTextEdit::GetDisplayString()
-{
- // If this control does not have focus, we should just reevaluate the string
- if (GetParent()) {
- if (!GetParent()->HasFocus(this))
- SetDisplayString(GetString(), false);
- }
-
- // If the edit box is read only, then add the pre and postfix,
- // otherwise, just the display string is drawn while editing
- Q3DStudio::CString theCompleteString = m_DisplayString;
- if (m_IsReadOnly)
- theCompleteString = m_Prefix + m_DisplayString + m_Postfix;
-
- return theCompleteString;
-}
-
-//==============================================================================
-/**
- * Invokied in a Draw call. Derived class can override to do their own background fill
- */
-void CTextEdit::DoFillBackground(CRenderer *inRenderer)
-{
- if ((m_FillBackground && m_UseBGColorReadOnly) || !m_IsReadOnly) {
- // Fill the interior of the edit box
- ::CColor theFillColor = m_BackgroundColorNoFocus;
- // If this control has focus
- if (GetParent()) {
- // Lighten the fill color
- if (GetParent()->HasFocus(this))
- theFillColor = m_BackgroundColorFocus;
- }
- inRenderer->FillSolidRect(QRect(0, 0, GetSize().x, GetSize().y), theFillColor);
- }
-}
-
-//==============================================================================
-/**
- * Selects the specified text within the edit box. If inFirstIndex == inLastIndex
- * no text is selected. If the indices specified do not fall within the size of
- * the actual text, no selection occurs.
- *
- * @param inFirstIndex Index of the first letter to be selected
- * @param inLastIndex Index of the last letter to be selected
- */
-void CTextEdit::SetSelection(long inFirstIndex, long inLastIndex)
-{
- if (inFirstIndex < 0 || inLastIndex > GetDisplayString().Length()) {
- ClearSelection();
- } else {
- if (m_SelectionStart != inFirstIndex || m_SelectionEnd != inLastIndex)
- Invalidate();
-
- m_SelectionStart = inFirstIndex;
- m_SelectionEnd = inLastIndex;
- }
-
- m_Caret.position = m_SelectionEnd;
-}
-
-//==============================================================================
-/**
- * Sets this CTextEdit as either read-only or read/write. When a CTextEdit
- * control is set to read-only, users cannot input data via the keyboard,
- * and the text cannot be selected.
- *
- * @param inReadOnly true to specify static, non-editable, non-selectable text
- */
-void CTextEdit::SetReadOnly(bool inReadOnly)
-{
- if (inReadOnly != m_IsReadOnly)
- Invalidate();
-
- m_IsReadOnly = inReadOnly;
-}
-
-//==============================================================================
-/**
- * @return true if this control should not allow the string to be edited
- */
-bool CTextEdit::IsReadOnly()
-{
- return m_IsReadOnly;
-}
-
-//==============================================================================
-/**
- * Sets the color of the text dispalyed by this control.
- * @param inColor Color of the text to be displayed
- */
-void CTextEdit::SetTextColor(::CColor inColor)
-{
- if (m_TextColor == inColor)
- return;
-
- m_TextColor = inColor;
- m_Caret.color = inColor;
- Invalidate();
-}
-
-//==============================================================================
-/**
- * @return The current text color
- */
-::CColor CTextEdit::GetTextColor()
-{
- return m_TextColor;
-}
-
-//==============================================================================
-/**
- * Sets the flag that says whether or not to use the m_BackgroundColorFocus
- * and m_BackgroundColorNoFocus user colors to draw the background color
- * of the text box.
- */
-void CTextEdit::SetUseBGColorReadOnly(bool inUseBGColorReadOnly)
-{
- m_UseBGColorReadOnly = inUseBGColorReadOnly;
-}
-
-//==============================================================================
-/**
- * Sets the color of the background of this control when it does not have focus.
- * Note that this color only has an effect when SetFillBackground has been
- * called with true.
- * @param inColor Color of the background when the control does not have focus
- * @return The previous background color
- */
-::CColor CTextEdit::SetBGColorNoFocus(::CColor inColor)
-{
- ::CColor theOldColor = m_BackgroundColorNoFocus;
- m_BackgroundColorNoFocus = inColor;
- return theOldColor;
-}
-
-//==============================================================================
-/**
- * Sets the color of the background of this control when it has focus.
- * Note that this color only has an effect when SetFillBackground has been
- * called with true.
- * @param inColor Color of the background when the control has focus
- * @return The previous background color
- */
-::CColor CTextEdit::SetBGColorFocus(::CColor inColor)
-{
- ::CColor theOldColor = m_BackgroundColorFocus;
- m_BackgroundColorFocus = inColor;
- return theOldColor;
-}
-
-void CTextEdit::AddCommitListener(CCommitDataListener *inListener)
-{
- m_CommitListeners.AddListener(inListener);
-}
-
-void CTextEdit::RemoveCommitListener(CCommitDataListener *inListener)
-{
- m_CommitListeners.RemoveListener(inListener);
-}
-
-//==============================================================================
-/**
- * Fires commit events on Listeners. Only fires a commit event if it has not
- * been fired previously.
- */
-void CTextEdit::FireCommitEvent()
-{
- // If we are not currently processing a command to fire commit events to listeners
- if (m_NeedsCommit) {
- // Fire the event and undirty the text
- m_CommitListeners.FireEvent(&CCommitDataListener::OnSetData, this);
- m_NeedsCommit = false;
- }
-}
-
-void CTextEdit::AddChangeListener(IChangeDataListener *inListener)
-{
- m_ChangeListeners.AddListener(inListener);
-}
-
-void CTextEdit::RemoveChangeListener(IChangeDataListener *inListener)
-{
- m_ChangeListeners.RemoveListener(inListener);
-}
-
-//==============================================================================
-/**
- * Fires change events on Listeners.
- */
-void CTextEdit::FireChangeEvent(const Q3DStudio::CString &inOldString,
- const Q3DStudio::CString &inNewString)
-{
- m_ChangeListeners.FireEvent(&IChangeDataListener::OnChangeData, inOldString, inNewString);
-}
-
-void CTextEdit::AddEnterListener(ITextEditEnterListener *inListener)
-{
- m_EnterListeners.AddListener(inListener);
-}
-
-void CTextEdit::RemoveEnterListener(ITextEditEnterListener *inListener)
-{
- m_EnterListeners.RemoveListener(inListener);
-}
-
-//==============================================================================
-/**
- * Fires enter events on listeners.
- */
-void CTextEdit::FireEnterEvent()
-{
- m_EnterListeners.FireEvent(&ITextEditEnterListener::OnEnter, this);
-}
-
-//==============================================================================
-/**
- * Delete any text that is currently selected.
- * If there is no text selected this will do nothing.
- */
-void CTextEdit::DeleteCurrentSelection(bool inFireEvent /*=true*/)
-{
- if (HasSelectedText()) {
- Q3DStudio::CString theTempString = m_DisplayString;
- theTempString.Delete(GetSelectionLeft(), GetSelectionRight() - GetSelectionLeft());
-
- m_Caret.position = GetSelectionLeft();
-
- ClearSelection();
-
- // @see DeleteCharacter( )
- SetData(theTempString, inFireEvent);
- SetDisplayString(theTempString, inFireEvent);
- SetDirty(true);
- }
-}
-
-//==============================================================================
-/**
- * Delete a character to the left or right of the cursor.
- * This will delete a single character on the specified side of the cursor.
- * @param inOnRight true if the character to be deleted is on the right of the cursor.
- */
-void CTextEdit::DeleteCharacter(bool inOnRight)
-{
- if (!inOnRight) {
- if (m_Caret.position == 0)
- return;
- else
- m_Caret.position--;
- }
-
- Q3DStudio::CString theTempString = m_DisplayString;
- theTempString.Delete(m_Caret.position, 1);
- // Since SetData is overloaded by other types of text edit controls,
- // it has to be called first so that subclasses have a chance to set their internal values
- // before calling SetDisplayString, which fires a DataChanged event.
- // @see DeleteCurrentSelection( ). EnterText got it right.
- SetData(theTempString);
- SetDisplayString(theTempString);
- SetDirty(true);
-}
-
-//==============================================================================
-/**
- * Move the caret to the specified position in the string.
- * If inSelect then this will select the text from the selection start position
- * to the new position. If there is no current selection start then this will
- * select from the old position to the new position. If select is false and there
- * is selected text the selection will be cleared.
- * @param inPosition the position to move to in the string.
- * @param inSelect true if the selection should be changed when moving.
- * @param inScroll true if moving the caret should allow the text to scroll within the box
- */
-void CTextEdit::MoveCaretTo(long inPosition, bool inSelect /*=false*/, bool inScroll /*=true*/)
-{
- if (inPosition < 0)
- inPosition = 0;
- if (inPosition > GetDisplayString().Length())
- inPosition = GetDisplayString().Length();
-
- // Only perform the operation if the caret is actually going to move, or the selection is going
- // to change
- if ((static_cast<unsigned long>(inPosition) != m_Caret.position)
- || (HasSelectedText() && !inSelect)) {
- if (inSelect) {
- if (!HasSelectedText())
- m_SelectionStart = m_Caret.position;
- m_SelectionEnd = inPosition;
- } else {
- ClearSelection();
- }
-
- m_Caret.position = inPosition;
-
- // Scroll if necessary
- if (inScroll) {
- long theCaretPixelPos = ConvertIndexToPosition(m_Caret.position);
- if (theCaretPixelPos + m_ScrollAmount.x <= 0)
- Scroll(m_ScrollAmount.x - (theCaretPixelPos + m_ScrollAmount.x) + m_BufferLength);
- else if (theCaretPixelPos + m_ScrollAmount.x > GetSize().x)
- Scroll(-(theCaretPixelPos - GetSize().x + m_BufferLength));
- }
-
- Invalidate();
- }
-}
-
-//==============================================================================
-/**
- * Effectively scrolls the text in this edit box.
- * Enables you to set the number of pixels to offset the text and caret by when
- * they are drawn to the screen. If inPixel = 0, no scrolling takes place. If
- * inPixel < 0, text is scrolled to the left. If inPixel > 0, text is scrolled
- * to the right.
- * @param inPixel specifies the horizontal scroll in pixels
- */
-void CTextEdit::Scroll(long inPixel)
-{
- m_ScrollAmount.x = inPixel;
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Pushes the display string back down to the control and optionally highlights
- * the entire string. Called when the user clicks the enter button in an edit
- * box.
- * @param inHighlight true to highlight the string
- */
-void CTextEdit::EnterText(bool inHighlight)
-{
- SetData(m_DisplayString);
- SetDisplayString(GetString());
-
- if (inHighlight)
- SetSelection(0, m_DisplayString.Length());
-
- Invalidate();
-
- FireEnterEvent();
-}
-
-//==============================================================================
-/**
- * Check to see if there is any text selected.
- * @return true if there is any text selected.
- */
-bool CTextEdit::HasSelectedText()
-{
- return m_SelectionStart != m_SelectionEnd;
-}
-
-//==============================================================================
-/**
- * Get the index of the leftmost selected character.
- * @return the index, invalid if no text is selected.
- */
-long CTextEdit::GetSelectionLeft()
-{
- return m_SelectionStart < m_SelectionEnd ? m_SelectionStart : m_SelectionEnd;
-}
-
-//==============================================================================
-/**
- * Get the index of the rightmost selected character.
- * @return the index, invalid if no text is selected.
- */
-long CTextEdit::GetSelectionRight()
-{
- return m_SelectionStart > m_SelectionEnd ? m_SelectionStart : m_SelectionEnd;
-}
-
-//==============================================================================
-/**
- * Clear any text from being selected, this will not delete the text, only deselect it.
- */
-void CTextEdit::ClearSelection()
-{
- m_SelectionStart = 0;
- m_SelectionEnd = 0;
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Re-get the display string.
- */
-void CTextEdit::ReloadData()
-{
- SetDisplayString(GetString());
-}
-
-//==============================================================================
-/**
- * Supply a prefix to be displayed when the string is not being edited (e.g. "#").
- */
-void CTextEdit::SetPrefix(const Q3DStudio::CString &inPrefix)
-{
- m_Prefix = inPrefix;
-}
-
-//==============================================================================
-/**
- * Supply a postfix to be displayed when the string is not being edited (e.g. " inches").
- */
-void CTextEdit::SetPostfix(const Q3DStudio::CString &inPostfix)
-{
- m_Postfix = inPostfix;
-}
-
-//==============================================================================
-/**
- * Copies selected text to clipboard. If nothing is selected, everything is copied.
- * @return true if text was copied
- */
-bool CTextEdit::CopyText()
-{
- if (!m_IsReadOnly) {
- if (HasSelectedText()) {
- CStudioClipboard::CopyTextToClipboard(
- m_DisplayString.Extract(GetSelectionLeft(), GetSelectionRight()
- - GetSelectionLeft()).toQString());
- } else {
- CStudioClipboard::CopyTextToClipboard(m_DisplayString.toQString());
- }
- }
- return !m_IsReadOnly;
-}
-
-//==============================================================================
-/**
- * Pastes text to clipboard
- */
-
-bool CTextEdit::PasteText()
-{
- Q3DStudio::CString theText = Q3DStudio::CString
- ::fromQString(CStudioClipboard::GetTextFromClipboard());
- bool theHandledFlag = !m_IsReadOnly && CanPaste() && !theText.IsEmpty();
-
- theHandledFlag &= theText.Length() <= GetMaxLength();
- if (HasSelectedText()) {
- theHandledFlag &=
- m_DisplayString.Length() - (GetSelectionRight() - GetSelectionLeft())
- + theText.Length() <= GetMaxLength();
- } else {
- theHandledFlag &= m_DisplayString.Length() + theText.Length() <= GetMaxLength();
- }
-
- if (theHandledFlag) {
- if (!m_Caret.show) {
- SetData(theText);
- } else {
- Q3DStudio::CString theNewString(m_DisplayString);
-
- if (HasSelectedText()) {
- theNewString.Delete(GetSelectionLeft(), GetSelectionRight() - GetSelectionLeft());
- m_Caret.position = Q3DStudio::MIN(GetSelectionLeft(), GetSelectionRight());
- }
- theNewString.Insert(m_Caret.position, theText);
-
- SetData(theNewString);
- m_Caret.position += theText.Length();
- }
- SetDirty(true);
- }
- return theHandledFlag;
-}
-
-//==============================================================================
-/**
- * Cuts text to clipboard
- */
-
-bool CTextEdit::CutText()
-{
- bool theReturn = false;
-
- if (CopyText()) {
- DeleteCurrentSelection();
- theReturn = true;
- }
-
- return theReturn;
-}
-
-//==============================================================================
-/**
- * Reloads the display string with the given string
- * @param inString The string to be set
- */
-void CTextEdit::SetDisplayString(const Q3DStudio::CString &inString, bool inFireEvent /*= true*/)
-{
- if (m_DisplayString != inString) {
- Q3DStudio::CString theOldString = m_DisplayString;
- m_DisplayString = inString;
-
- if (inFireEvent)
- FireChangeEvent(theOldString, m_DisplayString);
-
- m_IsStringDirty = true;
- }
-}
-
-//==============================================================================
-/**
- * The buffer length is the number of pixels between where the control starts
- * and where the text begins drawing (in the case of left alignment). In the
- * case of right alignment it's the number of pixels on the right side of the
- * control where the text ends before the actual edge of the control. Provided
- * for sub classes.
- */
-long CTextEdit::GetBufferLength()
-{
- return m_BufferLength;
-}
-
-//==============================================================================
-/**
- * The maximum allowed length of text
- */
-long CTextEdit::GetMaxLength()
-{
- return m_MaxLength;
-}
-
-//==============================================================================
-/**
- * Displays the Copy/Cut/Paste context menu on right mouse down
- */
-void CTextEdit::DisplayContextMenu(CPt inPt)
-{
- CTextEditContextMenu theMenu(this);
- DoPopup(&theMenu, inPt);
-}
-
-//==============================================================================
-/**
- * Handles the Right mouse down event. Displays a cut/copy/paste context menu.
- * @param inPoint location of the mouse at time of the event (context menu's upper left corner will
- * be here)
- * @param inFlags state of the modifier keys at the time of the event
- * @return true - this control always consumes the event
- */
-bool CTextEdit::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Give children the chance to handle the event, otherwise display the context menu
- if (!CControl::OnMouseRDown(inPoint, inFlags)) {
- if (!IsReadOnly()) {
- DisplayContextMenu(CPt(inPoint.x, GetSize().y));
- return true;
- }
- }
- return false;
-}
-
-//==============================================================================
-/**
- * Periodic callback to make the caret blink.
- */
-void CTextEdit::OnTimer()
-{
- m_Caret.visible = !m_Caret.visible;
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Cancels the current timer and adds a new timer so that the cursor continues
- * to blink. If the cursor is not currently visible, it is made visible.
- */
-void CTextEdit::ResetBlinkingCursor()
-{
- // Cancel the current timer
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
-
- // If the cursor is not visible, make it visible
- if (!m_Caret.visible) {
- m_Caret.visible = true;
- Invalidate();
- }
-
- // Add the timer so that the cursor will blink back off after BLINKSPEED amount of time
- m_TimerConnection =
- ITickTock::GetInstance().AddTimer(BLINKSPEED, true, std::bind(&CTextEdit::OnTimer,
- this),
- QStringLiteral("CTextEdit::ResetBlinkingCursor::")
- + m_DisplayString.toQString());
-}
-
-//==============================================================================
-/**
- * Set to true to indicate text should be drawn bold.
- * @param inBold true to set text to bold
- */
-void CTextEdit::SetBoldText(bool inBold)
-{
- m_BoldText = inBold;
-}
diff --git a/src/Authoring/Studio/Controls/TextEdit.h b/src/Authoring/Studio/Controls/TextEdit.h
deleted file mode 100644
index d82c4557..00000000
--- a/src/Authoring/Studio/Controls/TextEdit.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#ifndef INCLUDED_TEXT_EDIT_H
-#define INCLUDED_TEXT_EDIT_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "Control.h"
-#include "HotKeys.h"
-#include "StudioPreferences.h"
-#include "ITickTock.h"
-#include "Multicaster.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-class CRenderer;
-
-//==============================================================================
-/**
- * @class CTextEdit Base class for textual edit fields in Studio (timeline, inspector).
- */
-
-// Functors
-GENERIC_FUNCTOR_1(CCommitDataListener, OnSetData, CControl *);
-GENERIC_FUNCTOR_1(ITextEditEnterListener, OnEnter, CControl *);
-GENERIC_FUNCTOR_2(IChangeDataListener, OnChangeData, const Q3DStudio::CString &,
- const Q3DStudio::CString &);
-
-class CTextEdit : public CControl
-{
- struct SCaret
- {
- unsigned long position; ///< index of the character that the cursor is currently in front of
- ///(zero is first character)
- ::CColor color; ///< color of the cursor
- bool show; ///< must be true in order for the cursor to show up (outside of blink state)
- bool visible; ///< blinking state of the cursor (true if currently visible)
- };
-
- typedef std::vector<float> TCharLengths;
-
-public:
- enum EAlignment { LEFT = 0, CENTER, RIGHT };
-
- CTextEdit();
- virtual ~CTextEdit();
-
- DEFINE_OBJECT_COUNTER(CTextEdit)
-
- virtual Q3DStudio::CString
- GetString() = 0; ///< Returns the string to be displayed in the edit box
-
- void Draw(CRenderer *inRenderer) override;
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inLocation, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnChar(const QString &inChar, Qt::KeyboardModifiers inModifiers) override;
- bool OnKeyDown(unsigned int inChar, Qt::KeyboardModifiers inModifiers) override;
- void OnGainFocus() override;
- void OnLoseFocus() override;
- bool CanGainFocus() override;
- virtual bool CanAcceptChar(const Q3DStudio::CString &inCheckString, unsigned int inChar,
- unsigned int inPosition);
- void SetAlignment(EAlignment inAlignment);
- void SetBufferLength(long inLength);
- void SetMaxLength(long inLength);
- void SetFillBackground(bool inFillBackground);
- void SelectAllText();
- void DisplayContextMenu(CPt inPt);
- virtual bool CanPaste() = 0;
-
- virtual void SetData(const Q3DStudio::CString &inData, bool inFireEvent = true) = 0;
- virtual void ReloadData();
- virtual void SetPrefix(const Q3DStudio::CString &inPrefix);
- virtual void SetPostfix(const Q3DStudio::CString &inPostfix);
-
- void SetReadOnly(bool inReadOnly);
- bool IsReadOnly();
- void SetTextColor(::CColor inColor);
- ::CColor GetTextColor();
- void SetUseBGColorReadOnly(bool inUseBGColorReadOnly);
- ::CColor SetBGColorNoFocus(::CColor inColor);
- ::CColor SetBGColorFocus(::CColor inColor);
- void SetBoldText(bool inBold);
-
- void AddCommitListener(CCommitDataListener *inListener);
- void RemoveCommitListener(CCommitDataListener *inListener);
- void FireCommitEvent();
-
- void AddChangeListener(IChangeDataListener *inListener);
- void RemoveChangeListener(IChangeDataListener *inListener);
- void FireChangeEvent(const Q3DStudio::CString &inOldString,
- const Q3DStudio::CString &inNewString);
-
- void AddEnterListener(ITextEditEnterListener *inListener);
- void RemoveEnterListener(ITextEditEnterListener *inListener);
- void FireEnterEvent();
-
- bool HasSelectedText();
- long GetSelectionLeft();
- long GetSelectionRight();
- void ClearSelection();
- virtual void SetSelection(long inFirstIndex, long inLastIndex);
-
- void MoveCaretTo(long inPosition, bool inSelect = false, bool inScroll = true);
- void Scroll(long inPixel);
- virtual void EnterText(bool inHighlight);
-
- virtual void RefreshDisplayFromData() = 0;
-
- bool CopyText();
- bool PasteText();
- bool CutText();
- bool IsDirty() const;
-
- virtual void OnTimer();
-
- // Public so that derived objects can query the value on change events
- Q3DStudio::CString GetDisplayString();
-
-protected:
- virtual void DoFillBackground(CRenderer *inRenderer);
-
-protected:
- bool m_IsStringDirty;
- bool m_NeedsCommit;
- TCharLengths m_CharWidths;
- EAlignment m_Alignment;
- float m_TotalCharWidth;
- SCaret m_Caret;
- long m_BufferLength;
- long m_MaxLength;
- bool m_IsReadOnly;
- bool m_MouseIsDown;
- CPt m_StartDragPt;
- CHotKeys *m_CommandHandler;
- bool m_FillBackground;
- ::CColor m_TextColor;
- bool m_UseBGColorReadOnly; ///< Flag indicating that we should use the background colors in read
- ///only boxes as well as read/write
- ::CColor m_BackgroundColorNoFocus;
- ::CColor m_BackgroundColorFocus;
- Q3DStudio::CString m_DisplayString;
- Q3DStudio::CString m_Prefix;
- Q3DStudio::CString m_Postfix;
- bool m_BoldText;
-
- virtual void DeleteCurrentSelection(bool inFireEvent = true);
- virtual void DeleteCharacter(bool inIsOnRight = false);
- virtual void SetDirty(bool inDirty);
- float CalculateCharWidths(CRenderer *inRenderer);
- virtual bool HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags);
- void DrawText(CRenderer *inRenderer);
- void DrawCaret(CRenderer *inRenderer);
- CRct GetTextRect();
- long ConvertIndexToPosition(long inIndex);
- long ConvertPositionToIndex(CPt inPosition);
- void SetDisplayString(const Q3DStudio::CString &inString, bool inFireEvent = true);
- long GetBufferLength();
- long GetMaxLength();
- void ResetBlinkingCursor();
- bool InsertChar(unsigned int inChar);
-
-private:
- CMulticaster<CCommitDataListener *> m_CommitListeners;
- CMulticaster<IChangeDataListener *> m_ChangeListeners;
- CMulticaster<ITextEditEnterListener *> m_EnterListeners;
- long m_SelectionStart;
- long m_SelectionEnd;
- CPt m_ScrollAmount; ///< Pixel offset to scroll the text and caret by
- std::shared_ptr<qt3dsdm::ISignalConnection> m_TimerConnection;
-};
-
-#endif // INCLUDED_TEXT_EDIT_H
diff --git a/src/Authoring/Studio/Controls/TextEditContextMenu.cpp b/src/Authoring/Studio/Controls/TextEditContextMenu.cpp
deleted file mode 100644
index 4074699d..00000000
--- a/src/Authoring/Studio/Controls/TextEditContextMenu.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TextEditContextMenu.h"
-#include "TextEdit.h"
-#include "StudioClipboard.h"
-
-//==============================================================================
-/**
- * Constructor
- */
-
-CTextEditContextMenu::CTextEditContextMenu(CTextEdit *inEditControl, QWidget *parent)
- : QMenu(parent)
-{
- m_TextEditControl = inEditControl;
-
- m_cutAction = new QAction(tr("Cut"), this);
- connect(m_cutAction, &QAction::triggered, this, &CTextEditContextMenu::CutText);
- addAction(m_cutAction);
-
- m_copyAction = new QAction(tr("Copy"), this);
- connect(m_copyAction, &QAction::triggered, this, &CTextEditContextMenu::CopyText);
- addAction(m_copyAction);
-
- m_pasteAction = new QAction(tr("Paste"), this);
- connect(m_pasteAction, &QAction::triggered, this, &CTextEditContextMenu::PasteText);
- addAction(m_pasteAction);
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-
-CTextEditContextMenu::~CTextEditContextMenu()
-{
-}
-
-//==============================================================================
-/**
- * returns true if 'cut' can be applied to the control
- */
-bool CTextEditContextMenu::CanCutText()
-{
- return true;
-}
-
-//==============================================================================
-/**
- * Returns true if you can copy the text in the control
- */
-bool CTextEditContextMenu::CanCopyText()
-{
- return true;
-}
-
-//==============================================================================
-/**
- * Returns true if you may paste text from the clipboard into the control
- */
-bool CTextEditContextMenu::CanPasteText()
-{
- return CStudioClipboard::CanPasteText();
-}
-
-//==============================================================================
-/**
- * Calls the controls cuttext function
- */
-void CTextEditContextMenu::CutText()
-{
- m_TextEditControl->CutText();
-}
-
-//==============================================================================
-/**
- * Calls the controls copy text function
- */
-void CTextEditContextMenu::CopyText()
-{
- m_TextEditControl->CopyText();
-}
-
-//==============================================================================
-/**
- * Calls the controls paste text function
- */
-void CTextEditContextMenu::PasteText()
-{
- m_TextEditControl->PasteText();
-}
-
-void CTextEditContextMenu::showEvent(QShowEvent *event)
-{
- m_cutAction->setEnabled(CanCutText());
- m_copyAction->setEnabled(CanCopyText());
- m_pasteAction->setEnabled(CanPasteText());
-
- QMenu::showEvent(event);
-}
diff --git a/src/Authoring/Studio/Controls/TextEditContextMenu.h b/src/Authoring/Studio/Controls/TextEditContextMenu.h
deleted file mode 100644
index 6ac164d9..00000000
--- a/src/Authoring/Studio/Controls/TextEditContextMenu.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#ifndef INCLUDED_TEXTEDITCONTEXTMENU_H
-#define INCLUDED_TEXTEDITCONTEXTMENU_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include <QtWidgets/qmenu.h>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CTextEdit;
-
-//==============================================================================
-/**
- * @class CTextEditContextMenu
- */
-
-class CTextEditContextMenu : public QMenu
-{
- Q_OBJECT
-public:
- CTextEditContextMenu(CTextEdit *inEditControl, QWidget *parent = nullptr);
- ~CTextEditContextMenu();
-
-protected Q_SLOTS:
- void CutText();
- void CopyText();
- void PasteText();
-
-protected:
- void showEvent(QShowEvent *event) override;
-
- bool CanCutText();
- bool CanPasteText();
- bool CanCopyText();
-
- CTextEdit *m_TextEditControl;
- QAction *m_cutAction;
- QAction *m_copyAction;
- QAction *m_pasteAction;
-};
-
-#endif // INCLUDED_TEXTEDITCONTEXTMENU_H
diff --git a/src/Authoring/Studio/Controls/TextEditInPlace.cpp b/src/Authoring/Studio/Controls/TextEditInPlace.cpp
deleted file mode 100644
index c0da4e66..00000000
--- a/src/Authoring/Studio/Controls/TextEditInPlace.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-// using namespace Q3DStudio; <-- Do not do this here because it will conflict with CList and make
-// the template generator go blah
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TextEditInPlace.h"
-#include "Renderer.h"
-
-#include <QTimer>
-
-//==============================================================================
-// Static class constants
-//==============================================================================
-const long CTextEditInPlace::s_RightBuffer =
- 6; ///< Extra space allotted on the right side of the text
-
-//==============================================================================
-/**
- * Constructor
- */
-CTextEditInPlace::CTextEditInPlace()
- : CStringEdit()
- , m_IsInEditMode(false)
- , m_IsEditable(true)
- , m_AllowSingleClickEdit(true)
-{
- SetAlignment(LEFT);
- SetReadOnly(true);
- SetFillBackground(false);
-}
-
-//==============================================================================
-/**
- * Destructor
- */
-CTextEditInPlace::~CTextEditInPlace()
-{
-}
-
-//==============================================================================
-/**
- * Handles the mouse double-click event. Enters the text into edit mode so that
- * the user can change its value.
- * @param inPoint location of the mouse
- * @param inFlags modifier flags for the mouse
- * @return true if this message should not be passed to any other children, otherwise false
- */
-bool CTextEditInPlace::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theMessageWasHandled = false;
- if (m_IsEditable) {
- SetEditMode(true);
- SetSelection(0, GetString().Length());
- m_Caret.show = true;
- theMessageWasHandled = true;
- } else
- theMessageWasHandled = CStringEdit::OnMouseDoubleClick(inPoint, inFlags);
- return theMessageWasHandled;
-}
-
-void CTextEditInPlace::OnMouseClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CStringEdit::OnMouseClick(inPoint, inFlags);
- if (IsInFocus() && !(inFlags & CHotKeys::MOUSE_RBUTTON) && !m_IsInEditMode && m_IsEditable
- && m_AllowSingleClickEdit) {
- SetEditMode(true);
- SelectAllText();
- }
-}
-
-//==============================================================================
-/**
- * Called when this control loses focus. Turns off edit mode and redraws the
- * control.
- */
-void CTextEditInPlace::OnLoseFocus()
-{
- SetEditMode(false);
- CStringEdit::OnLoseFocus();
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Handles most of the drawing, with some help from the parent class.
- * @param inRenderer Renderer to draw to
- */
-void CTextEditInPlace::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize()); // CRct( CPt( ::dtol( CalculateCharWidths( inRenderer ) + s_RightBuffer
- // ), GetSize( ).y ) );
-
- inRenderer->PushClippingRect(theRect);
- CStringEdit::Draw(inRenderer);
- inRenderer->PopClippingRect();
-}
-
-//==============================================================================
-/**
- * Enables or disables this control from being able to enter "Edit Mode" when
- * SetEditMode() is called.
- * @param inIsEditable true if you want the control to be editable when double-clicked, otherwise
- * false
- */
-void CTextEditInPlace::SetEditable(bool inIsEditable)
-{
- m_IsEditable = inIsEditable;
-
- if (!m_IsEditable && m_IsInEditMode)
- SetEditMode(false);
-}
-
-//==============================================================================
-/**
- * Starts or stops "Edit Mode". While in Edit Mode, the user can change the
- * text, move the caret, and highlight the text. An edit box is also drawn
- * around the text.
- * @param inEditMode true to turn on Edit Mode, false to turn off Edit Mode
- */
-void CTextEditInPlace::SetEditMode(bool inEditMode)
-{
- if (m_IsEditable && (inEditMode != m_IsInEditMode)) {
- m_IsInEditMode = inEditMode;
- SetReadOnly(!m_IsInEditMode);
-
- // If we are in edit mode
- if (m_IsInEditMode) {
- m_PreviousValue = GetString();
- }
- // If we are not in edit mode
- else {
- // Restore the text color and commit the changes
- FireCommitEvent();
- }
- }
-}
-
-//==============================================================================
-/**
- * Overriden from the parent to cause this control to lose focus when the Enter
- * button is pressed on the keyboard.
- * @param inHighlight true to highlight all of the text, false to just change the string
- */
-void CTextEditInPlace::EnterText(bool inHighlight)
-{
- CStringEdit::EnterText(inHighlight);
- QTimer::singleShot(0, [this] { OnLoseFocus(); });
-}
-
-//==============================================================================
-/**
- * Overriden to also invalidate/validate the parent.
- * @param inInvalidate true to invalidate this control and the parent control
- */
-void CTextEditInPlace::Invalidate(bool inInvalidate)
-{
- if (inInvalidate && GetParent())
- GetParent()->Invalidate(inInvalidate);
-
- CStringEdit::Invalidate(inInvalidate);
-}
-
-//==============================================================================
-/**
- * Override to avoid selecting all the text unless in edit mode.
- */
-void CTextEditInPlace::OnGainFocus()
-{
- if (m_IsInEditMode && m_IsEditable)
- CStringEdit::OnGainFocus();
-}
-
-bool CTextEditInPlace::CanGainFocus()
-{
- return true;
-}
-
-//==============================================================================
-/**
- * Returns the edit mode.
- * @return true if the control is currently in edit mode meaning that the user
- * can enter text into it, otherwise false
- */
-bool CTextEditInPlace::GetEditMode()
-{
- return m_IsInEditMode;
-}
-
-long CTextEditInPlace::GetRightBuffer()
-{
- return s_RightBuffer;
-}
-
-//==============================================================================
-/**
- * Handles the Right mouse button down command. Only shows the cut/copy/paste
- * context menu if the control is currently being edited. You can't change a
- * string that's not currently being edited
- * @param inPoint The mouse position at the time of the event
- * @param inFlags The state of the modifier keys at the time of the event
- * @return true if this function handled the character, otherwise false
- */
-
-bool CTextEditInPlace::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theMessageWasHandled = false;
-
- // The base class shows the cut/copy/paste menu, so only do it if we are in edit mode
- if (m_IsInEditMode)
- theMessageWasHandled = CStringEdit::OnMouseRDown(inPoint, inFlags);
-
- return theMessageWasHandled;
-}
-
-//=============================================================================
-/**
- * Handles character input from the keyboard.
- *
- * @param inChar Character that was pressed
- * @return true if the character was handled, false if this control does not
- * care about the character that was pressed
- */
-bool CTextEditInPlace::OnChar(const QString &inChar, Qt::KeyboardModifiers inModifiers)
-{
- bool theMessageWasHandled = false;
- if (GetEditMode())
- theMessageWasHandled = CStringEdit::OnChar(inChar, inModifiers);
- return theMessageWasHandled;
-}
-
-//==============================================================================
-/**
- * By default, clicking on a CTextEditInPlace control that already has focus, will
- * cause the control to enter edit mode (if SetEditable( true ) has been called).
- * This is referred to as single-click editing. This function allows you to
- * enable or disable this functionality. Even if single-click editing is
- * disabled, the user can still edit the text control by double-clicking on it.
- * @param inAllow true to enable single-click editing, false to prevent it
- */
-void CTextEditInPlace::SetSingleClickEdit(bool inAllow)
-{
- m_AllowSingleClickEdit = inAllow;
-}
-
-//==============================================================================
-/**
- * Reverts the displayed text to the previous text.
- */
-void CTextEditInPlace::RevertText()
-{
- if (m_IsInEditMode)
- CStringEdit::RevertText();
-}
-
-//==============================================================================
-/**
- * Override the base class's version
- */
-void CTextEditInPlace::DoFillBackground(CRenderer *inRenderer)
-{
- if (m_FillBackground && !m_IsInEditMode)
- inRenderer->FillSolidRect(QRect(0, 0, GetSize().x, GetSize().y), m_BackgroundColorNoFocus);
-}
-
-//==============================================================================
-/**
- * Handles any non-character keys that were pressed and need to be handled.
- *
- * @param inChar The key that was pressed
- * @param inFlags Indicates which modifier keys were down when event occurred
- * @return true if this function handled the character, otherwise false
- */
-bool CTextEditInPlace::HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool theMessageWasHandled = false;
-
- switch (inChar) {
- // We're overwriting the Escape hotkey sequence from StringEdit because we need to lose focus
- // in TextEditInPlace, StringEdit basically does the same thing for Escape and Ctrl + Z.
- case Qt::Key_Escape:
- RevertText();
- OnLoseFocus();
- theMessageWasHandled = true;
- break;
-
- default:
- theMessageWasHandled = CStringEdit::HandleSpecialChar(inChar, inFlags);
- }
-
- return theMessageWasHandled;
-}
diff --git a/src/Authoring/Studio/Controls/TextEditInPlace.h b/src/Authoring/Studio/Controls/TextEditInPlace.h
deleted file mode 100644
index 7239e6fc..00000000
--- a/src/Authoring/Studio/Controls/TextEditInPlace.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-
-#ifndef INCLUDED_TEXT_EDIT_IN_PLACE_H
-#define INCLUDED_TEXT_EDIT_IN_PLACE_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "StringEdit.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//==============================================================================
-/**
- * @class CTextEditInPlace
- */
-class CTextEditInPlace : public CStringEdit
-{
-public:
- CTextEditInPlace();
- virtual ~CTextEditInPlace();
-
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnLoseFocus() override;
- void OnGainFocus() override;
- bool CanGainFocus() override;
- void Draw(CRenderer *inRenderer) override;
- void SetEditable(bool inIsEditable);
- void SetEditMode(bool inEditMode);
- void EnterText(bool inHighlight) override;
- void Invalidate(bool inInvalidate = true) override;
- bool GetEditMode();
- static long GetRightBuffer();
- bool OnChar(const QString &inChar, Qt::KeyboardModifiers inModifiers) override;
- bool HandleSpecialChar(unsigned int inChar, Qt::KeyboardModifiers inFlags) override;
- virtual void SetSingleClickEdit(bool inAllow);
-
-protected:
- void DoFillBackground(CRenderer *inRenderer) override;
-
-protected:
- bool m_IsInEditMode; ///< If in edit mode, the user is currently editing the control
- bool m_IsEditable; ///< Can only enter edit mode when the control is editable
- bool m_AllowSingleClickEdit; ///< True if clicking on the control while it has focus should
- ///cause it to enter edit mode. False to force a double-click for
- ///entering edit mode.
-
- void RevertText() override;
-
-private:
- static const long s_RightBuffer;
-};
-
-#endif // INCLUDED_TEXT_EDIT_IN_PLACE_H
diff --git a/src/Authoring/Studio/Controls/TimeEdit.cpp b/src/Authoring/Studio/Controls/TimeEdit.cpp
deleted file mode 100644
index 5e44ed1f..00000000
--- a/src/Authoring/Studio/Controls/TimeEdit.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stdafx.h"
-
-#include "CoreUtils.h"
-#include "TimeEdit.h"
-#include "Renderer.h"
-#include "IDoc.h"
-#include "TimeEditDlg.h"
-
-long DELIMITER_SIZE = 2;
-long MINUTES_SIZE = 28;
-long SECONDS_SIZE = 20;
-long MILLIS_SIZE = 28;
-
-CTimeEdit::CTimeEdit(IDoc *inDoc)
- : m_Time(0)
- , m_MinimumTime(0)
- , m_MaximumTime(LONG_MAX)
-{
- AddChild(&m_Minutes);
- AddChild(&m_Seconds);
- AddChild(&m_Millis);
- m_Doc = inDoc;
-}
-
-CTimeEdit::~CTimeEdit()
-{
-}
-long CTimeEdit::GetTime()
-{
- return m_Time;
-}
-
-//=============================================================================
-/**
- * OnMouseDown: Displays a time edit dialog, when the user clicks on the time edit box.
- * @param inPoint stores the point clicked
- * @param inFlags stores the control keys pressed
- */
-bool CTimeEdit::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
-
- CTimeEditDlg theTimeEditDlg;
- theTimeEditDlg.showDialog(m_Time, m_Doc, PLAYHEAD);
- return true;
-}
-
-void CTimeEdit::SetSize(CPt inSize)
-{
- CControl::SetSize(inSize);
-
- inSize.x -= DELIMITER_SIZE * 2;
-
- m_Minutes.SetPosition(CPt(0, 0));
- m_Minutes.SetAbsoluteSize(CPt(MINUTES_SIZE, inSize.y));
- m_Minutes.SetAlignment(CTextEdit::RIGHT);
- m_Minutes.SetNumDecimalPlaces(0);
- m_Minutes.AddCommitListener(this);
- m_Minutes.SetMin(0);
-
- m_Seconds.SetPosition(CPt(MINUTES_SIZE + DELIMITER_SIZE, 0));
- m_Seconds.SetAbsoluteSize(CPt(SECONDS_SIZE, inSize.y));
- m_Seconds.SetAlignment(CTextEdit::LEFT);
- m_Seconds.SetFixedPlaces(2);
- m_Seconds.SetNumDecimalPlaces(0);
- m_Seconds.AddCommitListener(this);
- m_Seconds.SetMin(0);
-
- m_Millis.SetPosition(CPt(MINUTES_SIZE + SECONDS_SIZE + DELIMITER_SIZE * 2, 0));
- m_Millis.SetAbsoluteSize(CPt(MILLIS_SIZE, inSize.y));
- m_Millis.SetAlignment(CTextEdit::LEFT);
- m_Millis.SetFixedPlaces(3);
- m_Millis.SetNumDecimalPlaces(0);
- m_Millis.AddCommitListener(this);
- m_Millis.SetMin(0);
-}
-
-//=============================================================================
-/**
- * Draw this time.
- * @param inRenderer the renderer to draw to.
- */
-
-void CTimeEdit::Draw(CRenderer *inRenderer)
-{
- // Fill in the background, otherwise we'll have junk left over from before
- CRct theRect(GetSize());
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
- const float yPos = GetSize().y - 3;
- inRenderer->PushPen(CStudioPreferences::GetRulerTickColor());
- inRenderer->DrawText(static_cast<float>(m_Seconds.GetPosition().x - DELIMITER_SIZE - 1), yPos,
- ":");
- inRenderer->DrawText(static_cast<float>(m_Millis.GetPosition().x - DELIMITER_SIZE - 1), yPos,
- ".");
-}
-
-//=============================================================================
-/**
- * Set the text background color for this component.
- * @param inColor the background color for this.
- */
-void CTimeEdit::SetBackgroundColor(const CColor &inColor)
-{
- m_BackgroundColor = inColor;
-
- m_Minutes.SetBGColorNoFocus(inColor);
- m_Seconds.SetBGColorNoFocus(inColor);
- m_Millis.SetBGColorNoFocus(inColor);
-}
-
-//=============================================================================
-/**
- * Lame, yes. Basically gets the estimated width of this control.
- */
-long CTimeEdit::GetWidth()
-{
- return MINUTES_SIZE + SECONDS_SIZE + MILLIS_SIZE + DELIMITER_SIZE * 2;
-}
-
-//=============================================================================
-/**
- * Set the time displayed by this control.
- * This will make sure the time is in the proper ranges then set it to the
- * value.
- * @param inTime the new time value for this control.
- */
-void CTimeEdit::SetTime(long inTime)
-{
- m_Time = inTime;
-
- m_Minutes.SetData((float)(m_Time / (1000 * 60)));
- m_Seconds.SetData((float)((m_Time / 1000) % 60));
- m_Millis.SetData((float)(m_Time % 1000));
- Invalidate();
-}
-
-void CTimeEdit::OnSetData(CControl *inControl)
-{
- Q_UNUSED(inControl);
-
- long theTime = ::dtol(m_Millis.GetData()) + ::dtol(m_Seconds.GetData() * 1000)
- + ::dtol(m_Minutes.GetData() * 60 * 1000);
-
- m_TimeListeners.FireEvent(&CTimeEditChangeListener::OnTimeChanged, theTime);
-}
-
-//=============================================================================
-/**
- * Add a listener to this control for when the time changes.
- * @param inListener the listener to be added to this control.
- */
-void CTimeEdit::AddTimeChangeListener(CTimeEditChangeListener *inListener)
-{
- m_TimeListeners.AddListener(inListener);
-}
-
-//=============================================================================
-/**
- * Remove a time change listener from this control.
- * @param inListener the listener to be removed from this control.
- */
-void CTimeEdit::RemoveTimeChangeListener(CTimeEditChangeListener *inListener)
-{
- m_TimeListeners.RemoveListener(inListener);
-}
diff --git a/src/Authoring/Studio/Controls/TimeEdit.h b/src/Authoring/Studio/Controls/TimeEdit.h
deleted file mode 100644
index 39c8cd3b..00000000
--- a/src/Authoring/Studio/Controls/TimeEdit.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INCLUDED_TIME_EDIT_H
-#define INCLUDED_TIME_EDIT_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "GenericFunctor.h"
-#include "Multicaster.h"
-#include "FloatEdit.h"
-#include "EditInPlace.h"
-#include "StringEdit.h"
-
-#include "IDoc.h"
-
-GENERIC_FUNCTOR_1(CTimeEditChangeListener, OnTimeChanged, long);
-
-class CTimeEdit : public CControl, public CCommitDataListener
-{
-public:
- CTimeEdit(IDoc *inDoc);
- virtual ~CTimeEdit();
-
- void SetMinimumTime(long inMinimumTime);
- void SetMaximumTime(long inMaximumTime);
- void SetBackgroundColor(const CColor &inColor);
- void SetTime(long inTime);
- virtual void Draw(CRenderer *inRenderer);
- long GetWidth();
- void AddTimeChangeListener(CTimeEditChangeListener *inListener);
- void RemoveTimeChangeListener(CTimeEditChangeListener *inListener);
-
- virtual void SetSize(CPt inSize);
-
- virtual void OnSetData(CControl *inControl);
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags);
- long GetTime();
-
-protected:
- long m_Time;
- IDoc *m_Doc;
- CEditInPlace<CFloatEdit> m_Minutes;
- CEditInPlace<CFloatEdit> m_Seconds;
- CEditInPlace<CFloatEdit> m_Millis;
-
- CColor m_BackgroundColor;
-
- long m_MinimumTime;
- long m_MaximumTime;
-
- CMulticaster<CTimeEditChangeListener *> m_TimeListeners;
-};
-#endif // INCLUDED_TIME_EDIT_H
diff --git a/src/Authoring/Studio/Controls/ToggleButton.cpp b/src/Authoring/Studio/Controls/ToggleButton.cpp
deleted file mode 100644
index 48d2eaa4..00000000
--- a/src/Authoring/Studio/Controls/ToggleButton.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ToggleButton.h"
-
-IMPLEMENT_OBJECT_COUNTER(CToggleButton)
-
-//=============================================================================
-/**
- * Constructor
- */
-CToggleButton::CToggleButton()
- : m_IsToggleDown(false)
-{
- ADDTO_OBJECT_COUNTER(CToggleButton)
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CToggleButton::~CToggleButton()
-{
- REMOVEFROM_OBJECT_COUNTER(CToggleButton)
-}
-
-//=============================================================================
-/**
- * Handles mouse click events (full mouse down and mouse up combo). Causes the
- * button to change states.
- * @param inListener toggle listener to be removed
- */
-void CToggleButton::OnMouseClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CButtonControl::OnMouseClick(inPoint, inFlags);
- Toggle();
-}
-
-//=============================================================================
-/**
- * Handles mouse down on the button. Allows a button down event to be fired
- * by the base class, but then returns the button to the proper state, meaning
- * that toggle buttons should not actually change states on mouse down messages
- * even though that's what the base class does.
- * @param inPoint location of the mouse when this event occurred
- * @param inFlags state of modifier keys at the time that this event occurred
- */
-bool CToggleButton::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theReturn = CButtonControl::OnMouseDown(inPoint, inFlags);
-
- if (m_IsToggleDown)
- SetButtonState(EBUTTONSTATE_DOWN);
- else
- SetButtonState(EBUTTONSTATE_UP);
- Invalidate();
-
- return theReturn;
-}
-
-//=============================================================================
-/**
- * Handles mouse up on the button. Fires a mouse up event, but not a toggle
- * event, as this is handled by OnMouseClick. Button state is maintained for
- * the toggle button instead of changing immediately like on the base class.
- * @param inPoint location of the mouse when this event occurred
- * @param inFlags state of modifier keys at the time that this event occurred
- */
-void CToggleButton::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CButtonControl::OnMouseUp(inPoint, inFlags);
-
- if (m_IsToggleDown)
- SetButtonState(EBUTTONSTATE_DOWN);
- else
- SetButtonState(EBUTTONSTATE_UP);
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Changes the state of the button. If the button is currently down, it will
- * be changed to up and vice versa. An event is fired to notify interested
- * listeners that the button was toggled.
- */
-void CToggleButton::Toggle()
-{
- m_IsToggleDown = !m_IsToggleDown;
- if (m_IsToggleDown)
- SetButtonState(EBUTTONSTATE_DOWN);
- else
- SetButtonState(EBUTTONSTATE_UP);
-
- Q_EMIT SigToggle(this, GetButtonState());
-
- Invalidate();
-}
-
-void CToggleButton::SetToggleState(bool inIsDown)
-{
- if (inIsDown != m_IsToggleDown) {
- m_IsToggleDown = inIsDown;
- SetButtonState(inIsDown ? EBUTTONSTATE_DOWN : EBUTTONSTATE_UP);
- }
-}
diff --git a/src/Authoring/Studio/Controls/ToggleButton.h b/src/Authoring/Studio/Controls/ToggleButton.h
deleted file mode 100644
index 4230a892..00000000
--- a/src/Authoring/Studio/Controls/ToggleButton.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_TOGGLE_BUTTON_H
-#define INCLUDED_TOGGLE_BUTTON_H 1
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ButtonControl.h"
-
-//==============================================================================
-// Functors
-//==============================================================================
-
-//=============================================================================
-/**
- * Class for making toggle buttons. A toggle button changes state each time a
- * full mouse click is received. When you click the mouse on a toggle button,
- * it will enter the "down" state. When you click it again, the toggle button
- * will enter the "up" state. This differs from a regular button, which only
- * enters the "down" state while the mouse is being held down, then immediately
- * returns to the "up" state when the mouse is released.
- */
-class CToggleButton : public CButtonControl
-{
- Q_OBJECT
-public:
- CToggleButton();
- virtual ~CToggleButton();
-
- DEFINE_OBJECT_COUNTER(CToggleButton)
-
- void OnMouseClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- virtual void Toggle();
-
- virtual void SetToggleState(bool inIsDown);
- bool GetToggleState() const { return m_IsToggleDown; }
-
- //=============================================================================
- /**
- * Functor for handling button toggle messages. The message will be fired to
- * interested listeners when a full button click occurs on this button. If you
- * want to be a listener for button toggle events, you must define an
- * OnButtonToggle function with the following parameters.
- * @param CToggleButton* pointer to the button that generated the event
- * @param EButtonState the state of the button as a result of this event
- */
-Q_SIGNALS:
- void SigToggle(CToggleButton*, CButtonControl::EButtonState);
-
-protected:
- // protected to force use of SetToggleState instead.
- void SetButtonState(EButtonState inState) override { CButtonControl::SetButtonState(inState); }
-
- bool m_IsToggleDown;
-};
-
-#endif // INCLUDED_TOGGLE_BUTTON_H
diff --git a/src/Authoring/Studio/Controls/TreeControl.cpp b/src/Authoring/Studio/Controls/TreeControl.cpp
deleted file mode 100644
index 751c57f6..00000000
--- a/src/Authoring/Studio/Controls/TreeControl.cpp
+++ /dev/null
@@ -1,766 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TreeControl.h"
-#include "Renderer.h"
-#include "HotKeys.h"
-#include "MasterP.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CTreeControl::CTreeControl()
- : m_AllowMultipleSelection(false)
- , m_Refresh(true)
- , m_SortFlag(false)
-{
-
- m_BGColor = CStudioPreferences::GetBaseColor();
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTreeControl::~CTreeControl()
-{
- // Just clear out our lists, deletion is handled by whoever created the items.
- m_ItemList.clear();
- m_SelectedItemList.clear();
-}
-
-//=============================================================================
-/**
- * Sets the background color of this control.
- * @param inColor new background color
- */
-void CTreeControl::SetBackgroundColor(const CColor &inColor)
-{
- m_BGColor = inColor;
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Draws the control.
- */
-void CTreeControl::Draw(CRenderer *inRenderer)
-{
- inRenderer->FillSolidRect(QRect(QPoint(0, 0), GetSize()), m_BGColor);
-}
-
-//=============================================================================
-/**
- * Find the item that this item should be added after to maintain sort order.
- */
-CTreeItem *CTreeControl::FindPrevSortSibling(CTreeItem *inParent, CTreeItem *inChild)
-{
- CTreeItem *theSortItem = nullptr;
-
- if (inParent) {
- theSortItem = inParent->FindPrevSortSibling(inChild);
- } else {
- // No items in the list - return nullptr (because we don't care)
- if (m_ItemList.size()) {
- CTreeItem::TItemList::iterator thePos = m_ItemList.end();
- for (; thePos != m_ItemList.begin(); --thePos) {
- // Item in the list
- theSortItem = *thePos;
- if (IsItemLess(inChild, theSortItem))
- break;
- }
-
- // Last item in the list
- if (thePos == m_ItemList.begin())
- theSortItem = nullptr;
- }
- }
-
- return theSortItem;
-}
-
-//=============================================================================
-/**
- * Find the item that this item should be before after to maintain sort order.
- */
-CTreeItem *CTreeControl::FindNextSortSibling(CTreeItem *inParent, CTreeItem *inChild)
-{
- CTreeItem *theSortItem = nullptr;
-
- if (inParent) {
- theSortItem = inParent->FindNextSortSibling(inChild);
- } else {
- // No items in the list - return nullptr (because we don't care)
- if (m_ItemList.size()) {
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- // Item in the list
- theSortItem = *thePos;
- if (IsItemLess(inChild, theSortItem))
- break;
- }
-
- // Last item in the list
- if (thePos == m_ItemList.end())
- theSortItem = nullptr;
- }
- }
-
- return theSortItem;
-}
-
-//=============================================================================
-/**
- * Adds a tree item to the tree control. The child is automatically added to
- * the end of the list under the specified parent. Once you add a tree item,
- * to this tree control. You must call the remove functions to take it out of
- * the tree control, after which point, it is safe for you to delete it.
- * @param inParent parent of the tree item or nullptr if the item is to be a root
- * @param inChild the child item to be added
- */
-void CTreeControl::AddItem(CTreeItem *inParent, CTreeItem *inChild)
-{
- CTreeItem *theBeforeItem = nullptr;
-
- if (IsSorting())
- theBeforeItem = FindNextSortSibling(inParent, inChild);
-
- AddItemBefore(inParent, inChild, theBeforeItem);
-}
-
-//=============================================================================
-/**
- * Same as AddItem( ), except that you can specify where to put the child in relation
- * to its siblings.
- * @param inParent parent of the new item, or nullptr if adding a root level item
- * @param inChild new child to be added
- * @param inBefore should be a child of inParent, in which case, inChild is added before it;
- * can be nullptr to indicate that inChild needs to go at the end of the inParent's children.
- */
-void CTreeControl::AddItemBefore(CTreeItem *inParent, CTreeItem *inChild, CTreeItem *inBefore)
-{
- if (inParent)
- inParent->AddItem(inChild, inBefore);
- else
- AddToRootItemList(inChild, inBefore);
-
- CTreeItem *theControlBefore = inBefore;
- if (inParent && !inBefore)
- theControlBefore = RecurseGetControlAfter(inParent);
-
- AddToHierarchy(inChild, theControlBefore, true);
-}
-
-//=============================================================================
-/**
- * Same as AddItem( ), except that you can specify where to put the child in relation
- * to its siblings.
- * @param inParent parent of the new item, or nullptr if adding a root level item
- * @param inChild new child to be added
- * @param inAfter should be a child of inParent, in which case, inChild is added after it
- */
-void CTreeControl::AddItemAfter(CTreeItem *inParent, CTreeItem *inChild, CTreeItem *inAfter)
-{
- CTreeItem *theItemBefore = nullptr;
- CTreeItem *theControlBefore = nullptr;
-
- theItemBefore = GetSiblingAfter(inAfter);
- theControlBefore = RecurseGetControlAfter(inAfter);
-
- if (inParent)
- inParent->AddItem(inChild, theItemBefore);
- else
- AddToRootItemList(inChild, theItemBefore);
-
- AddToHierarchy(inChild, theControlBefore, true);
-}
-
-//=============================================================================
-/**
- * Simply detaches inItem from the tree. Provided so that subclasses can
- * override this function to actually perform item deletion if necessary.
- * @param inItem Item to be removed
- */
-void CTreeControl::RemoveItem(CTreeItem *inItem)
-{
- Detach(inItem);
-}
-
-//=============================================================================
-/**
- * Removes all currently selected items.
- * @param inItem Item to be removed
- */
-void CTreeControl::RemoveSelectedItems()
-{
- // Iterate through the selected items, removing each one
- CTreeItem::TItemList::iterator thePos = m_SelectedItemList.begin();
- for (; thePos != m_SelectedItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- RemoveItem(theItem);
- }
- m_SelectedItemList.clear();
-}
-
-//=============================================================================
-/**
- * Removes all currently selected items.
- * @param inItem Item to be removed
- */
-void CTreeControl::RemoveAllItems()
-{
- // Iterate through the selected items, removing each one
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
-
- while (thePos != m_ItemList.end()) {
- CTreeItem *theItem = *thePos;
- RemoveItem(theItem);
- thePos = m_ItemList.begin();
- }
- ASSERT(m_ItemList.empty() == true);
-}
-
-//=============================================================================
-/**
- * Creates a break in the tree. The item being detached is disconnected from
- * it's parent (or from the tree control itself if it has no parent). The
- * releations between branches below inItem are maintained internally by
- * each child item. However, inItem and all of it's children are removed
- * from the control hierarchy (they won't be drawn). This is useful if you
- * want to move sections of the tree around without deleting anything.
- * @param inItem item to detach
- */
-void CTreeControl::Detach(CTreeItem *inItem)
-{
- inItem->Detach();
-
- if (inItem->IsRootItem())
- RemoveFromRootItemList(inItem);
-
- RemoveFromHierarchy(inItem, true);
-}
-
-//=============================================================================
-/**
- * Allows you to enable or disable multiple selection for this tree control.
- * @param inAllow true to allow multiple selection, false to only allow single selection
- */
-void CTreeControl::SetAllowMultipleSelection(bool inAllow)
-{
- m_AllowMultipleSelection = inAllow;
-}
-
-//=============================================================================
-/**
- * @return true if multiple selection is enabled, false if only single
- * selection is enabled.
- */
-bool CTreeControl::GetAllowMultipleSelection()
-{
- return m_AllowMultipleSelection;
-}
-
-//=============================================================================
-/**
- * @return the number of items at the root level of this tree control
- */
-long CTreeControl::GetNumRootItems()
-{
- return (long)m_ItemList.size();
-}
-
-//=============================================================================
-/**
- * Get the root item at the specified index
- */
-CTreeItem *CTreeControl::GetRootItem(long inIndex)
-{
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- std::advance(thePos, inIndex);
-
- if (thePos != m_ItemList.end())
- return (*thePos);
-
- return nullptr;
-}
-
-//=============================================================================
-/**
- * Gets iterators for traversing the list of selected tree items.
- * @param outListBegin returns an iterator to the beginning of the selected item list
- * @param outListEnd returns an iterator to the end of the selected item list
- */
-void CTreeControl::GetSelectionIterators(CTreeItem::TItemList::iterator &outListBegin,
- CTreeItem::TItemList::iterator &outListEnd)
-{
- outListBegin = m_SelectedItemList.begin();
- outListEnd = m_SelectedItemList.end();
-}
-
-//=============================================================================
-/**
- * @return number of selected items in this tree control
- */
-long CTreeControl::GetNumSelectedItems()
-{
- return (long)m_SelectedItemList.size();
-}
-
-//=============================================================================
-/**
- * @return the first selected item in the tree control
- */
-CTreeItem *CTreeControl::GetFirstSelectedItem()
-{
- CTreeItem::TItemList::iterator theBegin = m_SelectedItemList.begin();
- if (theBegin != m_SelectedItemList.end())
- return (*theBegin);
- return nullptr;
-}
-
-//=============================================================================
-/**
- * Selects the specified tree item and adds the item to the selection list.
- * Multiple selection is handled via inKeyModifiers and setting of the multiple
- * selection flag on this class.
- * @param inItem item to be selected
- * @param inKeyModifiers optionally indicates the state of shift, ctrl, etc. for multiple selection
- */
-void CTreeControl::Select(CTreeItem *inItem, long inKeyModifiers /*=0*/)
-{
- ASSERT(inItem != nullptr);
-
- bool theCtrlKeyIsDown =
- (inKeyModifiers & CHotKeys::MODIFIER_CONTROL) == CHotKeys::MODIFIER_CONTROL;
- bool theShiftKeyIsDown =
- (inKeyModifiers & CHotKeys::MODIFIER_SHIFT) == CHotKeys::MODIFIER_SHIFT;
-
- // clears all existing selection if multiple selection is not allowed
- // If multiple selection is not enabled or neither control nor shift is down
- if (!m_AllowMultipleSelection || (!theCtrlKeyIsDown && !theShiftKeyIsDown)) {
- CTreeItem::TItemList::iterator thePos = m_SelectedItemList.begin();
- // Iterate through all the selected items and deselect them
- for (; thePos != m_SelectedItemList.end();) {
- CTreeItem *theItem = *thePos;
- if (theItem->IsSelected() && inItem != theItem) {
- theItem->SetSelected(false);
- thePos = m_SelectedItemList.erase(thePos); // remove unselected item from list
- } else
- ++thePos;
- }
- }
-
- // Don't bother selecting the item if it is already selected
- if (!inItem->IsSelected()) {
- inItem->SetSelected(true);
- m_SelectedItemList.push_back(inItem);
-
- // Tell all TreeItemSelectionListeners that the item was selected
- FireItemSelected(inItem);
- }
-
- if (theShiftKeyIsDown) {
- // TODO: advanced selection
- }
-}
-
-//=============================================================================
-/**
- * Deselects the specified item, if it is selected.
- * @param inItem item to be deselected
- */
-void CTreeControl::Deselect(CTreeItem *inItem)
-{
- // Run through the list and look for the specified item
- bool theItemWasFound = false;
- CTreeItem::TItemList::iterator thePos = m_SelectedItemList.begin();
- CTreeItem::TItemList::iterator theEnd = m_SelectedItemList.end();
- for (; thePos != theEnd; ++thePos) {
- CTreeItem *theItem = *thePos;
- if (theItem == inItem) {
- theItemWasFound = true;
- break;
- }
- }
-
- // If the item was found, remove it from the selected item list
- if (theItemWasFound) {
- m_SelectedItemList.erase(thePos);
- // Tell the item it is no longer selected
- inItem->SetSelected(false);
- }
-}
-
-//=============================================================================
-/**
- * Deselects all currently selected items.
- */
-void CTreeControl::DeselectAll()
-{
- CTreeItem::TItemList::iterator thePos = m_SelectedItemList.begin();
- CTreeItem::TItemList::iterator theEnd = m_SelectedItemList.end();
- for (; thePos != theEnd; ++thePos) {
- CTreeItem *theItem = *thePos;
- theItem->SetSelected(false);
- }
- m_SelectedItemList.clear();
-}
-
-//=============================================================================
-/**
- * Expand all nodes to the specified item.
- */
-void CTreeControl::ExpandTo(CTreeItem *inItem)
-{
- // Turn off tree refreshing
- bool theAllowRefresh = GetAllowRefresh();
- SetAllowRefresh(false);
-
- // Expand the specified item
- inItem->Expand();
-
- // Expand the parents
- CTreeItem *theParent = inItem->GetParentItem();
- if (theParent)
- ExpandTo(theParent);
-
- // Restore tree refreshing
- SetAllowRefresh(theAllowRefresh);
-}
-
-//=============================================================================
-/**
- * Expand all nodes from this item onwards.
- */
-void CTreeControl::ExpandFrom(CTreeItem *inItem)
-{
- // Turn off tree refreshing
- bool theAllowRefresh = GetAllowRefresh();
- SetAllowRefresh(false);
-
- // Expand the item's immediate children
- inItem->Expand();
-
- CTreeItem::TItemList::iterator theBegin;
- CTreeItem::TItemList::iterator theEnd;
-
- inItem->GetItemIterator(theBegin, theEnd);
-
- // Expand all children
- std::for_each(theBegin, theEnd, std::bind1st(std::mem_fun(&CTreeControl::ExpandFrom), this));
-
- // Restore refresh state
- SetAllowRefresh(theAllowRefresh);
-}
-
-//=============================================================================
-/**
- * Collapse all items in the tree.
- */
-void CTreeControl::CollapseAll()
-{
- // Not implemented
- QT3DS_ASSERT(false);
-}
-
-//=============================================================================
-/**
- * Allows or disallows calls to RecalcLayout. This is useful if you are adding
- * a bulk amount of items to the tree control at once. You can simply call
- * this function with false, add your items, the call this function again with
- * true. In this way, you don't incur a call to RecalcLayout for each item
- * added, just one call at the end when all the items are added.
- * @param inAllowRefresh true to allow RecalcLayout calls, false to prevent them
- * from doing anything.
- */
-void CTreeControl::SetAllowRefresh(bool inAllowRefresh)
-{
- m_Refresh = inAllowRefresh;
-}
-
-//=============================================================================
-/**
- * Tells you whether or not a call to RecalcLayout will actually result in
- * resizing and repositioning the items in the tree.
- * @return true if the tree control is currently allowing recalc layout calls
- * to process, otherwise false.
- */
-bool CTreeControl::GetAllowRefresh()
-{
- return m_Refresh;
-}
-
-//=============================================================================
-/**
- * Helper function for finding the tree item that is the next sibling after
- * the specified item. If inItem has a parent, the parent's list is searched,
- * otherwise, we just search the root item list. If there is no sibling, this
- * function recurses on the parent (if there is one) all the way up the tree
- * until we reach the top. If there is not a control after the specified one,
- * this function returns nullptr.
- * @param inItem Item whose sibling we are searching for
- * @return the sibling that occurs after inItem in the tree hierarchy
- */
-CTreeItem *CTreeControl::GetSiblingAfter(CTreeItem *inItem)
-{
- QT3DS_PROFILE(GetSiblingAfter);
-
- ASSERT(inItem);
-
- CTreeItem *theSibling = nullptr;
- CTreeItem *theParent = inItem->GetParentItem();
-
- // Declare the iterators, then use them on either list
- CTreeItem::TItemList::reverse_iterator thePos;
- CTreeItem::TItemList::reverse_iterator theListEnd;
-
- // If we have a parent, get the iterators from the parent
- if (theParent) {
- theParent->GetReverseItemIterator(thePos, theListEnd);
- }
- // If we don't have a parent, we must be searching for a root-level item, so search the tree
- // control's list
- else {
- thePos = m_ItemList.rbegin();
- theListEnd = m_ItemList.rend();
- }
-
- // Iterate through the list
- bool theItemWasFound = false;
- CTreeItem *thePreviousItem = nullptr;
- for (; thePos != theListEnd; ++thePos) {
- CTreeItem *theCurrentItem = *thePos;
-
- // If we found the item we are looking for, break out of the loop
- if (theCurrentItem == inItem) {
- theItemWasFound = true;
- break;
- }
-
- thePreviousItem = theCurrentItem;
- }
-
- // If the item we were looking for was found, the sibling is probably contained in
- // thePreviousItem
- if (theItemWasFound)
- theSibling = thePreviousItem;
-
- return theSibling;
-}
-
-//=============================================================================
-/**
- * Helper function for fetching the control after inItem. If inItem has siblings,
- * those are searched to determine if there is a sibling after inItem. If no
- * sibling is found, this function recurses, this time searching for a sibling
- * of inItem->GetParentItem( ); assuming that inItem has a parent. In this
- * way, we determine the control that occurs after inItem in the Control
- * hierarchy.
- * @param inItem we are searching for the item after this one
- * @return the item after inItem in the control hierarchy or nullptr if there is no item after inItem.
- */
-CTreeItem *CTreeControl::RecurseGetControlAfter(CTreeItem *inItem)
-{
- QT3DS_PROFILE(RecurseGetControlAfter);
-
- ASSERT(inItem);
-
- CTreeItem *theControlAfter = GetSiblingAfter(inItem);
- CTreeItem *theParent = inItem->GetParentItem();
-
- // If we still haven't found a sibling, and we have a valid parent, recursively search for a
- // sibling of the parent
- if (!theControlAfter && theParent)
- theControlAfter = RecurseGetControlAfter(theParent);
-
- return theControlAfter;
-}
-
-//=============================================================================
-/**
- * Protected function for adding items to the root level of this control.
- * @param inItem new item to be added
- * @param inInsertBefore item to insert inItem before in the list, or
- * nullptr to insert the item at the end of the list
- */
-void CTreeControl::AddToRootItemList(CTreeItem *inItem, CTreeItem *inInsertBefore)
-{
- // If an item to insert before is specified
- if (inInsertBefore) {
- // Go through the list and insert inItem before inInsertBefore
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theCurrentItem = *thePos;
- if (theCurrentItem == inInsertBefore) {
- m_ItemList.insert(thePos, inItem);
- break;
- }
- }
- }
- // If no item is specified for inserting before, add inItem to the end of the list
- else {
- m_ItemList.push_back(inItem);
- }
-}
-
-//=============================================================================
-/**
- * Protected function for removing items from the root level of this control.
- * The item is not deleted and nothing is done to the children of the item.
- * @param inItem item to be removed from the list
- */
-void CTreeControl::RemoveFromRootItemList(CTreeItem *inItem)
-{
- bool theItemWasFound = false;
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- if (theItem == inItem) {
- theItemWasFound = true;
- break;
- }
- }
-
- if (theItemWasFound) {
- m_ItemList.erase(thePos);
- }
-}
-
-//=============================================================================
-/**
- * Protected function for adding items to the root level of this control. No
- * lists are updated, this is merely for updating the control hierarchy.
- * @param inItem item to be added to the control hierarchy
- * @param inBefore item to insert inItem before in the control hierarchy or nullptr
- * to insert at the end of the control hierarchy.
- * @param inIsRecursive true to recursively add all children of inItem to hierarchy
- */
-void CTreeControl::AddToHierarchy(CTreeItem *inItem, CTreeItem *inBefore, bool inIsRecursive)
-{
- AddChild(inItem, inBefore);
-
- if (inIsRecursive) {
- bool theAllowRefresh = GetAllowRefresh();
- SetAllowRefresh(false);
-
- if (inItem->IsContainer()) {
- CTreeItem::TItemList::iterator thePos;
- CTreeItem::TItemList::iterator theEnd;
- inItem->GetItemIterator(thePos, theEnd);
- for (; thePos != theEnd; ++thePos) {
- CTreeItem *theChild = *thePos;
- AddToHierarchy(theChild, inBefore, inIsRecursive);
- }
- }
-
- SetAllowRefresh(theAllowRefresh);
- }
-}
-
-//=============================================================================
-/**
- * Protected function for removing an item from the control hierarchy. The
- * item is not deleted, but it will no longer be drawn.
- * @param inItem Item to remove
- * @param inIsRecursive true to recursively call this function on all of the item's children
- */
-void CTreeControl::RemoveFromHierarchy(CTreeItem *inItem, bool inIsRecursive)
-{
- if (inIsRecursive) {
- bool theAllowRefresh = GetAllowRefresh();
- SetAllowRefresh(false);
-
- if (inItem->IsContainer()) {
- CTreeItem::TItemList::iterator thePos;
- CTreeItem::TItemList::iterator theEnd;
- inItem->GetItemIterator(thePos, theEnd);
- for (; thePos != theEnd; ++thePos) {
- CTreeItem *theChild = *thePos;
- RemoveFromHierarchy(theChild, inIsRecursive);
- }
- }
-
- SetAllowRefresh(theAllowRefresh);
- }
-
- Deselect(inItem);
- RemoveChild(inItem);
-}
-
-//=============================================================================
-/**
- * Private function for adding children to the Control hierarchy. Only this
- * class should call this function. Everyone else needs to go through AddItem( ).
- * @param inControl new control to be added
- * @param inInsertBefore control to insert the new one before in the hierarchy
- */
-void CTreeControl::AddChild(CControl *inControl, CControl *inInsertBefore)
-{
- Q3DStudio::Control::SVerticalLazyFlow::AddChild(inControl, inInsertBefore);
-}
-
-//==============================================================================
-/**
- * Add a CTreeItemSelectionListener to this control's list of
- * CTreeItemSelectionListeners.
- *
- * @param inListener CTreeItemSelectionListener to add to m_SelectionListeners
- */
-void CTreeControl::AddSelectionListener(CTreeItemSelectionListener *inListener)
-{
- m_SelectionListeners.AddListener(inListener);
-}
-
-//==============================================================================
-/**
- * Remove a CTreeItemSelectionListener from this control's list of
- * CTreeItemSelectionListeners.
- *
- * @param inListener CTreeItemSelectionListener to remove from m_SelectionListeners
- */
-void CTreeControl::RemoveSelectionListener(CTreeItemSelectionListener *inListener)
-{
- m_SelectionListeners.RemoveListener(inListener);
-}
-
-void CTreeControl::FireItemSelected(CTreeItem *inItem)
-{
- OnTreeItemSelected(inItem);
- m_SelectionListeners.FireEvent(&CTreeItemSelectionListener::OnTreeItemSelected, inItem);
-}
diff --git a/src/Authoring/Studio/Controls/TreeControl.h b/src/Authoring/Studio/Controls/TreeControl.h
deleted file mode 100644
index e9958322..00000000
--- a/src/Authoring/Studio/Controls/TreeControl.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_TREE_CONTROL_H
-#define INCLUDED_TREE_CONTROL_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "LazyFlow.h"
-#include "TreeItem.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-class CTest_TreeControl;
-
-//==============================================================================
-// Functor
-//==============================================================================
-/// This means that any class that wants be informed when TreeItems are selected
-/// needs to implement the CTreeItemSelectionListener interface, and the
-/// void OnTreeItemSelected( CTreeItem* ) method
-/// The CTreeItem is the item that was selected
-GENERIC_FUNCTOR_1(CTreeItemSelectionListener, OnTreeItemSelected, CTreeItem *);
-
-//=============================================================================
-/**
- * Custom tree control class. You need to call one of the AddItem*( ) functions
- * to add tree items to this control. Multiple selection can be enabled using
- * the provided functions. The tree control maintains a list of all the root
- * level items. It is also responsible for managing the separate "Control
- * hierarchy."
- */
-class CTreeControl : public Q3DStudio::Control::SVerticalLazyFlow
-{
-public:
- CTreeControl();
- virtual ~CTreeControl();
- void SetBackgroundColor(const ::CColor &inColor);
- void Draw(CRenderer *inRenderer) override;
- virtual void AddItem(CTreeItem *inParent, CTreeItem *inChild);
- virtual void AddItemBefore(CTreeItem *inParent, CTreeItem *inChild, CTreeItem *inBefore);
- virtual void AddItemAfter(CTreeItem *inParent, CTreeItem *inChild, CTreeItem *inAfter);
- virtual void RemoveItem(CTreeItem *inItem);
- virtual void RemoveSelectedItems();
- virtual void RemoveAllItems();
- virtual void Detach(CTreeItem *inItem);
- void SetAllowMultipleSelection(bool inAllow);
- bool GetAllowMultipleSelection();
- void GetSelectionIterators(CTreeItem::TItemList::iterator &outListBegin,
- CTreeItem::TItemList::iterator &outListEnd);
- long GetNumSelectedItems();
- CTreeItem *GetFirstSelectedItem();
- virtual void Select(CTreeItem *inItem, long inKeyModifiers = 0);
- virtual void Deselect(CTreeItem *inItem);
- virtual void DeselectAll();
- void SetAllowRefresh(bool inAllowRefresh);
- bool GetAllowRefresh();
- long GetNumRootItems();
- CTreeItem *GetRootItem(long inIndex);
- virtual void ExpandTo(CTreeItem *inItem);
- virtual void ExpandFrom(CTreeItem *inItem);
- virtual void CollapseAll();
- virtual void SetSorting(bool inSort) { m_SortFlag = inSort; }
- virtual bool IsSorting() { return m_SortFlag; }
-
- virtual bool IsItemGreater(CTreeItem *, CTreeItem *) { return true; }
- virtual bool IsItemLess(CTreeItem *, CTreeItem *) { return false; }
-
- // SelectionListener methods
- void AddSelectionListener(CTreeItemSelectionListener *inListener);
- void RemoveSelectionListener(CTreeItemSelectionListener *inListener);
- void FireItemSelected(CTreeItem *inItem);
-
- // Override to hear select
- virtual void OnTreeItemSelected(CTreeItem *) {}
- virtual void OnItemExpanding(CTreeItem *) {}
- virtual void OnItemExpanded(CTreeItem *) { NotifyParentNeedsLayout(); }
- virtual void OnItemCollapsing(CTreeItem *) {}
- virtual void OnItemCollapsed(CTreeItem *) { NotifyParentNeedsLayout(); }
-
-protected:
- // Member Vars
- ::CColor m_BGColor; ///< Specifies the background color of this control
- bool m_AllowMultipleSelection; ///< If true, multiple selection is enabled for this control
- CTreeItem::TItemList m_ItemList; ///< List of all root level tree items
- CTreeItem::TItemList m_SelectedItemList; ///< List of all selected tree items, regardless of
- ///whether or not they are root level
- bool m_Refresh;
- bool m_SortFlag;
-
- // Member Functions
- CTreeItem *GetSiblingAfter(CTreeItem *inItem);
- CTreeItem *RecurseGetControlAfter(CTreeItem *inItem);
- CTreeItem *FindPrevSortSibling(CTreeItem *inParent, CTreeItem *inChild);
- CTreeItem *FindNextSortSibling(CTreeItem *inParent, CTreeItem *inChild);
- void AddToRootItemList(CTreeItem *inItem, CTreeItem *inInsertBefore);
- void RemoveFromRootItemList(CTreeItem *inItem);
- void AddToHierarchy(CTreeItem *inItem, CTreeItem *inBefore, bool inIsRecursive);
- void RemoveFromHierarchy(CTreeItem *inItem, bool inIsRecursive);
-
-private:
- /// Private because you can only add CTreeItems to this control with AddItem( ).
- void AddChild(CControl *inControl, CControl *inInsertBefore = nullptr) override;
-
- CMulticaster<CTreeItemSelectionListener *>
- m_SelectionListeners; ///< List of listeners who want to know when a TreeItem is selected
-};
-#endif // INCLUDED_TREE_CONTROL_H
diff --git a/src/Authoring/Studio/Controls/TreeItem.cpp b/src/Authoring/Studio/Controls/TreeItem.cpp
deleted file mode 100644
index b72cb803..00000000
--- a/src/Authoring/Studio/Controls/TreeItem.cpp
+++ /dev/null
@@ -1,953 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TreeItem.h"
-#include "TreeControl.h"
-#include "Renderer.h"
-#include "SIcon.h"
-#include "ResourceCache.h"
-#include "HotKeys.h"
-#include "MasterP.h"
-#include "StudioPreferences.h"
-
-IMPLEMENT_OBJECT_COUNTER(CTreeItem)
-
-//=============================================================================
-/**
- * Constructor
- * @param inTreeControl the tree control that this item will belong to
- */
-CTreeItem::CTreeItem(CTreeControl *inTreeControl)
- : m_TreeControl(inTreeControl)
- , m_Parent(NULL)
- , m_Toggle(NULL)
- , m_Name(NULL)
- , m_Icon(NULL)
- , m_ControlGap(2)
- , m_IndentLevel(0)
- , m_IndentSize(0)
- , m_IsExpanded(false)
- , m_IsSelected(false)
- , m_ShowVisibleSelection(true)
- , m_Color(CStudioPreferences::GetBaseColor())
- , m_TextColor(CStudioPreferences::GetNormalColor())
-{
- ADDTO_OBJECT_COUNTER(CTreeItem)
-
- // Set up some of our flow layout properties
- SetFlowDirection(FLOW_HORIZONTAL);
- SetAlignment(ALIGN_VERT_NEITHER, ALIGN_LEFT);
- SetGapBetweenChildren(m_ControlGap);
- SetMaximumSize(CPt(LONG_MAX, CStudioPreferences::GetDefaultTextEditSize()));
- SetMinimumSize(CPt(0, CStudioPreferences::GetDefaultTextEditSize()));
-
- // Create the toggle
- CreateToggle();
-
- // Icon control
- m_Icon = new CSIcon();
-
- // Name control
- m_Name = new CTextEditInPlace();
- m_Name->SetAlignment(CTextEditInPlace::LEFT);
- m_Name->SetTextColor(m_TextColor);
- m_Name->SetBGColorNoFocus(CStudioPreferences::GetSelectColor());
- m_Name->SetFillBackground(false);
- m_Name->AllowAutoSize(true);
-
- // Name change listener
- m_NameChangeListener =
- new CSpecificCCommitDataListener<CTreeItem>(this, &CTreeItem::OnNameChanged);
- m_Name->AddCommitListener(m_NameChangeListener);
-
- // Toggle listener
- QObject::connect(m_Toggle,&CToggleButton::SigToggle,
- std::bind(&CTreeItem::OnToggleExpansion, this,
- std::placeholders::_1, std::placeholders::_2));
- // Add all the controls to the flow
- AddChild(m_Toggle);
- AddChild(m_Icon);
- AddChild(m_Name);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTreeItem::~CTreeItem()
-{
- m_Name->RemoveCommitListener(m_NameChangeListener);
- delete m_NameChangeListener;
-
- // Clear out our list of subitems, but don't delete anything (whoever called new should do the
- // delete)
- m_ItemList.clear();
- delete m_Toggle;
- delete m_Icon;
- delete m_Name;
-
- REMOVEFROM_OBJECT_COUNTER(CTreeItem)
-}
-
-//=============================================================================
-/**
- * Fills in the background color of this control.
- * @param inRenderer renderer to draw to
- */
-void CTreeItem::Draw(CRenderer *inRenderer)
-{
- inRenderer->FillSolidRect(QRect({}, GetSize()), m_Color);
-}
-
-//=============================================================================
-/**
- * Allows you to set the background color of this control.
- * @param inColor new background color for this control
- */
-void CTreeItem::SetBackgroundColor(const CColor &inColor)
-{
- m_Color = inColor;
- Invalidate();
-}
-
-void CTreeItem::SetTextColor(const CColor &inColor)
-{
- m_Name->SetTextColor(inColor);
- m_TextColor = inColor;
- Invalidate();
-}
-
-void CTreeItem::SetTextBGFocusColor(const ::CColor &inColor)
-{
- m_Name->SetBGColorNoFocus(inColor);
- Invalidate();
-}
-//=============================================================================
-/**
- * @return the current background color of this control
- */
-CColor CTreeItem::GetBackgroundColor()
-{
- return m_Color;
-}
-
-//=============================================================================
-/**
- * Sets the parent of this tree item. The parent is the tree item that can
- * be toggled to hide or show this item. You can set this value to nullptr to
- * specify that this item is a root item, thus making it always be visible.
- * @param inParent parent of this item
- */
-void CTreeItem::SetParentItem(CTreeItem *inParent)
-{
- m_Parent = inParent;
-}
-
-//=============================================================================
-/**
- * Allows you to access the parent of this tree item. Note that this parent is
- * not the same as parenting in the Control hierarchy. The parent is the tree
- * item that can be toggled to hide or show this item.
- * @return the parent of this tree item, or nullptr if this is a root level item.
- */
-CTreeItem *CTreeItem::GetParentItem()
-{
- return m_Parent;
-}
-
-//=============================================================================
-/**
- * Allows you to change the icon associated with this tree item.
- * @param inIcon name of the icon in normal state
- * @param inSelectedIcon name of the icon to be displayed when this item is selected
- */
-void CTreeItem::SetIcon(const QString &inIcon, const QString &inSelectedIcon)
-{
- SetIcon(CResourceCache::GetInstance()->GetBitmap(inIcon),
- CResourceCache::GetInstance()->GetBitmap(inSelectedIcon));
-}
-
-//=============================================================================
-/**
- * Allows you to change the icon associated with this tree item.
- */
-void CTreeItem::SetIcon(const QPixmap &inNormalIcon, const QPixmap &inSelectedIcon)
-{
- m_NormalIcon = inNormalIcon;
- m_SelectedIcon = inSelectedIcon;
-
- m_Icon->SetImage(m_NormalIcon);
-}
-
-//=============================================================================
-/**
- * Allows you to specifiy whether or not the name of this tree item can be edited.
- * If set to true, the user can edit an item's name by double-clicking on it.
- * @param inIsEditable true to specify that the user is allowed to edit this
- * item, otherwise false to prevent double-click editing.
- */
-void CTreeItem::SetIsNameEditable(bool inIsEditable)
-{
- m_Name->SetEditable(inIsEditable);
-}
-
-//=============================================================================
-/**
- * Sets the text displayed by this tree item. This does not trigger a name
- * change event.
- * @param inText text to be displayed
- */
-void CTreeItem::SetText(const Q3DStudio::CString &inText)
-{
- m_Name->SetData(inText);
-}
-
-//=============================================================================
-/**
- * Gets the text displayed by this tree item.
- * @return the text that is displayed.
- */
-Q3DStudio::CString CTreeItem::GetText()
-{
- return m_Name->GetString();
-}
-
-//=============================================================================
-/**
- * Called when the name of the tree item is changed. Notifies any interested
- * listeners. This is only for when the name control is edited directly. If
- * you call SetText directly or change the text by other means, no listeners
- * are notified.
- * @param inControl control that generated the name change message (not used)
- */
-void CTreeItem::OnNameChanged(CControl *inControl)
-{
- Q_UNUSED(inControl);
-
- // Maintain the color scheme based upon whether or not this item is selected
- if (m_ShowVisibleSelection) {
- if (m_IsSelected) {
- m_Name->SetFillBackground(true);
- m_Name->SetTextColor(CColor(255, 255, 255));
- } else {
- m_Name->SetFillBackground(false);
- m_Name->SetTextColor(m_TextColor);
- }
- }
-
- // TODO: notify listeners
-}
-
-//=============================================================================
-/**
- * Allows you to specify the indent level of this tree item. Generally, this
- * is called automatically when adding a child item. An item at level 0 is a
- * root item, an item at level 1 is a child of a root item, and so on. The
- * indent level is multiplied by a fixed amount to cause the control to appear
- * indented.
- * @param inAmount number indicating how many children deep this item is
- * @param inIsRecursive set to true to recursively set the indent level of all
- * children in addition to this item. Each child is set at one more indent
- * level than its parent.
- */
-void CTreeItem::SetIndent(long inAmount, bool inIsRecursive)
-{
- m_IndentLevel = inAmount;
-
- SetLeftMargin((m_IndentLevel * m_IndentSize) + m_ControlGap);
-
- if (inIsRecursive) {
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theChild = *thePos;
- theChild->SetIndent(m_IndentLevel + 1, inIsRecursive);
- }
- }
-}
-
-//=============================================================================
-/**
- * Handles clicking on this item and selects or deselects it appropriately.
- * @param inPoint location of the mouse
- * @param inFlags key modifier states at time of mouse event
- */
-bool CTreeItem::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CFlowLayout::OnMouseDown(inPoint, inFlags)) {
- // If the name is being edited, but was not clicked on, force it to lose focus
- if (m_Name->GetEditMode() && !m_Name->HitTest(inPoint))
- m_Name->OnLoseFocus();
-
- // The item needs to see if the control key is down, because that might mean that it needs
- // to deselect itself
- bool theControlKeyIsDown =
- (inFlags & CHotKeys::MODIFIER_CONTROL) == CHotKeys::MODIFIER_CONTROL;
-
- // If the control key is down and we are currently selected, deselect ourselves
- if (theControlKeyIsDown && IsSelected())
- m_TreeControl->Deselect(this);
- // Otherwise, go ahead and perform a normal select command
- else
- m_TreeControl->Select(this, inFlags);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * If this item is a container, double-click will expand it or collapse it.
- * @param inPoint location of mouse at time of event
- * @param inFlags modifier flags at time of event
- */
-bool CTreeItem::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Let the children have the chance to handle the message
- bool theMessageWasHandled = CFlowLayout::OnMouseDoubleClick(inPoint, inFlags);
-
- // If no one else handled it, we'll just go ahead and expand
- if (!theMessageWasHandled) {
- // If this item is a container, toggle whether or not it's expanded
- if (IsContainer())
- ToggleExpansion();
- }
-
- return theMessageWasHandled;
-}
-
-//=============================================================================
-/**
- * Handles right clicking on this item and selects or deselects it appropriately.
- * @param inPoint location of the mouse
- * @param inFlags key modifier states at time of mouse event
- * @return true if the event was consumed, false if it should continue to propagate
- */
-bool CTreeItem::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- bool theMessageWasHandled = CFlowLayout::OnMouseRDown(inPoint, inFlags);
- if (!theMessageWasHandled) {
- // If the name is being edited, but was not clicked on, force it to lose focus
- if (m_Name->GetEditMode() && !m_Name->HitTest(inPoint))
- m_Name->OnLoseFocus();
-
- // If this item is not already selected
- if (!IsSelected()) {
- // Select this tree item
- m_TreeControl->Select(this, inFlags);
- }
- }
-
- return theMessageWasHandled;
-}
-
-//=============================================================================
-/**
- * @return true if this row is currently expanded (showing it's children).
- */
-bool CTreeItem::IsExpanded()
-{
- return m_IsExpanded;
-}
-
-//=============================================================================
-/**
- * If the row is currently expanded, this call will collapse it, or vice-versa.
- */
-void CTreeItem::ToggleExpansion()
-{
- if (IsExpanded())
- Collapse();
- else
- Expand();
-}
-
-//=============================================================================
-/**
- * Expands this item to reveal all of its children.
- */
-void CTreeItem::Expand()
-{
- QT3DS_PROFILE(Expand);
-
- if (!m_IsExpanded) {
- m_TreeControl->OnItemExpanding(this);
-
- bool theAllowRefresh = m_TreeControl->GetAllowRefresh();
- m_TreeControl->SetAllowRefresh(false);
-
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- theItem->ShowChildItems();
- }
-
- m_IsExpanded = true;
-
- m_TreeControl->SetAllowRefresh(theAllowRefresh);
-
- // Expand/collapse might come from somewhere other than the button itself (see
- // CTreeItem::OnMouseDoubleClick),
- // so make sure we toggle it just in case
- m_Toggle->SetToggleState(true);
-
- m_TreeControl->OnItemExpanded(this);
- }
-}
-
-//=============================================================================
-/**
- * Collapses this row, hiding all of its children
- */
-void CTreeItem::Collapse()
-{
- if (m_IsExpanded) {
- m_TreeControl->OnItemCollapsing(this);
-
- bool theAllowRefresh = m_TreeControl->GetAllowRefresh();
- m_TreeControl->SetAllowRefresh(false);
-
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- theItem->HideChildItems();
- }
-
- m_IsExpanded = false;
-
- // Deselect all children if they are being hidden and see if any children were in fact
- // selected
- // If there were children that were selected, we need to add this item to the selection
- // list, without
- // interfering with the selection state of other items
- if (DeselectChildren()) {
- long theFlags = 0;
-
- // If multiple selection is enabled, we need to make sure that we don't disrupt any
- // other selection,
- // so we simulate a control click on this item (selects this item in addition to
- // whatever is already
- // selected).
- if (m_TreeControl->GetAllowMultipleSelection())
- theFlags = CHotKeys::MODIFIER_CONTROL;
-
- m_TreeControl->Select(this, theFlags);
- }
-
- m_TreeControl->SetAllowRefresh(theAllowRefresh);
-
- // Expand/collapse might come from somewhere other than the button itself (see
- // CTreeItem::OnMouseDoubleClick),
- // so make sure we toggle it just in case
- m_Toggle->SetToggleState(false);
-
- m_TreeControl->OnItemCollapsed(this);
- }
-}
-
-//=============================================================================
-/**
- * Adds a tree item as a child of this one.
- * @param inItem the new item to be added.
- * @param inInsertBefore the item to insert the new one before, or nullptr to
- * insert at the end of the list
- */
-void CTreeItem::AddItem(CTreeItem *inItem, CTreeItem *inInsertBefore /*=nullptr*/)
-{
- inItem->SetIndent(m_IndentLevel + 1, true);
-
- inItem->SetVisible(IsExpanded());
-
- if (!inInsertBefore) {
- m_ItemList.push_back(inItem);
- } else {
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- if (theItem == inInsertBefore) {
- m_ItemList.insert(thePos, inItem);
- break;
- }
- }
- }
-
- inItem->SetParentItem(this);
-
- UpdateToggle();
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * The number of children this item has. Note that this is different than
- * the GetChildCount( ) function on the base class CControl. The "children"
- * counted by this function are the ones that have been added to this control
- * to form a tree by calls to AddItem.
- * @return the number of items added a "child tree items" to this one.
- */
-long CTreeItem::GetNumChildItems()
-{
- return (long)m_ItemList.size();
-}
-
-//=============================================================================
-/**
- * Retrieve the child tree item based on it's position within m_ItemList
- * @param inIndex position of the child tree item
- * @return CTreeItem* ptr to child tree item or nullptr if inIndex is invalid.
- */
-CTreeItem *CTreeItem::GetChildItem(long inIndex)
-{
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- std::advance(thePos, inIndex);
-
- if (thePos != m_ItemList.end())
- return (*thePos);
-
- return nullptr;
-}
-
-//=============================================================================
-/**
- * Retrieve the index of a child tree item based on it's position within
- * m_ItemList.
- * @param inChildItem ptr to the child tree item
- * @return long index to the child tree item or -1 if inChildItem is invalid.
- */
-long CTreeItem::GetChildTreeItemIndex(const CTreeItem *inChildItem) const
-{
- TItemList::const_iterator thePos = m_ItemList.begin();
- TItemList::const_iterator theEnd = m_ItemList.end();
-
- long theItemIndex(-1);
- bool theIsFound(false);
- for (; thePos != theEnd && !theIsFound; ++thePos) {
- ++theItemIndex;
-
- if ((*thePos) == inChildItem)
- theIsFound = true;
- }
-
- if (theIsFound)
- return theItemIndex;
- else
- return -1;
-}
-
-//=============================================================================
-/**
- * Retrieves the necessary iterators for searching through this item's list
- * of children. You should not need to access this directly. This is provided
- * for use by the CTreeControl class.
- * @param outListBegin returns an iterator pointing to the first element in the list
- * @param outListEnd returns an iterator pointing to the last element
- */
-void CTreeItem::GetItemIterator(TItemList::iterator &outListBegin, TItemList::iterator &outListEnd)
-{
- outListBegin = m_ItemList.begin();
- outListEnd = m_ItemList.end();
-}
-
-//=============================================================================
-/**
- * Retrieves the necessary iterators for searching through this item's list
- * of children (in reverse order). You should not need to access this directly.
- * This is provided for use by the CTreeControl class.
- * @param outListBegin returns a reverse iterator pointing to the last element in the list
- * @param outListEnd returns a reverse iterator pointing to the first element
- */
-void CTreeItem::GetReverseItemIterator(TItemList::reverse_iterator &outListBegin,
- TItemList::reverse_iterator &outListEnd)
-{
- outListBegin = m_ItemList.rbegin();
- outListEnd = m_ItemList.rend();
-}
-
-//=============================================================================
-/**
- * An item that is a container has a visible toggle that can be clicked to
- * hide or show its children.
- * @return true if this item is a parent and has children, otherwise false
- */
-bool CTreeItem::IsContainer()
-{
- return m_ItemList.size() > 0;
-}
-
-//=============================================================================
-/**
- * @return true if this item is a root level item, false if it has a parent
- */
-bool CTreeItem::IsRootItem()
-{
- return (!m_Parent);
-}
-
-//=============================================================================
-/**
- * Removes this tree item and all its children from the tree control. Recursively
- * goes through all children and asks them to detach themselves as children of
- * the tree control. No items are actually deleted, as this is deferred to
- * the class that created the items.
- */
-void CTreeItem::RemoveItem()
-{
- // Enable or disable the toggle on the parent accordingly
- if (m_Parent)
- m_Parent->UpdateToggle();
-
- // Recursively remove all children
- RemoveChildren();
-
- // If this item has a parent, ask the parent to remove us from it's list of children
- if (m_Parent)
- m_Parent->RemoveFromList(this);
-
- // Remove this item from the control hierarchy
- m_TreeControl->RemoveChild(this);
-}
-
-//=============================================================================
-/**
- * Updates the visibility of the expand toggle. If the the item is a container,
- * the toggle is shown, otherwise it is hidden.
- */
-void CTreeItem::UpdateToggle()
-{
- QT3DS_PROFILE(UpdateToggle);
-
- bool theEnableToggle = IsContainer();
- bool theToggleIsEnabled = m_Toggle->IsEnabled();
-
- if (theEnableToggle != theToggleIsEnabled) {
- m_Toggle->SetEnabled(theEnableToggle);
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Recursively removes all children from the child list and from the control
- * hierarchy maintained by the tree control.
- */
-void CTreeItem::RemoveChildren()
-{
- // If this item has children
- if (IsContainer()) {
- // Iterate through each child
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- // And recursively remove the child's children
- CTreeItem *theItem = *thePos;
- theItem->RemoveChildren();
-
- // Ask the tree control to remove this child from the control hierarchy
- m_TreeControl->RemoveChild(theItem);
- }
-
- // Clear the child list since we deleted all the children
- m_ItemList.clear();
- }
-}
-
-//=============================================================================
-/**
- * Helper function for item removal. Goes through the list of child items that
- * belongs to this control and removes the specified item from the list.
- * @param inItem item to be removed from list
- */
-void CTreeItem::RemoveFromList(CTreeItem *inItem)
-{
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- if (theItem == inItem) {
- m_ItemList.erase(thePos);
- break;
- }
- }
-}
-
-//=============================================================================
-/**
- * Detaches this item from its parent.
- */
-void CTreeItem::Detach()
-{
- if (m_Parent)
- m_Parent->RemoveFromList(this);
-}
-
-//=============================================================================
-/**
- * @return true if this item is currently selected, otherwise false.
- */
-bool CTreeItem::IsSelected()
-{
- return m_IsSelected;
-}
-
-//=============================================================================
-/**
- * Selects or deselects this row. Color of the selected item changes, as well
- * as the item's icon.
- * @param inIsSelected true to select this item, false to deselect it
- */
-void CTreeItem::SetSelected(bool inIsSelected)
-{
- // If this command is actually resulting in a change of state
- if (m_IsSelected != inIsSelected) {
- m_IsSelected = inIsSelected;
-
- if (m_ShowVisibleSelection) {
- // If the item is to be selected
- if (m_IsSelected) {
- // Change to the selection color
- m_Name->SetFillBackground(true);
-
- if (!m_SelectedIcon.isNull())
- m_Icon->SetImage(m_SelectedIcon);
- }
- // Otherwise, the item is to be deselected
- else {
- // Change to the normal color scheme
- m_Name->SetFillBackground(false);
- m_Name->SetTextColor(m_TextColor);
-
- if (!m_NormalIcon.isNull())
- m_Icon->SetImage(m_NormalIcon);
- }
- }
- }
-}
-
-//=============================================================================
-/**
- * Deselects all children, grandchildren, and so on who are currently selected.
- * @return true if there were any selected children who were deselected
- */
-bool CTreeItem::DeselectChildren()
-{
- bool theChildSelection = false;
-
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theChild = *thePos;
-
- if (theChild->IsContainer()) {
- bool theRecursiveCheck = theChild->DeselectChildren();
- if (!theChildSelection)
- theChildSelection = theRecursiveCheck;
- }
-
- if (theChild->IsSelected()) {
- m_TreeControl->Deselect(theChild);
- theChildSelection = true;
- }
- }
-
- return theChildSelection;
-}
-
-//=============================================================================
-/**
- * Creates the toggle control used by this tree item.
- */
-void CTreeItem::CreateToggle()
-{
- m_Toggle = new CToggleButton();
-
- // Make sure these sizes are accurate
- QSize theImageSize = CResourceCache::GetInstance()->GetBitmap("arrow.png").size();
- m_Toggle->SetUpImage("arrow.png");
-
- m_Toggle->SetDownImage("arrow_down.png");
- m_Toggle->SetDisabledImage("empty-pixel.png");
- m_Toggle->SetAbsoluteSize({theImageSize.width(), theImageSize.height()});
- m_Toggle->SetEnabled(false);
-
- // This is to get around a problem in SetIndent when the parent control is 0
- m_IndentSize = theImageSize.width();
-}
-
-//=============================================================================
-/**
- * Called when the toggle button for this item is clicked on. Expands the item
- * if is currently collapsed, otherwise, collapses the row.
- * @param inButton button that generated this event
- * @param inState state of the button after the toggle event
- */
-void CTreeItem::OnToggleExpansion(CToggleButton *inButton, CButtonControl::EButtonState inState)
-{
- Q_UNUSED(inState);
-
- if (inButton == m_Toggle)
- ToggleExpansion();
-}
-
-//=============================================================================
-/**
- * Recursive function to help change the visiblity of all children of this item.
- */
-void CTreeItem::HideChildItems()
-{
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- theItem->HideChildItems();
- }
-
- SetVisible(false);
-}
-
-//=============================================================================
-/**
- * Recursive function to help change the visiblity of all children of this item.
- * If a child is expanded, this function is called recursively to reveal all of
- * the grandchildren, and so on.
- */
-void CTreeItem::ShowChildItems()
-{
- if (m_Parent)
- SetVisible(m_Parent->IsVisible());
- else
- SetVisible(true);
-
- TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- CTreeItem *theItem = *thePos;
- if (IsExpanded())
- theItem->ShowChildItems();
- }
-}
-
-//=============================================================================
-/**
- * Private function for adding children to this control. The only children
- * should be a toggle, an icon, and a text control for the name. If you
- * need to add another tree item as a "child" of this one, you should use
- * AddItem( ).
- * @param inControl Control to be added as a child to this one
- * @param inInsertBefore Control to insert before in the hierarchy or nullptr to
- * insert at the end of the list.
- */
-void CTreeItem::AddChild(CControl *inControl, CControl *inInsertBefore /*= nullptr*/)
-{
- CFlowLayout::AddChild(inControl, inInsertBefore);
-}
-
-//=============================================================================
-/**
- * Find the item that this item should be added after to maintain sort order.
- */
-CTreeItem *CTreeItem::FindPrevSortSibling(CTreeItem *inChild)
-{
- CTreeItem *theSortItem = nullptr;
-
- // No items in the list - return nullptr (because we don't care)
- if (m_ItemList.size()) {
- CTreeItem::TItemList::iterator thePos = m_ItemList.end();
- for (; thePos != m_ItemList.begin(); --thePos) {
- // Item in the list
- theSortItem = *thePos;
- if (m_TreeControl->IsItemLess(inChild, theSortItem))
- break;
- }
-
- // Last item in the list
- if (thePos == m_ItemList.begin())
- theSortItem = nullptr;
- }
-
- return theSortItem;
-}
-
-//=============================================================================
-/**
- * Find the item that this item should be added before to maintain sort order.
- */
-CTreeItem *CTreeItem::FindNextSortSibling(CTreeItem *inChild)
-{
- CTreeItem *theSortItem = nullptr;
-
- // No items in the list - return nullptr (because we don't care)
- if (m_ItemList.size()) {
- CTreeItem::TItemList::iterator thePos = m_ItemList.begin();
- for (; thePos != m_ItemList.end(); ++thePos) {
- // Item in the list
- theSortItem = *thePos;
- if (m_TreeControl->IsItemLess(inChild, theSortItem))
- break;
- }
-
- // Last item in the list
- if (thePos == m_ItemList.end())
- theSortItem = nullptr;
- }
-
- return theSortItem;
-}
-
-/**
- * Retrieve the edit state of the text edit control associated with this tree item
- */
-bool CTreeItem::GetEditMode()
-{
- if (m_Name) {
- return m_Name->GetEditMode();
- }
-
- return false;
-}
-
-//=============================================================================
-/**
- * Sets whether item is 'visibly' selected
- */
-void CTreeItem::SetVisibleSelection(bool inValue)
-{
- m_ShowVisibleSelection = inValue;
-}
-
-//=============================================================================
-/**
- * Gets whether item is 'visibly' selected
- */
-bool CTreeItem::GetVisibleSelection() const
-{
- return m_ShowVisibleSelection;
-}
diff --git a/src/Authoring/Studio/Controls/TreeItem.h b/src/Authoring/Studio/Controls/TreeItem.h
deleted file mode 100644
index 8d4619df..00000000
--- a/src/Authoring/Studio/Controls/TreeItem.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_TREE_ITEM_H
-#define INCLUDED_TREE_ITEM_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "FlowLayout.h"
-#include "ToggleButton.h"
-#include "TextEditInPlace.h"
-
-#include <QPixmap>
-//==============================================================================
-// Forwards
-//==============================================================================
-class CTreeControl;
-class CRenderer;
-class CSIcon;
-class CTreeItem;
-class CTest_TreeControl;
-
-//=============================================================================
-/**
- * Class encapsulating a single row in a tree control. Manages the toggle, the
- * icon, and the name of the tree item. When you create a tree item you must
- * associate it with a tree control. Then you can specify it's parent when you
- * call AddItem( ).
- */
-class CTreeItem : public QObject, public CFlowLayout
-{
- Q_OBJECT
-public:
- typedef std::vector<CTreeItem *> TItemList;
-
-public:
- CTreeItem(CTreeControl *inTreeControl);
- virtual ~CTreeItem();
-
- DEFINE_OBJECT_COUNTER(CTreeItem)
-
- void Draw(CRenderer *inRenderer) override;
-
- void SetBackgroundColor(const ::CColor &inColor);
- ::CColor GetBackgroundColor();
- void SetTextColor(const ::CColor &inColor);
- void SetTextBGFocusColor(const ::CColor &inColor);
-
- void SetParentItem(CTreeItem *inParent);
- CTreeItem *GetParentItem();
- bool GetEditMode();
-
- virtual void SetIcon(const QString &inIcon,
- const QString &inSelectedIcon);
- virtual void SetIcon(const QPixmap &inNormalIcon, const QPixmap &inSelectedIcon);
- void SetIsNameEditable(bool inIsEditable);
- virtual void SetText(const Q3DStudio::CString &inText);
- virtual Q3DStudio::CString GetText();
- virtual void OnNameChanged(CControl *inControl);
- void SetIndent(long inAmount, bool inIsRecursive);
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- bool IsExpanded();
- virtual void ToggleExpansion();
- virtual void Expand();
- virtual void Collapse();
-
- virtual void AddItem(CTreeItem *inItem, CTreeItem *inInsertBefore = nullptr);
- long GetNumChildItems();
- CTreeItem *GetChildItem(long inIndex);
- long GetChildTreeItemIndex(const CTreeItem *inChildItem) const;
- void GetItemIterator(TItemList::iterator &outListBegin, TItemList::iterator &outListEnd);
- void GetReverseItemIterator(TItemList::reverse_iterator &outListBegin,
- TItemList::reverse_iterator &outListEnd);
- virtual bool IsContainer();
- bool IsRootItem();
- virtual void RemoveItem();
- void UpdateToggle();
- virtual void RemoveChildren();
- void RemoveFromList(CTreeItem *inItem);
- virtual void Detach();
- virtual CTreeItem *FindPrevSortSibling(CTreeItem *inChild);
- virtual CTreeItem *FindNextSortSibling(CTreeItem *inChild);
-
- bool IsSelected();
- virtual void SetSelected(bool inIsSelected);
- bool DeselectChildren();
-
- void SetVisibleSelection(bool inValue);
- bool GetVisibleSelection() const;
-Q_SIGNALS:
- void SigToggle(CControl *);
-
-protected:
- // Member Vars
- CTreeControl *m_TreeControl;
- CTreeItem *m_Parent;
- CToggleButton *m_Toggle;
- CTextEditInPlace *m_Name;
- CCommitDataListener *m_NameChangeListener;
- CSIcon *m_Icon;
- QPixmap m_NormalIcon;
- QPixmap m_SelectedIcon;
- TItemList m_ItemList;
- long m_ControlGap;
- long m_IndentLevel;
- long m_IndentSize;
- bool m_IsExpanded;
- bool m_IsSelected;
- bool m_ShowVisibleSelection;
- ::CColor m_Color;
- ::CColor m_TextColor;
-
- // Member Functions
- void CreateToggle();
- void OnToggleExpansion(CToggleButton *inButton, CButtonControl::EButtonState inState);
- void HideChildItems();
- void ShowChildItems();
-
-private:
- /// Private because no one outside this class should be calling it; use AddItem( ) instead.
- void AddChild(CControl *inControl, CControl *inInsertBefore = nullptr) override;
-};
-#endif // INCLUDED_TREE_ITEM_H
diff --git a/src/Authoring/Studio/Controls/WinRenderer.h b/src/Authoring/Studio/Controls/WinRenderer.h
index 0fda597c..3c56145b 100644
--- a/src/Authoring/Studio/Controls/WinRenderer.h
+++ b/src/Authoring/Studio/Controls/WinRenderer.h
@@ -95,7 +95,7 @@ public:
QRect GetClippingRect() override;
void PushClippingRect(const QRect &inRect) override;
void PopClippingRect() override;
- void PushAbsoluteClippingRect(const QRect &inRect) override {}
+ void PushAbsoluteClippingRect(const QRect &) override {}
void FillHashed(const QRect &inRect, const QColor &inForeGroundColor) override;
QPainter *GetPainter() override;
QPen GetPen(const QColor &inColor, int inWidth, Qt::PenStyle inStyle);
diff --git a/src/Authoring/Studio/Docs/CmdLineOptions.txt b/src/Authoring/Studio/Docs/CmdLineOptions.txt
deleted file mode 100644
index 42610e8a..00000000
--- a/src/Authoring/Studio/Docs/CmdLineOptions.txt
+++ /dev/null
@@ -1,27 +0,0 @@
--t, -test <Test Path> - Runs the specified Unit Test(s) (TEST_CMD_LINE)
--n <File Name> - Normal operation (NORMAL)
--replay - Replay File
--export - Export the file. Usage: Studio.exe -export AMWFilename AMCFilename DOMPath [ slide index(optional and defaults to 1) ]
--silent - Run silent run deep
--refresh - Refresh resources
-
-Unused:
--u, -xml <File Name> - TEST_XML
--i, -testInfo - TEST_INFO
-
-It is possible to stack command line options, with left to right operation precedence. With the exception of
--test and -silent which take effect regardless of ordering. Any failed operations would result in the
-aborting of subsequent operations, and a -1 (failure) value will be returned.
-
-Example 1:
-StudioC -silent -refresh myFile.uip -export myOutput.amc Scene.Layer.Component
-Refreshes the myFile.uip, then exports to myOutput.amc the component found at the indicated DOM path. No dialogs are
-displayed. Error messages are piped to stdout.
-
-Example 2:
-Studio -refresh myFile.uip myOutput.xgf -export
-Refreshes myFile.uip then exports to myOutput.xgf using the XGF exporter.
-
-Example 3:
-StudioC -silent -export myFile.uip -refresh myOutput.avi
-Exports myFile.uip to myOutput.avi THEN refreshes myFile.uip. Error messages are piped to stdout. \ No newline at end of file
diff --git a/src/Authoring/Studio/DragAndDrop/DropProxy.cpp b/src/Authoring/Studio/DragAndDrop/DropProxy.cpp
index 0ed794ce..f0ab1aea 100644
--- a/src/Authoring/Studio/DragAndDrop/DropProxy.cpp
+++ b/src/Authoring/Studio/DragAndDrop/DropProxy.cpp
@@ -117,17 +117,15 @@ CDropSource *CDropProxy::GetDropSource(const QMimeData *inDataObject, long inFla
}
} break;
case QT3DS_FLAVOR_TEXT:
- // Don't do anythiing for this
- case QT3DS_FLAVOR_LISTBOX:
- // Don't do anythiing for this
+ // Don't do anything for this
case QT3DS_FLAVOR_BASIC_OBJECTS:
- // Don't do anythiing for this
+ // Don't do anything for this
case QT3DS_FLAVOR_ASSET_LIB:
- // make an Aset out of this.
+ // make an asset out of this
case QT3DS_FLAVOR_ASSET_TL:
- // make an Aset out of this.
+ // make an asset out of this
case QT3DS_FLAVOR_ASSET_UICFILE:
- // make an Aset out of this.
+ // make an asset out of this
// Get a pointer to the object
theDropSource = dynamic_cast<const CDropSource *>(inDataObject);
if (theDropSource != nullptr && theDropSource->GetFlavor() != inFlavor)
diff --git a/src/Authoring/Studio/DragAndDrop/DropSource.cpp b/src/Authoring/Studio/DragAndDrop/DropSource.cpp
index 190eb95a..ee1f003a 100644
--- a/src/Authoring/Studio/DragAndDrop/DropSource.cpp
+++ b/src/Authoring/Studio/DragAndDrop/DropSource.cpp
@@ -40,7 +40,6 @@
#include "ExplorerFileDropSource.h"
#include "TimelineDropSource.h"
#include "BasicObjectDropSource.h"
-#include "ListBoxDropSource.h"
#include "Views.h"
#include "MainFrm.h"
#include "TimelineWidget.h"
@@ -85,10 +84,6 @@ CDropSource *CDropSourceFactory::Create(long inFlavor, IDragable *inDragable)
{
CDropSource *theDropSource(nullptr);
switch (inFlavor) {
- case QT3DS_FLAVOR_LISTBOX:
- theDropSource = new CListBoxDropSource(inFlavor, inDragable);
- break;
-
case QT3DS_FLAVOR_BASIC_OBJECTS:
theDropSource = new CBasicObjectDropSource(inFlavor, inDragable);
break;
@@ -109,11 +104,6 @@ CDropSource *CDropSourceFactory::Extract(long inFlavor, void *inData, unsigned l
CDropSource *theDropSource(nullptr);
switch (inFlavor) {
// For all of the Studio Flavors we just need to extract the dropsource out of it.
- case QT3DS_FLAVOR_LISTBOX:
- // make an Aset out of this.
- theDropSource = static_cast<CListBoxDropSource *>(inData);
- break;
-
case QT3DS_FLAVOR_BASIC_OBJECTS:
// make an Aset out of this.
theDropSource = static_cast<CBasicObjectDropSource *>(inData);
diff --git a/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.cpp b/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.cpp
deleted file mode 100644
index 04cde06c..00000000
--- a/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ListBoxDropSource.h"
-#include "DropTarget.h"
-#include "ListBoxItem.h"
-#include "IDragable.h"
-
-//===============================================================================
-/**
- * Constructor
- */
-CListBoxDropSource::CListBoxDropSource(long inFlavor, IDragable *inDragable)
- : CDropSource(inFlavor, 0)
-{
- m_Item = reinterpret_cast<CListBoxItem *>(inDragable);
-}
-
-//===============================================================================
-/**
- * Validate that the drop target is QT3DS_FLAVOR_LISTBOX type.
- * @param inTarget Drop target for validation
- * @return true if inTarget is QT3DS_FLAVOR_LISTBOX; false if otherwise
- */
-bool CListBoxDropSource::ValidateTarget(CDropTarget *inTarget)
-{
- bool theValidTarget = (inTarget->GetObjectType() == QT3DS_FLAVOR_LISTBOX);
- SetHasValidTarget(theValidTarget);
-
- return theValidTarget;
-}
-
-//===============================================================================
-/**
- * @return true
- */
-bool CListBoxDropSource::CanMove()
-{
- return true;
-}
-
-//===============================================================================
-/**
- * @return true
- */
-bool CListBoxDropSource::CanCopy()
-{
- return true;
-}
diff --git a/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.h b/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.h
deleted file mode 100644
index a28678d4..00000000
--- a/src/Authoring/Studio/DragAndDrop/ListBoxDropSource.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef __ListBoxDropSource_H__
-#define __ListBoxDropSource_H__
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "DropSource.h"
-
-class CStudioApp;
-class CDropTarget;
-class CListBoxItem;
-
-class CListBoxDropSource : public CDropSource
-{
-protected:
- CListBoxItem *m_Item;
-
-public:
- CListBoxDropSource(long inFlavor, IDragable *inDragable);
-
- bool CanMove() override;
- bool CanCopy() override;
- bool ValidateTarget(CDropTarget *inTarget) override;
-
- CListBoxItem *GetItem() { return m_Item; }
-};
-
-#endif // #ifndef __ListBoxDropSource_H__
diff --git a/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.cpp b/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.cpp
deleted file mode 100644
index f69d0bae..00000000
--- a/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "ListBoxDropTarget.h"
-#include "ListBoxDropSource.h"
-#include "IDragable.h"
-
-//===============================================================================
-/**
- * Constructor
- */
-CListBoxDropTarget::CListBoxDropTarget()
- : m_Item(nullptr)
-{
-}
-
-//===============================================================================
-/**
- * This get called on every DragWithin.
- * Note: the source will validate the target instead of the otherway around.
- * This is because the DropSource knows how to get information from itself without
- * creating an asset. This is mainly for DropSources that have a lazy creation idiom.
- * like files.
- * @param the DropSource in question.
- * @return true if the DropSource likes the DropTarget.
- */
-bool CListBoxDropTarget::Accept(CDropSource &inSource)
-{
- return inSource.ValidateTarget(this);
-}
-
-//===============================================================================
-/**
- * This is where is actually happens.
- * Note: At this point everything should be verified, and setup in the dropsource.
- * The only thing left to do is to get the Assets and move/copy or connect them.
- * @param inSource the Object in question.
- * @return true if the drop was successful .
- */
-bool CListBoxDropTarget::Drop(CDropSource &inSource)
-{
- if (m_Item) {
- inSource;
- /*
- CSlideDropSource* theSlideDropSource = static_cast< CSlideDropSource* >(
- &inSource );
- CSlideControl* theSlideControl = theSlideDropSource->GetSlide( );
- CTimeContext* theTimeContext = theSlideControl->GetTimeContext( );
-
- // Reorder this slide to the position held by this drop target.
- CCmdRearrangeTimeContext* theCommand = new CCmdRearrangeTimeContext( theTimeContext,
- m_SlideInsert->GetInsertIndex( ) );
- if ( theCommand )
- {
- theTimeContext->GetAsset( )->ExecuteCommand( theCommand, false );
- }
- */
- }
-
- // we are always successful
- return true;
-}
-
-//===============================================================================
-/**
- * This will get the objec ttype from the Asset.
- * Note: The asset can change all of the time, so i always ask the asset for its type.
- * @return the Studio object type.
- */
-long CListBoxDropTarget::GetObjectType()
-{
- return QT3DS_FLAVOR_LISTBOX;
-}
-
-//===============================================================================
-/**
- * Set the SlideInsertionControl that is the drop target
- */
-void CListBoxDropTarget::SetItem(CListBoxItem *inItem)
-{
- m_Item = inItem;
-} \ No newline at end of file
diff --git a/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.h b/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.h
deleted file mode 100644
index 44199092..00000000
--- a/src/Authoring/Studio/DragAndDrop/ListBoxDropTarget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 1999-2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef __ListBoxDropTarget_H__
-#define __ListBoxDropTarget_H__
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "DropTarget.h"
-
-class CDropSource;
-class CListBoxItem;
-
-//==============================================================================
-/**
- * @class
- * @brief justin.ebert needs to enter a brief description here.
- *
- * justin.ebert needs to enter a long description here.
- */
-class CListBoxDropTarget : public CDropTarget
-{
-protected:
- CListBoxItem *m_Item; ///< The list item that we can drop on
-
-public:
- CListBoxDropTarget();
- bool Accept(CDropSource &inSource) override;
- bool Drop(CDropSource &inSource) override;
- long GetObjectType() override;
-
- void SetItem(CListBoxItem *inItem);
-};
-
-#endif // #ifndef __ListBoxDropTarget_H__
diff --git a/src/Authoring/Studio/DragAndDrop/TimelineDropSource.cpp b/src/Authoring/Studio/DragAndDrop/TimelineDropSource.cpp
index 3f5a04b8..7779f950 100644
--- a/src/Authoring/Studio/DragAndDrop/TimelineDropSource.cpp
+++ b/src/Authoring/Studio/DragAndDrop/TimelineDropSource.cpp
@@ -149,8 +149,6 @@ CCmd *CTimeLineDropSource::GenerateAssetCommand(qt3dsdm::Qt3DSDMInstanceHandle i
qt3dsdm::Qt3DSDMSlideHandle inSlide)
{
CDoc *theDoc = g_StudioApp.GetCore()->GetDoc();
- CClientDataModelBridge *theBridge = theDoc->GetStudioSystem()->GetClientDataModelBridge();
-
if (CanCopy()) {
SCOPED_DOCUMENT_EDITOR(*theDoc, QObject::tr("Duplicate Object"))
->DuplicateInstances(m_Instances, inTarget,
diff --git a/src/Authoring/Studio/Palettes/Inspector/IEasyInspectorRowListener.h b/src/Authoring/Studio/Palettes/Inspector/IEasyInspectorRowListener.h
deleted file mode 100644
index ced2099b..00000000
--- a/src/Authoring/Studio/Palettes/Inspector/IEasyInspectorRowListener.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2008 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#pragma once
-#include "ToggleButton.h"
-
-//==============================================================================
-// Namespace
-//==============================================================================
-namespace Q3DStudio {
-
-//==============================================================================
-/**
- * Interface for getting callbacks from the EasyInspectorRow
- */
-class IEasyInspectorRowListener
-{
-public: // IEasyInspectorRowListener
- virtual void OnAnimateToggle(CToggleButton::EButtonState inState) = 0;
- virtual void OnLinkToggle() = 0;
-};
-
-} // namespace Q3DStudio
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
index 12427b4f..b4c24b22 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp
@@ -307,7 +307,7 @@ InspectorControlBase* InspectorControlModel::createMaterialItem(Qt3DSDMInspectab
break;
}
- for (size_t matIdx = 0, end = m_materials.size(); matIdx < end; ++matIdx) {
+ for (int matIdx = 0, end = int(m_materials.size()); matIdx < end; ++matIdx) {
if (m_materials[matIdx].m_relativePath == sourcePath)
item->m_value = values[matIdx + 2]; // +2 for standard and referenced materials
}
diff --git a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
index e839f9f2..51e65e56 100644
--- a/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/ObjectListModel.cpp
@@ -79,7 +79,7 @@ int ObjectListModel::rowCount(const QModelIndex &parent) const
const auto handle = handleForIndex(parent);
const auto children = childrenList(m_slideHandle, handle);
- return children.size();
+ return int(children.size());
}
int ObjectListModel::columnCount(const QModelIndex &parent) const
diff --git a/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMInspectorRow.h b/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMInspectorRow.h
index 5d9a79fd..568d9d81 100644
--- a/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMInspectorRow.h
+++ b/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMInspectorRow.h
@@ -32,8 +32,6 @@
// Includes
//==============================================================================
#include "Qt3DSDMHandles.h"
-#include "IEasyInspectorRowListener.h"
-#include "IDataDrivenChangeListener.h"
#include "DispatchListeners.h"
#include "Qt3DSDMMetaDataTypes.h"
#include "CmdBatch.h"
diff --git a/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMMaterialInspectable.cpp b/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMMaterialInspectable.cpp
index 431bf430..3cfb74c3 100644
--- a/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMMaterialInspectable.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/Qt3DSDMMaterialInspectable.cpp
@@ -32,7 +32,6 @@
#include "Qt3DSDMInspectorRow.h"
#include "Core.h"
#include "IDocumentEditor.h"
-#include "GenericComboDropDown.h"
#include "Qt3DSDMHandles.h"
#include "Doc.h"
#include "GenericFunctor.h"
@@ -47,140 +46,6 @@
using namespace qt3dsdm;
-struct SMaterialTypeDropDown : public CGenericComboDropDown
-{
- struct SMaterialEntry
- {
- Q3DStudio::CString m_Name;
- Q3DStudio::CString m_RelativePath;
- bool operator<(const SMaterialEntry &inOther) const { return m_Name < inOther.m_Name; }
- };
- Qt3DSDMInstanceHandle m_Instance;
- Q3DStudio::CAutoMemPtr<CGenericEditCommitListener> m_CommitListener;
- vector<SMaterialEntry> m_Materials;
- CDoc &m_Doc;
- TSignalConnectionPtr m_FileListPtr;
-
- SMaterialTypeDropDown(CDoc &inDoc, Qt3DSDMInstanceHandle inInstance)
- : m_Instance(inInstance)
- , m_Doc(inDoc)
- {
- using Q3DStudio::CString;
- using Q3DStudio::CFilePath;
- m_CommitListener =
- CREATE_LISTENER(CGenericEditCommitListener, SMaterialTypeDropDown, OnDataCommit);
- AddCommitListener(m_CommitListener);
- m_FileListPtr = m_Doc.GetDirectoryWatchingSystem()->AddDirectory(
- m_Doc.GetDocumentDirectory().toQString(),
- std::bind(&SMaterialTypeDropDown::OnFilesChanged, this, std::placeholders::_1));
- }
-
- vector<SMaterialEntry>::iterator GetMaterialEntry(const Q3DStudio::CString &inRelativePath)
- {
- for (size_t idx = 0, end = m_Materials.size(); idx < end; ++idx)
- if (m_Materials[idx].m_RelativePath == inRelativePath)
- return m_Materials.begin() + idx;
- return m_Materials.end();
- }
-
- vector<SMaterialEntry>::iterator
- GetOrCreateMaterialEntry(const Q3DStudio::CString &inRelativePath)
- {
- vector<SMaterialEntry>::iterator retval = GetMaterialEntry(inRelativePath);
- if (retval == m_Materials.end()) {
- m_Materials.push_back(SMaterialEntry());
- m_Materials.back().m_RelativePath = inRelativePath;
- return m_Materials.begin() + m_Materials.size() - 1;
- } else
- return retval;
- }
-
- void OnFilesChanged(const Q3DStudio::TFileModificationList &inFileModificationList)
- {
- for (size_t idx = 0, end = inFileModificationList.size(); idx < end; ++idx) {
- const Q3DStudio::SFileModificationRecord &theRecord = inFileModificationList[idx];
- Q3DStudio::CFilePath relativePath(Q3DStudio::CFilePath::GetRelativePathFromBase(
- m_Doc.GetDocumentDirectory(), theRecord.m_File));
- Q3DStudio::CString extension = relativePath.GetExtension();
- if (extension.CompareNoCase("material")) {
- switch (theRecord.m_ModificationType) {
- case Q3DStudio::FileModificationType::Created:
- case Q3DStudio::FileModificationType::Modified: {
- SMaterialEntry &theEntry =
- *GetOrCreateMaterialEntry(Q3DStudio::CString(relativePath));
- theEntry.m_Name =
- m_Doc.GetDocumentReader().GetCustomMaterialName(
- theRecord.m_File.toCString());
- } break;
- case Q3DStudio::FileModificationType::Destroyed: {
- vector<SMaterialEntry>::iterator theEntry = GetMaterialEntry(relativePath);
- if (theEntry != m_Materials.end())
- m_Materials.erase(theEntry);
- } break;
-
- default: // don't care.
- break;
- }
- }
- }
-
- std::sort(m_Materials.begin(), m_Materials.end());
-
- RefreshAllItems();
- }
-
- void RefreshAllItems()
- {
- RemoveAllItems();
- AddItem("Standard Material");
- AddItem("Referenced Material");
- CClientDataModelBridge *theBridge = m_Doc.GetStudioSystem()->GetClientDataModelBridge();
- long selectIdx = 0;
- EStudioObjectType theType = theBridge->GetObjectType(m_Instance);
-
- if (theType == OBJTYPE_REFERENCEDMATERIAL)
- selectIdx = 1;
-
- Q3DStudio::CString sourcePath = theBridge->GetSourcePath(m_Instance);
-
- for (size_t matIdx = 0, end = m_Materials.size(); matIdx < end; ++matIdx) {
- AddItem(m_Materials[matIdx].m_Name);
- if (m_Materials[matIdx].m_RelativePath.Compare(sourcePath))
- selectIdx = (long)matIdx + 2;
- }
-
- SelectItem(selectIdx, false);
- }
-
- // Note that the this object is probably deleted when this happens or will be during its
- // execution.
- static void DoChangeObjectType(CDoc *inDoc, const Q3DStudio::CString &inNewType,
- Qt3DSDMInstanceHandle instance)
- {
- using namespace Q3DStudio;
- SCOPED_DOCUMENT_EDITOR(*inDoc, QObject::tr("Set Property"))->SetMaterialType(instance,
- inNewType);
- }
-
- void OnDataCommit()
- {
- using Q3DStudio::CString;
- size_t item = this->GetSelectedItem();
- if (item >= 0) {
- CString selectedType = this->GetItemText(this->GetSelectedItem());
- if (item > 1) {
- size_t matIdx = item - 2;
- if (matIdx < m_Materials.size())
- selectedType = m_Materials[matIdx].m_RelativePath;
- }
- // Fire a command to do this later because we will get screwed if we don't as we will be
- // deleted during this process.
- g_StudioApp.GetCore()->GetDispatch()->FireOnAsynchronousCommand(
- std::bind(&DoChangeObjectType, &m_Doc, selectedType, m_Instance));
- }
- }
-};
-
Qt3DSDMMaterialInspectorGroup::Qt3DSDMMaterialInspectorGroup(
CStudioApp &inApp,
const QString &inName,
diff --git a/src/Authoring/Studio/Palettes/PaletteManager.cpp b/src/Authoring/Studio/Palettes/PaletteManager.cpp
index fbac281d..02ec8324 100644
--- a/src/Authoring/Studio/Palettes/PaletteManager.cpp
+++ b/src/Authoring/Studio/Palettes/PaletteManager.cpp
@@ -120,7 +120,6 @@ CPaletteManager::CPaletteManager(CMainFrame *inMainFrame)
m_timelineWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
WidgetControl *timeLineWidgetControl = new WidgetControl(m_timelineWidget, m_timelineDock);
timeLineWidgetControl->RegisterForDnd(timeLineWidgetControl);
- timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_LISTBOX);
timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_FILE);
timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_ASSET_UICFILE);
timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_ASSET_LIB);
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp
index 0e7b0b19..daa03983 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp
@@ -255,4 +255,5 @@ ITimelineItemBinding *CLayerTimelineItemBinding::GetOrCreateBinding(Qt3DSDMInsta
} else
return m_TransMgr->GetOrCreate(instance);
}
+ return nullptr;
}
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
index f1e5c9cc..4704d70b 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
@@ -689,7 +689,7 @@ void Qt3DSDMTimelineItemBinding::getTimeContextIndices(const QSet<int> &children
for (size_t current = 0; current < count; ++current) {
auto handle = graphChildren.GetResult(current);
if (children.contains(handle))
- indexMap.insert(current, int(handle));
+ indexMap.insert(int(current), int(handle));
}
}
}
diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro
index 68b0a740..a64f81bb 100644
--- a/src/Authoring/Studio/Qt3DStudio.pro
+++ b/src/Authoring/Studio/Qt3DStudio.pro
@@ -29,7 +29,6 @@ INCLUDEPATH += \
Palettes/Progress \
Palettes/Project \
Palettes/Slide \
- Palettes/Splash \
Palettes/Timeline \
Palettes/TimelineGraphicsView \
Palettes/TimelineGraphicsView/ui \
@@ -125,12 +124,7 @@ HEADERS += \
Application/SubPresentationListDlg.h \
Application/TimeEditDlg.h \
Application/TimeEnums.h \
- Controls/BreadCrumbControl.h \
- Controls/ButtonControl.h \
Controls/ClickableLabel.h \
- Controls/TextEditContextMenu.h \
- Controls/ToggleButton.h \
- Controls/TreeItem.h \
Controls/WidgetControl.h \
DragAndDrop/DropProxy.h \
Palettes/Action/ActionContextMenu.h \
@@ -246,45 +240,13 @@ SOURCES += \
Application/SubPresentationListDlg.cpp \
Application/TimeEditDlg.cpp \
Controls/AppFonts.cpp \
- Controls/BaseMeasure.cpp \
- Controls/BlankControl.cpp \
- Controls/BreadCrumbControl.cpp \
Controls/BufferedRenderer.cpp \
- Controls/ButtonControl.cpp \
Controls/ClickableLabel.cpp \
Controls/Control.cpp \
Controls/ControlData.cpp \
Controls/ControlGraph.cpp \
- Controls/FloatEdit.cpp \
- Controls/FlowLayout.cpp \
- Controls/InsertionLine.cpp \
- Controls/InsertionOverlay.cpp \
- Controls/LazyFlow.cpp \
- Controls/ListBoxItem.cpp \
- Controls/ListBoxStringItem.cpp \
- Controls/ListLayout.cpp \
- Controls/NameEdit.cpp \
Controls/OffscreenRenderer.cpp \
- Controls/OverlayControl.cpp \
Controls/Renderer.cpp \
- Controls/ScrollController.cpp \
- Controls/Scroller.cpp \
- Controls/ScrollerBackground.cpp \
- Controls/ScrollerBar.cpp \
- Controls/ScrollerButtonControl.cpp \
- Controls/ScrollerThumb.cpp \
- Controls/SIcon.cpp \
- Controls/SplashControl.cpp \
- Controls/SplitBar.cpp \
- Controls/Splitter.cpp \
- Controls/StringEdit.cpp \
- Controls/TextEdit.cpp \
- Controls/TextEditContextMenu.cpp \
- Controls/TextEditInPlace.cpp \
- Controls/TimeEdit.cpp \
- Controls/ToggleButton.cpp \
- Controls/TreeControl.cpp \
- Controls/TreeItem.cpp \
Controls/WidgetControl.cpp \
Controls/WinRenderer.cpp \
DragAndDrop/BasicObjectDropSource.cpp \
@@ -294,8 +256,6 @@ SOURCES += \
DragAndDrop/DropTarget.cpp \
DragAndDrop/ExplorerFileDropSource.cpp \
DragAndDrop/FileDropSource.cpp \
- DragAndDrop/ListBoxDropSource.cpp \
- DragAndDrop/ListBoxDropTarget.cpp \
DragAndDrop/ProjectDropTarget.cpp \
DragAndDrop/SceneDropTarget.cpp \
DragAndDrop/TimelineDropSource.cpp \