summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2018-02-22 15:34:20 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-02-28 13:47:13 +0000
commit6741e0b808aef4992c81df1128b8db0f8113f49f (patch)
treee6d96b203c2a2f67ac84d7e038b4c25ed67772dc /src/Authoring/Studio
parent26a16b56b39f3904c382c392d7ed958fab73108b (diff)
Implement graphics view based timeline basics
Add rows, reorder rows, keyframes Task-number: QT3DS-927 Change-Id: Iaff7354fd5d5b8feaa86364d1b545a48cc3c0376 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio')
-rw-r--r--src/Authoring/Studio/MainFrm.cpp35
-rw-r--r--src/Authoring/Studio/MainFrm.h2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.cpp64
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.cpp445
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.h110
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.cpp612
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.h120
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.cpp187
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.h80
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.cpp693
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.h128
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.cpp176
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.cpp309
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.h107
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/FilterToolbar.cpp272
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/FilterToolbar.h80
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Playhead.cpp266
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Playhead.h82
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyRow.h2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.cpp313
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.h104
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.cpp521
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.h103
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.cpp376
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.h95
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.cpp115
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.cpp196
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateRow.cpp5
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateRowUI.cpp155
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.cpp157
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.h67
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.cpp374
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.h87
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimeMeasure.cpp340
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimeMeasure.h74
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimebarControl.cpp694
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimebarControl.h144
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimebarTip.cpp235
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimebarTip.h84
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Timeline.qml1
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineControl.cpp605
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineControl.h161
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.cpp67
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.h56
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.cpp719
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.h157
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.cpp338
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.h118
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp46
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.cpp86
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.h60
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleControl.cpp181
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleControl.h61
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.cpp200
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.h78
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.cpp83
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.h63
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/Keyframe.h53
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp417
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.h77
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp223
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.h (renamed from src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.h)63
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp144
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h (renamed from src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.h)51
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowTypes.h92
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp (renamed from src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.cpp)58
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h55
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineConstants.h71
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp657
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h115
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.cpp34
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.h39
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.cpp39
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.h (renamed from src/Authoring/Studio/Palettes/Timeline/SlideRowUI.h)25
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp216
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h (renamed from src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.h)43
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.cpp59
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.h (renamed from src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.h)43
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.cpp103
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.h58
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp435
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h96
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp481
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h104
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.cpp118
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.h (renamed from src/Authoring/Studio/Palettes/Timeline/StateRowUI.h)44
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.cpp (renamed from src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.h)68
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.h50
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.cpp43
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.h55
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp111
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h65
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.cpp (renamed from src/Authoring/Studio/Palettes/Timeline/SlideRowUI.cpp)42
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.h49
-rw-r--r--src/Authoring/Studio/Qt3DStudio.pro84
-rw-r--r--src/Authoring/Studio/_Win/Palettes/PaletteManager.cpp75
-rw-r--r--src/Authoring/Studio/_Win/Palettes/PaletteManager.h9
-rw-r--r--src/Authoring/Studio/_Win/UI/TimeLineToolbar.cpp340
-rw-r--r--src/Authoring/Studio/_Win/UI/TimeLineToolbar.h85
-rw-r--r--src/Authoring/Studio/_Win/UI/TimeLineToolbar.ui226
-rw-r--r--src/Authoring/Studio/images.qrc1
-rw-r--r--src/Authoring/Studio/images/playback_tools_low-04.pngbin0 -> 257 bytes
111 files changed, 4362 insertions, 12055 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index a5b0af09..d869fda7 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -635,8 +635,9 @@ void CMainFrame::OnTimelineDeleteSelectedKeyframes()
*/
void CMainFrame::OnUpdateTimelineDeleteSelectedKeyframes()
{
- m_ui->actionDelete_Selected_Keyframe_s->setEnabled(
- g_StudioApp.GetCore()->GetDoc()->GetKeyframesManager()->HasSelectedKeyframes());
+ // TODO: reimplement in the new timeline
+// m_ui->actionDelete_Selected_Keyframe_s->setEnabled(
+// g_StudioApp.GetCore()->GetDoc()->GetKeyframesManager()->HasSelectedKeyframes());
}
//==============================================================================
@@ -651,8 +652,9 @@ void CMainFrame::OnUpdateTimelineDeleteSelectedKeyframes()
*/
void CMainFrame::OnUpdateTimelineSetInterpolation()
{
- m_ui->actionSet_Interpolation->setEnabled(
- g_StudioApp.GetCore()->GetDoc()->GetKeyframesManager()->HasSelectedKeyframes());
+ // TODO: reimplement at a later stage of the new timeline, leaving it here for reference
+// m_ui->actionSet_Interpolation->setEnabled(
+// g_StudioApp.GetCore()->GetDoc()->GetKeyframesManager()->HasSelectedKeyframes());
}
//==============================================================================
@@ -1063,13 +1065,10 @@ void CMainFrame::RegisterGlobalKeyboardShortcuts(CHotKeys *inHotKeys, QWidget *a
m_SceneView->RegisterGlobalKeyboardShortcuts(inHotKeys);
- CTimelineControl *theTimelineControl = GetTimelineControl();
- if (theTimelineControl)
- theTimelineControl->RegisterGlobalKeyboardShortcuts(inHotKeys, actionParent);
-
- TimelineView *theTimelineView = GetTimelineView();
- if (theTimelineView)
- theTimelineView->RegisterGlobalKeyboardShortcuts(inHotKeys, actionParent);
+ // TODO: reimplement in the new timeline
+// TimelineView *theTimelineView = GetTimelineView();
+// if (theTimelineView)
+// theTimelineView->RegisterGlobalKeyboardShortcuts(inHotKeys, actionParent);
}
//==============================================================================
@@ -1805,11 +1804,6 @@ void CMainFrame::OnConnectionChanged(bool connected)
g_StudioApp.GetCore()->GetDispatch()->FireOnProgressEnd();
}
-CTimelineControl *CMainFrame::GetTimelineControl()
-{
- return m_PaletteManager->GetTimelineControl();
-}
-
TimelineView *CMainFrame::GetTimelineView()
{
return m_PaletteManager->GetTimelineView();
@@ -1817,12 +1811,13 @@ TimelineView *CMainFrame::GetTimelineView()
ITimelineTimebar *CMainFrame::GetSelectedTimelineTimebar()
{
- Qt3DSDMTimelineItemBinding *theTimelineItemBinding =
- GetTimelineControl()->GetTranslationManager()->GetSelectedBinding();
- if (theTimelineItemBinding == NULL)
+ // TODO: reimplement after finishing the new timeline
+// Qt3DSDMTimelineItemBinding *theTimelineItemBinding =
+// GetTimelineControl()->GetTranslationManager()->GetSelectedBinding();
+// if (theTimelineItemBinding == NULL)
return NULL;
- return theTimelineItemBinding->GetTimelineItem()->GetTimebar();
+// return theTimelineItemBinding->GetTimelineItem()->GetTimebar();
}
CRecentItems *CMainFrame::GetRecentItems()
diff --git a/src/Authoring/Studio/MainFrm.h b/src/Authoring/Studio/MainFrm.h
index 602c1c25..f86e7f3d 100644
--- a/src/Authoring/Studio/MainFrm.h
+++ b/src/Authoring/Studio/MainFrm.h
@@ -52,7 +52,6 @@ class CPaletteManager;
class CRecentItems;
class CSceneView;
class CStudioApp;
-class CTimelineControl;
class ITimelineTimebar;
class RemoteDeploymentSender;
class TimelineView;
@@ -225,7 +224,6 @@ public:
void OnTimeBarColorChanged(const QColor &color);
- CTimelineControl *GetTimelineControl();
ITimelineTimebar *GetSelectedTimelineTimebar();
TimelineView *GetTimelineView();
diff --git a/src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.cpp b/src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.cpp
deleted file mode 100644
index 48fe8993..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.cpp
+++ /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
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "AreaBoundingRect.h"
-#include "Renderer.h"
-#include "CColor.h"
-
-//=============================================================================
-/**
- * Draws the rectangle.
- */
-void CAreaBoundingRect::Draw(CRenderer *inRenderer)
-{
- CPt theSize = GetSize();
- inRenderer->PushPen(CColor(89, 120, 223));
-
- // Removed because alpha doesn't work on Mac
- // CColor theOverlayColor( 184, 198, 246 );
- // inRenderer->FillSolidRect( CPt( theSize.x - 1, theSize.y - 1 ) ), theOverlayColor );
-
- // Draw the rectangle outline
- if (theSize.y > 1 && theSize.x > 1) {
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(0, theSize.y - 1));
- inRenderer->LineTo(CPt(theSize.x - 1, theSize.y - 1));
- inRenderer->LineTo(CPt(theSize.x - 1, 0));
- inRenderer->LineTo(CPt(0, 0));
- }
- inRenderer->PopPen();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.cpp
deleted file mode 100644
index 911861ee..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.cpp
+++ /dev/null
@@ -1,445 +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 "AssetTimelineKeyframe.h"
-#include "StateTimebarlessRow.h"
-#include "Renderer.h"
-#include "MasterP.h"
-#include "StateRow.h"
-#include "StateRowUI.h"
-#include "KeyframeContextMenu.h"
-#include "HotKeys.h"
-#include "ResourceCache.h"
-#include "ITimelineControl.h"
-#include "Bindings/ITimelineItemBinding.h"
-#include "StudioUtils.h"
-#include "TimeEditDlg.h"
-#include "TimelineUIFactory.h"
-#include "AbstractTimelineRowUI.h"
-
-CAssetTimelineKeyframe::CAssetTimelineKeyframe(CStateTimebarlessRow *inParentRow,
- double inTimeRatio)
- : m_Selected(false)
- , m_ParentRow(inParentRow)
- , m_IsMouseDown(false)
- , m_IsDragging(false)
- , m_TimeRatio(inTimeRatio)
-{
- CResourceCache *theCache = CResourceCache::GetInstance();
- m_Icon = theCache->GetBitmap("Keyframe-Master-Normal.png");
- m_DisabledIcon = theCache->GetBitmap("Keyframe-Master-Disabled.png");
- m_SelectedIcon = theCache->GetBitmap("Keyframe-Master-Selected.png");
- m_DynamicIcon = theCache->GetBitmap("Keyframe-MasterDynamic-Normal.png");
- m_DynamicSelectedIcon = theCache->GetBitmap("Keyframe-MasterDynamic-Selected.png");
-
- m_RightIcon = theCache->GetBitmap("Keyframe-MasterRight-Normal.png");
- m_RightDisabledIcon = theCache->GetBitmap("Keyframe-MasterRight-disabled.png");
- m_RightSelectedIcon = theCache->GetBitmap("Keyframe-MasterRight-Selected.png");
- m_RightDynamicIcon = theCache->GetBitmap("Keyframe-MasterRightDynamic-Normal.png");
- m_RightDynamicSelectedIcon = theCache->GetBitmap("Keyframe-MasterRightDynamic-Selected.png");
-
- m_LeftIcon = theCache->GetBitmap("Keyframe-MasterLeft-Normal.png");
- m_LeftDisabledIcon = theCache->GetBitmap("Keyframe-MasterLeft-disabled.png");
- m_LeftSelectedIcon = theCache->GetBitmap("Keyframe-MasterLeft-Selected.png");
- m_LeftDynamicIcon = theCache->GetBitmap("Keyframe-MasterLeftDynamic-Normal.png");
- m_LeftDynamicSelectedIcon = theCache->GetBitmap("Keyframe-MasterLeftDynamic-Selected.png");
-
- m_RectOverHandled = false;
- m_PreviousSelectState = false;
-}
-
-CAssetTimelineKeyframe::~CAssetTimelineKeyframe()
-{
-}
-
-//=============================================================================
-/**
- * SetRectOverHandled: Sets if mouse rectangle has been handled
- * param@ inState indicates if the rectangle over has been handled.
- * return@ NONE
- */
-
-void CAssetTimelineKeyframe::SetRectOverHandled(bool inState)
-{
- m_RectOverHandled = inState;
-}
-
-//=============================================================================
-/**
- * GetRectOverHandled: GetRectOverHandled
- * param@ NONE
- * return@ m_RectOverHandled, which indicates if the rectangle over has been handled
- */
-bool CAssetTimelineKeyframe::GetRectOverHandled()
-{
- return m_RectOverHandled;
-}
-
-//=============================================================================
-/**
- * SetPreviousSelectState: Sets if the current keyframe was previously selected
- * param@ inState is used to set m_PreviousSelectState.
- * return@ NONE
- */
-void CAssetTimelineKeyframe::SetPreviousSelectState(bool inState)
-{
- m_PreviousSelectState = inState;
-}
-
-//=============================================================================
-/**
- * GetPreviousSelectState: Returns the keyframe's previous select state
- * param@ NONE
- * return@ m_PreviousSelectState that stores the select state for the keyframe
- */
-bool CAssetTimelineKeyframe::GetPreviousSelectState()
-{
- return m_PreviousSelectState;
-}
-
-//=============================================================================
-/**
-* Updates the ToolTip and moves it to the correct place on screen.
-* @param inPoint the point that the tooltip is supposed to be placed.
-*/
-void CAssetTimelineKeyframe::RefreshToolTip(CPt inPoint)
-{
- Q3DStudio::CString theCommentText;
- CStateRowUI *theStateRow = m_ParentRow->GetStateRowUI();
- CRct theTimelineBounds(theStateRow->GetTopControl()->GetBounds());
-
- // format label
- theCommentText = " " + ::FormatTimeString(GetTime());
-
- inPoint.y = GetPosition().y - GetSize().y;
- inPoint.x = GetSize().x / 2;
- ShowMoveableWindow(inPoint, theCommentText, theTimelineBounds);
-}
-
-//=============================================================================
-/**
- * Gets the correct image and draws
- */
-void CAssetTimelineKeyframe::Draw(CRenderer *inRenderer)
-{
- inRenderer->DrawBitmap(CPt(0, 0), GetImage());
-}
-
-//=============================================================================
-/**
- * Gets the name of the current bitmap depending on the state of the button,
- * postion of the mouse, etc. Returns name of the image for the up state by
- * default.
- * @return name of the image representing current state of the button
- */
-QPixmap CAssetTimelineKeyframe::GetImage() const
-{
- QPixmap theImage = m_Icon;
- auto baseStateRow = static_cast<CBaseStateRow *>(m_ParentRow->GetStateRowUI()->GetTimelineRow());
- long theStartTime = baseStateRow->GetStartTime();
- long theEndTime = baseStateRow->GetEndTime();
-
- if (theStartTime == m_Time) {
- theImage = m_LeftIcon;
- if (!IsEnabled())
- theImage = m_LeftDisabledIcon;
- else if (m_IsDynamic) {
- if (m_Selected)
- return m_LeftDynamicSelectedIcon;
- else
- return m_LeftDynamicIcon;
- } else if (m_Selected)
- theImage = m_LeftSelectedIcon;
- } else if (theEndTime == m_Time) {
- theImage = m_RightIcon;
- if (!IsEnabled())
- theImage = m_RightDisabledIcon;
- else if (m_IsDynamic) {
- if (m_Selected)
- return m_RightDynamicSelectedIcon;
- else
- return m_RightDynamicIcon;
- } else if (m_Selected)
- theImage = m_RightSelectedIcon;
- } else {
- if (!IsEnabled())
- theImage = m_DisabledIcon;
- else if (m_IsDynamic) {
- if (m_Selected)
- return m_DynamicSelectedIcon;
- else
- return m_DynamicIcon;
- } else if (m_Selected)
- theImage = m_SelectedIcon;
- }
- return theImage;
-}
-
-//=============================================================================
-/**
- * @return true if the mouse is over the keyframe
- * @param inPoint the point where the mouse is
- */
-bool CAssetTimelineKeyframe::HitTest(const CPt &inPoint) const
-{
- bool theRetVal = false;
- // If not over the control then don't bother with specific checks
- if (CControl::HitTest(inPoint)) {
- // If the key is at the beginning or end of the timebar then calculate the test differently
- auto baseStateRow = static_cast<CBaseStateRow *>(m_ParentRow->GetStateRowUI()->GetTimelineRow());
- long theStartTime = baseStateRow->GetStartTime();
- long theEndTime = baseStateRow->GetEndTime();
- CPt thePoint = inPoint - GetPosition();
- if (theStartTime == m_Time)
- theRetVal = (thePoint.x > 7);
- else if (theEndTime == m_Time)
- theRetVal = (thePoint.x < 9);
- else {
- if (m_Selected)
- theRetVal = (thePoint.x > 1 && thePoint.x < 15);
- else
- theRetVal = (thePoint.x > 3 && thePoint.x < 13);
- }
- }
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * Handler for left mouse down events.
- * @param inPoint the point where the mouse is
- * @param inFlags indicates modifier keys that were down at time of the event
- */
-bool CAssetTimelineKeyframe::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Store the mouse down location in screen coordinates so that we can check the dragging buffer
- // in OnMouseMove
- m_MouseDownLoc = inPoint;
-
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- bool theClearPreviouslySelectedKeys = false;
- bool theSelectedFlag = false;
- // If the control key is down then we change state, otherwise
- if (!((CHotKeys::MODIFIER_CONTROL & inFlags) == CHotKeys::MODIFIER_CONTROL)) {
- theClearPreviouslySelectedKeys = !m_Selected; // clear if not multi-selecting
- theSelectedFlag = true;
- } else {
- theSelectedFlag = !m_Selected;
- }
- m_ParentRow->OnKeySelected(m_Time, theSelectedFlag, theClearPreviouslySelectedKeys);
- m_Selected = theSelectedFlag; // set this after OnKeySelected, because the function may
- // clear out all previously selected keys including this
- // TODO : sk - 1-1 mapping of seemingly useless calls in
- // CPropertyTimelineKeyframe::OnMouseDown, see my comments there.
- // m_StudioDoc->UpdateClientScene( true );
- // m_ParentRow->GetStateRow( )->GetState( )->FireAnimatedPropertiesChanged( );
-
- m_IsMouseDown = true;
- auto theStateRow = static_cast<CBaseStateRow *>(m_ParentRow->GetStateRowUI()->GetTimelineRow());
- long theStartTime = theStateRow->GetStartTime();
- long theEndTime = theStateRow->GetEndTime();
- m_Snapper.SetStartEndTime(theStartTime, theEndTime);
- m_Snapper.SetSource(this);
- m_Snapper.SetKeyFrameClicked(true);
- m_Snapper.SetSnappingSelectedKeyframes(false);
-
- m_ParentRow->GetStateRowUI()->GetTimebar()->GetSnappingListProvider().PopulateSnappingList(&m_Snapper);
- m_Snapper.BeginDrag(inPoint.x);
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
- return true;
-}
-
-//=============================================================================
-/**
- * Handler for right mouse down events.
- * @param inPoint the point where the mouse is
- * @param inFlags indicates modifier keys that were down at time of the event
- */
-bool CAssetTimelineKeyframe::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseRDown(inPoint, inFlags)) {
- if (!m_Selected) {
- m_Selected = true;
- m_ParentRow->OnKeySelected(m_Time, m_Selected, true);
- }
- ITimelineItemProperty *iProperty = nullptr;
- if (GetTimelineItemBinding()->GetPropertyCount() > 0) {
- iProperty = GetTimelineItemBinding()->GetProperty(0);
- }
- CKeyframeContextMenu theMenu(GetTimelineItemBinding()->GetKeyframesManager(), iProperty);
- theMenu.SetTime(GetTime());
- DoPopup(&theMenu, inPoint);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * called when this key is selected
- *
- * @param inState the state this key is selected to
- */
-void CAssetTimelineKeyframe::Select(bool inState)
-{
- if (m_Selected != inState) {
- m_Selected = inState;
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * handler for the mouse up event
- * @param inFlags the state of things when the mouse button was released
- * @param inPoint the point where the mouse is
- */
-void CAssetTimelineKeyframe::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
- m_IsMouseDown = false;
- m_IsDragging = false;
-
- GetTimelineItemBinding()->CommitChangedKeyframes();
-
- HideMoveableWindow();
- Invalidate();
-}
-
-//=============================================================================
-/**
- * handler for the onMouse Move event. Offsets selected keys.
- * Displays the StudioToolTip for the keyframe, showing the time it is at.
- *
- * @param inFlags the state of things when the mouse was moved
- * @param inPoint the point where the mouse is
- */
-void CAssetTimelineKeyframe::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
- QT3DS_PROFILE(OnMouseMove);
- // If the mouse is down and this is slected, then offst the keys
- if (m_IsMouseDown && m_Selected) {
- // If we are not yet dragging the keyframe
- if (!m_IsDragging) {
- long theDiff = ::abs(inPoint.x) - m_MouseDownLoc.x;
- // Figure out if the mouse has moved far enough to start the drag, and readjust the drag
- // postion on the snapper
- m_IsDragging = (::abs(theDiff) > DRAGBUFFER);
- if (m_IsDragging && (::abs(theDiff) - DRAGBUFFER) > 2) {
- m_Snapper.BeginDrag(m_MouseDownLoc.x);
- } else
- m_Snapper.BeginDrag(inPoint.x);
- }
-
- // If we are now dragging, procceed as normal
- if (m_IsDragging) {
- long theNewTime = m_Snapper.ProcessDrag(m_Time, inPoint.x, inFlags);
- long theDiffTime = theNewTime - m_Time;
-
- if (theDiffTime != 0) {
- // theDiffTime can get updated if its invalid.
- theDiffTime = GetTimelineItemBinding()->OffsetSelectedKeyframes(theDiffTime);
- // Set this key's time so it won't be recalced in Refresh keyframes in the row
- SetTime(m_Time + theDiffTime);
-
- Invalidate();
- }
- }
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
-}
-
-//=============================================================================
-/**
- * Sets the time ratio
- *
- * @param inTimeRatio the new ratio
- */
-void CAssetTimelineKeyframe::SetTimeRatio(double inTimeRatio)
-{
- m_TimeRatio = inTimeRatio;
- CPt theSize = GetSize();
- SetPosition(::TimeToPos(GetTime(), m_TimeRatio) - (theSize.x / 2), 0);
-}
-
-//=============================================================================
-/**
- * Pass the double click notification on to the row and have it process it.
- * The row will do object-specific actions on doubleclicks.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- * @return true stating that the event was processed.
- */
-bool CAssetTimelineKeyframe::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
-
- GetTimelineItemBinding()->OnEditKeyframeTime(m_Time, ASSETKEYFRAME);
- m_IsMouseDown = false;
- m_IsDragging = false;
- return true;
-}
-
-//=============================================================================
-/**
- * @return true if selected
- */
-bool CAssetTimelineKeyframe::IsSelected()
-{
- return m_Selected;
-}
-
-void CAssetTimelineKeyframe::SetSize(CPt inSize)
-{
- CControl::SetSize(inSize);
-}
-
-//=============================================================================
-/**
- *
- */
-ITimelineItemBinding *CAssetTimelineKeyframe::GetTimelineItemBinding() const
-{
- return m_ParentRow->GetStateRowUI()->GetTimelineRow()->GetTimelineItemBinding();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.h
deleted file mode 100644
index 54a8b501..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/AssetTimelineKeyframe.h
+++ /dev/null
@@ -1,110 +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_ASSET_TIMELINE_KEYFRAME
-#define INCLUDED_ASSET_TIMELINE_KEYFRAME 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "TimelineKeyframe.h"
-#include "Snapper.h"
-
-#include <QPixmap>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-class CStateTimebarlessRow;
-class ITimelineItemBinding;
-
-class CAssetTimelineKeyframe : public CControl, public CTimelineKeyframe
-{
-
-public:
- CAssetTimelineKeyframe(CStateTimebarlessRow *inParentRow, double inTimeRatio);
- ~CAssetTimelineKeyframe();
-
- void Draw(CRenderer *inRenderer) override;
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void Select(bool inState);
- void SetTimeRatio(double inTimeRatio);
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool IsSelected();
- void SetSize(CPt inSize) override;
- bool HitTest(const CPt &inPoint) const override;
- void SetRectOverHandled(bool inState);
- bool GetRectOverHandled();
- void SetPreviousSelectState(bool inState);
- bool GetPreviousSelectState();
-
-protected:
- void RefreshToolTip(CPt inPoint);
- QPixmap GetImage() const;
- ITimelineItemBinding *GetTimelineItemBinding() const;
-
-protected:
- bool m_RectOverHandled; ///< Indicates if the mouse rect over has been handled.
- bool m_PreviousSelectState; ///< Stores the previous select state for the keyframe.
- bool m_Selected;
- CStateTimebarlessRow *m_ParentRow;
- bool m_IsMouseDown;
- CPt m_MouseDownLoc; ///< Location of the mouse after an OnMouseDownEvent, in client coordinates
- bool m_IsDragging; ///< Indicates whether or not the keyframe is currently being dragged,
- ///determined by the pixel buffer
- double m_TimeRatio;
-
- CSnapper m_Snapper;
- QPixmap m_Icon;
- QPixmap m_DisabledIcon;
- QPixmap m_SelectedIcon;
- QPixmap m_DynamicIcon;
- QPixmap m_DynamicSelectedIcon;
- QPixmap m_LeftIcon;
- QPixmap m_LeftDisabledIcon;
- QPixmap m_LeftSelectedIcon;
- QPixmap m_LeftDynamicIcon;
- QPixmap m_LeftDynamicSelectedIcon;
- QPixmap m_RightIcon;
- QPixmap m_RightDisabledIcon;
- QPixmap m_RightSelectedIcon;
- QPixmap m_RightDynamicIcon;
- QPixmap m_RightDynamicSelectedIcon;
-};
-
-#endif // INCLUDED_ASSET_TIMELINE_KEYFRAME
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp b/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp
index 30b80ab8..a9a65b9a 100644
--- a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp
@@ -32,8 +32,6 @@
#include "BaseStateRow.h"
#include "PropertyRow.h"
#include "StateRowFactory.h"
-#include "TimelineTimelineLayout.h"
-#include "ComponentContextMenu.h"
#include "ResourceCache.h"
#include "StudioUtils.h"
#include "Bindings/ITimelineItemBinding.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.cpp b/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.cpp
deleted file mode 100644
index f33031f2..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.cpp
+++ /dev/null
@@ -1,612 +0,0 @@
-/****************************************************************************
-**
-** 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 "BaseStateRowUI.h"
-
-#include "BaseStateRow.h"
-#include "BaseTimelineTreeControl.h"
-#include "BaseTimebarlessRow.h"
-#include "ColorControl.h"
-#include "PropertyRow.h"
-#include "StateRow.h"
-#include "ToggleControl.h"
-#include "TimelineRow.h"
-#include "TimelineUIFactory.h"
-#include "ITimelineControl.h"
-#include "StudioPreferences.h"
-#include "Snapper.h"
-#include "PropertyRowUI.h"
-#include "ComponentContextMenu.h"
-
-#include "Bindings/ITimelineItemBinding.h"
-
-const long CBaseStateRowUI::DEFAULT_TOGGLE_LENGTH = 57;
-
-CBaseStateRowUI::CBaseStateRowUI(CBaseStateRow *baseStateRow,
- CAbstractTimelineRowUI *parentUiRow)
- : CAbstractTimelineRowUI(baseStateRow, parentUiRow)
- , m_TreeList(true)// true to align the children in the timeline.
- , m_TreeControl(nullptr)
- , m_ColorControl(nullptr)
- , m_ToggleControl(nullptr)
- , m_TimebarControl(nullptr)
- , m_baseStateRow(baseStateRow)
- , m_Highlighted(false)
-{
- connectBackend();
-}
-
-CBaseStateRowUI::~CBaseStateRowUI()
-{
- delete m_TreeControl;
- delete m_ColorControl;
- delete m_ToggleControl;
- delete m_TimebarControl;
-}
-
-void CBaseStateRowUI::Initialize()
-{
- m_TreeControl = new CBaseTimelineTreeControl(this, m_baseStateRow->GetTimelineItem()->IsMaster());
- m_ColorControl = new CColorControl(m_baseStateRow);
- m_ToggleControl = CreateToggleControl();
- m_TimebarControl = CreateTimebarRow();
-
- m_timelineRow->setDirty(true);
-
- long theTimebarHeight = CStudioPreferences::GetRowSize();
- m_TreeControl->SetSize(CPt(500, theTimebarHeight));
- m_ColorControl->SetAbsoluteSize(CPt(theTimebarHeight, theTimebarHeight));
- m_ToggleControl->SetAbsoluteSize(CPt(DEFAULT_TOGGLE_LENGTH, theTimebarHeight));
- m_TimebarControl->SetSize(CPt(800, theTimebarHeight));
-
- ::CColor theColor = m_timelineRow->GetTimebarBackgroundColor(m_timelineRow->GetObjectType());
- m_TreeControl->SetBackgroundColor(theColor);
- m_ToggleControl->SetBackgroundColor(theColor);
- m_TimebarControl->SetBackgroundColor(theColor);
-
- m_ColorList.AddChild(m_ColorControl);
- m_TreeList.AddChild(m_TreeControl);
- m_ToggleList.AddChild(m_ToggleControl);
- m_TimebarList.AddChild(m_TimebarControl);
-
- m_timelineRow->setDirty(false);
-}
-
-void CBaseStateRowUI::connectBackend()
-{
- connect(m_baseStateRow, &CBaseStateRow::initialized,
- this, &CBaseStateRowUI::Initialize);
- connect(m_baseStateRow, &CBaseStateRow::dirtyChanged,
- this, &CBaseStateRowUI::handleDirtyChange);
- connect(m_baseStateRow, &CBaseStateRow::propertyRowAdded,
- this, &CBaseStateRowUI::handlePropertyRowAdded);
- connect(m_baseStateRow, &CBaseStateRow::rowAdded,
- this, &CBaseStateRowUI::handleRowAdded);
- connect(m_baseStateRow, &CBaseStateRow::childrenLoaded,
- this, &CBaseStateRowUI::handleChildrenLoaded);
- connect(m_baseStateRow, &CBaseStateRow::timeRatioChanged,
- this, &CBaseStateRowUI::setTimeRatio);
- connect(m_baseStateRow, &CBaseStateRow::expanded,
- this, &CBaseStateRowUI::handleExpanded);
- connect(m_baseStateRow, &CBaseStateRow::visibleChanged,
- this, &CBaseStateRowUI::handleVisibleChanged);
- connect(m_baseStateRow, &CBaseStateRow::hasChildrenChanged,
- this, &CBaseStateRowUI::handleHasChildrenChanged);
- connect(m_baseStateRow, &CBaseStateRow::rowAboutToBeRemoved,
- this, &CBaseStateRowUI::handleRowAboutToBeRemoved);
- connect(m_baseStateRow, &CBaseStateRow::selectAllKeys,
- this, &CBaseStateRowUI::handleSelectAllKeys);
- connect(m_baseStateRow, &CBaseStateRow::selectedChanged,
- this, &CBaseStateRowUI::handleSelectedChanged);
- connect(m_baseStateRow, &CBaseStateRow::addRowToUILists,
- this, &CBaseStateRowUI::handleAddRowToUILists);
- connect(m_baseStateRow, &CBaseStateRow::refreshRowMetaData,
- this, &CBaseStateRowUI::handleRefreshRowMetaDataRequest);
- connect(m_baseStateRow, &CBaseStateRow::setNameReadOnly,
- this, [this] { SetNameReadOnly(true);});
- connect(m_baseStateRow, &CBaseStateRow::updateActionStatus,
- this, &CBaseStateRowUI::UpdateActionStatus);
-}
-
-//=============================================================================
-/**
- * Get the color control for this row.
- * @return the color control for this row.
- */
-CControl *CBaseStateRowUI::GetColorControl()
-{
- return &m_ColorList;
-}
-
-//=============================================================================
-/**
- * Get the tree control for this row.
- * @return the tree control for this row.
- */
-CControl *CBaseStateRowUI::GetTreeControl()
-{
- return &m_TreeList;
-}
-
-//=============================================================================
-/**
- * Get the toggle control for this row.
- * @return the toggle control for this row.
- */
-CControl *CBaseStateRowUI::GetToggleControl()
-{
- return &m_ToggleList;
-}
-
-//=============================================================================
-/**
- * Get the timebar control for this row.
- * @return the timebar control for this row.
- */
-CControl *CBaseStateRowUI::GetTimebarControl()
-{
- return &m_TimebarList;
-}
-
-CBaseTimebarlessRow *CBaseStateRowUI::GetTimebar() const
-{
- return m_TimebarControl;
-}
-
-//=============================================================================
-/**
- * Restores the focus state of this row.
- */
-void CBaseStateRowUI::SetFocus()
-{
- if (!initialized())
- return;
-
- CControl *theParent = m_TreeControl->GetParent();
- if (theParent)
- theParent->GrabFocus(m_TreeControl);
-}
-
-void CBaseStateRowUI::SetNameReadOnly(bool inReadOnly)
-{
- if (!initialized())
- return;
-
- m_TreeControl->SetNameReadOnly(inReadOnly);
-}
-
-//=============================================================================
-/**
- * Call from the child controls that the mouse is over one of the children.
- * This is used to highlight the entire row on mouse over.
- */
-void CBaseStateRowUI::OnMouseOver()
-{
- if (!initialized())
- return;
-
- if (!m_Highlighted) {
- try {
- // TODO: Added the try/catch block to prevent crashing when the instance handle is not
- // found
- // this will happen sometimes when delete the object from the timeline
- // need to really fix this at the root.
- ::CColor theColor = m_baseStateRow->GetTimebarHighlightBackgroundColor(
- m_baseStateRow->GetObjectType());
- m_TreeControl->SetBackgroundColor(theColor);
- m_ToggleControl->SetBackgroundColor(theColor);
- m_TimebarControl->SetBackgroundColor(theColor);
-
- m_Highlighted = true;
- } catch (...) {
- }
- }
-}
-
-
-//=============================================================================
-/**
- * Call from the child controls that the mouse is no longer over one of the children.
- * This is used to highlight the entire row on mouse over.
- */
-void CBaseStateRowUI::OnMouseOut()
-{
- if (!initialized())
- return;
-
- if (m_Highlighted) {
- try {
- // TODO: Added the try/catch block to prevent crashing when the instance handle is not
- // found
- // this will happen sometimes when delete the object from the timeline
- // need to really fix this at the root.
- ::CColor theColor = m_baseStateRow->GetTimebarBackgroundColor(
- m_baseStateRow->GetObjectType());
- m_TreeControl->SetBackgroundColor(theColor);
- m_ToggleControl->SetBackgroundColor(theColor);
- m_TimebarControl->SetBackgroundColor(theColor);
-
- m_Highlighted = false;
- } catch (...) {
- }
- }
-}
-
-//=============================================================================
-/**
- * Called when the mouse is double clicked.
- * @param inPoint location of the mouse at time of event
- * @param inFlags modifier key states at time of event
- */
-void CBaseStateRowUI::OnMouseDoubleClick(CPt, Qt::KeyboardModifiers inFlags)
-{
- // Do nothing by default. Let subclasses define what to do.
- Q_UNUSED(inFlags);
-}
-
-//=============================================================================
-/**
- * Show context menu for this row
- */
-void CBaseStateRowUI::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!initialized())
- return;
-
- Q_UNUSED(inFlags);
-
- m_baseStateRow->Select(Qt::NoModifier); // ensure this is selected, but doesn't affect any key
- // selections, because this can be triggered from a
- // key being selected
- CComponentContextMenu theMenu(m_TreeControl, m_baseStateRow->GetTimelineItemBinding());
- m_TreeControl->DoPopup(&theMenu, inPoint);
-}
-
-void CBaseStateRowUI::OnChildVisibilityChanged()
-{
- if (!initialized())
- return;
-
- m_TreeControl->SetToggleVisible(m_timelineRow->HasVisibleChildren());
-}
-
-//=============================================================================
-/**
- * Selects keys in a given rect
- * @param inRect the rect to use for selection
- */void CBaseStateRowUI::SelectKeysInRect(CRct inRect, bool inModifierKeyDown, bool inGlobalCommitSelectionFlag)
-{
- if (!initialized())
- return;
-
- CRct theOffsetRect = inRect;
- theOffsetRect.Offset(-m_TimebarList.GetPosition());
-
- // KDAB_TODO avoid deep copy
- auto propertyRows = m_baseStateRow->GetPropertyRows();
-
- // Commits the keyframe selection by setting the keyframes' previous state to its current state,
- // when the user releases the mouse button.
- // This will help the keyframes to retain their original states even though they are
- // not in the mouse select region.
- if (inGlobalCommitSelectionFlag) {
- m_TimebarControl->CommitSelections();
-
- // iterates through every property row and commits the selection states of properties
- // keyframes
- auto thePropPos = propertyRows.begin();
- for (; thePropPos != propertyRows.end(); ++thePropPos) {
- CPropertyRow *thePropRow = (*thePropPos);
- if (thePropRow && thePropRow->IsViewable()) {
- auto uiRow = static_cast<CPropertyRowUI *>(TimelineUIFactory::instance()->uiForRow(thePropRow));
- uiRow->CommitSelections();
- }
- }
- }
-
- if (m_timelineRow->isExpanded()) {
- // Iterates each property row and select the keys that are in the rectangle
- auto thePropPos = propertyRows.begin();
- for (; thePropPos != propertyRows.end(); ++thePropPos) {
- CPropertyRow *thePropRow = (*thePropPos);
- if (thePropRow && thePropRow->IsViewable()) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(thePropRow);
- uiRow->SelectKeysInRect(theOffsetRect, inModifierKeyDown, false);
- }
- }
-
- // KDAB_TODO avoid deep copy
- auto stateRows = m_baseStateRow->GetStateRows();
- // Recurse the each state row (or master row) and selects the property keyframes in them
- auto thePos = stateRows.begin();
- for (; thePos != stateRows.end(); ++thePos) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(*thePos);
- uiRow->SelectKeysInRect(theOffsetRect, inModifierKeyDown,
- inGlobalCommitSelectionFlag);
- }
-
- } else {
- // Selects all the master key frames in the rect
- m_TimebarControl->SelectKeysInRect(theOffsetRect, inModifierKeyDown);
- }
-}
-
-//=============================================================================
-/**
- * Add snapping points to inSnappingList.
- * This will add the snapping points for any visible objects to inSnappingList.
- * @param inSnappingList the list to add the snapping points to.
- */
-void CBaseStateRowUI::PopulateSnappingList(CSnapper *inSnappingList)
-{
- if (!initialized())
- return;
-
- inSnappingList->PushOffset(-m_TimebarList.GetPosition().y);
- m_TimebarControl->PopulateSnappingList(inSnappingList);
-
- if (m_timelineRow->isExpanded()) {
- auto baseStateRow = static_cast<CBaseStateRow *>(m_timelineRow);
- // KDAB_TODO avoid deep copy
- auto stateRows = baseStateRow->GetStateRows();
-
- auto thePos = stateRows.begin();
- for (; thePos != stateRows.end(); ++thePos) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(*thePos);
- uiRow->PopulateSnappingList(inSnappingList);
- }
- }
-}
-
-//=============================================================================
-/**
- * Begin dragging.
- * sk - potential spot for refactoring the Drag&Drop implementation.
- * Right now, each IDragable is implicitly assumed to be a asset implementation. See
- * *DropSource.cpp: each IDragable is dynamically cast to its implementation.
- */
-void CBaseStateRowUI::DoStartDrag(CControlWindowListener *inWndListener)
-{
- m_timelineRow->GetTimelineItemBinding()->DoStartDrag(inWndListener);
-}
-
-void CBaseStateRowUI::AcceptDropAfter(bool inAccept)
-{
- if (!initialized())
- return;
- m_TreeControl->AcceptDropAfter(inAccept);
-}
-
-void CBaseStateRowUI::AcceptDropBefore(bool inAccept)
-{
- if (!initialized())
- return;
- m_TreeControl->AcceptDropBefore(inAccept);
-}
-
-//=============================================================================
-/**
- * Pass through to the binding to set up the target aset for a drag&drop action on this
- *control.
- */
-void CBaseStateRowUI::SetDropTarget(CDropTarget *inDropTarget)
-{
- m_timelineRow->GetTimelineItemBinding()->SetDropTarget(inDropTarget);
-}
-
-//=============================================================================
-/**
- * Sets all the child control enable states
- * @param inEnabled the state to set the controls to
- */
-void CBaseStateRowUI::SetEnabled(bool inEnabled)
-{
- if (!initialized())
- return;
- m_TreeControl->SetEnabled(inEnabled);
- m_ToggleControl->SetEnabled(inEnabled);
- m_ColorControl->SetEnabled(inEnabled);
- m_TimebarControl->SetEnabled(inEnabled);
-}
-
-void CBaseStateRowUI::UpdateActionStatus()
-{
- if (!initialized())
- return;
- m_ColorControl->UpdateIconStatus();
-}
-
-void CBaseStateRowUI::setTimeRatio(double inTimeRatio)
-{
- if (!initialized())
- return;
- m_TimebarControl->SetTimeRatio(inTimeRatio);
-}
-
-void CBaseStateRowUI::handleDirtyChange(bool dirty)
-{
- if (!initialized())
- return;
-
- if (dirty) {
- m_TimebarControl->SetDirty(true);
- m_TreeControl->Refresh(m_baseStateRow->GetTimelineItemBinding()->GetTimelineItem());
- m_ToggleControl->Refresh();
- m_ColorControl->Invalidate();
- m_TimebarControl->RefreshRowMetaData();
- }
-}
-
-void CBaseStateRowUI::handleRowAdded(CBaseStateRow *row)
-{
- auto uiRow = TimelineUIFactory::instance()->uiForRow(row);
- CControl *theTreeControl = uiRow->GetTreeControl();
- if (theTreeControl)
- theTreeControl->EnsureVisible();
-}
-
-void CBaseStateRowUI::handlePropertyRowAdded(CPropertyRow *row)
-{
- if (!initialized())
- return;
-
- // For snapping timebars/keyframes
- auto uiRow = TimelineUIFactory::instance()->uiForRow(row);
- uiRow->SetSnappingListProvider(GetSnappingListProvider());
-
- m_TimebarControl->SetDirty(true);
-}
-
-void CBaseStateRowUI::handleChildrenLoaded()
-{
- GetTopControl()->OnLayoutChanged();
-}
-
-void CBaseStateRowUI::handleVisibleChanged(bool visible)
-{
- m_ColorList.SetVisible(visible);
- m_TreeList.SetVisible(visible);
- m_ToggleList.SetVisible(visible);
- m_TimebarList.SetVisible(visible);
-}
-
-void CBaseStateRowUI::handleHasChildrenChanged(bool hasChildren)
-{
- m_TreeControl->SetToggleVisible(hasChildren);
-}
-
-void CBaseStateRowUI::handleRowAboutToBeRemoved(CTimelineRow *row)
-{
- auto uiRow = TimelineUIFactory::instance()->uiForRow(row);
-
- m_ColorList.RemoveChild(uiRow->GetColorControl());
- m_TreeList.RemoveChild(uiRow->GetTreeControl());
- m_ToggleList.RemoveChild(uiRow->GetToggleControl());
- m_TimebarList.RemoveChild(uiRow->GetTimebarControl());
-}
-
-void CBaseStateRowUI::handleSelectAllKeys()
-{
- if (!initialized())
- return;
-
- m_TimebarControl->SelectAllKeys();
-}
-
-void CBaseStateRowUI::handleSelectedChanged(bool selected)
-{
- if (!initialized())
- return;
-
- if (selected) {
- m_TreeControl->EnsureVisible();
-
- m_TreeControl->OnSelect();
- m_ToggleControl->OnSelect();
- m_ColorControl->OnSelect();
- m_TimebarControl->OnSelect();
- } else {
- m_TreeControl->OnDeselect();
- m_ToggleControl->OnDeselect();
- m_ColorControl->OnDeselect();
- m_TimebarControl->OnDeselect();
- }
-}
-
-void CBaseStateRowUI::handleAddRowToUILists(CTimelineRow *inRow, CTimelineRow *inNextRow, CFilter &inFilter)
-{
- // Default the insert locations to the end of the list.
- CControl *theNextColorControl = nullptr;
- CControl *theNextTreeControl = nullptr;
- CControl *theNextToggleControl = nullptr;
- CControl *theNextTimebarControl = nullptr;
- if (inNextRow) {
- auto uiNextRow = TimelineUIFactory::instance()->uiForRow(inNextRow);
-
- theNextColorControl = uiNextRow->GetColorControl();
- theNextTreeControl = uiNextRow->GetTreeControl();
- theNextToggleControl = uiNextRow->GetToggleControl();
- theNextTimebarControl = uiNextRow->GetTimebarControl();
- }
-
- auto inRowUI = TimelineUIFactory::instance()->uiForRow(inRow);
- inRowUI->SetIndent(m_Indent + CTimelineRow::TREE_INDENT);
- inRow->SetParent(m_timelineRow);
- inRow->Filter(inFilter);
- inRow->SetTimeRatio(m_timelineRow->GetTimeRatio());
-
- CControl *theColorControl = inRowUI->GetColorControl();
- CControl *theTreeControl = inRowUI->GetTreeControl();
- CControl *theToggleControl = inRowUI->GetToggleControl();
- CControl *theTimebarControl = inRowUI->GetTimebarControl();
-
- // If not expanded then hide the controls.
- if (!m_timelineRow->isExpanded()) {
- theColorControl->SetVisible(false);
- theTreeControl->SetVisible(false);
- theToggleControl->SetVisible(false);
- theTimebarControl->SetVisible(false);
- }
-
- // Add the controls to the lists in the prioritized order
- m_ColorList.AddChild(theColorControl, theNextColorControl);
- m_TreeList.AddChild(theTreeControl, theNextTreeControl);
- m_ToggleList.AddChild(theToggleControl, theNextToggleControl);
- m_TimebarList.AddChild(theTimebarControl, theNextTimebarControl);
-
- m_TreeControl->SetToggleVisible(m_timelineRow->HasVisibleChildren());
-}
-
-void CBaseStateRowUI::handleRefreshRowMetaDataRequest()
-{
- if (initialized())
- m_TimebarControl->RefreshRowMetaData();
-}
-
-void CBaseStateRowUI::handleExpanded(bool expanded)
-{
- if (!initialized())
- return;
-
- m_TreeControl->SetExpanded(expanded);
- m_ColorControl->UpdateIconStatus();
-}
-
-
-//=============================================================================
-/**
- * By default, we don't show shy/eye/lock toggles
- */
-CBlankToggleControl *CBaseStateRowUI::CreateToggleControl()
-{
- return new CBlankToggleControl(this);
-}
-
-bool CBaseStateRowUI::initialized() const
-{
- return m_TreeControl && m_ToggleControl && m_ColorControl && m_TimebarControl;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.h b/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.h
deleted file mode 100644
index 2e748ab6..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseStateRowUI.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** 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 BASESTATEROWUI_H
-#define BASESTATEROWUI_H
-
-#include "AbstractTimelineRowUI.h"
-#include "ListLayout.h"
-
-#include <QObject>
-
-class CBaseTimelineTreeControl;
-class CColorControl;
-class CBlankToggleControl;
-class CBaseTimebarlessRow;
-class CBaseStateRow;
-class CPropertyRow;
-class CFilter;
-class CSnapper;
-
-class CBaseStateRowUI : public CAbstractTimelineRowUI
-{
- Q_OBJECT
-public:
- static const long DEFAULT_TOGGLE_LENGTH;
-
- CBaseStateRowUI(CBaseStateRow *baseStateRow, CAbstractTimelineRowUI *parentUiRow);
- ~CBaseStateRowUI();
-
- CControl *GetColorControl() override;
- CControl *GetTreeControl() override;
- CControl *GetToggleControl() override;
- CControl *GetTimebarControl() override;
-
- CBaseTimebarlessRow *GetTimebar() const;
-
- void SetFocus() override;
- void SetNameReadOnly(bool inReadOnly) override;
-
- void OnChildVisibilityChanged() override;
- void SelectKeysInRect(CRct inRect, bool inModifierKeyDown,
- bool inGlobalCommitSelectionFlag) override;
- void PopulateSnappingList(CSnapper *inSnappingList) override;
-
- void DoStartDrag(CControlWindowListener *inWndListener) override;
- void AcceptDropAfter(bool inAccept) override;
- void AcceptDropBefore(bool inAccept) override;
- void SetDropTarget(CDropTarget *inDropTarget) override;
-
- void SetEnabled(bool inEnabled) override;
- void UpdateActionStatus() override;
-
- virtual void OnMouseOver();
- virtual void OnMouseOut();
- virtual void OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags);
- virtual void OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags);
-
-private Q_SLOTS:
- void Initialize() override;
- void setTimeRatio(double inTimeRatio);
- void handleDirtyChange(bool dirty);
- void handleRowAdded(CBaseStateRow *row);
- void handlePropertyRowAdded(CPropertyRow *row);
- void handleChildrenLoaded();
- void handleExpanded(bool expanded);
- void handleVisibleChanged(bool visible);
- void handleHasChildrenChanged(bool hasChildren);
- void handleRowAboutToBeRemoved(CTimelineRow *row);
- void handleSelectAllKeys();
- void handleSelectedChanged(bool selected);
- void handleAddRowToUILists(CTimelineRow *inRow, CTimelineRow *inNextRow, CFilter &inFilter);
- void handleRefreshRowMetaDataRequest();
-
-protected:
- void connectBackend();
-
- virtual CBlankToggleControl *CreateToggleControl();
- virtual CBaseTimebarlessRow *CreateTimebarRow() = 0;
-
- bool initialized() const;
-
- CListLayout m_ColorList;
- CListLayout m_TreeList;
- CListLayout m_ToggleList;
- CListLayout m_TimebarList;
-
- CBaseTimelineTreeControl *m_TreeControl;
- CColorControl *m_ColorControl;
- CBlankToggleControl *m_ToggleControl;
- CBaseTimebarlessRow *m_TimebarControl;
- CBaseStateRow *m_baseStateRow;
-
- bool m_Highlighted;
-};
-
-#endif // BASESTATEROWUI_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.cpp b/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.cpp
deleted file mode 100644
index 84bee54e..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.cpp
+++ /dev/null
@@ -1,187 +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 "BaseTimebarlessRow.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "BaseStateRow.h"
-#include "BaseStateRowUI.h"
-
-CBaseTimebarlessRow::CBaseTimebarlessRow()
- : m_Selected(false)
- , m_DirtyFlag(true)
- , m_TimeRatio(0.0f)
-{
-}
-
-CBaseTimebarlessRow::~CBaseTimebarlessRow()
-{
-}
-
-void CBaseTimebarlessRow::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
-
- // Fill in the background
- if (!m_Selected)
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
- else
- inRenderer->FillSolidRect(theRect, CStudioPreferences::GetTimelineSelectColor());
-
- // Draw the line at the bottom of this control and the one on the side
- inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Set this control to being highlighted or not.
- * @param inIsHighlighted true if this is to be highlighted.
- */
-void CBaseTimebarlessRow::SetBackgroundColor(::CColor inBackgroundColor)
-{
- if (m_BackgroundColor != inBackgroundColor) {
- m_BackgroundColor = inBackgroundColor;
- Invalidate();
- }
-}
-
-void CBaseTimebarlessRow::SetTimeRatio(double inTimeRatio)
-{
- m_TimeRatio = inTimeRatio;
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been selected.
- */
-void CBaseTimebarlessRow::OnSelect()
-{
- m_Selected = true;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been deselected.
- */
-void CBaseTimebarlessRow::OnDeselect()
-{
- m_Selected = false;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * called when meta data for this row is changed... should be overridden by the
- * timebar row
- */
-void CBaseTimebarlessRow::RefreshRowMetaData()
-{
-}
-
-//=============================================================================
-/**
- * called when a child changes and the keyframes need to be refreshed
- * @param inDirtyFlag true if this object is now dirty
- */
-void CBaseTimebarlessRow::SetDirty(bool inDirtyFlag)
-{
- if (m_DirtyFlag == inDirtyFlag)
- return;
-
- m_DirtyFlag = inDirtyFlag;
- Invalidate();
-}
-
-void CBaseTimebarlessRow::UpdateTime(long inStartTime, long inEndTime)
-{
- Q_UNUSED(inStartTime);
- Q_UNUSED(inEndTime);
-}
-
-//=============================================================================
-/**
- * OnMouseOver event, handles the highlighting of the row.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-void CBaseTimebarlessRow::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- GetBaseStateRowUI()->OnMouseOver();
-}
-
-//=============================================================================
-/**
- * OnMouseOut event, handles the de-highlighting of this row.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-void CBaseTimebarlessRow::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- GetBaseStateRowUI()->OnMouseOut();
-}
-
-//=============================================================================
-/**
- * OnMouseDown event, handles the selecting of this object.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-bool CBaseTimebarlessRow::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- return CControl::OnMouseDown(inPoint, inFlags);
-#if 0
- // this addition is causing 4085: Cannot do rubber band selection from sections of timeline that don't contain timebars anymore
- bool theReturn = CControl::OnMouseDown( inPoint, inFlags );
- if ( !theReturn )
- {
- // Tests if the user has pressed the modifier key, where the intention is to multi-select keyframes.
- if ( !(inFlags & CHotKeys::MODIFIER_CONTROL ) )
- {
- // SK - I changed this to select the row when this is clicked, because I think its a nice feature. ie don't always have to click on the timebar (esp for those e.g. scene without one)
- // when the modifier key is pressed.
- GetBaseStateRow( )->Select( false );
-
- theReturn = true;
- }
- }
- return theReturn;
-#endif
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.h b/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.h
deleted file mode 100644
index ee26f3c2..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseTimebarlessRow.h
+++ /dev/null
@@ -1,80 +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_TIMEBARLESS_ROW_H
-#define INCLUDED_BASE_TIMEBARLESS_ROW_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "CColor.h"
-
-class CSnapper;
-class CBaseStateRowUI;
-class ISnappingListProvider;
-
-class CBaseTimebarlessRow : public CControl
-{
-public:
- CBaseTimebarlessRow();
- virtual ~CBaseTimebarlessRow();
-
- void Draw(CRenderer *inRenderer) override;
-
- virtual void SetBackgroundColor(::CColor inColor);
- virtual void SetTimeRatio(double inTimeRatio);
-
- virtual void RefreshRowMetaData();
-
- virtual void OnSelect();
- virtual void OnDeselect();
-
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- virtual void SetDirty(bool inIsDirty);
- virtual void UpdateTime(long inStartTime, long inEndTime);
-
- virtual void CommitSelections() = 0;
- virtual void SelectKeysInRect(CRct inRect, bool inModifierKeyDown) = 0;
- virtual void SelectAllKeys() = 0;
- virtual void SelectKeysByTime(long inTime, bool inSelected) = 0;
- virtual void PopulateSnappingList(CSnapper *inSnappingList) = 0;
- virtual ISnappingListProvider &GetSnappingListProvider() const = 0;
-
-protected:
- virtual CBaseStateRowUI *GetBaseStateRowUI() const = 0;
-
- ::CColor m_BackgroundColor;
- bool m_Selected;
- bool m_DirtyFlag;
- double m_TimeRatio;
-};
-#endif // INCLUDED_BASE_TIMEBARLESS_ROW_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.cpp b/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.cpp
deleted file mode 100644
index 7db17c99..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.cpp
+++ /dev/null
@@ -1,693 +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 "Renderer.h"
-#include "ToggleButton.h"
-#include "BaseStateRow.h"
-#include "BaseStateRowUI.h"
-#include "StudioPreferences.h"
-#include "TimelineDropTarget.h"
-#include "BaseTimelineTreeControl.h"
-#include "NameEdit.h"
-#include "Bindings/ITimelineItem.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Create a new tree control for the specified state row.
- * This control contains the toggle button and item name controls.
- * @param inStateRow the state row of which this belongs to.
- */
-CBaseTimelineTreeControl::CBaseTimelineTreeControl(CBaseStateRowUI *inStateRow, bool inMaster)
- : m_Selected(false)
- , m_MouseDown(false)
-{
- m_StateRowUI = inStateRow;
-
- auto timelineRow = m_StateRowUI->GetTimelineRow();
- m_BackgroundColor = timelineRow->GetTimebarBackgroundColor(timelineRow->GetObjectType());
-
- // Create the expand/collapse button.
- m_ExpandButton = new CToggleButton();
- m_ExpandButton->SetUpImage("arrow.png");
- m_ExpandButton->SetDownImage("arrow_down.png");
-
- // Add the button and initialize all the listeners for the events on it.
- AddChild(m_ExpandButton);
- QObject::connect(m_ExpandButton,&CToggleButton::SigToggle,
- std::bind(&CBaseStateRow::ToggleExpansion, baseStateRow(),
- std::placeholders::_1, std::placeholders::_2));
- m_ExpandButton->SetVisible(false);
-
- m_Icon = new CSIcon(baseStateRow()->GetIcon(), baseStateRow()->GetDisabledIcon());
- AddChild(m_Icon);
-
- // Create and add the name label.
- m_Text = nullptr; // withdrawn from constructor to delay creation of text object
-
- // Initialize all the component's positions to 0.
- SetIndent(CStudioPreferences::GetRowSize());
-
- SetMinimumSize(CPt(CBaseStateRowUI::DEFAULT_TOGGLE_LENGTH + m_Icon->GetPosition().x
- + m_Icon->GetSize().x + 5,
- CStudioPreferences::GetRowSize()));
-
- m_TrackingPoint.x = 0;
- m_TrackingPoint.y = 0;
- m_DrawAcceptBefore = false;
- m_DrawAcceptAfter = false;
-
- // Set up default text colors
- m_NormalTextColor = CStudioPreferences::GetNormalColor();
- m_SelectedTextColor = CStudioPreferences::GetNormalColor();
- if (inMaster) {
- m_NormalTextColor = CStudioPreferences::GetMasterColor();
- m_SelectedTextColor = CStudioPreferences::GetMasterColor();
- }
- m_LockedTextColor = CStudioPreferences::GetLockedTextColor();
-}
-
-CBaseTimelineTreeControl::~CBaseTimelineTreeControl()
-{
- delete m_Icon;
- delete m_ExpandButton;
- delete m_Text;
-}
-
-//=============================================================================
-/**
- * Create a new text object. For performance reasons we delay
- * creating this object until it is needed, i.e. until the row is exposed
- * by the user and the Draw method is called
- */
-void CBaseTimelineTreeControl::CreateText()
-{
- if (!m_Text) {
- ITimelineItem *theTimelineItem = baseStateRow()->GetTimelineItem();
-
- m_Text = new CNameEdit(theTimelineItem);
-
- m_Text->SetSize(
- CPt(CStudioPreferences::GetTimelineNameSize(),
- CStudioPreferences::GetRowSize() - 3)); /* m_ExpandButton->GetSize( ).y - 3*/
- // m_Text->SetBGColorNoFocus( CStudioPreferences::GetNormalColor( ) );
- // if ( theTimelineItem->IsMaster( ) )
- // m_Text->SetBGColorNoFocus( CStudioPreferences::GetMasterColor( ) );
- // m_Text->SetFillBackground( false );
- m_Text->SetBoldText(false);
-
- // If the object is the scene, you can't edit it's name
- m_Text->SetEditable(baseStateRow()->GetObjectType() != OBJTYPE_SCENE);
- AddChild(m_Text);
- m_Text->SetPosition(CPt(m_Icon->GetPosition().x + m_Icon->GetSize().x + 5, 1));
-
- // This was disabled before Text was created.
- if (!IsEnabled()) {
- m_Text->SetEnabled(false);
- m_Text->SetParentEnabled(false);
- m_Text->SetTextColor(m_LockedTextColor);
- } else // since we do delay-creation, "sync" with the parent's selection state
- UpdateTextSelection();
-
- // This is so that make the timeline scrollbar scrolls correctly
- // ( i.e. to the end of the asset name )
- CPt theSize(GetSize());
- theSize.x =
- CBaseStateRowUI::DEFAULT_TOGGLE_LENGTH + m_Text->GetPosition().x + m_Text->GetSize().x;
- SetAbsoluteSize(theSize);
- }
-}
-
-void CBaseTimelineTreeControl::UpdateTextSelection()
-{
- // since we do delay-creation for the Text only when we have to draw it.. this checks if it is
- // created first
- if (m_Text) {
- if (!IsEnabled())
- m_Text->SetTextColor(m_LockedTextColor);
- else
- m_Text->SetTextColor(m_Selected ? m_SelectedTextColor : m_NormalTextColor);
- // m_Text->SetFillBackground( m_Selected );
- // m_Text->SetBoldText( m_Selected );
- }
-}
-
-CBaseStateRow *CBaseTimelineTreeControl::baseStateRow() const
-{
- return static_cast<CBaseStateRow* >(m_StateRowUI->GetTimelineRow());
-}
-
-//=============================================================================
-/**
- * Perform the drawing of this control.
- * @param inRenderer the renderer to draw to.
- */
-void CBaseTimelineTreeControl::Draw(CRenderer *inRenderer)
-{
- CreateText(); // the row is now exposed and we can't delay creating the text object any longer
-
- CRct theRect(GetSize());
- // Fill in the background
- if (!m_Selected)
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
- else
- inRenderer->FillSolidRect(theRect, CStudioPreferences::GetTimelineSelectColor());
-
- // if ( m_Text )
- // m_Text->SetBoldText( m_Selected );
- // m_Text->SetFillBackground( m_Selected );
-
- // Draw the line at the bottom of this control
- inRenderer->PushPen(CStudioPreferences::GetTreeFloorColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Override for the set parent enabled function which tells children the state of the parent
- */
-void CBaseTimelineTreeControl::SetEnabled(bool inIsEnabled)
-{
- CControl::SetEnabled(inIsEnabled);
- if (m_Text) {
- m_Text->SetEnabled(inIsEnabled);
- if (!inIsEnabled)
- m_Text->SetTextColor(m_LockedTextColor);
- else
- m_Text->SetTextColor(m_Selected ? m_SelectedTextColor : m_NormalTextColor);
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Notification that something has changed on the asset that this
- * represents, update it.
- */
-void CBaseTimelineTreeControl::Refresh(ITimelineItem *inTimelineItem)
-{
- bool theEnabled = !inTimelineItem->IsLocked();
- if (m_Text) {
- // Make sure the color is correct depending on if its is a master object
- if (m_NormalTextColor != CStudioPreferences::GetMasterColor()
- && inTimelineItem->IsMaster()) {
- m_NormalTextColor = CStudioPreferences::GetMasterColor();
- m_Text->SetBGColorNoFocus(CStudioPreferences::GetMasterColor());
- if (!m_Selected)
- m_Text->SetTextColor(m_NormalTextColor);
- }
-
- m_Text->SetData(inTimelineItem->GetName());
- }
- m_Icon->SetImage((theEnabled) ? baseStateRow()->GetIcon() : baseStateRow()->GetDisabledIcon());
- SetEnabled(theEnabled);
-}
-
-//=============================================================================
-/**
- * Set the indent of this control.
- * The indent gives the semblance of a tree control, and causes the toggle
- * name and icon to be pushed in some.
- * @param inIndent the indent for this control.
- */
-void CBaseTimelineTreeControl::SetIndent(long inIndent)
-{
- m_Indent = inIndent;
-
- // Set the new position for all the children.
- m_ExpandButton->SetPosition(CPt(inIndent, 0));
-
- m_Icon->SetPosition(CPt(m_ExpandButton->GetPosition().x + m_ExpandButton->GetSize().x, 0));
- if (m_Text)
- m_Text->SetPosition(CPt(m_Icon->GetPosition().x + m_Icon->GetSize().x + 5, 1));
-}
-
-//=============================================================================
-/**
- * Get the current indent of this control.
- */
-long CBaseTimelineTreeControl::GetIndent()
-{
- return m_Indent;
-}
-
-//=============================================================================
-/**
- * Set whether or not to have the toggle control visible.
- * The toggle is turned off by the state row when there are no visible children.
- * @param inIsToggleVisible false if the toggle is not to be visible.
- */
-void CBaseTimelineTreeControl::SetToggleVisible(bool inIsToggleVisible)
-{
- m_ExpandButton->SetVisible(inIsToggleVisible);
-}
-
-//=============================================================================
-/**
- * Set whether or not this control is expanded.
- * This is used to set the state of the expand button.
- */
-void CBaseTimelineTreeControl::SetExpanded(bool inIsExpanded)
-{
- m_ExpandButton->SetToggleState(inIsExpanded);
-}
-
-//=============================================================================
-/**
- * Set the current background color for this control.
- * The background color changes when the control gets a mouse over/mouse out.
- */
-void CBaseTimelineTreeControl::SetBackgroundColor(CColor inColor)
-{
- if (m_BackgroundColor == inColor)
- return;
-
- m_BackgroundColor = inColor;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Notify the row that a mouse out occurred.
- * The row will in turn turn off the highlighting.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- */
-void CBaseTimelineTreeControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_DrawAcceptAfter = false;
- m_DrawAcceptBefore = false;
-
- CControl::OnMouseOut(inPoint, inFlags);
-
- m_StateRowUI->OnMouseOut();
-
- if (m_TimerHandler) {
-
- // nullptr out our handle so we can create a new one.
- m_TimerHandler = std::shared_ptr<qt3dsdm::ISignalConnection>();
- }
-
- AcceptDropAfter(false);
- AcceptDropBefore(false);
-}
-
-//=============================================================================
-/**
- * Notify the row that a mouse over occurred.
- * The row will in turn turn on the highlighting.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- */
-void CBaseTimelineTreeControl::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- m_StateRowUI->OnMouseOver();
-}
-
-//=============================================================================
-/**
- * Pass the double click notification on to the row and have it process it.
- * The row will do object-specific actions on doubleclicks.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- * @return true stating that the event was processed.
- */
-bool CBaseTimelineTreeControl::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDoubleClick(inPoint, inFlags)) {
- m_StateRowUI->OnMouseDoubleClick(inPoint, inFlags);
- GrabFocus(nullptr);
- }
- return true;
-}
-
-//=============================================================================
-/**
- * Handles mouse down on the this control. Flags the button as down which results
- * in some possible drawing changes.
- * @param inPoint location of the mouse when event occurred
- * @param inFlags state of modifier keys when event occurred
- * @return true
- */
-bool CBaseTimelineTreeControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- Qt::KeyboardModifiers theKeyState;
- if ((CHotKeys::MODIFIER_SHIFT & inFlags) == CHotKeys::MODIFIER_SHIFT)
- theKeyState.setFlag(Qt::ShiftModifier);
- if ((CHotKeys::MODIFIER_CONTROL & inFlags) == CHotKeys::MODIFIER_CONTROL)
- theKeyState.setFlag(Qt::ControlModifier);
- baseStateRow()->Select(theKeyState);
-
- // Always track where the mouse is.
- m_MouseDown = true;
-
- Invalidate();
- }
-
- return true;
-}
-
-bool CBaseTimelineTreeControl::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseRDown(inPoint, inFlags))
- m_StateRowUI->OnMouseRDown(inPoint, inFlags);
-
- return true;
-}
-
-void CBaseTimelineTreeControl::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_MouseDown = false;
-
- CControl::OnMouseUp(inPoint, inFlags);
-
- AcceptDropAfter(false);
- AcceptDropBefore(false);
-}
-
-//=============================================================================
-/**
- * This method handles the keydown event for a StateTreeControl. It calls
- * CControl::OnKeyDown method to make sure that the keydown event is handled
- * by its children. If the keydown event is not handled and F2 is down, it
- * enables text edit mode.
- * @param inChar is the char pressed
- * @param inFlags state of modifier keys when event occurred
- * @return if the key was handled
- */
-bool CBaseTimelineTreeControl::OnKeyDown(unsigned int inChar, Qt::KeyboardModifiers inFlags)
-{
- bool theKeyWasHandled = CControl::OnKeyDown(inChar, inFlags);
-
- if (!theKeyWasHandled && (inChar == Qt::Key_F2)) {
- DoRename();
- theKeyWasHandled = true;
- }
-
- return theKeyWasHandled;
-}
-
-//=============================================================================
-/**
- * This is so the Gesture can this object to get something ready to Drag.
- */
-void CBaseTimelineTreeControl::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- if (m_MouseDown /*&& inFlags & MOUSE_LBUTTON*/) {
- long theDeltaX = inPoint.x - m_TrackingPoint.x;
- long theDeltaY = inPoint.y - m_TrackingPoint.y;
-
- if (::abs(theDeltaX) > 3 || ::abs(theDeltaY) > 3) {
- m_TrackingPoint = inPoint;
-
- m_StateRowUI->DoStartDrag(GetWindowListener());
- }
- }
-}
-
-//=============================================================================
-/**
- * Notification that the state that this is displaying has been selected.
- */
-void CBaseTimelineTreeControl::OnSelect()
-{
- m_Selected = true;
-
- UpdateTextSelection();
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Notification that the state that this is displaying has been deselected.
- */
-void CBaseTimelineTreeControl::OnDeselect()
-{
- m_Selected = false;
-
- UpdateTextSelection();
- Invalidate();
-}
-
-void CBaseTimelineTreeControl::GrabTextFocus()
-{
- GrabFocus(m_Text);
-}
-
-//=============================================================================
-/**
- * To enable F2 editing.
- */
-void CBaseTimelineTreeControl::OnGainFocus()
-{
- CControl::OnGainFocus();
- GrabFocus(m_Text);
-}
-
-//=============================================================================
-/**
- * Called when this control loses focus. Overridden because we need to set the
- * text color depending on whether or not the asset for this row is still
- * selected.
- */
-void CBaseTimelineTreeControl::OnLoseFocus()
-{
- CControl::OnLoseFocus();
-
- if (m_Text) {
- if (m_Selected) {
- m_Text->SetTextColor(m_SelectedTextColor);
- } else // If this asset is no longer selected
- {
- // If the row is enabled, use the normal text color
- if (m_Text->IsEnabled()) {
- m_Text->SetTextColor(m_NormalTextColor);
- }
- // Otherwise use the locked text color
- else {
- m_Text->SetTextColor(m_LockedTextColor);
- }
- }
- }
-
- AcceptDropAfter(false);
- AcceptDropBefore(false);
-}
-
-//=============================================================================
-/**
- * If the name is changed, the size has to be adjusted accordingly.
- */
-void CBaseTimelineTreeControl::OnChildSizeChanged(CControl *inChild)
-{
- CControl::OnChildSizeChanged(inChild);
-
- if (inChild == m_Text) { // This is so that make the timeline scrollbar scrolls correctly
- // ( i.e. to the end of the asset name )
- CPt theSize(GetSize());
- theSize.x =
- CBaseStateRowUI::DEFAULT_TOGGLE_LENGTH + m_Text->GetPosition().x + m_Text->GetSize().x;
- SetAbsoluteSize(theSize);
- }
-}
-
-//=============================================================================
-/**
- * This will do a vertical hit test on this control.
- * This need to figure out if the point is toward teh top or toward the bottom, or on this
- *control.
- * @param inMousePoint the point where the dropp wants to occure.
- * @return An enumeration representing the location of the potential drop.
- */
-CBaseTimelineTreeControl::ECONTROLREGION CBaseTimelineTreeControl::FindHitRegion(CPt &inMousePoint)
-{
- // Default Region is "on"
- CBaseTimelineTreeControl::ECONTROLREGION theDropRegion =
- CBaseTimelineTreeControl::ECONTROLREGION_ON;
-
- CPt theSize = GetSize();
- long theTop = 0;
- long theBottom = theSize.y - 1;
- long thePointY = inMousePoint.y;
-
- // check if we are in the upper part of the control
- if ((thePointY >= theTop) && (thePointY <= (theTop + 3))) {
- theDropRegion = CBaseTimelineTreeControl::ECONTROLREGION_ABOVE;
- }
- // check if we are in the lower part of the control
- else if ((thePointY <= (theBottom)) && (thePointY >= (theBottom - 3))) {
- theDropRegion = CBaseTimelineTreeControl::ECONTROLREGION_BELOW;
- }
-
- return theDropRegion;
-}
-
-//=============================================================================
-/**
- * Find an object under the point.
- * If tht point is close to the top or the bottom of the control,
- * then the Asset to use would be the parent of the current asset.
- * @param inMousePoint the point where the Drop wants to occure.
- */
-CDropTarget *CBaseTimelineTreeControl::BuildDropTarget(CPt &inMousePoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inFlags);
-
- // This will do the hit testing to see where we are with the point.
- ECONTROLREGION theRegion = FindHitRegion(inMousePoint);
-
- // Make a new DropTarget to return.
- CTimeLineDropTarget *theTarget = new CTimeLineDropTarget();
-
- EDROPDESTINATION theDropDest = EDROPDESTINATION_ON;
-
- switch (theRegion) {
- case ECONTROLREGION_BELOW:
- theDropDest = EDROPDESTINATION_BELOW;
-
- AcceptDropAfter(true);
- AcceptDropBefore(false);
- break;
-
- case ECONTROLREGION_ABOVE:
- theDropDest = EDROPDESTINATION_ABOVE;
-
- AcceptDropAfter(false);
- AcceptDropBefore(true);
- break;
-
- case ECONTROLREGION_ON:
-
- AcceptDropAfter(false);
- AcceptDropBefore(false);
- break;
- }
- theTarget->SetDestination(theDropDest);
- // For insertion markers
- theTarget->SetInsertionMarkerRow(this);
- theTarget->SetInsertionMarkerIndent(m_Icon->GetPosition().x);
-
- // connect the data portion of the drag&drop action
- m_StateRowUI->SetDropTarget(theTarget);
-
- return theTarget;
-}
-
-//=============================================================================
-/**
- * This function is overriden from the CControl class.
- * It will find an Asset that can be dropped upon. Also it will
- * figureout if the DropTarget should contain this Asset or the parent
- * of this Asset.
- * @param inMousePoint the coords [in local space] of the drop action.
- * @param inFlags the Modifier flags for the keyboard state.
- * @return the found DropTarget or null if not found.
- */
-CDropTarget *CBaseTimelineTreeControl::FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags)
-{
- // Make sure the Mouse Highlighting happens.
- m_StateRowUI->OnMouseOver();
-
- // This will do all of the work.
- CDropTarget *theReturnTarget = BuildDropTarget(inMousePoint, inFlags);
-
- // Expand the object [ once again ask CE for an explaination of this ]
- if (!m_TimerHandler && m_ExpandButton->IsVisible() && m_ExpandButton->IsEnabled()) {
- if (!m_DrawAcceptBefore && !m_DrawAcceptAfter)
- m_TimerHandler = Q3DStudio::ITickTock::GetInstance().AddTimer(
- 1000, false, std::bind(&CBaseTimelineTreeControl::OnTimer, this),
- "CStateTreeControl::FindDropCandidate::" + GetName());
- }
-
- // we always return true, since we should be the only one to handle it.
- return theReturnTarget;
-}
-
-//=============================================================================
-/**
- * Notification that the Hover Time has expired,
- */
-void CBaseTimelineTreeControl::OnTimer()
-{
- // Expand the Row to show the children.
- baseStateRow()->Expand();
-}
-
-//=============================================================================
-/**
- * This will set the Flag so we can Draw the Bottom Line.
- * @param inAccept true to draw the line false otherwise.
- */
-void CBaseTimelineTreeControl::AcceptDropAfter(bool inAccept)
-{
- if (inAccept != m_DrawAcceptAfter) {
- m_DrawAcceptAfter = inAccept;
- }
-}
-
-//=============================================================================
-/**
- * This will set the Flag so we can Draw the Top Line.
- * @param inAccept true to draw the line false otherwise.
- */
-void CBaseTimelineTreeControl::AcceptDropBefore(bool inAccept)
-{
- if (inAccept != m_DrawAcceptBefore) {
- m_DrawAcceptBefore = inAccept;
- }
-}
-
-//=============================================================================
-/**
- * Called by the state context menu to do the renaming portion of the menu
- */
-void CBaseTimelineTreeControl::DoRename()
-{
- CreateText();
- m_Text->SetEditMode(true);
- GrabFocus(m_Text);
- m_Text->SelectAllText();
-}
-
-void CBaseTimelineTreeControl::SetNameReadOnly(bool inReadOnly)
-{
- CreateText(); // Create the text if it's not ready.
- m_Text->SetEditable(!inReadOnly);
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.h b/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.h
deleted file mode 100644
index d48a9c2c..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BaseTimelineTreeControl.h
+++ /dev/null
@@ -1,128 +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_TIMELINE_TREE_CONTROL_H
-#define INCLUDED_BASE_TIMELINE_TREE_CONTROL_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "SIcon.h"
-#include "ToggleButton.h"
-#include "ITickTock.h"
-
-class CButtonControl;
-class CBaseStateRow;
-class CBaseStateRowUI;
-class CDropTarget;
-class CNameEdit;
-class CTickTockProc;
-struct STickTockHandle;
-class CPt;
-class CToggleButton;
-class ITimelineItem;
-
-class CBaseTimelineTreeControl : public CControl
-{
-
-public:
- enum ECONTROLREGION { ECONTROLREGION_ON, ECONTROLREGION_ABOVE, ECONTROLREGION_BELOW };
-
- CBaseTimelineTreeControl(CBaseStateRowUI *inStateRow, bool inMaster);
- virtual ~CBaseTimelineTreeControl();
-
- void Draw(CRenderer *inRenderer) override;
- void OnChildSizeChanged(CControl *inChild) override;
-
- void SetIndent(long inIndent);
- long GetIndent();
-
- void SetExpanded(bool inIsExpanded);
-
- void SetToggleVisible(bool inIsToggleVisible);
- void OnSelect();
- void OnDeselect();
- void GrabTextFocus();
- void OnGainFocus() override;
- void OnLoseFocus() override;
- void SetBackgroundColor(::CColor inBackgroundColor);
-
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- 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 OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnKeyDown(unsigned int inChar, Qt::KeyboardModifiers inFlags) override;
-
- void OnTimer();
-
- void Refresh(ITimelineItem *inTimelineItem);
-
- void SetEnabled(bool inIsEnabled) override;
-
- CDropTarget *BuildDropTarget(CPt &inMousePoint, Qt::KeyboardModifiers inFlags);
- CDropTarget *FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags) override;
- void AcceptDropAfter(bool inAccept);
- void AcceptDropBefore(bool inAccept);
- void DoRename();
-
- void SetNameReadOnly(bool inReadOnly);
-
-protected:
- ECONTROLREGION FindHitRegion(CPt &inMousePoint);
- void CreateText(); // delay text creation until row is exposed
- void UpdateTextSelection();
-
- CBaseStateRow *baseStateRow() const;
-
- long m_Indent;
-
- CBaseStateRowUI *m_StateRowUI;
-
- CToggleButton *m_ExpandButton;
- CNameEdit *m_Text;
-
- CSIcon *m_Icon;
- bool m_Selected;
-
- ::CColor m_BackgroundColor;
-
- CPt m_TrackingPoint;
- CPt m_MouseMovePoint;
- bool m_MouseDown;
- bool m_DrawAcceptBefore;
- bool m_DrawAcceptAfter;
- std::shared_ptr<qt3dsdm::ISignalConnection> m_TimerHandler;
- ::CColor m_NormalTextColor;
- ::CColor m_SelectedTextColor;
- ::CColor m_LockedTextColor;
-};
-#endif // INCLUDED_BASE_TIMELINE_TREE_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp
index 94aa3ba3..8b53aba0 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp
@@ -39,7 +39,6 @@
#include "TimelineTranslationManager.h"
#include "Qt3DSDMHandles.h"
#include "BaseStateRow.h"
-#include "BaseStateRowUI.h"
#include "Doc.h"
#include "IObjectReferenceHelper.h"
#include "EmptyTimelineTimebar.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
index 9620155d..02ff7c58 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp
@@ -41,8 +41,6 @@
#include "EmptyTimelineTimebar.h"
#include "Qt3DSDMTimelineTimebar.h"
#include "BaseStateRow.h"
-#include "BaseTimebarlessRow.h"
-#include "PropertyTimebarRow.h"
#include "PropertyRow.h"
#include "KeyframesManager.h"
#include "StudioApp.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
index 88728fd7..eb6f4864 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
@@ -39,7 +39,6 @@
#include "PropertyRow.h"
#include "TimelineTranslationManager.h"
#include "ITimelineItemBinding.h"
-#include "PropertyTimebarRow.h"
#include "Qt3DSDMTimelineItemBinding.h"
#include "Qt3DSDMTimelineKeyframe.h"
#include "KeyframesManager.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
index 90ab90a0..f6a16c94 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
@@ -47,7 +47,6 @@
#include "DurationEditDlg.h"
#include "IDocumentEditor.h"
#include "BaseStateRow.h"
-#include "BaseTimebarlessRow.h"
#include "StudioFullSystem.h"
#include "StudioPreferences.h"
#include "ITimelineItemBinding.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp
index d33f947e..1afb57fc 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp
@@ -37,7 +37,6 @@
//==============================================================================
#include "SlideTimelineItemBinding.h"
#include "BaseStateRow.h"
-#include "BaseStateRowUI.h"
// Data model specific
#include "Doc.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.cpp b/src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.cpp
deleted file mode 100644
index 9407b8c4..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.cpp
+++ /dev/null
@@ -1,176 +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 "BlankToggleControl.h"
-#include "Renderer.h"
-#include "BaseStateRowUI.h"
-#include "StudioPreferences.h"
-#include "HotKeys.h"
-#include "BaseStateRow.h"
-
-CBlankToggleControl::CBlankToggleControl(CBaseStateRowUI *inBaseStateRow)
- : m_StateRowUI(inBaseStateRow)
- , m_Selected(false)
-{
- m_StateRow = static_cast<CBaseStateRow *>(m_StateRowUI->GetTimelineRow());
- m_BackgroundColor = m_StateRow->GetTimebarBackgroundColor(m_StateRow->GetObjectType());
-}
-
-CBlankToggleControl::~CBlankToggleControl()
-{
-}
-
-//==============================================================================
-/**
- * Handles the drawing fo rthe toggle control
- */
-void CBlankToggleControl::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
-
- // Fill in the background
- if (!m_Selected)
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
- else
- inRenderer->FillSolidRect(theRect, CStudioPreferences::GetTimelineSelectColor());
-
- // Draw the line at the bottom of this control
- inRenderer->PushPen(CStudioPreferences::GetTreeFloorColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
- inRenderer->PopPen();
-
- // Draw the line on the left side of this control
- inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor());
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(0, theRect.size.y - 1));
- inRenderer->PopPen();
-
- // Draw the highlight
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(CPt(1, 0));
- inRenderer->LineTo(CPt(1, theRect.size.y - 1));
- inRenderer->PopPen();
-
- // Draw the line on the right side of this control
- inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor());
- inRenderer->MoveTo(CPt(theRect.size.x - 1, 0));
- inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1));
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been selected.
- */
-void CBlankToggleControl::OnSelect()
-{
- m_Selected = true;
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been deselected.
- */
-void CBlankToggleControl::OnDeselect()
-{
- m_Selected = false;
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Handler for the OnMouseDown event
- *
- * @param inPoint the point where this event takes place
- * @param inFlags the state when this event takes place.
- */
-bool CBlankToggleControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_StateRow->Select(Qt::NoModifier);
- }
- return true;
-}
-
-//==============================================================================
-/**
- * Sets the background color of this toggle control
- */
-void CBlankToggleControl::SetBackgroundColor(::CColor inBackgroundColor)
-{
- if (m_BackgroundColor == inBackgroundColor)
- return;
-
- m_BackgroundColor = inBackgroundColor;
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Handler for the OnMouseOver event
- *
- * @param inPoint the point where this event takes place
- * @param inFlags the state when this event takes place.
- */
-void CBlankToggleControl::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- m_StateRowUI->OnMouseOver();
-}
-
-//==============================================================================
-/**
- * Handler for the OnMouseOut event
- *
- * @param inPoint the point where this event takes place
- * @param inFlags the state when this event takes place.
- */
-void CBlankToggleControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- m_StateRowUI->OnMouseOut();
-}
-
-void CBlankToggleControl::Refresh()
-{
-}
-
-CBaseStateRow *CBlankToggleControl::baseStateRow() const
-{
- return m_StateRow;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.cpp b/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.cpp
deleted file mode 100644
index a2197b19..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.cpp
+++ /dev/null
@@ -1,309 +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 "ComponentContextMenu.h"
-#include "TimelineControl.h"
-#include "StudioUtils.h"
-#include "StudioClipboard.h"
-#include "Dialogs.h"
-#include "BaseTimelineTreeControl.h"
-#include "Bindings/ITimelineItemBinding.h"
-#include "RelativePathTools.h"
-
-CComponentContextMenu::CComponentContextMenu(CBaseTimelineTreeControl *inTreeControl,
- ITimelineItemBinding *inTimelineItemBinding,
- QWidget *parent)
- : QMenu(parent)
- , m_TreeControl(inTreeControl)
- , m_TimelineItemBinding(inTimelineItemBinding)
-{
- Initialize();
-}
-
-void CComponentContextMenu::Initialize()
-{
- m_renameAction = new QAction(tr("Rename Object"), this);
- connect(m_renameAction, &QAction::triggered, this, &CComponentContextMenu::RenameObject);
- addAction(m_renameAction);
-
- m_duplicateAction = new QAction(tr("Duplicate Object"), this);
- connect(m_duplicateAction, &QAction::triggered, this, &CComponentContextMenu::DuplicateObject);
- addAction(m_duplicateAction);
-
- m_deleteAction = new QAction(tr("Delete Object"), this);
- connect(m_deleteAction, &QAction::triggered, this, &CComponentContextMenu::DeleteObject);
- addAction(m_deleteAction);
-
- addSeparator();
-
- m_copyAction = new QAction(tr("Copy"), this);
- connect(m_copyAction, &QAction::triggered, this, &CComponentContextMenu::CopyObject);
- addAction(m_copyAction);
-
- m_pasteAction = new QAction(tr("Paste"), this);
- connect(m_pasteAction, &QAction::triggered, this, &CComponentContextMenu::PasteObject);
- addAction(m_pasteAction);
-
- m_cutAction = new QAction(tr("Cut"), this);
- connect(m_cutAction, &QAction::triggered, this, &CComponentContextMenu::CutObject);
- addAction(m_cutAction);
- addSeparator();
-
- m_makeAction = new QAction(tr("Make Component"), this);
- connect(m_makeAction, &QAction::triggered, this, &CComponentContextMenu::MakeComponent);
- addAction(m_makeAction);
-
- if (CanInspectComponent()) {
- m_inspectAction = new QAction(tr("Edit Component"), this);
- connect(m_inspectAction, &QAction::triggered,
- this, &CComponentContextMenu::InspectComponent);
- addAction(m_inspectAction);
- }
-
- if (m_TimelineItemBinding->IsExternalizeable()) {
- addSeparator();
- m_externalizeAction = new QAction(tr("Externalize Buffer"), this);
- connect(m_externalizeAction, &QAction::triggered,
- this, &CComponentContextMenu::Externalize);
- addAction(m_externalizeAction);
- } else if (m_TimelineItemBinding->IsInternalizeable()) {
- addSeparator();
- m_internalizeAction = new QAction(tr("Internalize Buffer"), this);
- connect(m_internalizeAction, &QAction::triggered,
- this, &CComponentContextMenu::Internalize);
- addAction(m_internalizeAction);
- }
-
- addSeparator();
-
- m_copyPathAction = new QAction(tr("Copy Object Path"), this);
- connect(m_copyPathAction, &QAction::triggered, this, &CComponentContextMenu::CopyObjectPath);
- addAction(m_copyPathAction);
-}
-
-void CComponentContextMenu::showEvent(QShowEvent *event)
-{
- m_renameAction->setEnabled(CanRenameObject());
- m_duplicateAction->setEnabled(CanDuplicateObject());
- m_deleteAction->setEnabled(CanDeleteObject());
-
- m_cutAction->setEnabled(CanCutObject());
- m_copyAction->setEnabled(CanCopyObject());
- m_pasteAction->setEnabled(CanPasteObject());
-
- m_makeAction->setEnabled(CanMakeComponent());
-
- QMenu::showEvent(event);
-}
-
-
-CComponentContextMenu::~CComponentContextMenu()
-{
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be renamed.
- * @return true if the object can be renamed.
- */
-bool CComponentContextMenu::CanRenameObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(ITimelineItemBinding::EUserTransaction_Rename);
-}
-
-//=============================================================================
-/**
- * Rename the object.
- */
-void CComponentContextMenu::RenameObject()
-{
- m_TreeControl->DoRename();
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be duplicated.
- * @return true if the object can be duplicated.
- */
-bool CComponentContextMenu::CanDuplicateObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(
- ITimelineItemBinding::EUserTransaction_Duplicate);
-}
-
-//=============================================================================
-/**
- * Duplicate the object.
- */
-void CComponentContextMenu::DuplicateObject()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_Duplicate);
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be deleted.
- * @return true if the object can be deleted.
- */
-bool CComponentContextMenu::CanDeleteObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(ITimelineItemBinding::EUserTransaction_Delete);
-}
-
-//=============================================================================
-/**
- * Deletes the object from the scene graph.
- */
-void CComponentContextMenu::DeleteObject()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_Delete);
-}
-
-//=============================================================================
-/**
- * Checks to see if the State is a component and can be inspected.
- * @return true is the state is a component and can be inspected.
- */
-bool CComponentContextMenu::CanInspectComponent()
-{
- return m_TimelineItemBinding->IsValidTransaction(
- ITimelineItemBinding::EUserTransaction_EditComponent);
-}
-
-//=============================================================================
-/**
- * Inspect the State (Component).
- * This will make the component the top level item of the timelineview.
- */
-void CComponentContextMenu::InspectComponent()
-{
- m_TimelineItemBinding->OpenAssociatedEditor();
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be wrapped in a component.
- * @return true if the object is allowed to be wrapped in a component.
- */
-bool CComponentContextMenu::CanMakeComponent()
-{
- return m_TimelineItemBinding->IsValidTransaction(
- ITimelineItemBinding::EUserTransaction_MakeComponent);
-}
-
-//=============================================================================
-/**
- * Wraps the specified asset hierarchy under a component.
- */
-void CComponentContextMenu::MakeComponent()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_MakeComponent);
-}
-
-//=============================================================================
-/**
- * Get the full Scripting path of the object and copy it to the clipboard.
- * This will figure out the proper way to address the object via scripting
- * and put that path into the clipboard.
- */
-void CComponentContextMenu::CopyObjectPath()
-{
- CStudioClipboard::CopyTextToClipboard(m_TimelineItemBinding->GetObjectPath().toQString());
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be copied
- * @return true if the object can be copied
- */
-bool CComponentContextMenu::CanCopyObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(ITimelineItemBinding::EUserTransaction_Copy);
-}
-
-//=============================================================================
-/**
- * Copy the object.
- */
-void CComponentContextMenu::CopyObject()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_Copy);
-}
-
-bool CComponentContextMenu::CanCutObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(ITimelineItemBinding::EUserTransaction_Cut);
-}
-
-void CComponentContextMenu::CutObject()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_Cut);
-}
-
-//=============================================================================
-/**
- * Checks to see if the object can be pasted
- * @return true if the object can be pasted
- */
-bool CComponentContextMenu::CanPasteObject()
-{
- return m_TimelineItemBinding->IsValidTransaction(ITimelineItemBinding::EUserTransaction_Paste);
-}
-
-//=============================================================================
-/**
- * Paste the object.
- */
-void CComponentContextMenu::PasteObject()
-{
- m_TimelineItemBinding->PerformTransaction(ITimelineItemBinding::EUserTransaction_Paste);
-}
-
-ITimelineItem *CComponentContextMenu::GetTimelineItem() const
-{
- return m_TimelineItemBinding->GetTimelineItem();
-}
-
-void CComponentContextMenu::Externalize()
-{
- m_TimelineItemBinding->Externalize();
-}
-
-void CComponentContextMenu::Internalize()
-{
- m_TimelineItemBinding->Internalize();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.h b/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.h
deleted file mode 100644
index dc837a2c..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ComponentContextMenu.h
+++ /dev/null
@@ -1,107 +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_COMPONENT_CONTEXT_MENU_H
-#define INCLUDED_COMPONENT_CONTEXT_MENU_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include <QtWidgets/qmenu.h>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CBaseTimelineTreeControl;
-class ITimelineItem;
-class ITimelineItemBinding;
-
-class CComponentContextMenu : public QMenu
-{
- Q_OBJECT
-public:
- CComponentContextMenu(CBaseTimelineTreeControl *inTreeControl,
- ITimelineItemBinding *inTimelineItemBinding,
- QWidget *parent = nullptr);
- virtual ~CComponentContextMenu();
-
-protected Q_SLOTS:
- void RenameObject();
- void DuplicateObject();
- void DeleteObject();
- void InspectComponent();
- void MakeComponent();
- void CopyObjectPath();
- void CopyObject();
- void PasteObject();
- void CutObject();
- void Externalize();
- void Internalize();
-
-protected:
- void showEvent(QShowEvent *event) override;
-
- bool CanRenameObject();
- bool CanDuplicateObject();
- bool CanDeleteObject();
- bool CanInspectComponent();
- bool CanMakeComponent();
- bool CanCopyObject();
- bool CanPasteObject();
- bool CanCutObject();
- void Import();
- void RefreshImport();
- bool CanImport();
- bool CanRefreshImport();
- bool CanExportComponent();
-
- void Initialize();
-
- ITimelineItem *GetTimelineItem() const;
-
- CBaseTimelineTreeControl *m_TreeControl;
- ITimelineItemBinding *m_TimelineItemBinding;
- QAction *m_renameAction;
- QAction *m_duplicateAction;
- QAction *m_deleteAction;
- QAction *m_inspectAction;
- QAction *m_makeAction;
- QAction *m_copyPathAction;
- QAction *m_cutAction;
- QAction *m_copyAction;
- QAction *m_pasteAction;
- QAction *m_externalizeAction;
- QAction *m_internalizeAction;
-};
-#endif // INCLDUED_STATE_CONTEXT_MENU_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.cpp b/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.cpp
deleted file mode 100644
index 24d9fc60..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.cpp
+++ /dev/null
@@ -1,272 +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 "FilterToolbar.h"
-#include "ButtonControl.h"
-#include "SystemPreferences.h"
-#include "Renderer.h"
-#include "TimelineTreeLayout.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CFilterToolbar::CFilterToolbar(CTimelineTreeLayout *inTreeLayout)
- : CFlowLayout(nullptr, false)
-{
- m_TreeLayout = inTreeLayout;
-
- SetFlowDirection(FLOW_HORIZONTAL);
- SetAlignment(ALIGN_TOP, ALIGN_LEFT);
- SetLeftMargin(1);
-
- // Create the buttons
- m_FltrBehaviorsBtn = new CProceduralButton<CToggleButton>();
- m_FltrPropertiesBtn = new CProceduralButton<CToggleButton>();
- m_FltrMaterialsBtn = new CProceduralButton<CToggleButton>();
- m_FltrShyBtn = new CProceduralButton<CToggleButton>();
- m_FltrVisibleBtn = new CProceduralButton<CToggleButton>();
-
- // Load the bitmaps
- m_FltrBehaviorsBtn->SetUpImage("obsolete_placeholder.png");
- m_FltrBehaviorsBtn->SetDownImage("obsolete_placeholder.png");
-
- m_FltrPropertiesBtn->SetUpImage("obsolete_placeholder.png");
- m_FltrPropertiesBtn->SetDownImage("obsolete_placeholder.png");
-
- m_FltrMaterialsBtn->SetUpImage("obsolete_placeholder.png");
- m_FltrMaterialsBtn->SetDownImage("obsolete_placeholder.png");
-
- m_FltrShyBtn->SetUpImage("Toggle-Shy.png");
- m_FltrShyBtn->SetDownImage("Toggle-Shy.png");
-
- m_FltrVisibleBtn->SetUpImage("Toggle-HideShow.png");
- m_FltrVisibleBtn->SetDownImage("Toggle-HideShow.png");
-
- // Turn off the left border of each button since they are all next to each other, otherwise,
- // you'll get a double line effect
- CProceduralButton<CToggleButton>::SBorderOptions theBorderOptions(false, true, true, true);
- m_FltrBehaviorsBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrPropertiesBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrMaterialsBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrShyBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrVisibleBtn->SetBorderVisibilityAll(theBorderOptions);
-
- // Set the max sizes for the buttons
- m_FltrBehaviorsBtn->SetAbsoluteSize(m_FltrBehaviorsBtn->GetSize());
- m_FltrPropertiesBtn->SetAbsoluteSize(m_FltrPropertiesBtn->GetSize());
- m_FltrMaterialsBtn->SetAbsoluteSize(m_FltrMaterialsBtn->GetSize());
- m_FltrShyBtn->SetAbsoluteSize(m_FltrShyBtn->GetSize());
- m_FltrVisibleBtn->SetAbsoluteSize(m_FltrShyBtn->GetSize());
-
- // Tooltips
- m_FltrBehaviorsBtn->SetTooltipText(QObject::tr("Hide behaviors"));
- m_FltrPropertiesBtn->SetTooltipText(QObject::tr("Hide properties"));
- m_FltrMaterialsBtn->SetTooltipText(QObject::tr("Hide materials"));
- m_FltrShyBtn->SetTooltipText(QObject::tr("Hide shy objects"));
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Hide inactive objects"));
-
- // Callback for one of the Filter buttons being clicked on
- QObject::connect(m_FltrBehaviorsBtn,&CToggleButton::SigToggle,
- std::bind(&CFilterToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_FltrPropertiesBtn,&CToggleButton::SigToggle,
- std::bind(&CFilterToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_FltrMaterialsBtn,&CToggleButton::SigToggle,
- std::bind(&CFilterToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_FltrShyBtn,&CToggleButton::SigToggle,
- std::bind(&CFilterToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_FltrVisibleBtn,&CToggleButton::SigToggle,
- std::bind(&CFilterToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- // Add the buttons to this layout
- AddChild(m_FltrMaterialsBtn);
- AddChild(m_FltrPropertiesBtn);
- AddChild(m_FltrBehaviorsBtn);
- AddChild(m_FltrShyBtn);
- AddChild(m_FltrVisibleBtn);
-
- m_FltrBehaviorsBtn->SetToggleState(false);
- m_FltrPropertiesBtn->SetToggleState(false);
- m_FltrMaterialsBtn->SetToggleState(false);
- m_FltrShyBtn->SetToggleState(false);
- m_FltrVisibleBtn->SetToggleState(false);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CFilterToolbar::~CFilterToolbar()
-{
- delete m_FltrBehaviorsBtn;
- delete m_FltrPropertiesBtn;
- delete m_FltrMaterialsBtn;
- delete m_FltrShyBtn;
- delete m_FltrVisibleBtn;
-}
-
-//=============================================================================
-/**
- * Overriden to draw some highlighting.
- */
-void CFilterToolbar::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
- // Draw the highlight at the bottom
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
- inRenderer->PopPen();
-
- // Draw the line on the left side
- inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor());
- inRenderer->MoveTo(0, 0);
- inRenderer->LineTo(0, theRect.size.y - 1);
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for behavior objects in the timeline.
- * @param inFilter true to filter behaviors out of the timeline, false to show
- * behaviors in the timeline.
- */
-void CFilterToolbar::FilterBehaviors(bool inFilter)
-{
- if (inFilter)
- m_FltrBehaviorsBtn->SetTooltipText(QObject::tr("Show behaviors"));
- else
- m_FltrBehaviorsBtn->SetTooltipText(QObject::tr("Hide behaviors"));
-
- m_TreeLayout->GetFilter()->SetBehaviors(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for properties on objects in the timeline.
- * @param inFilter true to filter properties out of the timeline, false to show
- * properties in the timeline.
- */
-void CFilterToolbar::FilterProperties(bool inFilter)
-{
- if (inFilter)
- m_FltrPropertiesBtn->SetTooltipText(QObject::tr("Show properties"));
- else
- m_FltrPropertiesBtn->SetTooltipText(QObject::tr("Hide properties"));
-
- m_TreeLayout->GetFilter()->SetProperties(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for material objects.
- * @param inFilter true to filter material objects out of the timeline, false to show
- * material objects in the timeline.
- */
-void CFilterToolbar::FilterMaterials(bool inFilter)
-{
- if (inFilter)
- m_FltrMaterialsBtn->SetTooltipText(QObject::tr("Show materials"));
- else
- m_FltrMaterialsBtn->SetTooltipText(QObject::tr("Hide materials"));
-
- m_TreeLayout->GetFilter()->SetMaterials(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for shy objects.
- * @param inFilter true to filter shy objects out of the timeline, false to show
- * shy objects in the timeline.
- */
-void CFilterToolbar::FilterShy(bool inFilter)
-{
- if (inFilter)
- m_FltrShyBtn->SetTooltipText(QObject::tr("Show shy objects"));
- else
- m_FltrShyBtn->SetTooltipText(QObject::tr("Hide shy objects"));
-
- m_TreeLayout->GetFilter()->SetShy(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for visible objects.
- * @param inFilter true to filter visible objects out of the timeline, false to show
- * shy objects in the timeline.
- */
-void CFilterToolbar::FilterVisible(bool inFilter)
-{
- if (inFilter)
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Show inactive objects"));
- else
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Hide inactive objects"));
-
- m_TreeLayout->GetFilter()->SetVisible(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * 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 CFilterToolbar::OnButtonToggled(CToggleButton *inButton, CButtonControl::EButtonState inState)
-{
- bool theFilterNeedsApplied = (inState == CButtonControl::EBUTTONSTATE_UP);
-
- if (inButton == m_FltrBehaviorsBtn)
- FilterBehaviors(theFilterNeedsApplied);
- else if (inButton == m_FltrPropertiesBtn)
- FilterProperties(theFilterNeedsApplied);
- else if (inButton == m_FltrMaterialsBtn)
- FilterMaterials(theFilterNeedsApplied);
- else if (inButton == m_FltrShyBtn)
- FilterShy(theFilterNeedsApplied);
- else if (inButton == m_FltrVisibleBtn)
- FilterVisible(theFilterNeedsApplied);
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.h b/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.h
deleted file mode 100644
index 8148fff3..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/FilterToolbar.h
+++ /dev/null
@@ -1,80 +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_FILTER_TOOLBAR_H
-#define INCLUDED_FILTER_TOOLBAR_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "FlowLayout.h"
-#include "ProceduralButton.h"
-#include "ToggleButton.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CButtonControl;
-class CRenderer;
-class CTimelineTreeLayout;
-
-//=============================================================================
-/**
- * Control at the top of the timeline containing filter buttons.
- */
-class CFilterToolbar : public CFlowLayout
-{
-public:
- CFilterToolbar(CTimelineTreeLayout *inTreeLayout);
- virtual ~CFilterToolbar();
- void Draw(CRenderer *inRenderer) override;
-
- void FilterBehaviors(bool inFilter);
- void FilterProperties(bool inFilter);
- void FilterMaterials(bool inFilter);
- void FilterShy(bool inFilter);
- void FilterVisible(bool inFilter);
-
- void OnButtonToggled(CToggleButton *inButton, CToggleButton::EButtonState inState);
-
-protected:
- CProceduralButton<CToggleButton> *m_FltrBehaviorsBtn;
- CProceduralButton<CToggleButton> *m_FltrPropertiesBtn;
- CProceduralButton<CToggleButton> *m_FltrMaterialsBtn;
- CProceduralButton<CToggleButton> *m_FltrShyBtn;
- CProceduralButton<CToggleButton> *m_FltrVisibleBtn;
- CTimelineTreeLayout *m_TreeLayout;
-};
-
-#endif // INCLUDED_FILTER_TOOLBAR_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h b/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h
index 0c19b2b2..7a686522 100644
--- a/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h
+++ b/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h
@@ -36,7 +36,6 @@
// Includes
//==============================================================================
#include "StateRow.h"
-#include "TimelineTimelineLayout.h"
#include "Bindings/IKeyframeSelector.h"
//==============================================================================
diff --git a/src/Authoring/Studio/Palettes/Timeline/Playhead.cpp b/src/Authoring/Studio/Palettes/Timeline/Playhead.cpp
deleted file mode 100644
index be59530d..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/Playhead.cpp
+++ /dev/null
@@ -1,266 +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 "Playhead.h"
-#include "Renderer.h"
-#include "TimelineTimelineLayout.h"
-#include "IDoc.h"
-#include "HotKeys.h"
-#include "ResourceCache.h"
-#include "TimeEditDlg.h"
-#include "TimeMeasure.h"
-
-//=============================================================================
-/**
- * Create a new Playhead.
- * The timeline is used for notifying of time changes and for scrolling.
- * @param inTimeline the timeline that this is a part of.
- */
-CPlayhead::CPlayhead(CTimelineTimelineLayout *inTimeline, IDoc *inDoc)
- : m_IsMouseDown(false)
- , m_MinimumPosition(0)
- , m_MaximumPosition(LONG_MAX)
- , m_InitialOffset(0)
- , m_Doc(inDoc)
-{
- m_Timeline = inTimeline;
-
- m_PlayheadImage = CResourceCache::GetInstance()->GetBitmap("PlaybackHead.png");
- SetName("Playhead");
-
- // Set the line to the middle of this.
- m_LinePos = GetSize().x / 2;
- SetAlpha(128);
-}
-
-CPlayhead::~CPlayhead()
-{
-}
-
-//=============================================================================
-/**
- * Call from the OverlayControl to perform the draw.
- * Wish this didn't have to be a special function but...
- * @param inRenderer the renderer to draw to.
- */
-void CPlayhead::Draw(CRenderer *inRenderer)
-{
- // If this goes before position then clip it at 0.
- if (GetPosition().x < 0) {
- CRct theClipRect(GetSize());
- theClipRect.Offset(CPt(-GetPosition().x, 0));
- inRenderer->PushClippingRect(theClipRect);
- }
-
- // Draw the playhead
- inRenderer->DrawBitmap(CPt(0, 2), m_PlayheadImage);
-
- // Draw the line
- inRenderer->PushPen(CColor(255, 0, 0));
- inRenderer->MoveTo(m_LinePos, 20);
- inRenderer->LineTo(m_LinePos, GetSize().y - 1);
- inRenderer->PopPen();
-
- // If we added an extra clipping rect then remove it.
- if (GetPosition().x < 0) {
- inRenderer->PopClippingRect();
- }
-}
-
-//=============================================================================
-/**
- * Handles mouse down messages.
- * @param inPoint where the mouse was clicked.
- * @param inFlags the state of the mouse.
- */
-bool CPlayhead::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // If no one else processed it then process the command.
- if (!COverlayControl::OnMouseDown(inPoint, inFlags)) {
- m_Snapper.Clear();
- m_Snapper.SetSource(this);
- m_Timeline->PopulateSnappingList(&m_Snapper);
-
- // m_Snapper.SetTimeOffset( m_Timeline->GetViewTimeOffset( ) );
- m_Snapper.SetSnappingKeyframes(true);
- m_Snapper.BeginDrag(inPoint.x, GetSize().x / 2);
-
- m_InitialOffset = inPoint.x;
- m_IsMouseDown = true;
-
- m_Timeline->RecalcTime((inFlags & CHotKeys::MODIFIER_CONTROL) == 0, 0);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Handles mouse double click messages. Pops up a time edit dialog box for
- * modifying playhead time.
- * @param inPoint the location of the mouse in local coordinates.
- * @param inFlags the state of the mouse.
- */
-bool CPlayhead::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
-
- CTimeEditDlg theTimeEditDlg;
- theTimeEditDlg.showDialog(GetCurrentTime(), m_Doc, PLAYHEAD);
- return true;
-}
-
-//=============================================================================
-/**
- * Handles mouse move messages.
- * @param inPoint the location of the mouse in local coordinates.
- * @param inFlags the state of the mouse.
- */
-void CPlayhead::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- COverlayControl::OnMouseMove(inPoint, inFlags);
-
- // If we are down then move the playhead
- if (m_IsMouseDown) {
- long theTime = m_Snapper.ProcessDrag(GetCurrentTime(), inPoint.x, inFlags);
- bool theUpdateClientTimeFlag = (inFlags & CHotKeys::MODIFIER_CONTROL) == 0;
-
- UpdateTime(theTime, theUpdateClientTimeFlag);
- }
-}
-
-//=============================================================================
-/**
- * Updates the time of the active context
- * @param inTime the new time
- * @param inUpdateClient true if scene is to be redrawn
- */
-void CPlayhead::UpdateTime(long inTime, bool /*inUpdateClient*/)
-{
- // true to "check bounds" to ensure playhead is within valid range.
- m_Doc->NotifyTimeChanged(inTime);
-}
-
-//=============================================================================
-/**
- * Notification that the mouse was let go.
- * @param inPoint the location of the mouse in local coordinates.
- * @param inFlags the state of the mouse.
- */
-void CPlayhead::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- COverlayControl::OnMouseUp(inPoint, inFlags);
-
- m_IsMouseDown = false;
-}
-
-//=============================================================================
-/**
- * Set the size of this control.
- * @param inSize the size to be set.
- */
-void CPlayhead::SetSize(CPt inSize)
-{
- COverlayControl::SetSize(inSize);
- // Update the line position.
- m_LinePos = inSize.x / 2;
-}
-
-//=============================================================================
-/**
- * Set the minimum and maximum allowed positions of the line.
- * @param inMinimumPosition the minimum allowed position.
- * @param inMaximumPosition the maximum allowed position.
- */
-void CPlayhead::SetMinMaxPosition(long inMinimumPosition, long inMaximumPosition)
-{
- m_MinimumPosition = inMinimumPosition;
- m_MaximumPosition = inMaximumPosition;
-}
-
-long CPlayhead::GetCurrentTime()
-{
- return m_Doc->GetCurrentViewTime();
-}
-
-//=============================================================================
-/**
- * Check to see if inPoint is over this control or not.
- * This overrides COverlayControl::HitTest so that the playhead line can be
- * exempt from mouse hits.
- * @param inPoint the location of the mouse in local coordinates.
- */
-bool CPlayhead::HitTest(const CPt &inPoint) const
-{
- if (inPoint.y < m_PlayheadImage.height()) {
- return COverlayControl::HitTest(inPoint);
- }
- return false;
-}
-
-void CPlayhead::StepRightSmall()
-{
- long theInterval = m_Timeline->GetTimeMeasure()->GetSmallHashInterval();
-
- long theCurrentTime = GetCurrentTime();
- long theTime = theCurrentTime / theInterval * theInterval + theInterval;
- UpdateTime(theTime, true);
-}
-
-void CPlayhead::StepRightLarge()
-{
- long theInterval = m_Timeline->GetTimeMeasure()->GetLargeHashInterval();
-
- long theCurrentTime = GetCurrentTime();
- long theTime = theCurrentTime / theInterval * theInterval + theInterval;
- UpdateTime(theTime, true);
-}
-
-void CPlayhead::StepLeftSmall()
-{
- long theInterval = m_Timeline->GetTimeMeasure()->GetSmallHashInterval();
-
- long theCurrentTime = GetCurrentTime();
- long theTime = theCurrentTime / theInterval * theInterval - theInterval;
-
- UpdateTime(theTime, true);
-}
-
-void CPlayhead::StepLeftLarge()
-{
- long theInterval = m_Timeline->GetTimeMeasure()->GetLargeHashInterval();
-
- long theCurrentTime = GetCurrentTime();
- long theTime = theCurrentTime / theInterval * theInterval - theInterval;
-
- UpdateTime(theTime, true);
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/Playhead.h b/src/Authoring/Studio/Palettes/Timeline/Playhead.h
deleted file mode 100644
index 21d21041..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/Playhead.h
+++ /dev/null
@@ -1,82 +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_PLAYHEAD_H
-#define INCLUDED_PLAYHEAD_H 1
-
-#pragma once
-
-#include "OverlayControl.h"
-#include "Snapper.h"
-
-#include <QPixmap>
-
-class CTimelineTimelineLayout;
-class IDoc;
-
-class CPlayhead : public COverlayControl
-{
-public:
- CPlayhead(CTimelineTimelineLayout *inTimeline, IDoc *inDoc);
- virtual ~CPlayhead();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void SetSize(CPt inSize) override;
- void Draw(CRenderer *inRenderer) override;
- void SetMinMaxPosition(long inMinimumPosition, long inMaximumPosition);
- long GetCurrentTime();
- bool HitTest(const CPt &inPoint) const override;
- void StepRightSmall();
- void StepRightLarge();
- void StepLeftSmall();
- void StepLeftLarge();
-
- long GetCenterOffset() const { return m_LinePos; }
- bool IsMouseDown() const { return m_IsMouseDown; }
-
- void UpdateTime(long inTime, bool inUpdateClient);
-
-protected:
- QPixmap m_PlayheadImage;
- bool m_IsMouseDown;
- long m_InitialOffset;
-
- long m_MinimumPosition;
- long m_MaximumPosition;
- long m_LinePos;
-
- CTimelineTimelineLayout *m_Timeline;
-
- CSnapper m_Snapper;
- IDoc *m_Doc;
-};
-#endif // INCLUDED_PLAYHEAD_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h b/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h
index 5c608d06..7b76b955 100644
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h
+++ b/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h
@@ -48,8 +48,6 @@
class CPropertyColorControl;
class CBlankControl;
class CPropertyTreeControl;
-class CPropertyToggleControl;
-class CPropertyTimebarRow;
class ITimelineItemProperty;
class CPropertyRow : public CTimelineRow
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.cpp
deleted file mode 100644
index 2f8e3ffb..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-/****************************************************************************
-**
-** 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 "PropertyRowUI.h"
-
-#include "PropertyRow.h"
-#include "PropertyTreeControl.h"
-#include "TimelineControl.h"
-#include "PropertyColorControl.h"
-#include "PropertyToggleControl.h"
-#include "PropertyTreeControl.h"
-#include "PropertyTimebarRow.h"
-#include "BlankControl.h"
-
-CPropertyRowUI::CPropertyRowUI(CPropertyRow *propertyRow, CAbstractTimelineRowUI *parentUiRow)
- : CAbstractTimelineRowUI(propertyRow, parentUiRow)
- , m_propertyRow(propertyRow)
-{
- connect(propertyRow, &CPropertyRow::dirtyChanged,
- this, &CPropertyRowUI::handleDirtyChanged);
- connect(propertyRow, &CPropertyRow::visibleChanged,
- this, &CPropertyRowUI::handleVisibleChanged);
- connect(propertyRow, &CPropertyRow::selectAllKeys,
- this, &CPropertyRowUI::handleSelectAllKeys);
- connect(propertyRow, &CPropertyRow::deleteAllKeys,
- this, &CPropertyRowUI::handleDeleteAllKeys);
- connect(propertyRow, &CPropertyRow::refreshRequested,
- this, &CPropertyRowUI::handleRefreshRequested);
- connect(propertyRow, &CPropertyRow::selectKeysByTime,
- this, &CPropertyRowUI::handleSelectKeysByTime);
- connect(propertyRow, &CPropertyRow::timeRatioChanged,
- this, &CPropertyRowUI::setTimeRatio);
-
- m_TreeControl = new CPropertyTreeControl(this);
- m_ToggleControl = new CPropertyToggleControl(this);
- m_TimebarRow = new CPropertyTimebarRow(this);
- m_TimebarRow->SetTimeRatio(propertyRow->GetTimeRatio());
-
- m_PropertyColorControl = new CPropertyColorControl(m_propertyRow);
- long theTimebarHeight = CStudioPreferences::GetRowSize();
-
- // do not set absolute size because it messes up the timeline
- m_TreeControl->SetSize(CPt(500, theTimebarHeight));
- m_PropertyColorControl->SetAbsoluteSize(CPt(theTimebarHeight, theTimebarHeight));
- m_ToggleControl->SetAbsoluteSize(CPt(57, theTimebarHeight));
- m_TimebarRow->SetSize(CPt(0, theTimebarHeight));
-
- // sk: setting controls names' seem to be only useful for debugging.
- // Q3DStudio::CString thePropName( inProperty->GetName( ) );
- // m_TreeControl->SetName( thePropName );
- // m_TimebarRow->SetName( thePropName + "TimebarRow" );
-}
-
-CPropertyRowUI::~CPropertyRowUI()
-{
- delete m_TreeControl;
- delete m_ToggleControl;
- delete m_PropertyColorControl;
- delete m_TimebarRow;
-}
-
-
-//=============================================================================
-/**
- * Get the left hand color control for this row.
- * @return the color control for this row.
- */
-CControl *CPropertyRowUI::GetColorControl()
-{
- return m_PropertyColorControl;
-}
-
-//=============================================================================
-/**
- * Get the tree control object for this row.
- * @return the tree control object for this row.
- */
-CControl *CPropertyRowUI::GetTreeControl()
-{
- return m_TreeControl;
-}
-
-//=============================================================================
-/**
- * Get the toggle control object for this row.
- * @return the toggle control object for this row.
- */
-CControl *CPropertyRowUI::GetToggleControl()
-{
- return m_ToggleControl;
-}
-
-//=============================================================================
-/**
- * Get the timebar control for this row.
- * @return the timebar control for this row.
- */
-CControl *CPropertyRowUI::GetTimebarControl()
-{
- return m_TimebarRow;
-}
-
-//=============================================================================
-/**
- * Set the amount that this row is indented.
- * This handles the tree indenting.
- * @param inIndent the amount of indent for this row.
- */
-void CPropertyRowUI::SetIndent(long inIndent)
-{
- m_TreeControl->SetIndent(inIndent);
-}
-
-long CPropertyRowUI::GetIndent() const
-{
- return m_TreeControl->GetIndent();
-}
-
-void CPropertyRowUI::SetSnappingListProvider(ISnappingListProvider *inProvider)
-{
- m_TimebarRow->SetSnappingListProvider(inProvider);
-}
-
-ISnappingListProvider *CPropertyRowUI::GetSnappingListProvider() const
-{
- return &m_TimebarRow->GetSnappingListProvider();
-}
-
-//=============================================================================
-/**
- * Notification from one of the child controls that the mouse just entered.
- * This is used to handle the highlighting of the entire row.
- */
-void CPropertyRowUI::OnMouseOver()
-{
- // Only change if change is needed
- if (!m_Highlighted) {
- m_TreeControl->SetHighlighted(true);
- m_ToggleControl->SetHighlighted(true);
- m_TimebarRow->SetHighlighted(true);
-
- m_Highlighted = true;
- }
-}
-
-//=============================================================================
-/**
- * Notification from one of the child controls that the mouse just left.
- * This is used to handle the highlighting of the entire row.
- */
-void CPropertyRowUI::OnMouseOut()
-{
- // Only change is change is needed.
- if (m_Highlighted) {
- m_TreeControl->SetHighlighted(false);
- m_ToggleControl->SetHighlighted(false);
- m_TimebarRow->SetHighlighted(false);
-
- m_Highlighted = false;
- }
-}
-
-//=============================================================================
-/**
- * Double click handler for the property row
- */
-void CPropertyRowUI::OnMouseDoubleClick()
-{
- SetDetailedView(!m_DetailedView);
-}
-
-//=============================================================================
-/**
- * Selects all keyframes of this property that are inside inRect
- *
- * @param inRect theRect to check
- */
-void CPropertyRowUI::SelectKeysInRect(CRct inRect, bool inModifierKeyDown,
- bool inGlobalCommitSelectionFlag)
-{
- Q_UNUSED(inGlobalCommitSelectionFlag);
- CRct theOffsetRect = inRect;
-
- theOffsetRect.Offset(-m_TimebarRow->GetPosition());
- m_TimebarRow->SelectKeysInRect(theOffsetRect, inModifierKeyDown);
-}
-
-//=============================================================================
-/**
- * Sets all the child control enable states
- * @param inEnabled the state to set the controls to
- */
-void CPropertyRowUI::SetEnabled(bool inEnabled)
-{
- m_TreeControl->SetEnabled(inEnabled);
- m_ToggleControl->SetEnabled(inEnabled);
- m_PropertyColorControl->SetEnabled(inEnabled);
- m_TimebarRow->SetEnabled(inEnabled);
-}
-
-
-//=============================================================================
-/**
- * CommitSelections: commits all the property keyframe selections by setting their
- * previous selection state to the current selection state.
- * This will prevent the keyframes in the current selection
- * from
- * switching states as we select other keyframes.
- *
- * @param NONE
- * @return NONE
- */
-void CPropertyRowUI::CommitSelections()
-{
- m_TimebarRow->CommitSelections();
-}
-
-void CPropertyRowUI::handleDirtyChanged(bool dirty)
-{
- m_TimebarRow->SetDirty(true);
-}
-
-void CPropertyRowUI::setTimeRatio(double inTimeRatio)
-{
- m_TimebarRow->SetTimeRatio(inTimeRatio);
-}
-
-void CPropertyRowUI::handleVisibleChanged(bool visible)
-{
- m_TreeControl->SetVisible(visible);
- m_TimebarRow->SetVisible(visible);
- m_ToggleControl->SetVisible(visible);
- m_PropertyColorControl->SetVisible(visible);
-}
-
-void CPropertyRowUI::handleSelectAllKeys()
-{
- m_TimebarRow->SelectAllKeys();
-}
-
-void CPropertyRowUI::handleDeleteAllKeys()
-{
- m_TimebarRow->Invalidate();
-}
-
-void CPropertyRowUI::handleRefreshRequested()
-{
- if (m_TimebarRow->IsVisible())
- m_TimebarRow->SetDirty(true);
-}
-
-void CPropertyRowUI::handleSelectKeysByTime(long inTime, bool inSelected)
-{
- m_TimebarRow->SelectKeysByTime(inTime, inSelected);
-}
-
-//=============================================================================
-/**
- * Expands the row out so a more detailed view of the animation tracks can be seen
- *
- * @param inIsInDetailedView true if we are switching to a detailed view
- */
-void CPropertyRowUI::SetDetailedView(bool inIsDetailedView)
-{
- m_DetailedView = inIsDetailedView;
-
- if (m_DetailedView) {
- long theHeight = 100;
- m_PropertyColorControl->SetAbsoluteSize(
- CPt(m_PropertyColorControl->GetSize().x, theHeight));
- m_TreeControl->SetSize(CPt(m_TreeControl->GetSize().x, theHeight));
- m_ToggleControl->SetAbsoluteSize(CPt(m_ToggleControl->GetSize().x, theHeight));
- m_TimebarRow->SetAbsoluteSize(CPt(m_TimebarRow->GetSize().x, theHeight));
-
- m_TimebarRow->SetDetailedView(true);
- } else {
- long theDefaultHeight = CStudioPreferences::GetRowSize();
-
- m_PropertyColorControl->SetAbsoluteSize(
- CPt(m_PropertyColorControl->GetSize().x, theDefaultHeight));
- m_TreeControl->SetSize(CPt(m_TreeControl->GetSize().x, theDefaultHeight));
- m_ToggleControl->SetAbsoluteSize(CPt(m_ToggleControl->GetSize().x, theDefaultHeight));
- m_TimebarRow->SetAbsoluteSize(CPt(m_TimebarRow->GetSize().x, theDefaultHeight));
-
- m_TimebarRow->SetDetailedView(false);
- }
-
- GetTopControl()->OnLayoutChanged();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.h b/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.h
deleted file mode 100644
index d698209b..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyRowUI.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** 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 PROPERTYROWUI_H
-#define PROPERTYROWUI_H
-
-#include "AbstractTimelineRowUI.h"
-
-class CPropertyRow;
-class CPropertyColorControl;
-class CBlankControl;
-class CPropertyTreeControl;
-class CPropertyToggleControl;
-class CPropertyTimebarRow;
-class ITimelineItemProperty;
-
-class CPropertyRowUI : public CAbstractTimelineRowUI
-{
- Q_OBJECT
-public:
- CPropertyRowUI(CPropertyRow *baseStateRow, CAbstractTimelineRowUI *parentUiRow);
- ~CPropertyRowUI();
-
- CControl *GetColorControl() override;
- CControl *GetTreeControl() override;
- CControl *GetToggleControl() override;
- CControl *GetTimebarControl() override;
-
- void SetIndent(long inIndent) override;
- long GetIndent() const override;
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider) override;
- ISnappingListProvider *GetSnappingListProvider() const override;
-
- void OnMouseOver();
- void OnMouseOut();
- void OnMouseDoubleClick();
-
- void SelectKeysInRect(CRct inRect, bool inModifierKeyDown,
- bool inGlobalCommitSelectionFlag) override;
- void SetEnabled(bool inEnabled) override;
-
- void CommitSelections();
-
- // unused methods from CAbstractTimelineRowUI
- void SetFocus() override {}
- void SetNameReadOnly(bool) override {}
- void OnChildVisibilityChanged() override {}
- void PopulateSnappingList(CSnapper *) override {}
- void DoStartDrag(CControlWindowListener *) override {}
- void AcceptDropAfter(bool) override {}
- void AcceptDropBefore(bool) override {}
- void SetDropTarget(CDropTarget *) override {}
-
- void UpdateActionStatus() override {}
-
-private Q_SLOTS:
- void Initialize() {}
- void handleDirtyChanged(bool dirty);
- void setTimeRatio(double inTimeRatio);
- void handleVisibleChanged(bool visible);
- void handleSelectAllKeys();
- void handleDeleteAllKeys();
- void handleRefreshRequested();
- void handleSelectKeysByTime(long inTime, bool inSelected);
-
-protected:
- void SetDetailedView(bool inIsDetailedView);
-
- CPropertyTreeControl *m_TreeControl;
- CPropertyToggleControl *m_ToggleControl;
- CPropertyColorControl *m_PropertyColorControl;
- CPropertyTimebarRow *m_TimebarRow;
- CPropertyRow *m_propertyRow;
-
- bool m_DetailedView = false;
- bool m_Highlighted = false;
-};
-
-#endif // PROPERTYROWUI_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.cpp
deleted file mode 100644
index 231a6d85..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.cpp
+++ /dev/null
@@ -1,521 +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"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "PropertyTimebarRow.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "StudioUtils.h"
-#include "PropertyRow.h"
-#include "PropertyRowUI.h"
-#include "MasterP.h"
-#include "KeyframeContextMenu.h"
-#include "PropertyTimelineKeyframe.h"
-#include "HotKeys.h"
-#include "MultiSelectAspect.h"
-#include "Bindings/ITimelineItemProperty.h"
-#include "IKeyframe.h"
-#include "CoreUtils.h"
-
-//=============================================================================
-/**
- */
-CPropertyTimebarRow::CPropertyTimebarRow(CPropertyRowUI *inPropertyRowUI)
- : m_PropertyRowUI(inPropertyRowUI)
- , m_DetailedView(static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow())->GetProperty())
- , m_DirtyFlag(false)
- , m_Refreshing(false)
- , m_SnappingListProvider(nullptr)
-{
- m_DetailedView.SetVisible(false);
-
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- m_BackgroundColor = propertyRow->GetTimebarBackgroundColor();
-
- AddChild(&m_DetailedView);
- m_Refreshing = false;
- RefreshKeyframes();
-}
-
-CPropertyTimebarRow::~CPropertyTimebarRow()
-{
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- CPropertyTimelineKeyframe *theDeletedKey = (*thePos);
- RemoveChild(theDeletedKey);
- delete theDeletedKey;
- }
-}
-
-//=============================================================================
-/**
- * Draws the this row background.
- * @param inRenderer the renderer to draw to.
- */
-void CPropertyTimebarRow::Draw(CRenderer *inRenderer)
-{
- if (m_DirtyFlag) {
- RefreshKeyframes();
- m_DirtyFlag = false;
- }
-
- CRct theRect(GetSize());
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- qt3dsdm::TDataTypePair theType = propertyRow->GetProperty()->GetType();
- if (theType.first == qt3dsdm::DataModelDataType::Float3
- && theType.second == qt3dsdm::AdditionalMetaDataType::Color) {
- inRenderer->FillSolidRect(CRct(0, 0, theRect.size.x, theRect.size.y - 1),
- m_BackgroundColor);
- DrawColor(inRenderer);
- } else {
- inRenderer->FillSolidRect(CRct(0, 0, theRect.size.x, theRect.size.y - 1),
- m_BackgroundColor);
- }
-
- inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1));
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * Draw a colorized background for this property row.
- * If this is a color object then this will draw the background of this control
- * as the color that the property is. This will draw a gradient between the
- * colors over time to show somewhat what the colors look like.
- * @param inRenderer the renderer to draw to.
- */
-void CPropertyTimebarRow::DrawColor(CRenderer *inRenderer)
-{
- QT3DS_PROFILE(DrawColor);
-
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- ITimelineItemProperty *theProperty = propertyRow->GetProperty();
- ASSERT(theProperty->GetChannelCount() == 3); // sanity check
-
- CColor thePreviousColor;
- thePreviousColor.SetRed(::dtol(theProperty->GetChannelValueAtTime(0, 0)));
- thePreviousColor.SetGreen(::dtol(theProperty->GetChannelValueAtTime(1, 0)));
- thePreviousColor.SetBlue(::dtol(theProperty->GetChannelValueAtTime(2, 0)));
-
- long thePreviousTime = 0;
- long theLastPosition = 0;
- CColor theCurrentColor;
-
- long theKeyframeCount = theProperty->GetKeyframeCount();
-
- // Go through all the keyframes and draw a gradient from the previous key to the current key.
- // Only use the first channel for the keyframes, assume they are all at the same time.
- for (long theIndex = 0; theIndex < theKeyframeCount; ++theIndex) {
- long theCurrentTime = theProperty->GetKeyframeByIndex(theIndex)->GetTime();
- // Get the color at the specified time.
- theCurrentColor.SetRed(::dtol(theProperty->GetChannelValueAtTime(0, theCurrentTime)));
- theCurrentColor.SetGreen(::dtol(theProperty->GetChannelValueAtTime(1, theCurrentTime)));
- theCurrentColor.SetBlue(::dtol(theProperty->GetChannelValueAtTime(2, theCurrentTime)));
-
- long thePreviousPixel = ::TimeToPos(thePreviousTime, m_TimeRatio);
- long theCurrentPixel = ::TimeToPos(theCurrentTime, m_TimeRatio);
-
- // Draw a gradient from the previous keyframe position to the current one.
- inRenderer->DrawGradient(
- CRct(thePreviousPixel, 0, theCurrentPixel - thePreviousPixel, GetSize().y),
- thePreviousColor, theCurrentColor);
- thePreviousTime = theCurrentTime;
- thePreviousColor = theCurrentColor;
- theLastPosition = theCurrentPixel;
- }
- // Fill in from the last keyframe to the end of the bar.
- inRenderer->DrawGradient(CRct(theLastPosition, 0, GetSize().x - theLastPosition, GetSize().y),
- thePreviousColor, thePreviousColor);
-}
-
-//=============================================================================
-/**
- * OnMouseOver event, handles the highlighting of the row.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-void CPropertyTimebarRow::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- m_PropertyRowUI->OnMouseOver();
-}
-
-//=============================================================================
-/**
- * OnMouseOut event, handles the de-highlighting of this row.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-void CPropertyTimebarRow::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- m_PropertyRowUI->OnMouseOut();
-}
-
-//=============================================================================
-/**
- * OnMouseRDown event, pops up a context menu
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the modifier key states (shift, alt, and ctrl).
- */
-bool CPropertyTimebarRow::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Only do it if a child has not handled the mouse down.
- bool theRetVal = CControl::OnMouseRDown(inPoint, inFlags);
- if (!theRetVal) {
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- propertyRow->Select();
- CKeyframeContextMenu theMenu(propertyRow->GetProperty()->GetKeyframesManager(),
- propertyRow->GetProperty());
- DoPopup(&theMenu, inPoint);
- theRetVal = true;
- }
-
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * OnMouseOut event, handles the de-highlighting of this row.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-void CPropertyTimebarRow::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- QT3DS_PROFILE(OnMouseMove);
- CControl::OnMouseMove(inPoint, inFlags);
-}
-//=============================================================================
-/**
- * Set this control to being highlighted or not.
- * @param inIsHighlighted true if this is to be highlighted.
- */
-void CPropertyTimebarRow::SetHighlighted(bool inIsHighlighted)
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- if (inIsHighlighted)
- m_BackgroundColor = propertyRow->GetTimebarHighlightBackgroundColor();
- else
- m_BackgroundColor = propertyRow->GetTimebarBackgroundColor();
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Get the state row that this belongs to.
- */
-CPropertyRowUI *CPropertyTimebarRow::GetPropertyRowUI()
-{
- return m_PropertyRowUI;
-}
-
-//=============================================================================
-/**
- * Sets teh time ratio
- *
- * @param inTimeRatio the new ratio
- */
-void CPropertyTimebarRow::SetTimeRatio(double inTimeRatio)
-{
- m_TimeRatio = inTimeRatio;
-
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- (*thePos)->SetTimeRatio(inTimeRatio);
- }
- m_DetailedView.SetTimeRatio(inTimeRatio);
-
- Invalidate();
-}
-
-void CPropertyTimebarRow::SetDetailedView(bool inDetailedView)
-{
- m_DetailedView.SetVisible(inDetailedView);
-}
-
-//=============================================================================
-/**
- * Sets teh size of this control.
- * @param inSize size to set the row
- */
-void CPropertyTimebarRow::SetSize(CPt inSize)
-{
- CControl::SetSize(inSize);
-
- m_DetailedView.SetSize(inSize);
-}
-
-//=============================================================================
-/**
- * called when keyframes need to be updated, this funciton has two loops:
- * the first loops through and deletes any keys no longer in the sskf list. the
- * second adds any keys in the sskf list that are not already in the list
- *
- */
-void CPropertyTimebarRow::RefreshKeyframes()
-{
- m_Refreshing = true;
- QT3DS_PROFILE(RefreshKeyframes);
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
-
- // First Loop clears any keys that do not correlate to a supersetkey
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- while (thePos != m_Keyframes.end()) {
- CPropertyTimelineKeyframe *theTimelineKey = (*thePos);
- CPt theSize = theTimelineKey->GetSize();
- IKeyframe *theTempKey = nullptr;
- theTempKey = propertyRow->GetProperty()->GetKeyframeByTime(theTimelineKey->GetTime());
-
- // If we find a key at this time, then the timeline key doesn't need to be deleted
- if (!theTempKey) {
- RemoveChild(theTimelineKey);
- delete theTimelineKey;
- thePos = m_Keyframes.erase(thePos);
- } else if (theTempKey->IsDynamic() != theTimelineKey->IsDynamic()) {
- theTimelineKey->SetDynamic(theTempKey->IsDynamic());
- } else {
- // Set the position
- theTimelineKey->SetPosition(
- ::TimeToPos(theTempKey->GetTime(), m_TimeRatio) - (theSize.x / 2), 0);
- ++thePos;
- }
- }
-
- // Second Loop adds teh remaining keys
- long theKeyframeCount = propertyRow->GetProperty()->GetKeyframeCount();
- for (long theKey = 0; theKey < theKeyframeCount; ++theKey) {
- bool theFoundFlag = false;
- IKeyframe *theTempKey = propertyRow->GetProperty()->GetKeyframeByIndex(theKey);
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
-
- long theKeyframeTime = theTempKey->GetTime();
- // each key needs to be compared to all the keys in the sskf list to see if it has to be
- // added.
- for (; thePos != m_Keyframes.end() && !theFoundFlag; ++thePos) {
- CPropertyTimelineKeyframe *theCurrentKey = (*thePos);
- if (theCurrentKey->GetTime() == theKeyframeTime) {
- theFoundFlag = true;
- }
- }
- if (!theFoundFlag) {
- // If we don't have a timeline key, then we have to make a new one
- CPropertyTimelineKeyframe *thePropertyTimelineKey =
- new CPropertyTimelineKeyframe(this, m_TimeRatio);
- thePropertyTimelineKey->SetTime(theKeyframeTime);
- thePropertyTimelineKey->Select(theTempKey->IsSelected());
- thePropertyTimelineKey->SetDynamic(theTempKey->IsDynamic());
- thePropertyTimelineKey->SetSize(CPt(15, 16));
- CPt theSize = thePropertyTimelineKey->GetSize();
- long theXPosition = ::TimeToPos(theKeyframeTime, m_TimeRatio) - (theSize.x / 2);
- thePropertyTimelineKey->SetPosition(theXPosition, 0);
- AddChild(thePropertyTimelineKey);
- m_Keyframes.push_back(thePropertyTimelineKey);
- }
- }
-
- if (m_DetailedView.IsVisible())
- m_DetailedView.RefreshKeyframes();
-
- m_Refreshing = false;
-}
-
-void CPropertyTimebarRow::Invalidate(bool inInvalidate)
-{
- if (!m_Refreshing) {
- CControl::Invalidate(inInvalidate);
- }
-}
-
-//=============================================================================
-/**
- * Handler for when a child key is selected
- *
- * @param inTime time of the key
- */
-void CPropertyTimebarRow::OnKeySelected(long inTime, bool inSelected)
-{
- if (inTime >= 0) {
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- propertyRow->GetProperty()->SelectKeyframes(inSelected, inTime);
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Deselects all keyframes
- */
-void CPropertyTimebarRow::DeselectAllKeyframes()
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- propertyRow->GetProperty()->SelectKeyframes(false);
-}
-
-//=============================================================================
-/**
- * called when a child changes and the keyframes need to be refreshed
- *
- * @param inDirtyFlag true if this object is now dirty
- *
- */
-void CPropertyTimebarRow::SetDirty(bool inDirtyFlag)
-{
- if (m_DirtyFlag == inDirtyFlag)
- return;
-
- m_DirtyFlag = inDirtyFlag;
- Invalidate();
-}
-
-//=============================================================================
-/**
- * SelectKeysInRect: selects any keyframes inside the rect
- *
- * @param inRect is used to select keyframes
- * @param inModifierKeyDown indicates if the control modifier is down
- */
-void CPropertyTimebarRow::SelectKeysInRect(CRct inRect, bool inModifierKeyDown)
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- CMultiSelectAspect<TTimelineKeyframeList> theMultiSelectAspect(m_Keyframes,
- propertyRow->GetProperty());
- theMultiSelectAspect.MultiSelect(inRect, inModifierKeyDown);
-}
-
-//=============================================================================
-/**
- * CommitSelections: commits all the master keyframe selections by setting their
- * previous selection state to the current selection state.
- * This will prevent the keyframes in the current selection
- *from
- * switching states as we select other keyframes.
- *
- * @param NONE
- * @return NONE
- */
-
-void CPropertyTimebarRow::CommitSelections()
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- CMultiSelectAspect<TTimelineKeyframeList> theMultiSelectAspect(m_Keyframes,
- propertyRow->GetProperty());
- theMultiSelectAspect.CommitSelections();
-}
-
-//=============================================================================
-/**
- * true if there are selected keys on this object
- */
-bool CPropertyTimebarRow::HasSelectedKeys()
-{
- bool theRetVal = false;
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end() && !theRetVal; ++thePos) {
- if ((*thePos)->IsSelected()) {
- theRetVal = true;
- }
- }
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * selects all keys for this timebar row
- */
-void CPropertyTimebarRow::SelectAllKeys()
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- propertyRow->GetProperty()->SelectKeyframes(true, (*thePos)->GetTime());
- (*thePos)->Select(true);
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Set this control as being visible or not.
- * If the control is not visible then it will not be drawn and will not
- * get mouse clicks.
- * @param inIsVisible true if this control is to be visible.
- */
-void CPropertyTimebarRow::SetVisible(bool inIsVisible)
-{
- if (inIsVisible != IsVisible()) {
- CControl::SetVisible(inIsVisible);
- SetDirty(true);
- }
-}
-
-bool CPropertyTimebarRow::HasKeyframe(long inTime) const
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- return propertyRow->GetProperty()->GetKeyframeByTime(inTime) != nullptr;
-}
-
-//=============================================================================
-/**
- * @param inTime -1 for all keyframes
- */
-void CPropertyTimebarRow::SelectKeysByTime(long inTime, bool inSelected)
-{
- TTimelineKeyframeList::iterator thePos = m_Keyframes.begin();
- bool theFoundFlag = false;
- for (; thePos != m_Keyframes.end() && !theFoundFlag; ++thePos) {
- CPropertyTimelineKeyframe *theKey = (*thePos);
- if (inTime == -1 || theKey->GetTime() == inTime) {
- theKey->Select(inSelected);
- theFoundFlag = (inTime != -1);
- }
- }
- Invalidate();
-}
-
-void CPropertyTimebarRow::SetSnappingListProvider(ISnappingListProvider *inProvider)
-{
- m_SnappingListProvider = inProvider;
-}
-
-ISnappingListProvider &CPropertyTimebarRow::GetSnappingListProvider() const
-{
- // sk - If you hit this, it means the setup is incorrect. e.g. the parent row (which is most
- // probably a staterow) isn't pass 'down' this info.
- ASSERT(m_SnappingListProvider);
- return *m_SnappingListProvider;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.h b/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.h
deleted file mode 100644
index 687bc840..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarRow.h
+++ /dev/null
@@ -1,103 +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_PROPERTY_TIMEBAR_ROW_H
-#define INCLUDED_PROPERTY_TIMEBAR_ROW_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "PropertyTimebarGraph.h"
-#include "StateRow.h"
-
-//==============================================================================
-// forwards
-//==============================================================================
-class CPropertyRowUI;
-class CPropertyTimelineKeyframe;
-class ISnappingListProvider;
-
-class CPropertyTimebarRow : public CControl
-{
- typedef std::vector<CPropertyTimelineKeyframe *> TTimelineKeyframeList;
-
-public:
- CPropertyTimebarRow(CPropertyRowUI *inPropertyRowUI);
- virtual ~CPropertyTimebarRow();
-
- void Draw(CRenderer *inRenderer) override;
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void SetHighlighted(bool inIsHighlighted);
- void RefreshKeyframes();
-
- void SetSize(CPt inSize) override;
-
- CPropertyRowUI *GetPropertyRowUI();
-
- void SetTimeRatio(double inTimeRatio);
-
- void SetDetailedView(bool inDetailedView);
- void OnKeySelected(long inTime, bool inSelected);
- void DeselectAllKeyframes();
- void SetDirty(bool inDirtyFlag);
- void CommitSelections();
- void SelectKeysInRect(CRct inRect, bool inModifierKeyDown);
- void SelectAllKeys();
- bool HasSelectedKeys();
- void Invalidate(bool inInvalidate = true) override;
- void SetVisible(bool inIsVisible) override;
-
- bool HasKeyframe(long inTime) const;
- void SelectKeysByTime(long inTime, bool inSelected);
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider);
- ISnappingListProvider &GetSnappingListProvider() const;
-
-protected:
- void DrawColor(CRenderer *inRenderer);
-
-protected:
- TTimelineKeyframeList m_Keyframes; ///< Properties Keyframe List (STL)
- CPropertyRowUI *m_PropertyRowUI;
- CPropertyTimebarGraph m_DetailedView;
- ::CColor m_BackgroundColor;
- double m_TimeRatio;
-
- bool m_DirtyFlag;
- bool m_Refreshing;
- ISnappingListProvider *m_SnappingListProvider;
-};
-#endif // INCLUDED_STATE_TIMEBAR_ROW_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.cpp
deleted file mode 100644
index 4f970d59..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.cpp
+++ /dev/null
@@ -1,376 +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 "Dialogs.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "PropertyTimelineKeyframe.h"
-#include "PropertyTimebarRow.h"
-#include "Renderer.h"
-#include "PropertyRow.h"
-#include "PropertyRowUI.h"
-#include "KeyframeContextMenu.h"
-#include "HotKeys.h"
-#include "ResourceCache.h"
-#include "TimelineControl.h"
-#include "Bindings/ITimelineItemProperty.h"
-#include "StudioUtils.h"
-#include "TimeEditDlg.h"
-
-CPropertyTimelineKeyframe::CPropertyTimelineKeyframe(CPropertyTimebarRow *inParentRow,
- double inTimeRatio)
- : m_Selected(false)
- , m_IsMouseDown(false)
- , m_IsDragging(false)
-{
- m_ParentRow = inParentRow;
- m_TimeRatio = inTimeRatio;
- CResourceCache *theCache = CResourceCache::GetInstance();
- m_Icon = theCache->GetBitmap("Keyframe-Property-Normal.png");
- m_DisabledIcon = theCache->GetBitmap("Keyframe-Property-Disabled.png");
- m_SelectedIcon = theCache->GetBitmap("Keyframe-Property-Selected.png");
- m_DynamicIcon = theCache->GetBitmap("Keyframe-PropertyDynamic-Normal.png");
- m_DynamicSelectedIcon = theCache->GetBitmap("Keyframe-PropertyDynamic-Selected.png");
- m_RectOverHandled = false;
- m_PreviousSelectState = false;
-}
-
-CPropertyTimelineKeyframe::~CPropertyTimelineKeyframe()
-{
-}
-
-//=============================================================================
-/**
- * SetRectOverHandled: Sets if mouse rectangle has been handled
- * param@ inState indicates if the rectangle over has been handled.
- * return@ NONE
- */
-void CPropertyTimelineKeyframe::SetRectOverHandled(bool inState)
-{
- m_RectOverHandled = inState;
-}
-
-//=============================================================================
-/**
- * GetRectOverHandled: GetRectOverHandled
- * param@ NONE
- * return@ m_RectOverHandled, which indicates if the rectangle over has been handled
- */
-bool CPropertyTimelineKeyframe::GetRectOverHandled()
-{
- return m_RectOverHandled;
-}
-
-//=============================================================================
-/**
- * SetPreviousSelectState: Sets if the current keyframe was previously selected
- * param@ inState is used to set m_PreviousSelectState.
- * return@ NONE
- */
-void CPropertyTimelineKeyframe::SetPreviousSelectState(bool inState)
-{
- m_PreviousSelectState = inState;
-}
-
-//=============================================================================
-/**
- * GetPreviousSelectState: Returns the keyframe's previous select state
- * param@ NONE
- * return@ m_PreviousSelectState that stores the select state for the keyframe
- */
-bool CPropertyTimelineKeyframe::GetPreviousSelectState()
-{
- return m_PreviousSelectState;
-}
-
-//=============================================================================
-/**
- * Gets teh correct image and draws
- */
-void CPropertyTimelineKeyframe::Draw(CRenderer *inRenderer)
-{
- if (m_Selected) {
- inRenderer->DrawBitmap(CPt(0, 0), GetImage());
- } else {
- inRenderer->DrawBitmap(CPt(2, 0), GetImage());
- }
-}
-
-//=============================================================================
-/**
- * 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.
- */
-QPixmap CPropertyTimelineKeyframe::GetImage()
-{
- if (!IsEnabled())
- return m_DisabledIcon;
- else if (m_IsDynamic) {
- if (m_Selected)
- return m_DynamicSelectedIcon;
- else
- return m_DynamicIcon;
- } else if (m_Selected)
- return m_SelectedIcon;
- else
- return m_Icon;
-}
-
-//=============================================================================
-/**
- * Handler for left-click events. Allows keyframe dragging. Children are
- * allowed to handle this event before the parent does.
- * @param inPoint the point where the mouse is
- * @param inFlags the state of modifier keys when the event occurred
- * @return true
- */
-bool CPropertyTimelineKeyframe::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // Store the mouse down location in screen coordinates so that we can check the dragging buffer
- // in OnMouseMove
- m_MouseDownLoc = inPoint;
-
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- // If the control key is down then we change state, otherwise
- if (!((CHotKeys::MODIFIER_CONTROL & inFlags) == CHotKeys::MODIFIER_CONTROL)) {
- if (!m_Selected)
- GetProperty()->ClearKeySelection();
-
- m_Selected = true;
- } else {
- m_Selected = !m_Selected;
- }
- m_ParentRow->OnKeySelected(m_Time, m_Selected);
- // TODO : sk - Remove this when we are clear on the fact that UpdateClientScene &
- // FireChangeEvent do nothing useful here.
- // This call makes no sense. However, if you run into some wierd
- //behavior related to mouse down events, this might be a clue.
- // I am leaving this just in case this speeds up debugging for anyone
- //else looking at this.
- // CAssetTimelineKeyframe::OnMouseDown does similar things.
- // m_Doc->UpdateClientScene( true );
- // m_ParentRow->GetPropertyRow()->GetProperty()->FireChangeEvent( false );
- m_IsMouseDown = true;
-
- m_Snapper.Clear();
- m_Snapper.SetSource(this);
- m_Snapper.SetSnappingSelectedKeyframes(false);
- m_ParentRow->GetSnappingListProvider().PopulateSnappingList(&m_Snapper);
- m_Snapper.BeginDrag(inPoint.x);
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Handler for right-click events. Pops up a context menu. Children are
- * allowed to handle this event before the parent does.
- * @param inPoint the point where the mouse is
- * @param inFlags the state of modifier keys when the event occurred
- * @return true
- */
-bool CPropertyTimelineKeyframe::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseRDown(inPoint, inFlags)) {
- if (!m_Selected) {
- GetProperty()->ClearKeySelection();
- m_Selected = true;
- m_ParentRow->OnKeySelected(m_Time, m_Selected);
- }
-
- CKeyframeContextMenu theMenu(GetProperty()->GetKeyframesManager(), GetProperty());
- theMenu.SetTime(GetTime());
- DoPopup(&theMenu, inPoint);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * called when this key is selected
- * @param inState the state this key is selected to
- */
-void CPropertyTimelineKeyframe::Select(bool inState)
-{
- if (m_Selected != inState) {
- m_Selected = inState;
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * handler for the mouse up event
- * @param inFlags the state of things when the mouse button was released
- * @param inPoint the point where the mouse is
- */
-void CPropertyTimelineKeyframe::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
-
- // If this key is selected, then we need to make sure that it moved all the way to the
- // mouse up location
- if (m_Selected && m_IsMouseDown && m_IsDragging) {
- long theNewTime = m_Snapper.ProcessDrag(m_Time, inPoint.x, inFlags);
- long theDiffTime = theNewTime - m_Time;
-
- // theDiffTime can get updated if its invalid.
- theDiffTime = GetProperty()->OffsetSelectedKeyframes(theDiffTime);
- // Set this key's time so it won't be recalced in Refresh keyframes in the row
- SetTime(m_Time + theDiffTime);
- }
-
- m_IsMouseDown = false;
- m_IsDragging = false;
-
- GetProperty()->CommitChangedKeyframes();
- HideMoveableWindow();
- Invalidate();
-}
-
-//=============================================================================
-/**
- * handler for the onMouse Move event. Offsets selected keys.
- *
- * @param inFlags the state of things when the mouse was moved
- * @param inPoint the point where the mouse is
- */
-void CPropertyTimelineKeyframe::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- // If the mouse is down and this is slected, then offst the keys
- if (m_IsMouseDown && m_Selected) {
- // If we are not yet dragging the keyframe
- if (!m_IsDragging) {
- long theDiff = ::abs(inPoint.x) - m_MouseDownLoc.x;
- // Figure out if the mouse has moved far enough to start the drag, and readjust the drag
- // postion on the snapper
- m_IsDragging = (::abs(theDiff) > DRAGBUFFER);
- if (m_IsDragging && (::abs(theDiff) - DRAGBUFFER) > 2) {
- m_Snapper.BeginDrag(m_MouseDownLoc.x);
- } else
- m_Snapper.BeginDrag(inPoint.x);
- }
-
- // If we are already dragging the keyframe, procceed as normal
- if (m_IsDragging) {
- long theNewTime = m_Snapper.ProcessDrag(m_Time, inPoint.x, inFlags);
- long theDiffTime = theNewTime - m_Time;
-
- if (theDiffTime != 0) {
- // theDiffTime can get updated if its invalid.
- theDiffTime = GetProperty()->OffsetSelectedKeyframes(theDiffTime);
- // Set this key's time so it won't be recalced in Refresh keyframes in the row
- SetTime(m_Time + theDiffTime);
- Invalidate();
- }
- }
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
-}
-
-//=============================================================================
-/**
- * Sets teh time ratio
- *
- * @param inTimeRatio the new ratio
- */
-void CPropertyTimelineKeyframe::SetTimeRatio(double inTimeRatio)
-{
- m_TimeRatio = inTimeRatio;
- CPt theSize = GetSize();
- SetPosition(::TimeToPos(GetTime(), m_TimeRatio) - (theSize.x / 2), 0);
-}
-
-//=============================================================================
-/**
- * Pass the double click notification on to the row and have it process it.
- * The row will do object-specific actions on doubleclicks.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- * @return true stating that the event was processed.
- */
-bool CPropertyTimelineKeyframe::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
-
- GetProperty()->OnEditKeyframeTime(m_Time, ASSETKEYFRAME);
- return true;
-}
-
-//=============================================================================
-/**
- * @return true if selected
- */
-bool CPropertyTimelineKeyframe::IsSelected()
-{
- return m_Selected;
-}
-
-//=============================================================================
-/**
-* Updates the ToolTip and moves it to the correct place on screen.
-* @param inPoint the point that the tooltip is supposed to be placed.
-*/
-void CPropertyTimelineKeyframe::RefreshToolTip(CPt inPoint)
-{
- CRct theTimelineBounds(m_ParentRow->GetPropertyRowUI()->GetTopControl()->GetBounds());
-
- // format label
- Q3DStudio::CString theCommentText = " " + ::FormatTimeString(GetTime());
-
- inPoint.y = GetPosition().y - GetSize().y;
- inPoint.x = GetSize().x / 2;
- ShowMoveableWindow(inPoint, theCommentText, theTimelineBounds);
-}
-
-//=============================================================================
-/**
-* Helper function to retrieve the ITimelineItemProperty
-*/
-ITimelineItemProperty *CPropertyTimelineKeyframe::GetProperty() const
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_ParentRow->GetPropertyRowUI()->GetTimelineRow());
- return propertyRow->GetProperty();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.h
deleted file mode 100644
index 40c7f05b..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimelineKeyframe.h
+++ /dev/null
@@ -1,95 +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_PROPERTY_TIMELINE_KEYFRAME
-#define INCLUDED_PROPERTY_TIMELINE_KEYFRAME 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "TimelineKeyframe.h"
-#include "Snapper.h"
-
-#include <QPixmap>
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-class CPropertyTimebarRow;
-class ITimelineItemProperty;
-
-class CPropertyTimelineKeyframe : public CControl, public CTimelineKeyframe
-{
-
-public:
- CPropertyTimelineKeyframe(CPropertyTimebarRow *inParentRow, double inTimeRatio);
- ~CPropertyTimelineKeyframe();
- void Draw(CRenderer *inRenderer) override;
- QPixmap GetImage();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void Select(bool inState);
- void SetTimeRatio(double inTimeRatio);
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool IsSelected();
- void SetRectOverHandled(bool inState);
- bool GetRectOverHandled();
- void SetPreviousSelectState(bool inState);
- bool GetPreviousSelectState();
-
-protected:
- void RefreshToolTip(CPt inPoint);
- ITimelineItemProperty *GetProperty() const;
-
-protected:
- bool m_Selected;
- bool m_RectOverHandled; ///< Indicates if the mouse rect over has been handled.
- bool m_PreviousSelectState; ///< Stores the previous select state for the keyframe.
- CPropertyTimebarRow *m_ParentRow;
- bool m_IsMouseDown;
- CPt m_MouseDownLoc; ///< Location of the mouse after an OnMouseDownEvent, in client coordinates
- bool m_IsDragging; ///< Indicates whether or not the keyframe is currently being dragged,
- ///determined by the pixel buffer
- double m_TimeRatio;
- CSnapper m_Snapper;
- QPixmap m_Icon;
- QPixmap m_DisabledIcon;
- QPixmap m_SelectedIcon;
- QPixmap m_DynamicIcon;
- QPixmap m_DynamicSelectedIcon;
-};
-
-#endif // INCLUDED_PROPERTY_TIMELINE_KEYFRAME
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.cpp
deleted file mode 100644
index 0c633c30..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.cpp
+++ /dev/null
@@ -1,115 +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 "PropertyToggleControl.h"
-#include "TimelineRow.h"
-#include "PropertyRow.h"
-#include "PropertyRowUI.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "HotKeys.h"
-
-CPropertyToggleControl::CPropertyToggleControl(CPropertyRowUI *inPropertyRow)
- : m_PropertyRowUI(inPropertyRow)
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- m_BackgroundColor = propertyRow->GetTimebarBackgroundColor();
-}
-
-CPropertyToggleControl::~CPropertyToggleControl()
-{
-}
-
-void CPropertyToggleControl::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
- inRenderer->FillSolidRect(QRect(0, 0, theRect.size.x + 1, theRect.size.y), m_BackgroundColor);
-
- // Draw the line at the bottom of this control
- inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor());
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
-
- // Draw the line on the left side of this control
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(0, theRect.size.y - 1));
-
- // Draw the highlight
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(CPt(1, 0));
- inRenderer->LineTo(CPt(1, theRect.size.y - 1));
- inRenderer->PopPen();
-
- // Draw the line on the right side of this control
- inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor());
- inRenderer->MoveTo(CPt(theRect.size.x - 1, 0));
- inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1));
- inRenderer->PopPen();
-}
-
-void CPropertyToggleControl::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- m_PropertyRowUI->OnMouseOver();
-}
-
-void CPropertyToggleControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- m_PropertyRowUI->OnMouseOut();
-}
-
-void CPropertyToggleControl::SetHighlighted(bool inIsHighlighted)
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- if (inIsHighlighted)
- m_BackgroundColor = propertyRow->GetTimebarHighlightBackgroundColor();
- else
- m_BackgroundColor = propertyRow->GetTimebarBackgroundColor();
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * Handles the OnMouseDownEvent
- */
-bool CPropertyToggleControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- auto propertyRow = static_cast<CPropertyRow *>(m_PropertyRowUI->GetTimelineRow());
- propertyRow->Select((CHotKeys::MODIFIER_SHIFT & inFlags) == CHotKeys::MODIFIER_SHIFT);
- }
-
- return true;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.cpp
deleted file mode 100644
index fbaf9ff9..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.cpp
+++ /dev/null
@@ -1,196 +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 "PropertyTreeControl.h"
-#include "PropertyRow.h"
-#include "PropertyRowUI.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "StudioUtils.h"
-#include "HotKeys.h"
-#include "ResourceCache.h"
-#include "BaseTimelineTreeControl.h"
-#include "Bindings/ITimelineItemProperty.h"
-#include "CoreUtils.h"
-
-CPropertyTreeControl::CPropertyTreeControl(CPropertyRowUI *inPropRowUI)
- : m_Icon(CResourceCache::GetInstance()->GetBitmap("Objects-Property-Normal.png"),
- CResourceCache::GetInstance()->GetBitmap("Objects-Property-Disabled.png"))
-{
- m_PropRowUI = inPropRowUI;
-
- auto propertyRow = static_cast<CPropertyRow *>(m_PropRowUI->GetTimelineRow());
- CTimelineRow *theParentRow = propertyRow->GetParentRow();
- if (theParentRow) // property row typically should never exists on its own, but to be safe.
- m_BackgroundColor = propertyRow->GetTimebarBackgroundColor();
- else
- m_BackgroundColor = CStudioPreferences::GetPropertyBackgroundColor();
-
- AddChild(&m_Icon);
-
- m_Text.SetData(propertyRow->GetProperty()->GetName());
- m_Text.SetAlignment(CTextEdit::LEFT);
- m_Text.SetReadOnly(true);
-
- AddChild(&m_Text);
-
- SetIndent(0);
-}
-
-CPropertyTreeControl::~CPropertyTreeControl()
-{
-}
-
-void CPropertyTreeControl::Draw(CRenderer *inRenderer)
-{
- CRct theRect(GetSize());
-
- inRenderer->FillSolidRect(theRect, m_BackgroundColor);
-
- // Draw the line at the bottom of this control
- CColor theShadowColor = CStudioPreferences::GetPropertyFloorColor();
- inRenderer->PushPen(theShadowColor);
- inRenderer->MoveTo(CPt(0, theRect.size.y - 1));
- inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1));
- inRenderer->PopPen();
-
- ::CColor theTextColor = CStudioPreferences::GetNormalColor();
- auto propertyRow = static_cast<CPropertyRow *>(m_PropRowUI->GetTimelineRow());
- if (propertyRow->GetProperty()->IsMaster())
- theTextColor = CStudioPreferences::GetMasterColor();
- m_Text.SetTextColor(theTextColor);
-}
-
-void CPropertyTreeControl::SetIndent(long inIndent)
-{
- m_Indent = inIndent;
-
- // place it it's size x2 to the right since we don't have a toggle.
- m_Icon.SetPosition(CPt(m_Indent + m_Icon.GetSize().x, 0));
-
- m_Text.SetPosition(CPt(m_Icon.GetPosition().x + m_Icon.GetSize().x + 5, 0));
- m_Text.SetSize(CPt(200, m_Icon.GetSize().y - 1));
-}
-
-long CPropertyTreeControl::GetIndent()
-{
- return m_Indent;
-}
-
-void CPropertyTreeControl::SetHighlighted(bool inIsHighlighted)
-{
- auto propertyRow = static_cast<CPropertyRow *>(m_PropRowUI->GetTimelineRow());
- CTimelineRow *theParentRow = propertyRow->GetParentRow();
- if (theParentRow) // property row typically should never exists on its own, but to be safe.
- m_BackgroundColor = (inIsHighlighted) ? propertyRow->GetTimebarHighlightBackgroundColor()
- : propertyRow->GetTimebarBackgroundColor();
- else
- m_BackgroundColor = (inIsHighlighted) ? CStudioPreferences::GetPropertyMouseOverColor()
- : CStudioPreferences::GetPropertyBackgroundColor();
-
- Invalidate();
-}
-
-//==============================================================================
-/**
- * HACK: Trying to scroll the timeline during a drag and drop operation.
- *
- * The Property Tree Control will never have a drop candidate, so this function
- * returns nullptr. However, we still need to scroll the timeline in case we are
- * at the top or bottom of the window. This is hackish for two reasons. 1) It
- * points out that CPropertyTreeControl and CStateTreeControl should have a
- * common base class that handles similar code. 2) The TreeControls should not
- * have to scroll the timeline automatically. It should be handled through a
- * timer on the scroller when the mouse is being dragged and hovering near the
- * border of the scroller. But all of that will be saved for another day.
- * @param inMousePoint location of the mouse
- * @param inFlags not used (modifier key flags)
- * @return nullptr (no drop candidate is ever found)
- */
-CDropTarget *CPropertyTreeControl::FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inFlags);
-
- CPt theSize(GetSize());
-
- // If the mouse is towards the top of this row, make sure that this row and the
- // one above it are visible (scroll upwards)
- if (inMousePoint.y <= ::dtol(theSize.y / 2.0f))
- EnsureVisible(CRct(CPt(0, -theSize.y), theSize));
- // Otherwise, the mouse is towards the bottom of this row, so make sure this row
- // and the one below it are visible (scroll downwards)
- else
- EnsureVisible(CRct(CPt(theSize.x, theSize.y * 2)));
-
- return nullptr;
-}
-
-void CPropertyTreeControl::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOver(inPoint, inFlags);
-
- m_PropRowUI->OnMouseOver();
-}
-
-void CPropertyTreeControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- m_PropRowUI->OnMouseOut();
-}
-
-//==============================================================================
-/**
- * Handles the OnMouseDownEvent
- */
-bool CPropertyTreeControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- auto propertyRow = static_cast<CPropertyRow *>(m_PropRowUI->GetTimelineRow());
- propertyRow->Select((CHotKeys::MODIFIER_SHIFT & inFlags) == CHotKeys::MODIFIER_SHIFT);
- }
-
- return true;
-}
-
-bool CPropertyTreeControl::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDoubleClick(inPoint, inFlags)) {
- m_PropRowUI->OnMouseDoubleClick();
- }
- return true;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp b/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp
index eb013f5a..04dfe7fc 100644
--- a/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp
@@ -30,7 +30,6 @@
#include "stdafx.h"
#include "SlideRow.h"
-#include "BlankToggleControl.h"
#include "ColorControl.h"
#include "Bindings/ITimelineItemBinding.h"
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp b/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp
index 708cddb4..7e21b29b 100644
--- a/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp
@@ -37,12 +37,7 @@
// Includes
//==============================================================================
#include "StateRow.h"
-#include "TimelineControl.h"
-#include "TimelineTimelineLayout.h"
#include "PropertyRow.h"
-#include "StateTimebarRow.h"
-#include "BaseTimebarlessRow.h"
-#include "BaseTimelineTreeControl.h"
#include "Bindings/ITimelineItemBinding.h"
//=============================================================================
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRowUI.cpp b/src/Authoring/Studio/Palettes/Timeline/StateRowUI.cpp
deleted file mode 100644
index 7fcbc8d1..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/StateRowUI.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** 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 "StateRowUI.h"
-
-#include "ColorControl.h"
-#include "StateTimebarRow.h"
-#include "StateRow.h"
-#include "ToggleControl.h"
-#include "BaseTimelineTreeControl.h"
-#include "TimelineUIFactory.h"
-#include "StateRow.h"
-#include "ITimelineControl.h"
-#include "PropertyRow.h"
-
-#include "Bindings/ITimelineItemBinding.h"
-
-CStateRowUI::CStateRowUI(CStateRow *stateRow, CAbstractTimelineRowUI *parentUiRow)
- : CBaseStateRowUI(stateRow, parentUiRow)
-{
- connect(stateRow, &CStateRow::timeChanged,
- this, &CStateRowUI::handleTimeChanged);
- connect(stateRow, &CStateRow::layoutRecalcRequested,
- this, &CStateRowUI::handleRecalcLayoutRequested);
-
-}
-
-void CStateRowUI::SetSnappingListProvider(ISnappingListProvider *inProvider)
-{
- CStateTimebarRow *theTimebarControl = dynamic_cast<CStateTimebarRow *>(m_TimebarControl);
- if (theTimebarControl)
- theTimebarControl->SetSnappingListProvider(inProvider);
-}
-
-ISnappingListProvider *CStateRowUI::GetSnappingListProvider() const
-{
- CStateTimebarRow *theTimebarControl = dynamic_cast<CStateTimebarRow *>(m_TimebarControl);
- return (theTimebarControl) ? &theTimebarControl->GetSnappingListProvider() : nullptr;
-
-}
-
-//=============================================================================
-/**
- * Set the indent of this control.
- * This controls how far to the right the toggle and text display on this
- * control. The indent should be increased for every level of sub-controls.
- * @param inIndent how much this control should be indented.
- */
-void CStateRowUI::SetIndent(long inIndent)
-{
- if (!initialized())
- return;
-
- CAbstractTimelineRowUI::SetIndent(inIndent);
-
- m_TreeControl->SetIndent(inIndent);
-
- auto baseStateRow = static_cast<CStateRow *>(m_timelineRow);
-
- // KDAB_TODO avoid deep copy
- auto stateRows = baseStateRow->GetStateRows();
-
- auto thePos = stateRows.begin();
- for (; thePos != stateRows.end(); ++thePos) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(*thePos);
- uiRow->SetIndent(inIndent + CTimelineRow::TREE_INDENT);
- }
-
- // For each property on this object
- // KDAB_TODO avoid deep copy
- auto propertyRows = baseStateRow->GetPropertyRows();
- auto thePropPos = propertyRows.begin();
- for (; thePropPos != propertyRows.end(); ++thePropPos) {
- CPropertyRow *thePropRow = (*thePropPos);
- if (thePropRow) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(thePropRow);
- uiRow->SetIndent(inIndent + CTimelineRow::TREE_INDENT);
- }
- }
-}
-//=============================================================================
-/**
- * Trigger any external applications where applicable.
- */
-void CStateRowUI::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inPoint);
- Q_UNUSED(inFlags);
-
- auto timelineItemBinding = m_timelineRow->GetTimelineItemBinding();
- if (!timelineItemBinding->OpenAssociatedEditor()) // if not handled, fall backon the base class
- CBaseStateRowUI::OnMouseDoubleClick(inPoint, inFlags);
-}
-
-void CStateRowUI::handleTimeChanged()
-{
- if (!initialized())
- return;
-
- m_TimebarControl->UpdateTime(m_baseStateRow->GetStartTime(),
- m_baseStateRow->GetEndTime());
-
- GetTopControl()->OnLayoutChanged();
-}
-
-void CStateRowUI::handleRecalcLayoutRequested()
-{
- GetTopControl()->OnLayoutChanged();
-}
-
-CBlankToggleControl *CStateRowUI::CreateToggleControl()
-{
- auto timelineItemBinding = m_timelineRow->GetTimelineItemBinding();
- return (timelineItemBinding->ShowToggleControls())
- ? new CToggleControl(this, timelineItemBinding)
- : CBaseStateRowUI::CreateToggleControl();
-}
-
-//=============================================================================
-/**
- * Create a new CStateTimebarRow.
- * This is virtual and used for objects to return their type specific
- * timebar rows if they want to.
- * @return the created timebar row.
- */
-CBaseTimebarlessRow *CStateRowUI::CreateTimebarRow()
-{
- auto stateTimebarRow = new CStateTimebarRow(this);
- stateTimebarRow->SetTimeRatio(m_baseStateRow->GetTimeRatio());
- return stateTimebarRow;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.cpp b/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.cpp
deleted file mode 100644
index e1579936..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.cpp
+++ /dev/null
@@ -1,157 +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 "StateTimebarRow.h"
-#include "Renderer.h"
-#include "StateRow.h"
-#include "StateRowUI.h"
-#include "StudioPreferences.h"
-#include "TimebarControl.h"
-#include "MasterP.h"
-#include "Snapper.h"
-#include "Bindings/ITimelineItemBinding.h"
-
-//=============================================================================
-/**
- * Creates a new CStateTimebarRow for the StateRow.
- * @param inStateRow the State Row that this is on.
- * @param inCreateTimebar true if the constructor is responsible for creating a timebar, otherwise
- * the derived class will take care of the construction.
- *
- */
-CStateTimebarRow::CStateTimebarRow(CStateRowUI *inStateRow, bool inCreateTimebar /*=true*/)
- : CStateTimebarlessRow(inStateRow)
- , m_Timebar(nullptr)
-{
- if (inCreateTimebar) {
- m_Timebar = new CTimebarControl(this, inStateRow->GetTimelineRow()->GetTimelineItemBinding());
- m_Timebar->SetMinimumSize(CPt(0, CStudioPreferences::GetRowSize()));
-
- AddChild(m_Timebar);
- }
-}
-
-CStateTimebarRow::~CStateTimebarRow()
-{
- delete m_Timebar;
-}
-
-//=============================================================================
-/**
- * OnMouseRDown event, handles context menus for this object.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-bool CStateTimebarRow::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CStateTimebarlessRow::OnMouseRDown(inPoint, inFlags)) {
- CPt theTimebarPoint = inPoint - m_Timebar->GetPosition();
- m_Timebar->ShowContextMenu(theTimebarPoint, false);
- }
- return true;
-}
-
-//=============================================================================
-/**
- * Set the amount of time that is being represented per pixel.
- * @param inTimerPerPixel the amound of time being represented per pixel.
- */
-void CStateTimebarRow::SetTimeRatio(double inTimeRatio)
-{
- CStateTimebarlessRow::SetTimeRatio(inTimeRatio);
-
- m_Timebar->SetTimeRatio(inTimeRatio);
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been selected.
- */
-void CStateTimebarRow::OnSelect()
-{
- CStateTimebarlessRow::OnSelect();
-
- m_Timebar->SetSelected(true);
-}
-
-//=============================================================================
-/**
- * Notification that the object that this row is representing has been deselected.
- */
-void CStateTimebarRow::OnDeselect()
-{
- CStateTimebarlessRow::OnDeselect();
-
- m_Timebar->SetSelected(false);
-}
-
-//=============================================================================
-/**
- * Notification from the Asset that it's time has changed.
- * @param inStartTime the new start time.
- * @param inEndTime the new end time.
- */
-void CStateTimebarRow::UpdateTime(long inStartTime, long inEndTime)
-{
- m_Timebar->Refresh(inStartTime, inEndTime);
- Invalidate();
-}
-
-void CStateTimebarRow::PopulateSnappingList(CSnapper *inSnappingList)
-{
- if (inSnappingList->GetSource() != m_Timebar) {
- inSnappingList->AddTime(m_Timebar->GetStartTime());
- inSnappingList->AddTime(m_Timebar->GetEndTime());
- }
- m_Timebar->PopulateSnappingList(inSnappingList);
- CStateTimebarlessRow::PopulateSnappingList(inSnappingList);
-}
-
-//=============================================================================
-/**
- * called when meta data for this row is changed... should be overridden by the
- * timebar row
- */
-void CStateTimebarRow::RefreshRowMetaData()
-{
- Invalidate();
- m_Timebar->RefreshMetaData();
-}
-
-void CStateTimebarRow::SetSnappingListProvider(ISnappingListProvider *inProvider)
-{
- m_Timebar->SetSnappingListProvider(inProvider);
-}
-
-ISnappingListProvider &CStateTimebarRow::GetSnappingListProvider() const
-{
- return m_Timebar->GetSnappingListProvider();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.h b/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.h
deleted file mode 100644
index 0330b080..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/StateTimebarRow.h
+++ /dev/null
@@ -1,67 +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_STATE_TIMEBAR_ROW_H
-#define INCLUDED_STATE_TIMEBAR_ROW_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "StateTimebarlessRow.h"
-
-class CStateRow;
-class CTimebarControl;
-class CSnapper;
-class ITimelineItemBinding;
-
-class CStateTimebarRow : public CStateTimebarlessRow
-{
-public:
- CStateTimebarRow(CStateRowUI *inStateRow, bool inCreateTimebar = true);
- virtual ~CStateTimebarRow();
-
- // CControl
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void SetTimeRatio(double inTimeRatio) override;
-
- void OnSelect() override;
- void OnDeselect() override;
- void UpdateTime(long inStartTime, long inEndTime) override;
-
- void PopulateSnappingList(CSnapper *inSnappingList) override;
- void RefreshRowMetaData() override;
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider);
- ISnappingListProvider &GetSnappingListProvider() const override;
-
-protected:
- CTimebarControl *m_Timebar;
-};
-#endif // INCLUDED_STATE_TIMEBAR_ROW_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.cpp b/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.cpp
deleted file mode 100644
index 0ecbe0aa..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.cpp
+++ /dev/null
@@ -1,374 +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 "StateTimebarlessRow.h"
-#include "IKeyframe.h"
-#include "Renderer.h"
-#include "StateRow.h"
-#include "MasterP.h"
-#include "KeyframeContextMenu.h"
-#include "Snapper.h"
-#include "MultiSelectAspect.h"
-#include "PropertyTimebarRow.h"
-#include "PropertyRow.h"
-#include "AssetTimelineKeyframe.h"
-#include "Bindings/ITimelineItemBinding.h"
-#include "StudioUtils.h"
-#include "StateRowUI.h"
-
-//=============================================================================
-/**
- * Creates a new CStateTimebarRow for the StateRow.
- * @param inStateRow the State Row that this is on.
- */
-CStateTimebarlessRow::CStateTimebarlessRow(CStateRowUI *inStateRow)
- : m_StateRowUI(inStateRow)
- , m_Selected(false)
- , m_Refreshing(false)
-{
- auto timelineRow = m_StateRowUI->GetTimelineRow();
- m_BackgroundColor = timelineRow->GetTimebarBackgroundColor(timelineRow->GetObjectType());
-}
-
-CStateTimebarlessRow::~CStateTimebarlessRow()
-{
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- CAssetTimelineKeyframe *theDeletedKey = (*thePos);
- RemoveChild(theDeletedKey);
- delete theDeletedKey;
- }
-}
-
-void CStateTimebarlessRow::OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation)
-{
- CControl::OnDraw(inRenderer, inDirtyRect, inIgnoreValidation);
-}
-
-//=============================================================================
-/**
- * Draws the this row background.
- * @param inRenderer the renderer to draw to.
- */
-void CStateTimebarlessRow::Draw(CRenderer *inRenderer)
-{
- QT3DS_PROFILE(Draw);
-
- if (m_DirtyFlag) {
- RefreshKeyframes();
- m_DirtyFlag = false;
- }
-
- CBaseTimebarlessRow::Draw(inRenderer);
-}
-
-//=============================================================================
-/**
- * OnMouseRDown event, handles context menus for this object.
- * @param inPoint the location of the mouse over this control.
- * @param inFlags the mouse state flags.
- */
-bool CStateTimebarlessRow::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- auto stateRow = static_cast<CStateRow *>(m_StateRowUI->GetTimelineRow());
- stateRow->Select(Qt::NoModifier); // ensure this is selected, but doesn't
- // affect any key selections, because this
- // can be triggered from a key being
- // selected
- return CControl::OnMouseRDown(inPoint, inFlags);
-}
-
-//=============================================================================
-/**
- * Set the amount of time that is being represented per pixel.
- * @param inTimerPerPixel the amound of time being represented per pixel.
- */
-void CStateTimebarlessRow::SetTimeRatio(double inTimeRatio)
-{
- CBaseTimebarlessRow::SetTimeRatio(inTimeRatio);
-
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- (*thePos)->SetTimeRatio(inTimeRatio);
- }
-}
-
-//=============================================================================
-/**
- * Get the state row that this belongs to.
- */
-CStateRowUI *CStateTimebarlessRow::GetStateRowUI()
-{
- return m_StateRowUI;
-}
-
-//=============================================================================
-/**
- * Handler for when a child key is selected
- *
- * @param inTime time of the key
- */
-void CStateTimebarlessRow::OnKeySelected(long inTime, bool inSelected,
- bool inClearPreviouslySelectedKeys)
-{
- ITimelineItemBinding *theTimelineItemBinding =
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding();
- if (inSelected)
- theTimelineItemBinding->SetSelected(false);
-
- if (inClearPreviouslySelectedKeys)
- theTimelineItemBinding->ClearKeySelection();
-
- theTimelineItemBinding->SelectKeyframes(inSelected, inTime);
- RefreshKeyframes();
- Invalidate();
-}
-
-CBaseStateRowUI *CStateTimebarlessRow::GetBaseStateRowUI() const
-{
- return m_StateRowUI;
-}
-
-//=============================================================================
-/**
- * Checks the data binding, instead of the property rows since they may not be created
- * (delayed-loading) if this is not expanded.
- */
-bool CStateTimebarlessRow::PropertiesHaveKeyframe(long inTime)
-{
- bool theResult = false;
-
- ITimelineItemBinding *theTimelineItemBinding =
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding();
- long theNumProps = theTimelineItemBinding->GetPropertyCount();
- for (long theIndex = 0; theIndex < theNumProps; ++theIndex) {
- ITimelineItemProperty *theProp = theTimelineItemBinding->GetProperty(theIndex);
- if (theProp && theProp->GetKeyframeByTime(inTime)) {
- theResult = true;
- break;
- }
- }
- return theResult;
-}
-
-//=============================================================================
-/**
- * called when keyframes need to be updated, this funciton has two loops:
- * the first loops through and deletes any keys no longer in the sskf list. the
- * second adds any keys in the sskf list that are not already in the list
- *
- */
-void CStateTimebarlessRow::RefreshKeyframes()
-{
- QT3DS_PROFILE(RefreshKeyframes);
-
- m_Refreshing = true;
-
- ITimelineItemBinding *theTimelineItemBinding =
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding();
- long theKeyframeCount = theTimelineItemBinding->GetKeyframeCount();
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
-
- // First Loop clears any keys that do not correlate to a supersetkey
- while (thePos != m_Keyframes.end()) {
- CAssetTimelineKeyframe *theTimelineKey = (*thePos);
- IKeyframe *theTempKey = nullptr;
- theTempKey = theTimelineItemBinding->GetKeyframeByTime(theTimelineKey->GetTime());
-
- // If we find a key at this time, then the timeline key doesn't need to be deleted
- if (!theTempKey || !PropertiesHaveKeyframe(theTimelineKey->GetTime())) {
- RemoveChild(theTimelineKey);
- delete theTimelineKey;
- thePos = m_Keyframes.erase(thePos);
- } else if (theTempKey->IsDynamic() != theTimelineKey->IsDynamic()) {
- theTimelineKey->SetDynamic(theTempKey->IsDynamic());
- } else {
- // Set the position
- theTimelineKey->SetPosition(::TimeToPos(theTempKey->GetTime(), m_TimeRatio)
- - (theTimelineKey->GetSize().x / 2),
- 0);
- ++thePos;
- }
- }
-
- // Second Loop adds the remaining keys
- for (long theKey = 0; theKey < theKeyframeCount; ++theKey) {
- bool theFoundFlag = false;
- IKeyframe *theTempKey = theTimelineItemBinding->GetKeyframeByIndex(theKey);
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
-
- // each key needs to be compared to all the keys in the sskf list to see if it has to be
- // added.
- for (; thePos != m_Keyframes.end() && !theFoundFlag; ++thePos) {
- CAssetTimelineKeyframe *theCurrentKey = (*thePos);
- if (theCurrentKey->GetTime() == theTempKey->GetTime()) {
- theFoundFlag = true;
- }
- }
- if (!theFoundFlag && PropertiesHaveKeyframe(theTempKey->GetTime())) {
- // If we don't have a timeline key, then we have to make a new one
- CAssetTimelineKeyframe *theAssetTimelineKey =
- new CAssetTimelineKeyframe(this, m_TimeRatio);
- theAssetTimelineKey->SetTime(theTempKey->GetTime());
- theAssetTimelineKey->Select(theTempKey->IsSelected());
- theAssetTimelineKey->SetDynamic(theTempKey->IsDynamic());
- theAssetTimelineKey->SetSize(CPt(17, 16));
- theAssetTimelineKey->SetPosition(::TimeToPos(theTempKey->GetTime(), m_TimeRatio)
- - (theAssetTimelineKey->GetSize().x / 2),
- 0);
- AddChild(theAssetTimelineKey);
- m_Keyframes.push_back(theAssetTimelineKey);
- }
- }
- m_Refreshing = false;
-}
-
-void CStateTimebarlessRow::Invalidate(bool inInvalidate)
-{
- if (!m_Refreshing) {
- CControl::Invalidate(inInvalidate);
- }
-}
-
-//=============================================================================
-/**
- * called when a list has a member change selection
- * @param inTime -1 to affect all keyframes.
- *
- */
-void CStateTimebarlessRow::SelectKeysByTime(long inTime, bool inSelected)
-{
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- bool theFoundFlag = false;
- for (; thePos != m_Keyframes.end() && !theFoundFlag; ++thePos) {
- CAssetTimelineKeyframe *theKey = (*thePos);
- if (inTime == -1 || theKey->GetTime() == inTime) {
- theKey->Select(inSelected);
- theFoundFlag = (inTime != -1);
- }
- }
- Invalidate();
-}
-
-//=============================================================================
-/**
- * SelectKeysInRect: selects any keyframes inside the rect
- *
- * @param inRect the Rect to select the keyframes in
- * @return NONE.
- */
-void CStateTimebarlessRow::SelectKeysInRect(CRct inRect, bool inModifierKeyDown)
-{
- ITimelineItemBinding *theTimelineItemBinding =
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding();
- CMultiSelectAspect<TTimelineAssetKeyframeList> theMultiSelectAspect(
- m_Keyframes, theTimelineItemBinding);
- theMultiSelectAspect.MultiSelect(inRect, inModifierKeyDown);
-}
-
-//=============================================================================
-/**
- * CommitSelections: commits all the master keyframe selections by setting their
- * previous selection state to the current selection state.
- * This will prevent the current keyframe states from
- *changing.
- *
- * @param NONE
- * @return NONE
- */
-
-void CStateTimebarlessRow::CommitSelections()
-{
- ITimelineItemBinding *theTimelineItemBinding =
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding();
- CMultiSelectAspect<TTimelineAssetKeyframeList> theMultiSelectAspect(
- m_Keyframes, theTimelineItemBinding);
- theMultiSelectAspect.CommitSelections();
-}
-
-//=============================================================================
-/**
- * true if there are selected keys on this object
- */
-bool CStateTimebarlessRow::HasSelectedKeys()
-{
- bool theRetVal = false;
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end() && !theRetVal; ++thePos) {
- if ((*thePos)->IsSelected()) {
- theRetVal = true;
- }
- }
- return theRetVal;
-}
-
-//=============================================================================
-/**
- * selects all keys for this timebar row
- */
-void CStateTimebarlessRow::SelectAllKeys()
-{
- m_StateRowUI->GetTimelineRow()->GetTimelineItemBinding()->SelectKeyframes(true, -1);
-
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos)
- (*thePos)->Select(true);
-
- Invalidate();
-}
-
-//=============================================================================
-/**
- * Populates the snapping list with any snapping points that may be on this.
- * This will add the timebar ends, master keyframes to the snapping list, and
- * time labels to the snapping list.
- * @param inSnapper the snapper to add the points to.
- */
-void CStateTimebarlessRow::PopulateSnappingList(CSnapper *inSnapper)
-{
- // Only add points if this is not the object originating the snapping.
- if (inSnapper->GetSource() != this) {
- // Add Keyframes
- TTimelineAssetKeyframeList::iterator thePos = m_Keyframes.begin();
- for (; thePos != m_Keyframes.end(); ++thePos) {
- if (inSnapper->IsSnappingSelectedKeyframes())
- inSnapper->AddTime((*thePos)->GetTime());
- else if (!(*thePos)->IsSelected())
- inSnapper->AddTime((*thePos)->GetTime());
- }
- }
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.h b/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.h
deleted file mode 100644
index 4cdcce7d..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/StateTimebarlessRow.h
+++ /dev/null
@@ -1,87 +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_STATE_TIMEBARLESS_ROW_H
-#define INCLUDED_STATE_TIMEBARLESS_ROW_H 1
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BaseTimebarlessRow.h"
-#include "DispatchListeners.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CStateRowUI;
-class CSnapper;
-class CAssetTimelineKeyframe;
-class ITimelineItemBinding;
-
-class CStateTimebarlessRow : public CBaseTimebarlessRow
-{
- typedef std::vector<CAssetTimelineKeyframe *> TTimelineAssetKeyframeList;
-
-public:
- CStateTimebarlessRow(CStateRowUI *inStateRow);
- virtual ~CStateTimebarlessRow();
-
- void OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation = false) override;
- void Draw(CRenderer *inRenderer) override;
-
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void OnKeySelected(long inTime, bool inState, bool inClearPreviouslySelectedKeys);
-
- void SetTimeRatio(double inTimeRatio) override;
-
- virtual void RefreshKeyframes();
- void Invalidate(bool inInvalidate = true) override;
- void CommitSelections() override;
- void SelectKeysInRect(CRct inRect, bool inModifierKeyDown) override;
- void SelectAllKeys() override;
- void SelectKeysByTime(long inTime, bool inSelected) override;
- bool HasSelectedKeys();
- CStateRowUI *GetStateRowUI();
- void PopulateSnappingList(CSnapper *inSnapper) override;
-
-protected:
- CBaseStateRowUI *GetBaseStateRowUI() const override;
- bool PropertiesHaveKeyframe(long inTime);
-
-protected:
- CStateRowUI *m_StateRowUI;
- bool m_Selected;
- TTimelineAssetKeyframeList m_Keyframes; ///<Master Keyframe list ( STL )
- bool m_Refreshing;
-};
-#endif // INCLUDED_STATE_TIMEBARLESS_ROW_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.cpp b/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.cpp
deleted file mode 100644
index f6c01e1a..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.cpp
+++ /dev/null
@@ -1,340 +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 "TimeMeasure.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "StudioUtils.h"
-#include "TimelineTimelineLayout.h"
-#include "Snapper.h"
-#include "Qt3DSDMSignals.h"
-
-const long AUTO_TICK_AMNT = 60;
-using namespace Q3DStudio;
-
-//=============================================================================
-/**
- * Create a new time measure.
- * @param inLayout the layout this is representing, used for modifying time.
- * @param inTimeRatio the current time ratio.
- * @param inIsTransparent true if the background of this control should not be drawn.
- */
-CTimeMeasure::CTimeMeasure(CTimelineTimelineLayout *inLayout, double inTimeRatio,
- bool inFillBackground /*= true */)
- : CBaseMeasure(inTimeRatio, inFillBackground)
- , m_ScrollDir(0)
- , m_TimePerPixel(0)
- , m_IsMouseDown(false)
- , m_TimelineLayout(inLayout)
-{
- SetTimeRatio(inTimeRatio);
- SetName("TimeMeasure");
-
- m_EdgeMargin = 2;
- // the large tickmark is shorter than the medium to leave room for the text
- m_LargeHashOffset = 5;
-}
-
-CTimeMeasure::~CTimeMeasure()
-{
-}
-
-//=============================================================================
-/**
- * Set the amount of time that is represented for each pixel.
- * @param inTimePerPixel the amount of time represented for each pixel.
- */
-void CTimeMeasure::SetTimeRatio(double inTimeRatio)
-{
- m_Ratio = inTimeRatio;
-
- double theTimePerPixel = (double)(1 / inTimeRatio);
-
- // Only go through this if it has actually changed
- if (theTimePerPixel != m_TimePerPixel) {
- m_TimePerPixel = theTimePerPixel;
-
- // Go through the possible hash settings and find the one that best suits the
- // time per pixel.
- double theMillisPerLargeHash = theTimePerPixel * 50;
- if (theMillisPerLargeHash <= 100) // 100ms
- theMillisPerLargeHash = 100;
- else if (theMillisPerLargeHash <= 200) // 200ms
- theMillisPerLargeHash = 200;
- else if (theMillisPerLargeHash <= 500) // .5s
- theMillisPerLargeHash = 500;
- else if (theMillisPerLargeHash <= 1000) // 1s
- theMillisPerLargeHash = 1000;
- else if (theMillisPerLargeHash <= 2000) // 2s
- theMillisPerLargeHash = 2000;
- else if (theMillisPerLargeHash <= 5000) // 5s
- theMillisPerLargeHash = 5000;
- else if (theMillisPerLargeHash <= 10000) // 10s
- theMillisPerLargeHash = 10000;
- else if (theMillisPerLargeHash <= 20000) // 20s
- theMillisPerLargeHash = 20000;
- else if (theMillisPerLargeHash <= 30000) // 30s
- theMillisPerLargeHash = 30000;
- else if (theMillisPerLargeHash <= 60000) // 1m
- theMillisPerLargeHash = 60000;
- else if (theMillisPerLargeHash <= 120000) // 2m
- theMillisPerLargeHash = 120000;
- else if (theMillisPerLargeHash <= 300000) // 5m
- theMillisPerLargeHash = 300000;
- else if (theMillisPerLargeHash <= 600000) // 10m
- theMillisPerLargeHash = 600000;
- else if (theMillisPerLargeHash <= 1200000) // 20m
- theMillisPerLargeHash = 1200000;
- else if (theMillisPerLargeHash <= 1800000) // 30m
- theMillisPerLargeHash = 1800000;
- else if (theMillisPerLargeHash <= 3600000) // 1h
- theMillisPerLargeHash = 3600000;
- else
- theMillisPerLargeHash = 7200000; // 2h
-
- // Set the distances between the hashes
- m_LargeHashInterval = theMillisPerLargeHash;
- m_MediumHashInterval = theMillisPerLargeHash / 2;
- m_SmallHashInterval = theMillisPerLargeHash / 10;
-
- // update to StudioPreferences so that the ',' '.' and '<' '>' keys would respond
- // accordingly
- CStudioPreferences::SetTimeAdvanceAmount(static_cast<long>(m_SmallHashInterval));
- CStudioPreferences::SetBigTimeAdvanceAmount(static_cast<long>(m_MediumHashInterval));
-
- Invalidate();
- }
-}
-//=============================================================================
-/**
- * Get the time formatted as a string.
- * This will figure out the best way to display the time and return it as a
- * string.
- * @param inTime the time to display in milliseconds.
- * @return the time formatted in a string.
- */
-Q3DStudio::CString CTimeMeasure::FormatTime(long inTime)
-{
- long theHours = inTime / 3600000;
- long theMinutes = inTime % 3600000 / 60000;
- long theSeconds = inTime % 60000 / 1000;
- long theMillis = inTime % 1000;
-
- bool theHoursOnlyFlag = theHours != 0 && theMinutes == 0 && theSeconds == 0 && theMillis == 0;
- bool theMinutesOnlyFlag =
- !theHoursOnlyFlag && theMinutes != 0 && theSeconds == 0 && theMillis == 0;
- bool theSecondsOnlyFlag = !theMinutesOnlyFlag && theMillis == 0;
-
- Q3DStudio::CString theTime;
- // If only hours are being displayed then format it as hours.
- if (theHoursOnlyFlag) {
- theTime.Format(_LSTR("%dh"), theHours);
- }
- // If only minutes are being displayed then format it as minutes.
- else if (theMinutesOnlyFlag) {
- theTime.Format(_LSTR("%dm"), theMinutes);
- }
- // If only seconds are being displayed then format as seconds
- else if (theSecondsOnlyFlag) {
- theTime.Format(_LSTR("%ds"), theSeconds);
- }
- // If the intervals are correct then this should only be tenths of seconds, so do that.
- else {
- theTime.Format(_LSTR("0.%ds"), theMillis / 100);
- }
-
- return theTime;
-}
-
-//=============================================================================
-/**
- * Set the amount of time that this time measure is offset by.
- * @param inTimeOffset the offset time in milliseconds.
- */
-void CTimeMeasure::SetTimeOffset(long inTimeOffset)
-{
- if (inTimeOffset != m_Offset) {
- m_Offset = inTimeOffset;
-
- Invalidate();
- }
-}
-
-//=============================================================================
-/**
- * Notification that the left mouse button was clicked.
- * This tells the timeline to move the playhead to the current loc.
- * @param inPoint the location where the mouse was clicked.
- * @param inFlags the state of the mouse.
- */
-bool CTimeMeasure::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_IsMouseDown = true;
-
- m_TimelineLayout->OnTimeMeasureMouseDown(inPoint, inFlags);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Notification that the mouse is moving over this control.
- * If the mouse was clicked on this control this will drag the playhead.
- * @param inPoint the location where the mouse was clicked.
- * @param inFlags the state of the mouse.
- */
-void CTimeMeasure::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
-
- // subtract out the button width since the playhead is never allowed into that area on the right
- // side
- // of the timeline and use it for the initial autoscrolling place
- if (inPoint.x > 0 && inPoint.x <= GetSize().x - CStudioPreferences::GetDefaultButtonWidth()) {
- CControl::OnMouseMove(inPoint, inFlags);
- if (m_IsMouseDown)
- m_TimelineLayout->OnTimeMeasureMouseDown(inPoint, inFlags);
- m_ScrollDir = 0;
- } else if (m_IsMouseDown) {
- if (inPoint.x < 0)
- m_ScrollDir = -1;
- else if (inPoint.x > GetSize().x - CStudioPreferences::GetDefaultButtonWidth())
- m_ScrollDir = 1;
- m_TimerConnection = ITickTock::GetInstance().AddTimer(
- 150, true, std::bind(&CTimeMeasure::OnTimer, this), "CTimeMeasure::OnMouseMove");
- OnTimer();
- }
-}
-
-//=============================================================================
-/**
- * Call back for the timer that was set in on mouse move
- */
-void CTimeMeasure::OnTimer()
-{
- CPt theOffset;
- if (m_ScrollDir > 0)
- theOffset.x =
- GetSize().x - 2 * CStudioPreferences::GetDefaultButtonWidth() + AUTO_TICK_AMNT;
- else if (m_ScrollDir < 0)
- theOffset.x = -AUTO_TICK_AMNT;
- m_TimelineLayout->OnTimeMeasureMouseDown(theOffset, 0);
- ;
-}
-
-//=============================================================================
-/**
- * Notification that the mouse was unclicked.
- * This stops dragging of the playhead if it was dragging it.
- * @param inPoint the location where the mouse was unclicked.
- * @param inFlags the state of the mouse.
- */
-void CTimeMeasure::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
- m_IsMouseDown = false;
-}
-
-//=============================================================================
-/**
- * Notification that the mouse was unclicked.
- * This stops dragging of the playhead if it was dragging it.
- * @param inPoint the location where the mouse was unclicked.
- * @param inFlags the state of the mouse.
- */
-void CTimeMeasure::OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
- m_IsMouseDown = false;
-}
-
-//=============================================================================
-/**
- * Add the tick marks to the snapping list.
- * This uses the user preference for the tick marks and adds them.
- */
-void CTimeMeasure::PopulateSnappingList(CSnapper *inSnapper)
-{
- // Only if this is supposed to snap to time markers.
- if (CStudioPreferences::IsTimelineSnappingGridActive()) {
- // Check the resolution to snap to
- ESnapGridResolution theResolution = CStudioPreferences::GetTimelineSnappingGridResolution();
- double thePeriodicInterval;
- if (theResolution == SNAPGRID_TICKMARKS) {
- thePeriodicInterval = m_SmallHashInterval;
- } else if (theResolution == SNAPGRID_HALFSECONDS) {
- thePeriodicInterval = m_MediumHashInterval;
- } else {
- thePeriodicInterval = m_LargeHashInterval;
- }
-
- // Set a periodic interval for snapping
- inSnapper->SetPeriodicInterval(::dtol(thePeriodicInterval));
- }
-}
-
-void CTimeMeasure::OnLoseFocus()
-{
- m_TimerConnection = std::shared_ptr<qt3dsdm::ISignalConnection>();
- m_IsMouseDown = false;
-}
-
-//=============================================================================
-/**
- * Draw the time at the specified position.
- * @param inRenderer the renderer to draw to.
- * @param inPosition the position to draw the time to, the time will be centered here.
- * @param inTime the time to draw.
- */
-void CTimeMeasure::DrawMeasureText(CRenderer *inRenderer, long inPosition, long inMeasure)
-{
- Q3DStudio::CString theTimeFormat(FormatTime(inMeasure));
- // Offset the position by half the text size to center it over the hash.
- const auto textSize = inRenderer->GetTextSize(theTimeFormat.toQString());
- inPosition -= ::dtol(textSize.width() / 2);
-
- inRenderer->DrawText((float)inPosition, -3, theTimeFormat.toQString(),
- QRect(0, 0, GetSize().x, GetSize().y),
- CStudioPreferences::GetRulerTickColor().getQColor());
-}
-
-//=============================================================================
-/**
- * Calculate the position of a time value on the time measure
- */
-long CTimeMeasure::CalculatePos(double inNewValue)
-{
- return ::TimeToPos(inNewValue, m_Ratio);
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.h b/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.h
deleted file mode 100644
index badc3249..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimeMeasure.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_TIME_MEASURE_H
-#define INCLUDED_TIME_MEASURE_H 1
-
-#pragma once
-
-#include "BaseMeasure.h"
-#include "ITickTock.h"
-
-class CTimelineTimelineLayout;
-class CSnapper;
-
-class CTimeMeasure : public CBaseMeasure
-{
-public:
- CTimeMeasure(CTimelineTimelineLayout *inLayout, double inTimeRatio,
- bool inFillBackground = true);
- virtual ~CTimeMeasure();
-
- void SetTimeRatio(double inTimeRatio);
- void SetTimeOffset(long inTimeOffset);
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseRUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
- void PopulateSnappingList(CSnapper *inSnapper);
-
- virtual void OnTimer();
- void OnLoseFocus() override;
-
-protected:
- // CBaseMeasure
- void DrawMeasureText(CRenderer *inRenderer, long inPosition, long inMeasure) override;
- long CalculatePos(double inNewValue) override;
-
- Q3DStudio::CString FormatTime(long inTime);
-
- long m_ScrollDir;
- double m_TimePerPixel;
- bool m_IsMouseDown;
- CTimelineTimelineLayout *m_TimelineLayout;
- std::shared_ptr<qt3dsdm::ISignalConnection> m_TimerConnection;
-};
-#endif // INCLUDED_TIME_MEASURE_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimebarControl.cpp b/src/Authoring/Studio/Palettes/Timeline/TimebarControl.cpp
deleted file mode 100644
index 5d2b1092..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimebarControl.cpp
+++ /dev/null
@@ -1,694 +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 "TimebarControl.h"
-#include "StateTimebarRow.h"
-#include "StateRow.h"
-#include "StateRowUI.h"
-#include "Renderer.h"
-#include "ColorControl.h"
-#include "StudioPreferences.h"
-#include "Views.h"
-#include "TimelineControl.h"
-#include "TimelineTimelineLayout.h"
-#include "ResourceCache.h"
-#include "HotKeys.h"
-#include "Preferences.h"
-#include "Bindings/ITimelineItemBinding.h"
-#include "Bindings/ITimelineTimebar.h"
-#include "StudioApp.h"
-#include "Core.h"
-#include "Doc.h"
-#include "CoreUtils.h"
-#include "StudioUtils.h"
-#include "MasterP.h"
-
-const float SCALING_FACTOR = 0.50;
-
-//=============================================================================
-/**
- * Create a timebar control on the specified state timebar row.
- * Attaches a new ToolTip to it that displays the time range this timebar control
- * encompasses.
- * @param inRow the row on which this timebar is attached.
- */
-CTimebarControl::CTimebarControl(CStateTimebarRow *inRow,
- ITimelineItemBinding *inTimelineItemBinding)
- : m_IsSelected(false)
- , m_IsMouseDown(false)
- , m_MaybeDragStart(false)
- , m_LeftLeftTip(this, true)
- , m_LeftTip(this, true)
- , m_RightTip(this, false)
- , m_RightRightTip(this, false)
- , m_SnappingListProvider(nullptr)
-{
- m_TimebarRow = inRow;
- m_TimelineItemBinding = inTimelineItemBinding;
- // Start/End times
- ITimelineTimebar *theTimelineTimebar = GetTimebar();
- m_StartTime = theTimelineTimebar->GetStartTime();
- m_EndTime = theTimelineTimebar->GetEndTime();
- bool theShowHandleBars = theTimelineTimebar->ShowHandleBars();
- m_LeftLeftTip.ShowHandles(theShowHandleBars);
- m_RightRightTip.ShowHandles(theShowHandleBars);
-
- m_LeftLeftTip.SetSize(CStudioPreferences::GetTimebarTipSize(),
- CStudioPreferences::GetRowSize());
- m_LeftTip.SetPosition(CPt(0, 0));
- m_LeftTip.SetSize(CStudioPreferences::GetTimebarInnerTipSize(),
- CStudioPreferences::GetRowSize());
- m_LeftTip.SetPosition(CPt(m_LeftLeftTip.GetSize().x, 0));
-
- m_RightTip.SetSize(CStudioPreferences::GetTimebarInnerTipSize(),
- CStudioPreferences::GetRowSize());
- m_RightRightTip.SetSize(CStudioPreferences::GetTimebarTipSize(),
- CStudioPreferences::GetRowSize());
-
- m_EditControl = new CCommentEdit(theTimelineTimebar);
- m_EditControl->SetPosition(CStudioPreferences::GetTimebarTipSize() * 2, 1);
- m_EditControl->SetSize(CPt(100, 15));
- m_EditControl->SetFillBackground(false);
- AddChild(m_EditControl);
- AddChild(&m_LeftTip);
- AddChild(&m_RightTip);
- AddChild(&m_RightRightTip);
- AddChild(&m_LeftLeftTip);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTimebarControl::~CTimebarControl()
-{
- delete m_EditControl;
-}
-
-//=============================================================================
-/**
- * Draw this timebar control to the renderer.
- * @param inRenderer the renderer to draw to.
- */
-void CTimebarControl::Draw(CRenderer *inRenderer)
-{
- CStateRowUI *theRowUI = m_TimebarRow->GetStateRowUI();
- auto theRow = static_cast<CBaseStateRow *>(theRowUI->GetTimelineRow());
- CRct theRect(GetSize());
-
- ::CColor theNormalColor = GetTimebar()->GetTimebarColor();
- ::CColor theSelectedColor = CColorControl::CalculateSelectedColor(theNormalColor);
-
- ::CColor theBorderColor = CStudioPreferences::GetTimeBarBorderColor();
- ::CColor theDarkExtendedColor = CStudioPreferences::GetExtendedObjectDarkColor();
- ::CColor theLightExtendedColor = CStudioPreferences::GetExtendedObjectLightColor();
-
- long theTipOffset = CStudioPreferences::GetTimebarTipSize();
-
- if (!IsEnabled()) {
- theNormalColor = CStudioPreferences::GetLockedTimebarColor();
- theBorderColor = CStudioPreferences::GetLockedBorderColor();
- theDarkExtendedColor = CStudioPreferences::GetExtendedLockedDarkColor();
- theLightExtendedColor = CStudioPreferences::GetExtendedLockedLightColor();
- }
-
- // Calculate the start/end/activestart
- long theObjectLifeStart = ::TimeToPos(m_StartTime, m_TimeRatio);
- long theStartPos = ::TimeToPos(theRow->GetActiveStart(), m_TimeRatio) - theObjectLifeStart;
- long theEndPos = ::TimeToPos(theRow->GetActiveEnd(), m_TimeRatio) - theObjectLifeStart;
- long theObjectLifeEnd = ::TimeToPos(m_EndTime, m_TimeRatio) - theObjectLifeStart;
-
- CRct theGradientRct(theStartPos + theTipOffset, 0, theEndPos - theStartPos, theRect.size.y - 1);
-
- if (theEndPos > theStartPos) {
- inRenderer->DrawGradientBitmap(theGradientRct, theNormalColor, 0, SCALING_FACTOR);
- // Calculate the gradient rect a bit differently depending on selection
- if (m_IsSelected) {
- CRct theSelectedRct(CPt(theGradientRct.position.x, theGradientRct.position.y + 3),
- CPt(theGradientRct.size.x, theGradientRct.size.y - 7));
- inRenderer->FillSolidRect(theSelectedRct, theSelectedColor);
- }
- }
-
- inRenderer->PushPen(theBorderColor);
- // Check to see if we need some hashes at the end
- if (theObjectLifeEnd > theEndPos) {
- long theUpdatedStartTime = theEndPos;
- if (theStartPos > theUpdatedStartTime)
- theUpdatedStartTime = theStartPos;
- else {
- inRenderer->MoveTo(theEndPos + theTipOffset, 0);
- inRenderer->LineTo(theEndPos + theTipOffset, theRect.size.y - 1);
- }
- CRct theClippingRect(CPt(theUpdatedStartTime + theTipOffset + 1, 0),
- CPt(theObjectLifeEnd - theUpdatedStartTime - 1, theRect.size.y - 1));
- inRenderer->PushClippingRect(theClippingRect);
-
- // Draw the hashed background
- DrawHashedBackgroundX(inRenderer, theDarkExtendedColor, theLightExtendedColor,
- theClippingRect);
- inRenderer->PopClippingRect();
- }
-
- // Check to see if we need some hashes at the beginning
- if (theStartPos > 0) {
- long theUpdatedEndTime = theStartPos;
- if (theObjectLifeEnd < theUpdatedEndTime)
- theUpdatedEndTime = theObjectLifeEnd;
- else {
- inRenderer->MoveTo(theStartPos + theTipOffset, 0);
- inRenderer->LineTo(theStartPos + theTipOffset, theRect.size.y - 1);
- }
- CRct theClippingRect(CPt(theTipOffset, 0), CPt(theUpdatedEndTime, theRect.size.y - 1));
- inRenderer->PushClippingRect(theClippingRect);
-
- // Draw the hashed background
- DrawHashedBackgroundX(inRenderer, theDarkExtendedColor, theLightExtendedColor,
- theClippingRect);
- inRenderer->PopClippingRect();
- }
-
- // Draw the border stuff
- inRenderer->MoveTo(CPt(theTipOffset, 0));
- inRenderer->LineTo(CPt(theTipOffset, theRect.size.y - 1));
- inRenderer->MoveTo(CPt(theObjectLifeEnd + theTipOffset, 0));
- inRenderer->LineTo(CPt(theObjectLifeEnd + theTipOffset, theRect.size.y - 1));
-
- inRenderer->PopPen();
- // Setting the position with the active time
- m_EditControl->SetPosition(CStudioPreferences::GetTimebarTipSize() * 2, 1);
-}
-
-//=============================================================================
-/**
- * Draws a hashed background in a given clipping rect
- *
- * @param inStartX the x position to start from
- * @param inSizeY the y size the you want the lines to range from
- * @param inEndX one after the last place where lines can be drawn from
- * @inRenderer the renderer to draw to
- * @param inFirstColor the first hash color
- * @param inSecondColor the second hash color
- * @para inRect the clipping rect
- */
-void CTimebarControl::DrawHashedBackgroundX(CRenderer *inRenderer, ::CColor inFirstColor,
- ::CColor inSecondColor, CRct inRect)
-{
- inRenderer->FillSolidRect(inRect, inFirstColor);
- if (m_IsSelected) {
- CRct theSelectedRct(CPt(inRect.position.x, inRect.position.y + 4),
- CPt(inRect.size.x, inRect.size.y - 8));
- inRenderer->FillSolidRect(
- theSelectedRct, CColorControl::CalculateSelectedColor(GetTimebar()->GetTimebarColor()));
- }
-
- inRenderer->FillHashed(inRect, inSecondColor);
-}
-
-//=============================================================================
-/**
- * Set the current time ratio.
- * The time ratio controls the length of this control and is the ratio of
- * pixels to milliseconds.
- * @param inTimeRatio the new time ratio.
- */
-void CTimebarControl::SetTimeRatio(double inTimeRatio)
-{
- m_TimeRatio = inTimeRatio;
-
- Refresh();
-}
-
-//=============================================================================
-/**
- * Set the size of this control.
- * @param inSize the new size of this control.
- */
-void CTimebarControl::SetSize(CPt inSize)
-{
- CControl::SetSize(CPt(inSize.x, inSize.y));
-
- CStateRowUI *theRowUI = m_TimebarRow->GetStateRowUI();
- auto theRow = static_cast<CBaseStateRow *>(theRowUI->GetTimelineRow());
- long theTipSize =
- CStudioPreferences::GetTimebarTipSize() + CStudioPreferences::GetTimebarInnerTipSize();
- long theCommentSize = CStudioPreferences::GetDefaultCommentSize();
- if (inSize.x < theCommentSize)
- theCommentSize = inSize.x;
-
- // Recalculate the comment size depending on where the timebar is and how large it is
- long theDiff = ::dtol((theRow->GetActiveEnd() - theRow->GetActiveStart()) * m_TimeRatio);
- if (theDiff < theCommentSize) {
- theCommentSize = theDiff - theTipSize;
- if (theCommentSize < 0)
- theCommentSize = 0;
- }
-
- m_EditControl->SetSize(CPt(theCommentSize, 15));
-
- // Set the two right tips depending on where the right side is
- m_RightTip.SetPosition(CPt(inSize.x - theTipSize, 0));
- m_RightRightTip.SetPosition(CPt(inSize.x - m_RightRightTip.GetSize().x + 1, 0));
-}
-
-//=============================================================================
-/**
- * Set whether this control is selected or not.
- * If this is selected then it will modify how this control looks.
- * @param inIsSelected true if this control is to be selected.
- */
-void CTimebarControl::SetSelected(bool inIsSelected)
-{
- if (inIsSelected != m_IsSelected) {
- m_IsSelected = inIsSelected;
- m_EditControl->SetSelected(m_IsSelected);
- Invalidate();
- }
-}
-
-void CTimebarControl::RefreshMetaData()
-{
- m_EditControl->RefreshMetaData();
-}
-
-//=============================================================================
-/**
- * Request for this control to refresh it's properties.
- * This checks the size of the asset and adjusts it's size the the asset's
- * length. Called when the time ratio or properties have changed.
- * If the time has changed then Refresh( long, long ) must be called with the
- * new times.
- */
-void CTimebarControl::Refresh()
-{
- Refresh(m_StartTime, m_EndTime);
-}
-
-//=============================================================================
-/**
- * Request for this control to refresh it's properties.
- * This updates all the properties of this control and resize it as necessary.
- * Called when the time changes on the asset, the time ratio changes or any
- * properties that this displays change.
- * @param inStartTime the asset's start time.
- * @param inEndTime the asset's end time.
- */
-void CTimebarControl::Refresh(long inStartTime, long inEndTime)
-{
- m_StartTime = inStartTime;
- m_EndTime = inEndTime;
-
- long thePosition = ::TimeToPos(inStartTime, m_TimeRatio);
- long theSize = ::dtol((inEndTime - inStartTime) * m_TimeRatio);
-
- SetPosition(thePosition - CStudioPreferences::GetTimebarTipSize(), GetPosition().y);
-
- SetSize(CPt(theSize + 2 * CStudioPreferences::GetTimebarTipSize(), GetMinimumSize().y));
- if (IsInvalidated())
- m_TimebarRow->Invalidate();
-}
-
-//=============================================================================
-/**
- * Get the interface to the timebar item in the data model
- */
-ITimelineTimebar *CTimebarControl::GetTimebar()
-{
- return m_TimelineItemBinding->GetTimelineItem()->GetTimebar();
-}
-
-//=============================================================================
-/**
-* Updates the ToolTip and moves it to the correct place on screen.
-* @param inPoint the point that the tooltip is supposed to be placed.
-*/
-void CTimebarControl::RefreshToolTip(CPt inPoint)
-{
- Q3DStudio::CString theCommentText;
- CStateRowUI *theRowUI= m_TimebarRow->GetStateRowUI();
- auto theRow = static_cast<CBaseStateRow *>(theRowUI->GetTimelineRow());
-
- CRct theTimelineBounds(GetTopControlBounds());
- // format label as: startTime - endTime (timeDifference)
- theCommentText = " " + FormatTimeString(theRow->GetStartTime()) + " - "
- + FormatTimeString(theRow->GetEndTime()) + " ("
- + FormatTimeString(theRow->GetEndTime() - theRow->GetStartTime()) + ")";
- inPoint.y = GetPosition().y - GetSize().y;
- ShowMoveableWindow(inPoint, theCommentText, theTimelineBounds);
-}
-
-//=============================================================================
-/**
- * OnMouseDoubleClick: Pop up a dialog box for the editing of the timebar start
- * and end time.
- */
-bool CTimebarControl::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDoubleClick(inPoint, inFlags)
- && !m_TimelineItemBinding->IsLockedEnabled()) {
- CDurationEditDlg theDurationEditDlg;
- theDurationEditDlg.showDialog(m_StartTime, m_EndTime, g_StudioApp.GetCore()->GetDoc(),
- this);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Allows this timebar control to add any times it wishes to the snapper list
- * @param inSnapper the Snapper that is handling the snapping functions for this timebar
- */
-void CTimebarControl::PopulateSnappingList(CSnapper *inSnapper)
-{
- Q_UNUSED(inSnapper);
-}
-
-//=============================================================================
-/**
- * Start drag handler, puts this control into drag mode.
- * @param inPoint the point where the mouse was clicked.
- * @param inFlags the mouse state.
- */
-bool CTimebarControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_IsMouseDown = true;
- m_MaybeDragStart = true;
- m_MouseDownLoc = inPoint;
-
- OnBeginDrag();
-
- auto row = static_cast<CBaseStateRow *>(m_TimebarRow->GetStateRowUI()->GetTimelineRow());
- row->Select(Qt::NoModifier);
-
- m_Snapper.Clear();
- m_Snapper.SetSource(this);
-
- GetSnappingListProvider().PopulateSnappingList(&m_Snapper);
- m_Snapper.BeginDrag(inPoint.x);
-
- if (HasFocus(m_EditControl) && !m_EditControl->HitTest(inPoint)) {
- m_EditControl->OnLoseFocus();
- }
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
- return true;
-}
-
-//=============================================================================
-/**
- * Puts up the context menu.
- * @param inPoint the point where the mouse was clicked.
- * @param inFlags the mouse state.
- */
-bool CTimebarControl::OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseRDown(inPoint, inFlags)) {
- if (m_IsMouseDown) {
- m_IsMouseDown = false;
- CommitTimeChange();
- HideMoveableWindow();
- }
- // only right-clicking ON the timebar will show the timebar (text and color) properties'
- // options
- ShowContextMenu(inPoint, true);
- }
-
- return true;
-}
-
-//=============================================================================
-/**
- * Notification that the drag has finished.
- * @param inPoint the point where the mouse was let go.
- * @param inFlags the state of the mouse.
- */
-void CTimebarControl::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // try to prevent stuck mousetips on exceptions
- try {
- CControl::OnMouseUp(inPoint, inFlags);
- CommitTimeChange();
- } catch (...) {
- }
- m_IsMouseDown = false;
- m_MaybeDragStart = false;
- HideMoveableWindow();
-}
-
-//=============================================================================
-/**
- * Handler for the mouse move messages.
- * If the mouse is down then this will drag the control and offset the timebar.
- * @param inPoint the current location of the mouse.
- * @param inFlags the state of the mouse.
- */
-void CTimebarControl::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- bool theCommentEditMode = m_EditControl->GetEditMode();
-
- // If we are in edit Comment mode or locked, then we do not drag the timebar.
- if (!theCommentEditMode && m_IsMouseDown && !m_TimelineItemBinding->IsLockedEnabled()) {
- QT3DS_PROFILE(OnMouseMove);
-
- if (m_MaybeDragStart) {
- // Dragging in the first 5 pixels will be ignored to avoid unconsciously accidental
- // moves
- CPt theDragDistance = inPoint - m_MouseDownLoc;
- if (theDragDistance.x * theDragDistance.x + theDragDistance.y * theDragDistance.y <= 25)
- return;
-
- m_MaybeDragStart = false;
- }
-
- long theNewTime = m_Snapper.ProcessDrag(m_StartTime, inPoint.x, inFlags);
- if (theNewTime < 0)
- theNewTime = 0;
- long theDiffTime = theNewTime - m_StartTime;
-
- if (theDiffTime) {
- GetTimebar()->OffsetTime(theDiffTime);
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
- }
-}
-
-//=============================================================================
-/**
- * Call from the left TimebarTab to resize the control.
- * @param inTime the time to set the start time to.
- */
-void CTimebarControl::ResizeTimebarLeftTo(long inTime)
-{
- // TOOD: sk - Figure out what this does
- // if ( inTime != 0 )
- {
- // The whole idea is to not do anything additional once times passes 0 (negatively)
- // unless it is valid that time is negative on the timebar
- if (inTime < 0 && m_StartTime > 0)
- inTime = -m_StartTime; // so that it decrements to 0
-
- if (m_StartTime > 0 || (m_StartTime == 0 && inTime > 0))
- GetTimebar()->ChangeTime(inTime, true);
- }
-}
-
-//=============================================================================
-/**
- * Call from the right TimebarTab to resize the control.
- * @param inTime the time to set the start time to.
- */
-void CTimebarControl::ResizeTimebarRightTo(long inTime)
-{
- GetTimebar()->ChangeTime(inTime, false);
-}
-
-//=============================================================================
-/**
- * Sets the Actual string of text
- * @param inText the text to set the comment text to
- */
-void CTimebarControl::SetText(const Q3DStudio::CString &inText)
-{
- m_EditControl->SetData(inText);
-}
-
-//=============================================================================
-/**
- * Sets the Text Color on the edit control
- * @param inColor the color
- */
-void CTimebarControl::SetTextColor(::CColor inColor)
-{
- m_EditControl->SetTextColor(inColor);
-}
-
-long CTimebarControl::GetStartTime()
-{
- return m_StartTime;
-}
-
-long CTimebarControl::GetEndTime()
-{
- return m_EndTime;
-}
-
-//=============================================================================
-/**
- * Sets whether or not this control is enabled.
- * If the control is not enabled then it is still drawn and still intercepts
- * mouse clicks, but it will not actually process them.
- * @param inIsEnabled true if this control is to be enabled.
- */
-void CTimebarControl::SetEnabled(bool inIsEnabled)
-{
- CControl::SetEnabled(inIsEnabled);
-}
-
-//=============================================================================
-/**
- * COMMENT!!!!!!!!!!!!!!!!!!!!!!
- */
-void CTimebarControl::OnLoseFocus()
-{
- if (m_IsMouseDown) {
- m_IsMouseDown = false;
- CommitTimeChange();
- HideMoveableWindow();
- }
- CControl::OnLoseFocus();
-}
-
-//=============================================================================
-/**
- * Setup prior to dragging.
- */
-void CTimebarControl::OnBeginDrag()
-{
- GetTimebar()->OnBeginDrag();
-}
-
-void CTimebarControl::ChangeStartTime(long inTime)
-{
- ResizeTimebarLeftTo(inTime);
-}
-
-void CTimebarControl::ChangeEndTime(long inTime)
-{
- ResizeTimebarRightTo(inTime);
-}
-
-void CTimebarControl::Commit()
-{
- GetTimebar()->CommitTimeChange();
-}
-void CTimebarControl::Rollback()
-{
- GetTimebar()->RollbackTimeChange();
-}
-
-void CTimebarControl::ShowContextMenu(CPt inPoint, bool inShowTimebarPropertiesOptions)
-{
- CTimebarKeyframeContextMenu theMenu(this, m_TimelineItemBinding->GetKeyframesManager(),
- inShowTimebarPropertiesOptions);
- DoPopup(&theMenu, inPoint);
-}
-
-void CTimebarControl::CommitTimeChange()
-{
- GetTimebar()->CommitTimeChange();
-}
-
-//=============================================================================
-/**
- * The binding is a keyframes holder
- */
-ITimelineItemKeyframesHolder *CTimebarControl::GetKeyframesHolder()
-{
- return m_TimelineItemBinding;
-}
-
-//=============================================================================
-/**
- * Start editing the timebar comment
- */
-void CTimebarControl::OnEditTimeComment()
-{
- GrabFocus(m_EditControl);
- m_EditControl->DoChangeComment();
-}
-
-//=============================================================================
-/**
- * Need to invalidate all timebars to redraw
- */
-void CTimebarControl::OnToggleTimebarHandles()
-{
- Invalidate();
-}
-
-void CTimebarControl::SetTimebarTime()
-{
- GetTimebar()->SetTimebarTime(this);
-}
-
-::CColor CTimebarControl::GetTimebarColor()
-{
- return GetTimebar()->GetTimebarColor();
-}
-
-void CTimebarControl::SetTimebarColor(const ::CColor &inColor)
-{
- GetTimebar()->SetTimebarColor(inColor);
-}
-
-void CTimebarControl::SetSnappingListProvider(ISnappingListProvider *inProvider)
-{
- m_SnappingListProvider = inProvider;
-}
-
-ISnappingListProvider &CTimebarControl::GetSnappingListProvider() const
-{
- // sk - If you hit this, it means the setup order is incorrect. e.g. loading children is done
- // depth first, ie your child's children is loaded before parent, doesn't work that way.
- return *m_SnappingListProvider;
-}
-
-CRct CTimebarControl::GetTopControlBounds() const
-{
- return m_TimebarRow->GetStateRowUI()->GetTopControl()->GetBounds();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimebarControl.h b/src/Authoring/Studio/Palettes/Timeline/TimebarControl.h
deleted file mode 100644
index 2d6e709d..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimebarControl.h
+++ /dev/null
@@ -1,144 +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_TIMEBAR_CONTROL_H
-#define INCLUDED_TIMEBAR_CONTROL_H 1
-
-#pragma once
-
-#include "Control.h"
-#include "Snapper.h"
-#include "CommentEdit.h"
-#include "TimebarTip.h"
-#include "DurationEditDlg.h"
-#include "KeyframeContextMenu.h"
-
-class CStateTimebarRow;
-class ITimelineItemBinding;
-class ISnappingListProvider;
-
-//=============================================================================
-/**
- * Interface to a timebar control
- */
-class ITimebarControl
-{
-public:
- virtual ~ITimebarControl() {}
-
- virtual ITimelineItemKeyframesHolder *GetKeyframesHolder() = 0;
- virtual void OnEditTimeComment() = 0;
- virtual void OnToggleTimebarHandles() = 0;
- virtual void SetTimebarTime() = 0;
- virtual ::CColor GetTimebarColor() = 0;
- virtual void SetTimebarColor(const ::CColor &inColor) = 0;
-};
-
-class CTimebarControl : public CControl, public ITimeChangeCallback, public ITimebarControl
-{
-public:
- CTimebarControl(CStateTimebarRow *inRow, ITimelineItemBinding *inTimelineItemBinding);
- virtual ~CTimebarControl();
- void Draw(CRenderer *inRenderer) override;
- void SetSize(CPt inSize) override;
- void SetSelected(bool inIsSelected);
- void SetTimeRatio(double inTimeRatio);
- void Refresh();
- void Refresh(long inStartTime, long inEndTime);
- void RefreshMetaData();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseRDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void ResizeTimebarLeftTo(long inTime);
- void ResizeTimebarRightTo(long inTime);
- void SetText(const Q3DStudio::CString &inText);
- void SetTextColor(::CColor inColor = ::CColor(0, 0, 0));
- void SetEnabled(bool inIsEnabled) override;
-
- long GetStartTime();
- long GetEndTime();
-
- virtual void PopulateSnappingList(CSnapper *inSnapper);
- void OnLoseFocus() override;
-
- void OnBeginDrag();
-
- // ITimeChangeCallback
- void ChangeStartTime(long) override;
- void ChangeEndTime(long) override;
- void Commit() override;
- void Rollback() override;
-
- void ShowContextMenu(CPt inPoint, bool inShowTimebarPropertiesOptions);
- void CommitTimeChange();
-
- // ITimebarControl
- ITimelineItemKeyframesHolder *GetKeyframesHolder() override;
- void OnEditTimeComment() override;
- void OnToggleTimebarHandles() override;
- void SetTimebarTime() override;
- ::CColor GetTimebarColor() override;
- void SetTimebarColor(const ::CColor &inColor) override;
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider);
- ISnappingListProvider &GetSnappingListProvider() const;
-
- CRct GetTopControlBounds() const;
-
-protected:
- ITimelineTimebar *GetTimebar();
-
- void RefreshToolTip(CPt inPoint);
- void DrawHashedBackgroundX(CRenderer *inRenderer, ::CColor inFirstColor, ::CColor inSecondColor,
- CRct inRect);
-
- CStateTimebarRow *m_TimebarRow;
- bool m_IsSelected;
- double m_TimeRatio;
- bool m_IsMouseDown;
- bool m_MaybeDragStart;
- CPt m_MouseDownLoc;
- long m_StartTime;
- long m_EndTime;
-
- CTimebarTip m_LeftLeftTip;
- CTimebarTip m_LeftTip;
-
- CTimebarTip m_RightTip;
- CTimebarTip m_RightRightTip;
- CCommentEdit *m_EditControl;
- CSnapper m_Snapper;
-
- ITimelineItemBinding *m_TimelineItemBinding;
- ISnappingListProvider *m_SnappingListProvider;
-};
-#endif // INCLUDED_TIMEBAR_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimebarTip.cpp b/src/Authoring/Studio/Palettes/Timeline/TimebarTip.cpp
deleted file mode 100644
index 9968a838..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimebarTip.cpp
+++ /dev/null
@@ -1,235 +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 "TimebarTip.h"
-#include "TimebarControl.h"
-#include "MouseCursor.h"
-#include "TimelineControl.h"
-#include "ResourceCache.h"
-#include "Renderer.h"
-#include "StudioUtils.h"
-
-#include <QApplication>
-
-//=============================================================================
-/**
- * Create a timebar tip for the timebar.
- * This handles displaying the resize cursor and processing the mouse commands.
- * @param inTimebar the timebar on which this tip is attached.
- * @param inIsLeft true if this is the left timebar tip.
- */
-CTimebarTip::CTimebarTip(CTimebarControl *inTimebar, bool inIsLeft, bool inHasHandle /*=false*/)
- : m_IsMouseDown(false)
- , m_MaybeDragStart(false)
- , m_HasHandle(false)
-{
- m_Timebar = inTimebar;
- m_IsLeft = inIsLeft;
-
- ShowHandles(inHasHandle);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTimebarTip::~CTimebarTip()
-{
-}
-
-//=============================================================================
-/**
-* Updates the ToolTip and moves it to the correct place on screen.
-* @param inPoint the point that the tooltip is supposed to be placed.
-*/
-void CTimebarTip::RefreshToolTip(CPt inPoint)
-{
- Q3DStudio::CString theCommentText;
-
- // format label as: startTime - endTime (timeDifference)
- theCommentText = " " + FormatTimeString(m_Timebar->GetStartTime()) + " - "
- + FormatTimeString(m_Timebar->GetEndTime()) + " ("
- + FormatTimeString(m_Timebar->GetEndTime() - m_Timebar->GetStartTime()) + ")";
-
- CRct theTimelineBounds(m_Timebar->GetTopControlBounds());
- inPoint.y = GetPosition().y - GetSize().y;
- ShowMoveableWindow(inPoint, theCommentText, theTimelineBounds);
-}
-
-//=============================================================================
-/**
- * Starts the dragging of the timebar tip.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- */
-bool CTimebarTip::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseDown(inPoint, inFlags);
-
- m_Timebar->OnBeginDrag();
-
- m_Snapper.Clear();
- m_Snapper.SetSource(m_Timebar);
- m_Timebar->GetSnappingListProvider().PopulateSnappingList(&m_Snapper);
- m_Snapper.BeginDrag(inPoint.x);
-
- m_IsMouseDown = true;
- m_MaybeDragStart = true;
- m_MouseDownLoc = inPoint;
-
- setCursorIfNotSet(CMouseCursor::CURSOR_RESIZE_LEFTRIGHT);
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
-
- return true;
-}
-
-//=============================================================================
-/**
- * Ends the dragging of the tip and commits the commands.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- */
-void CTimebarTip::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // try to prevent stuck mousetips on exceptions
- try {
- CControl::OnMouseUp(inPoint, inFlags);
-
- // Commit the current command so it will not be merged with drag commands if this gets
- // dragged again.
- m_Timebar->CommitTimeChange();
- } catch (...) {
- }
-
- m_IsMouseDown = false;
- m_MaybeDragStart = false;
- HideMoveableWindow();
- resetCursor();
-}
-
-//=============================================================================
-/**
- * If the mouse is down then this handles the resizing of the timebar.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse.
- */
-void CTimebarTip::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- // Don't show the cursor if the mouse is down from someone else.
- if (!(inFlags & CHotKeys::MOUSE_RBUTTON) && !(inFlags & CHotKeys::MOUSE_LBUTTON))
- setCursorIfNotSet(CMouseCursor::CURSOR_RESIZE_LEFTRIGHT);
-
- if (m_IsMouseDown) {
- if (m_MaybeDragStart) {
- // Dragging in the first 5 pixels will be ignored to avoid unconsciously accidental
- // moves
- CPt theDragDistance = inPoint - m_MouseDownLoc;
- if (theDragDistance.x * theDragDistance.x + theDragDistance.y * theDragDistance.y <= 25)
- return;
-
- m_MaybeDragStart = false;
- }
-
- // Figure out which method to call based on which tip we are.
- if (m_IsLeft) {
- long theNewTime = m_Snapper.ProcessDrag(m_Timebar->GetStartTime(), inPoint.x, inFlags);
- m_Timebar->ResizeTimebarLeftTo(theNewTime);
- } else {
- long theNewTime = m_Snapper.ProcessDrag(m_Timebar->GetEndTime(), inPoint.x, inFlags);
- m_Timebar->ResizeTimebarRightTo(theNewTime);
- }
-
- // display the time range tooltip
- RefreshToolTip(inPoint);
- }
-}
-
-//=============================================================================
-/**
- * Resets the cursor back to normal.
- * @param inPoint the location of the mouse.
- * @param inFlags the state of the mouse/modifier buttons.
- */
-void CTimebarTip::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
-
- resetCursor();
-}
-
-//=============================================================================
-/**
- * Draws timebar handles if necessary.
- */
-void CTimebarTip::Draw(CRenderer *inRenderer)
-{
- if (m_HasHandle) { // to show or not is based on Studio preferences
- bool theShowHandle =
- CPreferences::GetUserPreferences("Timeline").GetValue("ShowTimebarHandles", false);
- if (theShowHandle) {
- if (IsEnabled())
- inRenderer->DrawBitmap(CPt(0, 0), m_HandleImage);
- else
- inRenderer->DrawBitmap(CPt(0, 0), m_HandleDisabledImage);
- }
- }
-}
-
-void CTimebarTip::ShowHandles(bool inShowHandles)
-{
- m_HasHandle = inShowHandles;
-
- // If this tip can have a handle
- if (m_HasHandle) {
- if (!m_HandleImage) {
- // If this is a tip on the left side, load the images for the left side
- const char *theBitMap =
- (m_IsLeft) ? "timebarhandle-left.png" : "timebarhandle-right.png";
- m_HandleImage = CResourceCache::GetInstance()->GetBitmap(theBitMap);
- }
-
- if (!m_HandleDisabledImage) {
- const char *theBitMap =
- (m_IsLeft) ? "timebarhandle-disabled-left.png" : "timebarhandle-disabled-right.png";
- m_HandleDisabledImage = CResourceCache::GetInstance()->GetBitmap(theBitMap);
- }
- }
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimebarTip.h b/src/Authoring/Studio/Palettes/Timeline/TimebarTip.h
deleted file mode 100644
index 4aca03a7..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimebarTip.h
+++ /dev/null
@@ -1,84 +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_TIMEBAR_TIP
-#define INCLUDED_TIMEBAR_TIP 1
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "Snapper.h"
-
-#include <QCursor>
-#include <QPixmap>
-//==============================================================================
-// Forwards
-//==============================================================================
-class CTimebarControl;
-class CRenderer;
-
-//==============================================================================
-/**
- * Class for the tips of timebar controls. Allows the user to resize timebars
- * by grabbing the tips.
- */
-class CTimebarTip : public CControl
-{
-public:
- CTimebarTip(CTimebarControl *inTimebarControl, bool inIsLeft, bool inHasHandle = false);
- virtual ~CTimebarTip();
-
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(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;
-
- void ShowHandles(bool inShowHandles);
-
-protected:
- void RefreshToolTip(CPt inPoint);
-
- CTimebarControl *m_Timebar;
- bool m_IsMouseDown;
- bool m_MaybeDragStart;
- CPt m_MouseDownLoc;
- bool m_IsLeft;
- bool m_HasHandle;
- QPixmap m_HandleImage;
- QPixmap m_HandleDisabledImage;
- CSnapper m_Snapper;
-};
-
-#endif // INCLUDED_TIMEBAR_TIP
diff --git a/src/Authoring/Studio/Palettes/Timeline/Timeline.qml b/src/Authoring/Studio/Palettes/Timeline/Timeline.qml
index 6e10a12c..dd4bc088 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Timeline.qml
+++ b/src/Authoring/Studio/Palettes/Timeline/Timeline.qml
@@ -169,6 +169,7 @@ Rectangle {
Layout.minimumHeight: 80
Layout.preferredHeight: (timelineItemsList.count + 1) * itemHeight
Layout.preferredWidth: root.width
+ boundsBehavior: Flickable.StopAtBounds
contentHeight: height
contentWidth: 2000
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineControl.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineControl.cpp
deleted file mode 100644
index 053cf46b..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineControl.cpp
+++ /dev/null
@@ -1,605 +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 "TimelineControl.h"
-#include "TimelineSplitter.h"
-#include "StudioApp.h"
-#include "Dispatch.h"
-#include "TimelineTreeLayout.h"
-#include "TimelineTimelineLayout.h"
-#include "SlideRow.h"
-#include "IDoc.h"
-#include "InsertionLine.h"
-#include "InsertionOverlay.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "BreadCrumbControl.h"
-#include "BaseTimelineTreeControl.h"
-#include "Bindings/TimelineTranslationManager.h"
-#include "Doc.h"
-#include "Core.h"
-#include "MasterP.h"
-#include "TimelineUIFactory.h"
-#include "AbstractTimelineRowUI.h"
-
-// Data model specific
-#include "TimelineDropTarget.h"
-
-#include "ClientDataModelBridge.h"
-#include "Qt3DSDMStudioSystem.h"
-#include "Qt3DSDMSlides.h"
-
-IMPLEMENT_OBJECT_COUNTER(CTimelineControl)
-
-CTimelineControl::CTimelineControl(const QSize &preferredSize)
- : m_SuspendRecalcLayout(false)
- , m_TranslationManager(nullptr)
- , m_time(0)
- , m_preferredSize(preferredSize)
-{
- ADDTO_OBJECT_COUNTER(CTimelineControl)
-
- m_TranslationManager = new CTimelineTranslationManager();
-
- m_Splitter = new CTimelineSplitter();
- AddChild(m_Splitter);
-
- CDoc *theDoc = g_StudioApp.GetCore()->GetDoc();
- m_TreeLayout = new CTimelineTreeLayout(this, theDoc);
- m_Splitter->AddChild(m_TreeLayout);
-
- m_TimelineLayout = new CTimelineTimelineLayout(this, theDoc);
- m_Splitter->AddChild(m_TimelineLayout);
-
- m_Splitter->SetSplitDirection(CSplitter::SPLIT_VERTICAL);
- m_Splitter->SetSplitLocation(CStudioPreferences::GetTimelineSplitterLocation());
-
- CDispatch *theDispatch = g_StudioApp.GetCore()->GetDispatch();
- theDispatch->AddPresentationChangeListener(this);
- theDispatch->AddClientPlayChangeListener(this);
-
- // Insertion line
- m_InsertionLine = new CInsertionLine();
- m_InsertionLine->SetName("TimelineInsertionLine");
- AddChild(m_InsertionLine);
-
- // Insertion overlay marker
- m_InsertionOverlay = new CInsertionOverlay();
- m_InsertionOverlay->SetName("TimelineInsertionOverlay");
- AddChild(m_InsertionOverlay);
-
- m_Splitter->SetPosition(CPt(0, CStudioPreferences::GetHeaderHeight()));
-
- m_BreadCrumbToolbar = new CBreadCrumbControl();
- AddChild(m_BreadCrumbToolbar);
-
- SetPreferredSize(CPt(400, 200));
-}
-
-CTimelineControl::~CTimelineControl()
-{
- CDispatch *theDispatch = g_StudioApp.GetCore()->GetDispatch();
- theDispatch->RemovePresentationChangeListener(this);
- theDispatch->RemoveClientPlayChangeListener(this);
-
- delete m_InsertionOverlay;
- delete m_InsertionLine;
- delete m_TimelineLayout;
- delete m_TreeLayout;
- delete m_Splitter;
- delete m_BreadCrumbToolbar;
-
- REMOVEFROM_OBJECT_COUNTER(CTimelineControl)
-}
-
-CPt CTimelineControl::GetPreferredSize()
-{
- return CPt(m_preferredSize.width(), m_preferredSize.height());
-}
-
-//=============================================================================
-/**
- * Returns the playhead time
- */
-long CTimelineControl::GetTime()
-{
- return m_time;
-}
-
-//=============================================================================
-/**
- * Clear the contents of this view.
- * This will empty out this view and leave it ready for inspecting other objects.
- */
-void CTimelineControl::ClearView()
-{
- m_TimelineLayout->ClearRows();
- m_TreeLayout->ClearRows();
- m_ActiveSlide = 0;
-
- // clean out all previous translations, because the bindings are not guaranteed to be valid when
- // switching from one slide to another.
- m_TranslationManager->Clear();
-}
-
-//=============================================================================
-/**
- * Populates this view with the provided state.
- * This will set the state as being the root object on this view. ClearView
- * should be called before this is called.
- * The object will become the root object of this and will become the active
- * root of the doc.
- * @param inState the state to be viewed as the root asset.
- */
-void CTimelineControl::ViewSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide)
-{
- m_ActiveSlide = inSlide;
-
- qt3dsdm::ISlideSystem *theSlideSystem = GetDoc()->GetStudioSystem()->GetSlideSystem();
- qt3dsdm::Qt3DSDMInstanceHandle theSlideInstance = theSlideSystem->GetSlideInstance(inSlide);
- CSlideRow *theSlideRow = TimelineUIFactory::instance()->createSlideRow(nullptr,
- m_TranslationManager->GetOrCreate(theSlideInstance));
-
- auto uiRow = TimelineUIFactory::instance()->uiForRow(theSlideRow);
- uiRow->SetTimelineControl(this);
-
- m_TreeLayout->AddRow(theSlideRow);
- m_TimelineLayout->AddRow(theSlideRow);
-
- // Since this would be loading the entire context's assets, fire the OnTimelineLayoutChange
- // event just once.
- SuspendLayoutChanges(true);
- try {
- theSlideRow->LoadChildren();
- theSlideRow->Expand();
- } catch (...) { // restore the 'states' before passing the exception up
- SuspendLayoutChanges(false);
- throw;
- }
- // Update breadcrumbs
- m_BreadCrumbToolbar->RefreshTrail(m_TranslationManager->GetBreadCrumbProvider());
-
- SuspendLayoutChanges(false);
- OnLayoutChanged();
-}
-
-//=============================================================================
-/**
- * Notification from the StudioFullSystem signal provider that a we have a new active slide.
- * This will populate this view with the new context.
- */
-void CTimelineControl::OnActiveSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide)
-{
- if (m_ActiveSlide == inSlide)
- return;
-
- ClearView();
- ViewSlide(inSlide);
-
- double theStoredRatio = m_TimelineLayout->GetTimelineRatio(inSlide);
- if (theStoredRatio != -1)
- m_TimelineLayout->SetTimeRatio(theStoredRatio);
- else
- m_TimelineLayout->OnScalingReset();
-
- m_TimelineLayout->RecalcLayout();
-}
-
-void CTimelineControl::OnNewPresentation()
-{
- m_TranslationManager->OnNewPresentation();
-
- // Register callback
- qt3dsdm::IStudioFullSystemSignalProvider *theSignalProvider =
- GetDoc()->GetStudioSystem()->GetFullSystemSignalProvider();
- m_Connections.push_back(theSignalProvider->ConnectActiveSlide(
- std::bind(&CTimelineControl::OnActiveSlide, this, std::placeholders::_3)));
- m_Connections.push_back(theSignalProvider->ConnectSlideDeleted(
- std::bind(&CTimelineControl::OnDeleteSlide, this, std::placeholders::_1)));
- CDispatch *theDispatch = g_StudioApp.GetCore()->GetDispatch();
- m_Connections.push_back(theDispatch->ConnectSelectionChange(
- std::bind(&CTimelineControl::OnSelectionChange, this, std::placeholders::_1)));
-}
-
-//=============================================================================
-/**
- * Notification from the dispatch that the presentation is being closed.
- * This will clear all the objects from this presentation.
- */
-void CTimelineControl::OnClosingPresentation()
-{
- ClearView();
- m_TimelineLayout->ClearAllTimeRatios();
- m_BreadCrumbToolbar->RefreshTrail(nullptr);
-
- m_Connections.clear();
-}
-
-//=============================================================================
-/**
- * Accessor for the root object being displayed in this view.
- */
-qt3dsdm::Qt3DSDMSlideHandle CTimelineControl::GetActiveSlide()
-{
- return m_ActiveSlide;
-}
-
-//=============================================================================
-/**
- * Gets the timeline layout which is the portion of the timeline to the right
- * of the splitter. The timeline layout contains the timebars.
- */
-CTimelineTimelineLayout *CTimelineControl::GetTimelineLayout()
-{
- return m_TimelineLayout;
-}
-
-//=============================================================================
-/**
- * Gets the tree layout which is the portion of the timeline to the left
- * of the splitter. The tree layout contains the tree controls for expanding
- * rows in the timeline.
- */
-CTimelineTreeLayout *CTimelineControl::GetTreeLayout()
-{
- return m_TreeLayout;
-}
-
-//=============================================================================
-/**
- * Notification from the dispatch that the presentation is going into play mode.
- */
-void CTimelineControl::OnPlayStart()
-{
-}
-
-//=============================================================================
-/**
- * Notification from the dispatch that the presentation is exiting play state.
- */
-void CTimelineControl::OnPlayStop()
-{
-}
-
-//=============================================================================
-/**
- * Notification from the dispatch that the time has changed.
- * This is used to update the playhead location and view time.
- * @param inNewTime the new time that this should display.
- */
-void CTimelineControl::OnTimeChanged(long inNewTime)
-{
- SetTime(inNewTime);
-}
-
-//==============================================================================
-// CSelectionChangeListener
-//==============================================================================
-void CTimelineControl::OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable)
-{
- // testing for nullptr selection OR if the selected is not displayed in the timeline
- bool theLoseFocus = !inNewSelectable.empty();
- if (!theLoseFocus) {
- Q3DStudio::SelectedValueTypes::Enum theSelectionType = inNewSelectable.getType();
- // for now, its just DataModel objects
- theLoseFocus = theSelectionType != Q3DStudio::SelectedValueTypes::Instance; // DataModel objects
- }
- if (theLoseFocus)
- m_TreeLayout->OnLoseFocus();
-
- GetTranslationManager()->OnSelectionChange(inNewSelectable);
-
- // The drag&drop doesn't have any sort of callback after a drop
- // so for now, this acts as a "event-trigger" after a drop ( because new items are always
- // selcted after a drop )
- HideInsertionMarkers();
-}
-
-//=============================================================================
-/**
- * Callback when individual rows has affected the layout, such that the treelayout needs to be
- * synchronized with the timelinelayout or vice versa.
- */
-void CTimelineControl::OnLayoutChanged()
-{
- if (m_SuspendRecalcLayout) // optimization where this is explicitly shutoff.
- return;
-
- m_TreeLayout->RecalcLayout();
- m_TimelineLayout->OnTimelineLayoutChanged();
-}
-
-//=============================================================================
-/**
- * typically for displaying tooltip
- */
-CRct CTimelineControl::GetBounds() const
-{
- return CRct(GetGlobalPosition(CPt(0, 0)), GetSize());
-}
-
-void CTimelineControl::HideTimelineMoveableTooltip()
-{
- HideMoveableWindow();
-}
-
-//=============================================================================
-/**
- * For snapping timebars/keyframes
- */
-ISnappingListProvider *CTimelineControl::GetSnappingListProvider() const
-{
- return m_TimelineLayout;
-}
-
-//=============================================================================
-/**
- * Sets the current time as seen in this palette.
- * This will update the Playhead time and the time view time.
- * @param inNewTime the time to set on this.
- */
-void CTimelineControl::SetTime(long inNewTime)
-{
- m_time = inNewTime;
- m_TimelineLayout->SetTime(inNewTime);
-}
-
-void CTimelineControl::HideInsertionMarkers()
-{
- bool theInvalidate = false;
- if (m_InsertionOverlay->IsVisible()) {
- m_InsertionOverlay->SetVisible(false);
- theInvalidate = true;
- }
- if (m_InsertionLine->IsVisible()) {
- m_InsertionLine->SetVisible(false);
- theInvalidate = true;
- }
- if (theInvalidate) {
- m_TreeLayout->Invalidate();
- Invalidate();
- }
-}
-
-void CTimelineControl::SetSize(CPt inSize)
-{
- CControl::SetSize(inSize);
-
- m_Splitter->SetSize(CPt(inSize.x, inSize.y));
-}
-
-//=============================================================================
-/**
- * Scrolls both sides of the timeline along the y-axis so that they stay synced.
- * @param inSource Scroller that generated the scroll messsage
- * @param inPositionY New vertical scroll bar position
- */
-void CTimelineControl::SetScrollPositionY(CScroller *inSource, long inPositionY)
-{
- m_TreeLayout->SetScrollPositionY(inSource, inPositionY);
- m_TimelineLayout->SetScrollPositionY(inSource, inPositionY);
-}
-
-//=============================================================================
-/**
- * Override OnDraw to provide Timeline only draw profiling stats.
- */
-void CTimelineControl::OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation)
-{
- QT3DS_PROFILE(OnDraw);
- CControl::OnDraw(inRenderer, inDirtyRect, inIgnoreValidation);
-}
-
-//=============================================================================
-/**
- * Fills the whole control with the base (gray) color, then other controls will
- * draw on top of that.
- * @param inRenderer renderer to draw to
- */
-void CTimelineControl::Draw(CRenderer *inRenderer)
-{
- const auto size = GetSize();
- inRenderer->FillSolidRect(QRect(0, 0, size.x, size.y), CStudioPreferences::GetBaseColor());
-}
-
-//=============================================================================
-/**
- * Overriden from CControl. We want to propagate keydown (specifically F2)
- * messages to the selected row regardless if the control has focus or not.
- */
-void CTimelineControl::OnGainFocus()
-{
- CControl::OnGainFocus();
-
- CBaseStateRow *theRow = m_TranslationManager->GetSelectedRow();
- if (theRow) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(theRow);
- uiRow->SetFocus();
- }
-}
-
-//=============================================================================
-/**
- * Overridden to draw insertion lines
- */
-CDropTarget *CTimelineControl::FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags)
-{
- CDropTarget *theDropTarget = CControl::FindDropCandidate(inMousePoint, inFlags);
-
- bool theHideInsertionMarkers = true;
- CTimeLineDropTarget *theTimelineDropTarget = nullptr;
- if (theDropTarget
- && (theTimelineDropTarget = dynamic_cast<CTimeLineDropTarget *>(theDropTarget))) {
- CControl *theInsertionOverControl = theTimelineDropTarget->GetInsertionMarkerRow();
- if (theInsertionOverControl) {
- CRct theTreeRect = GetVisibleTreeLayoutArea();
- EDROPDESTINATION theDropDest = theTimelineDropTarget->GetDestination();
- switch (theDropDest) {
- case EDROPDESTINATION_ABOVE:
- case EDROPDESTINATION_BELOW: {
- // the insertion line starts from the indent to the end of the row
- long theIndent = theTimelineDropTarget->GetInsertionMarkerIndent();
- if (theDropDest == EDROPDESTINATION_ABOVE)
- m_InsertionLine->SetPosition(theInsertionOverControl->GetGlobalPosition(
- CPt(theIndent, -GetPosition().y)));
- else
- m_InsertionLine->SetPosition(theInsertionOverControl->GetGlobalPosition(CPt(
- theIndent, theInsertionOverControl->GetSize().y - 1 - GetPosition().y)));
-
- long theWidth =
- theTreeRect.size.x + theTreeRect.position.x - m_InsertionLine->GetPosition().x;
- m_InsertionLine->SetLineWidth(theWidth);
- m_InsertionLine->SetVisible(true);
- m_InsertionOverlay->SetVisible(false);
- } break;
- case EDROPDESTINATION_ON: {
- // insertion overlay spans the width of the row
- m_InsertionOverlay->SetPosition(theInsertionOverControl->GetGlobalPosition(
- CPt(theTreeRect.position.x, -GetPosition().y)));
-
- long theWidth = theTreeRect.size.x + theTreeRect.position.x
- - m_InsertionOverlay->GetPosition().x;
- m_InsertionOverlay->SetWidth(theWidth);
- m_InsertionOverlay->SetVisible(true);
- m_InsertionLine->SetVisible(false);
- } break;
- }
- theHideInsertionMarkers = false;
- }
- }
- // not drawn
- if (theHideInsertionMarkers)
- HideInsertionMarkers();
-
- return theDropTarget;
-}
-
-void CTimelineControl::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseOut(inPoint, inFlags);
- HideInsertionMarkers();
-}
-
-void CTimelineControl::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
- HideInsertionMarkers();
-}
-
-//=============================================================================
-/**
- * Gets the insertion line for the timeline. The insertion line should be used
- * to indicate when you can drag-and-drop and item between two other items.
- * Call SetVisible on this control to show/hide it.
- * @return the insertion line control
- */
-CInsertionLine *CTimelineControl::GetInsertionLine()
-{
- return m_InsertionLine;
-}
-
-//=============================================================================
-/**
- * Gets the insertion overlay marker for the timeline. This control should be
- * used to indicate that you can drag-and-drop and object onto another item in
- * the timeline. Call SetVisible on this control to show/hide it.
- * @return the insertion overlay marker for the timeline
- */
-CInsertionOverlay *CTimelineControl::GetInsertionOverlay()
-{
- return m_InsertionOverlay;
-}
-
-//=============================================================================
-/**
- * Fetches the bounding rect for the CTimelineTreeLayout section of the
- * timeline. This is the section that contains toggles and text names of items
- * in the timeline. The actual tree layout might be bigger than this rect
- * specifies. This is because portions of the tree layout might be overlapped
- * by other controls.
- * @return rectangle describing visible area of the tree control
- */
-CRct CTimelineControl::GetVisibleTreeLayoutArea()
-{
- return m_TreeLayout->GetVisibleArea();
-}
-
-void CTimelineControl::RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler,
- QWidget *actionParent)
-{
- m_TimelineLayout->RegisterGlobalKeyboardShortcuts(inShortcutHandler, actionParent);
-}
-
-//=============================================================================
-/**
- * event that takes place just before a save or export, on lose focus will commit changes
- * in text boxes
- */
-void CTimelineControl::OnSavingPresentation(const Qt3DSFile *inNewPresentationFile)
-{
- Q_UNUSED(inNewPresentationFile);
- OnLoseFocus();
-}
-
-//=============================================================================
-/**
- * Notification from the StudioFullSystem signal provider that a slide has been deleted.
- */
-void CTimelineControl::OnDeleteSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide)
-{
- m_TimelineLayout->DeleteTimelineRatio(inSlide);
-}
-
-//==============================================================================
-/**
- * When caller knows that there are 'batch' changes to the timeline layout,
- * to prevent unnecessary calls to recalclayout
- */
-void CTimelineControl::SuspendLayoutChanges(bool inSuspend)
-{
- m_SuspendRecalcLayout = inSuspend;
-}
-
-CDoc *CTimelineControl::GetDoc()
-{
- return g_StudioApp.GetCore()->GetDoc();
-}
-
-CClientDataModelBridge *CTimelineControl::GetBridge()
-{
- return GetDoc()->GetStudioSystem()->GetClientDataModelBridge();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineControl.h b/src/Authoring/Studio/Palettes/Timeline/TimelineControl.h
deleted file mode 100644
index 0cd6719e..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineControl.h
+++ /dev/null
@@ -1,161 +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_TIMELINE_CONTROL_H
-#define INCLUDED_TIMELINE_CONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "Control.h"
-#include "DispatchListeners.h"
-#include "TimelineRow.h"
-#include "ITimelineControl.h"
-
-#include "Qt3DSDMHandles.h"
-#include "Qt3DSDMSignals.h"
-#include "SelectedValueImpl.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CDoc;
-class CDropTarget;
-class CTimelineSplitter;
-class CTimelineTreeLayout;
-class CTimelineTimelineLayout;
-class CScroller;
-class CInsertionLine;
-class CInsertionOverlay;
-class CRenderer;
-class CHotKeys;
-class CBreadCrumbControl;
-class CTimelineTranslationManager;
-class CClientDataModelBridge;
-
-//==============================================================================
-// Classes
-//==============================================================================
-
-class CTimelineControl : public CControl,
- public CPresentationChangeListener,
- public CClientPlayChangeListener,
- public ITimelineControl
-{
-public:
- CTimelineControl(const QSize &preferredSize);
- ~CTimelineControl();
-
- DEFINE_OBJECT_COUNTER(CTimelineControl)
-
- // CControl
- void OnDraw(CRenderer *inRenderer, CRct &inDirtyRect, bool inIgnoreValidation = false) override;
- void Draw(CRenderer *inRenderer) override;
- void OnGainFocus() override;
- CDropTarget *FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- CPt GetPreferredSize() override;
-
- // Presentation Change Listener
- void OnNewPresentation() override;
- void OnClosingPresentation() override;
- void OnSavingPresentation(const Qt3DSFile *inNewPresentationFile) override;
-
- // ClientPlayChangeListener
- void OnPlayStart() override;
- void OnPlayStop() override;
- void OnTimeChanged(long inNewTime) override;
-
- // CSelectionChangeListener,
- virtual void OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable);
-
- // ITimelineControl
- void OnLayoutChanged() override;
- CRct GetBounds() const override;
- void HideTimelineMoveableTooltip() override;
- ISnappingListProvider *GetSnappingListProvider() const override;
-
- void ClearView();
- void ViewSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide);
- qt3dsdm::Qt3DSDMSlideHandle GetActiveSlide();
-
- CTimelineTimelineLayout *GetTimelineLayout();
- CTimelineTreeLayout *GetTreeLayout();
-
- void SetSize(CPt inSize) override;
- long GetTime();
- void SetScrollPositionY(CScroller *inSource, long inPositionY);
-
- CInsertionLine *GetInsertionLine();
- CInsertionOverlay *GetInsertionOverlay();
- CRct GetVisibleTreeLayoutArea();
-
- void RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler, QWidget *actionParent);
-
- CTimelineTranslationManager *GetTranslationManager() const { return m_TranslationManager; }
-
-protected:
- void SuspendLayoutChanges(bool inSuspend);
- void SetTime(long inNewTime);
-
- void HideInsertionMarkers();
-
- // DataModel callbacks
- void OnActiveSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide);
- void OnDeleteSlide(qt3dsdm::Qt3DSDMSlideHandle inSlide);
-
- // Helper functions
- inline CDoc *GetDoc();
- inline CClientDataModelBridge *GetBridge();
-
- CTimelineSplitter *m_Splitter;
- CTimelineTreeLayout *m_TreeLayout;
- CTimelineTimelineLayout *m_TimelineLayout;
- qt3dsdm::Qt3DSDMSlideHandle m_ActiveSlide;
- CInsertionLine
- *m_InsertionLine; ///< Drag-and-drop insertion line for dropping between timeline items
- CInsertionOverlay
- *m_InsertionOverlay; ///< Drag-and-drop insertion marker for dropping on a timeline item
- CBreadCrumbControl *m_BreadCrumbToolbar;
- bool m_SuspendRecalcLayout;
-
- CTimelineTranslationManager *m_TranslationManager;
-
- std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>>
- m_Connections; /// connections to the DataModel
- long m_time;
- QSize m_preferredSize;
-};
-#endif // INCLUDED_TIMELINE_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.cpp
deleted file mode 100644
index fe072db6..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.cpp
+++ /dev/null
@@ -1,67 +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 "TimelineSplitter.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CTimelineSplitter::CTimelineSplitter()
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTimelineSplitter::~CTimelineSplitter()
-{
-}
-
-//=============================================================================
-/**
- * Set the location of the splitter bar. Overridden so that this location can
- * be stored in the user's preferences.
- * @param inSplitLocation the location of the splitter bar, in pixels from the right/top.
- */
-void CTimelineSplitter::SetSplitLocation(long inPixels)
-{
- CSplitter::SetSplitLocation(inPixels);
- CStudioPreferences::SetTimelineSplitterLocation(inPixels);
-} \ No newline at end of file
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.h b/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.h
deleted file mode 100644
index f9ba681a..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineSplitter.h
+++ /dev/null
@@ -1,56 +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 TIMELINE_SPLITTER_INCLUDED
-#define TIMELINE_SPLITTER_INCLUDED 1
-
-#pragma once
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "Splitter.h"
-
-//=============================================================================
-/**
- * Overridden splitter, specific to the timeline, which stores the split location
- * so that it can be retrieved between program sessions.
- */
-class CTimelineSplitter : public CSplitter
-{
-public:
- CTimelineSplitter();
- virtual ~CTimelineSplitter();
- void SetSplitLocation(long inPixels) override;
-};
-
-#endif
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.cpp
deleted file mode 100644
index 0cb32093..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.cpp
+++ /dev/null
@@ -1,719 +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 "AbstractTimelineRowUI.h"
-#include "stdafx.h"
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "TimelineTimelineLayout.h"
-#include "TimeMeasure.h"
-#include "ScalableScroller.h"
-#include "StudioUtils.h"
-#include "TimelineRow.h"
-#include "TimelineControl.h"
-#include "StateRow.h"
-#include "Snapper.h"
-#include "Bindings/TimelineTranslationManager.h"
-#include "ControlData.h"
-#include "HotKeys.h"
-#include "TimelineUIFactory.h"
-
-#include "foundation/Qt3DSLogging.h"
-#include <QtWidgets/qaction.h>
-
-//=============================================================================
-// Defines
-//=============================================================================
-// For Win the modifier key for keyframe multi selection is the control key.
-#define MODIFIER_KEY CHotKeys::MODIFIER_CONTROL
-
-//=============================================================================
-// Class constants
-//=============================================================================
-const double CTimelineTimelineLayout::SCALING_PERCENTAGE_INC = 1.1;
-const double CTimelineTimelineLayout::SCALING_PERCENTAGE_DEC = 0.9;
-const double CTimelineTimelineLayout::MAX_ZOOM_OUT = 7e-005;
-
-//=============================================================================
-/**
- * Constructor
- */
-CTimelineTimelineLayout::CTimelineTimelineLayout(CTimelineControl *inTimelineControl, IDoc *inDoc)
- : m_Playhead(this, inDoc)
- , m_IsLayoutChanged(false)
- , m_IsMouseDown(false)
-{
- m_ControlData->SetMouseWheelEnabled(true);
- m_TimelineControl = inTimelineControl;
-
- m_TimeRatio = DEFAULT_TIME_RATIO + .01;
- m_TimeMeasure = new CTimeMeasure(this, m_TimeRatio);
- m_Scroller = new CScalableScroller();
-
- m_Scroller->SetVerticalScrollMode(CScroller::ALWAYS);
- m_Scroller->SetHorizontalScrollMode(CScroller::ALWAYS);
- m_Scroller->AddScrollListener(this);
- m_BoundingRect = new CAreaBoundingRect();
- m_BoundingRect->SetName("TimelineAreaBoundingRect");
- m_BoundingRect->SetVisible(false);
- m_BoundingRect->SetAlpha(128);
-
- AddChild(m_TimeMeasure);
- AddChild(m_Scroller);
- AddChild(&m_Playhead);
- AddChild(m_BoundingRect);
-
- // Blank control filling in the bottom of the timeline, under the rows
- CBlankControl *theTimelineBlankControl = new CBlankControl();
- m_TimebarList = new CFlowLayout(theTimelineBlankControl);
-
- m_Scroller->AddChild(m_TimebarList);
- m_Scroller->SetScalingListener(this);
- m_TimebarList->SetName("TimelineTimelineLayoutList");
-
- // Initializing flags for keyframe multi select to work.
- m_CommitKeyframeSelection = false;
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTimelineTimelineLayout::~CTimelineTimelineLayout()
-{
- delete m_TimeMeasure;
- delete m_Scroller;
- delete m_TimebarList;
- delete m_BoundingRect;
-}
-
-//=============================================================================
-/**
- * Clear all the StateRows out of the top-level list.
- * This is used when the current presentation is being cleared out.
- */
-void CTimelineTimelineLayout::ClearRows()
-{
- TTimelineRowList::iterator thePos = m_Rows.begin();
- for (; thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = (*thePos);
- auto uiRow = TimelineUIFactory::instance()->uiForRow(theRow);
- m_TimebarList->RemoveChild(uiRow->GetTimebarControl());
- }
-
- m_Rows.clear();
-}
-
-//=============================================================================
-/**
- * Set the size of this control.
- * Overrrides CControl::SetSize so that this can redo the layout of all inner
- * controls.
- * @param inSize the new size of this control.
- */
-void CTimelineTimelineLayout::SetSize(CPt inSize)
-{
- CControl::SetSize(inSize);
-
- RecalcLayout();
-}
-
-//=============================================================================
-/**
- * Recalculate the positioning of all the child components.
- */
-void CTimelineTimelineLayout::RecalcLayout()
-{
- CPt mySize = GetSize();
- // Put the time measure on top taking 21 pixels high.
- m_TimeMeasure->SetSize(CPt(mySize.x, 21));
- m_TimeMeasure->SetPosition(CPt(0, 0));
-
- // Make the scroller take up the rest of the space.
- m_Scroller->SetSize(CPt(mySize.x, mySize.y - 42));
- m_Scroller->SetPosition(CPt(0, 21));
-
- // Make it the full length of the view, minus the bottom scroll bar.
- m_Playhead.SetSize(CPt(13, GetSize().y - m_Scroller->GetHorizontalBar()->GetSize().y - 21));
-
- long theMinTime = -(m_Playhead.GetCenterOffset());
-
- if (!m_Rows.empty()) {
- long theLatestTime = 0;
- TTimelineRowList::iterator thePos = m_Rows.begin();
- for (; thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = (*thePos);
- long theRowLatestTime = theRow->GetLatestEndTime();
- if (theRowLatestTime > theLatestTime)
- theLatestTime = theRowLatestTime;
- }
-
- long theMinWidth = ::TimeToPos(theLatestTime, m_TimeRatio) + END_BUFFER_SIZE;
- long theMinHeight = m_TimebarList->GetMinimumSize().y;
-
- CPt theVisSize = m_Scroller->GetVisibleSize();
-
- if (theMinHeight < theVisSize.y)
- theMinHeight = theVisSize.y;
- if (theMinWidth < theVisSize.x)
- theMinWidth = theVisSize.x;
-
- m_TimebarList->ResetMinMaxPref();
- m_TimebarList->SetAbsoluteSize(CPt(theMinWidth, theMinHeight));
- }
-
- // Set up the limits.
- m_Playhead.SetMinMaxPosition(theMinTime, mySize.x - m_Scroller->GetVerticalBar()->GetSize().x);
-
- // Set playhead to time 0.
- SetTime(m_TimelineControl->GetTranslationManager()->GetCurrentViewTime(), true);
-
- // Reset! so that this isn't unnecessarily run
- m_IsLayoutChanged = false;
-}
-
-//=============================================================================
-/**
- * Add a timeline row to this object.
- * This will add the row as a top level object.
- * @param inRow the row to be added.
- */
-void CTimelineTimelineLayout::AddRow(CTimelineRow *inRow)
-{
- CAbstractTimelineRowUI *uiRow = TimelineUIFactory::instance()->uiForRow(inRow);
- m_Rows.push_back(inRow);
-
- m_TimebarList->AddChild(uiRow->GetTimebarControl());
-
- inRow->SetTimeRatio(m_TimeRatio);
- // For keyframe/timebar snapping.
- uiRow->SetSnappingListProvider(this);
-}
-
-//=============================================================================
-/**
- * Call from the ScalableScroller that it is scaling the right side of the timebar.
- * @param inLength the length that the thumb wants to be.
- * @param inTotalLength the maximum length that the thumb can be.
- * @param inOffset the offset of the thumb position.
- */
-void CTimelineTimelineLayout::OnScalingRight(long inLength, long inTotalLength, long inOffset)
-{
- double theViewSize = m_Scroller->GetVisibleSize().x;
- double theClientSize = m_Scroller->GetContaineeSize().x;
- double theLength = inLength;
- double theTotalLength = inTotalLength;
-
- double theTimeRatio =
- (theViewSize * theTotalLength) / (theClientSize * theLength) * m_TimeRatio;
-
- // This means the bar was dragged to the far end, just prevent it for getting wacky.
- if (theTimeRatio > 0) {
- // This will set the time ratio, but will cap it at 1 or MAX_ZOOM_OUT so if the Time ratio
- // less than max, don't need to move the timeline
- SetTimeRatio(theTimeRatio);
- if (theTimeRatio < 1) {
- double theMaxVisPos = m_Scroller->GetMaxVisiblePosition().x;
- long theVisiblePosition = ::dtol(theMaxVisPos * inOffset / (inTotalLength - inLength));
- m_Scroller->SetVisiblePosition(
- CPt(theVisiblePosition, m_Scroller->GetVisiblePosition().y));
- }
- }
-}
-
-//=============================================================================
-/**
- * Under construction.
- */
-void CTimelineTimelineLayout::OnScalingLeft(long inLength, long inTotalLength, long inOffset)
-{
- // Hey- look at that, doesn't matter which side you're scaling.
- // Hey, nice comment especially the function header
- OnScalingRight(inLength, inTotalLength, inOffset);
-}
-
-void CTimelineTimelineLayout::OnScalingReset()
-{
- SetTimeRatio(DEFAULT_TIME_RATIO);
-}
-
-//=============================================================================
-/**
- * Set the TimeRatio to be used.
- * This will propagate the time ratio down to all the child items.
- * @param inTimeRatio the time ratio to be set.
- */
-void CTimelineTimelineLayout::SetTimeRatio(double inTimeRatio)
-{
- if (inTimeRatio != m_TimeRatio) {
- if (inTimeRatio > 1)
- inTimeRatio = 1;
- // if ( inTimeRatio < MAX_ZOOM_OUT )
- // inTimeRatio = MAX_ZOOM_OUT;
-
- m_TimeRatio = inTimeRatio;
- m_TimeMeasure->SetTimeRatio(inTimeRatio);
-
- TTimelineRowList::iterator thePos = m_Rows.begin();
- for (; thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = (*thePos);
- theRow->SetTimeRatio(inTimeRatio);
- }
-
- RecalcLayout();
-
- // store the timeline ratio
- SetTimelineRatio(m_TimelineControl->GetActiveSlide(), m_TimeRatio);
- qCInfo(qt3ds::TRACE_INFO) << "Set time ratio: " << inTimeRatio;
- }
-}
-
-//==============================================================================
-/**
- * When timeline layout has changed. RecalcLayout should be called to adjust the scrollbars if
- * a asset is expanded/collapsed in the timeline.
- */
-void CTimelineTimelineLayout::OnTimelineLayoutChanged()
-{
- RecalcLayout();
-
- // In addition, this has to be 'marked' for if SetScrollerPositionY is called due to
- // new assets being added, RecalcLayout has to be called again.
- m_IsLayoutChanged = true;
-}
-
-/**
- * Deletes the time zoom ratio for a particular slide.
- * @param inContext the time context of that slide to delete
- */
-void CTimelineTimelineLayout::DeleteTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide)
-{
- m_TimelineRatio.erase(inSlide);
-}
-
-/**
- * Clear all entries
- */
-void CTimelineTimelineLayout::ClearAllTimeRatios()
-{
- m_TimelineRatio.clear();
-}
-
-/**
- * Retrieves the time zoom ratio for a particular slide
- * @param inContext the time context of that slide to retrieve zoom ratio
- * @return the zoom ratio, or -1 if it's not found
- */
-double CTimelineTimelineLayout::GetTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide)
-{
- TSlideRatioMap::iterator theResult = m_TimelineRatio.find(inSlide);
- if (theResult != m_TimelineRatio.end())
- return theResult->second;
- else
- return -1;
-}
-
-/**
- * Sets the time zoom ratio for a particular slide
- * @param inContext the time context of that slide
- * @param inRatio the zoom factor
- */
-void CTimelineTimelineLayout::SetTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide, double inRatio)
-{
- m_TimelineRatio[inSlide] = inRatio;
-}
-
-//=============================================================================
-/**
- * For testing purposes.
- */
-long CTimelineTimelineLayout::GetMaximumTimebarTime()
-{
- return 30000;
-}
-
-//=============================================================================
-/**
- * Call from the TimelineView to notifiy this that some of its objects got filtered.
- * This was used for redoing the layout but is no longer necessary.
- */
-void CTimelineTimelineLayout::Filter()
-{
-}
-
-//=============================================================================
-/**
- * Notification from the CScroller that it is scrolling.
- * This will update the other views with the verticall scrolling and update
- * the TimeMeasure with the horizontal scroll amount.
- * @param inScrollAmount the amount that was scrolled by.
- */
-void CTimelineTimelineLayout::OnScroll(CScroller *inSource, CPt inScrollAmount)
-{
- Q_UNUSED(inSource);
-
- m_TimelineControl->SetScrollPositionY(m_Scroller, m_Scroller->GetVisiblePosition().y);
-
- long theTimeOffset = GetViewTimeOffset();
- m_TimeMeasure->SetTimeOffset(theTimeOffset);
-
- long thePlayheadPos =
- ::TimeToPos(m_TimelineControl->GetTranslationManager()->GetCurrentViewTime()
- - theTimeOffset,
- m_TimeRatio)
- - m_Playhead.GetCenterOffset();
-
- m_Playhead.SetPosition(CPt(thePlayheadPos, 0));
-
- m_DragBeginPoint += inScrollAmount;
-}
-
-void CTimelineTimelineLayout::SetScrollPositionY(CScroller *inSource, long inPositionY,
- bool inAbsolute)
-{
- Q_UNUSED(inSource);
-
- CPt theVisPos = m_Scroller->GetVisiblePosition();
-
- if (!inAbsolute) {
- CPt theMaxSize = m_Scroller->GetMaxVisiblePosition();
-
- CRct theVisibleRect(CPt(theVisPos.x, theMaxSize.y - theVisPos.y),
- m_Scroller->GetVisibleSize());
- CPt thePoint(theVisPos.x, inPositionY);
- if (!theVisibleRect.IsInRect(thePoint))
- m_Scroller->SetVisiblePosition(CPt(theVisPos.x, inPositionY));
- } else {
- // For new assets added, RecalcLayout needs be called here if there was a layout changed
- // because
- // m_TimebarList->GetMinimumSize( ).y is only updated at this point, otherwise the tree and
- // layout will
- // go out of sync.
- if (m_IsLayoutChanged)
- RecalcLayout();
-
- m_Scroller->SetVisiblePosition(CPt(theVisPos.x, inPositionY));
- }
-}
-
-//=============================================================================
-/**
- * Get the scroller control this is using.
- * Meant for testing purposes.
- * @return the scroller this is using.
- */
-CScalableScroller *CTimelineTimelineLayout::GetScroller()
-{
- return m_Scroller;
-}
-
-//=============================================================================
-/**
- * Get the playhead control this is using.
- * Meant for testing purposes.
- * @return the playhead this is using.
- */
-CPlayhead *CTimelineTimelineLayout::GetPlayhead()
-{
- return &m_Playhead;
-}
-
-//=============================================================================
-/**
- * Scroll the contents of the timeline horizontally.
- * This is used mainly by the playhead to scroll the view when it gets to the
- * edge.
- * @param inAmount the amount to scroll the view by.
- * @return the amount actually scrolled, limited by min/max values.
- */
-long CTimelineTimelineLayout::ScrollLayout(long inAmount)
-{
- // Log the current position for returning
- CPt thePosition = m_Scroller->GetVisiblePosition();
-
- m_Scroller->SetVisiblePosition(CPt(thePosition.x + inAmount, thePosition.y));
-
- // Return how much was actually scrolled, let the scroller handle min/max scroll amounts.
- return m_Scroller->GetVisiblePosition().x - thePosition.x;
-}
-
-//=============================================================================
-/**
- * Recalculate what the time is based on the location of the playhead.
- * This will call SetTime on the TimelineView with the new time.
- * @param inUpdateClient true if the client time should be updated.
- */
-void CTimelineTimelineLayout::RecalcTime(bool inUpdateClient, long inFlags)
-{
- long theOffset = m_Playhead.GetPosition().x + m_Playhead.GetCenterOffset()
- + m_Scroller->GetVisiblePosition().x;
-
- long theTime = ::PosToTime(theOffset, m_TimeRatio);
- m_Snapper.InterpretTimeEx(theTime, inFlags);
-
- // Update the time
- m_Playhead.UpdateTime(theTime, inUpdateClient);
-}
-
-//=============================================================================
-/**
- * Call from the timeline view that the time is changing.
- * @param inNewTime the new time.
- * @param inIsSecondary flag to prevent infinite recursion.
- */
-void CTimelineTimelineLayout::SetTime(long inNewTime, bool inIsSecondary)
-{
- long theOffset = ::TimeToPos(inNewTime, m_TimeRatio);
- theOffset -= m_Scroller->GetVisiblePosition().x + m_Playhead.GetCenterOffset();
-
- long theViewSize = m_Scroller->GetVisibleSize().x;
-
- if (!inIsSecondary) {
- if (theOffset < -m_Playhead.GetCenterOffset()) {
- long thePos = ::TimeToPos(inNewTime, m_TimeRatio) - m_Playhead.GetCenterOffset();
- m_Scroller->SetVisiblePosition(CPt(thePos, m_Scroller->GetVisiblePosition().y));
- } else if (theOffset > (theViewSize - (m_Playhead.GetCenterOffset() + 20))) {
- long thePos = ::TimeToPos(inNewTime, m_TimeRatio) + 20;
- thePos -= theViewSize;
- m_Scroller->SetVisiblePosition(CPt(thePos, m_Scroller->GetVisiblePosition().y));
- }
- SetTime(inNewTime, true);
- } else {
- m_Playhead.SetPosition(CPt(theOffset, m_Playhead.GetPosition().y));
- }
-}
-
-//=============================================================================
-/**
- * Notification that the TimeMeasure was clicked on.
- * This is used to reposition the playhead wherever the mouse was clicked.
- * @param inPoint the location of the mouse local to the time measure.
- */
-void CTimelineTimelineLayout::OnTimeMeasureMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- Q_UNUSED(inFlags);
-
- m_Snapper.Clear();
- m_Snapper.SetSource(&m_Playhead);
- PopulateSnappingList(&m_Snapper);
- m_Snapper.SetSnappingKeyframes(true);
-
- m_Playhead.SetPosition(
- CPt(inPoint.x - m_Playhead.GetCenterOffset(), m_Playhead.GetPosition().y));
- RecalcTime(true, inFlags);
-}
-
-//=============================================================================
-/**
- * Handles left-clicks. Starts a drag operation if a child does not handle the
- * message.
- * @param inPoint location of the mouse when event occurred
- * @param inFlags state of modifier keys when event occurred
- */
-bool CTimelineTimelineLayout::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- if (!CControl::OnMouseDown(inPoint, inFlags)) {
- m_BoundingRect->SetSize(CPt(0, 0));
- m_BoundingRect->SetVisible(true);
-
- // Do not deselect all keyframes as the user intends to select more keyframes,
- // when the modifier key is pressed.
- if (!(inFlags & MODIFIER_KEY))
- m_TimelineControl->GetTranslationManager()->ClearKeyframeSelection();
-
- m_IsMouseDown = true;
- m_DragBeginPoint = inPoint;
- }
- return true;
-}
-
-void CTimelineTimelineLayout::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseMove(inPoint, inFlags);
-
- if (m_IsMouseDown) {
- CPt theSize;
- CRct theRect;
-
- // Tests if the user has pressed the modifier key, while moving the mouse.
- bool theModifierKeyDown;
- if (inFlags & MODIFIER_KEY)
- theModifierKeyDown = true;
- else
- theModifierKeyDown = false;
-
- // Calculate the rect for the bounding box
- theSize = CPt(inPoint.x - m_DragBeginPoint.x, inPoint.y - m_DragBeginPoint.y);
- theRect = CRct(m_DragBeginPoint, theSize);
- theRect.Normalize();
- m_BoundingRect->SetPosition(theRect.position);
- m_BoundingRect->SetSize(theRect.size);
- theRect.Offset(-m_Scroller->GetPosition());
- theRect.Offset(m_Scroller->GetVisiblePosition());
-
- // Select all keys inside the rect
-
- TTimelineRowList::iterator thePos = m_Rows.begin();
-
- for (; thePos != m_Rows.end(); ++thePos) {
- CStateRow *theRow = reinterpret_cast<CStateRow *>(*thePos);
- auto rowUi = TimelineUIFactory::instance()->uiForRow(theRow);
- rowUi->SelectKeysInRect(theRect, theModifierKeyDown, m_CommitKeyframeSelection);
- }
- m_CommitKeyframeSelection = false;
- }
-}
-
-void CTimelineTimelineLayout::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- // try to prevent stuck mousetips on exceptions
- try {
- CControl::OnMouseUp(inPoint, inFlags);
- m_BoundingRect->SetVisible(false);
- } catch (...) {
- }
-
- m_IsMouseDown = false;
-
- // Commits the key frame selection. This finalises the keyframes selection
- // in the rect. When the mouse is down again, we would be able to append
- // the commited keyframes with the new batch of keyframes.
- m_CommitKeyframeSelection = true;
-}
-
-void CTimelineTimelineLayout::PopulateSnappingList(CSnapper *inSnappingList)
-{
- CRct theArea(m_Scroller->GetVisibleSize());
- theArea.Offset(-m_Scroller->GetPosition());
- theArea.Offset(m_Scroller->GetVisiblePosition());
-
- inSnappingList->SetVisibleArea(theArea.position.y, theArea.size.y);
-
- inSnappingList->SetTimeRatio(m_TimeRatio);
- if (inSnappingList->GetSource() != &m_Playhead)
- inSnappingList->AddTime(m_Playhead.GetCurrentTime());
-
- m_TimeMeasure->PopulateSnappingList(inSnappingList);
-
- TTimelineRowList::iterator theRowIter = m_Rows.begin();
- for (; theRowIter != m_Rows.end(); ++theRowIter) {
- auto uiRow = TimelineUIFactory::instance()->uiForRow(*theRowIter);
- uiRow->PopulateSnappingList(inSnappingList);
- }
-}
-
-long CTimelineTimelineLayout::GetViewTimeOffset()
-{
- return ::dtol(m_Scroller->GetVisiblePosition().x / m_TimeRatio);
-}
-
-CTimeMeasure *CTimelineTimelineLayout::GetTimeMeasure()
-{
- return m_TimeMeasure;
-}
-
-//=============================================================================
-/**
- * Register all the events for hotkeys that are active for the entire application.
- * Hotkeys for the entire application are ones that are not view specific in
- * scope.
- * @param inShortcutHandler the global shortcut handler.
- */
-void CTimelineTimelineLayout::RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler,
- QWidget *actionParent)
-{
- Q_UNUSED(inShortcutHandler)
-
-#ifdef KDAB_TEMPORARILY_REMOVED
- ADD_GLOBAL_SHORTCUT(actionParent,
- QKeySequence(Qt::Key_Plus),
- CTimelineTimelineLayout::OnScalingZoomIn);
- ADD_GLOBAL_SHORTCUT(actionParent,
- QKeySequence(Qt::Key_Minus),
- CTimelineTimelineLayout::OnScalingZoomOut);
-#endif
-}
-
-//=============================================================================
-/**
- * Call from the Hotkey that it is zooming in the timebar.
- */
-
-void CTimelineTimelineLayout::OnScalingZoomIn()
-{
- double theTimeRatio = m_TimeRatio * SCALING_PERCENTAGE_INC;
-
- SetTimeRatio(theTimeRatio);
- CenterToPlayhead();
-}
-
-//=============================================================================
-/**
- * Call from the Hotkey that it is zooming out of the timebar.
- */
-
-void CTimelineTimelineLayout::OnScalingZoomOut()
-{
- double theTimeRatio = m_TimeRatio * SCALING_PERCENTAGE_DEC;
-
- SetTimeRatio(theTimeRatio);
- CenterToPlayhead();
-}
-
-void CTimelineTimelineLayout::CenterToPlayhead()
-{
- long theTime = m_Playhead.GetCurrentTime();
- long thePos = ::TimeToPos(theTime, m_TimeRatio);
- long theNewPosX = thePos - (m_Scroller->GetSize().x / 2);
-
- m_Scroller->SetVisiblePosition(CPt(theNewPosX, m_Scroller->GetVisiblePosition().y));
-}
-
-//==============================================================================
-/**
- * Handle mouse wheel messages to allow zooming
- */
-bool CTimelineTimelineLayout::OnMouseWheel(CPt inPoint, long inAmount, Qt::KeyboardModifiers inFlags)
-{
- bool theRetVal = false;
- if (inFlags & CHotKeys::MODIFIER_CONTROL) {
- if (inAmount > 0)
- OnScalingZoomIn();
- else
- OnScalingZoomOut();
- theRetVal = true;
- } else
- theRetVal = CControl::OnMouseWheel(inPoint, inAmount, inFlags);
- return theRetVal;
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.h b/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.h
deleted file mode 100644
index afc7ef02..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineTimelineLayout.h
+++ /dev/null
@@ -1,157 +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_TIMELINE_TIMELINE_LAYOUT_H
-#define INCLUDED_TIMELINE_TIMELINE_LAYOUT_H 1
-
-#pragma once
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "Control.h"
-#include <vector>
-#include "ScalableScrollerBar.h"
-#include "Scroller.h"
-#include "Pt.h"
-#include "Snapper.h"
-#include "AreaBoundingRect.h"
-#include "Playhead.h"
-#include "Qt3DSDMHandles.h"
-
-#include "TimelineRow.h"
-
-//=============================================================================
-// Forwards
-//=============================================================================
-class CScalableScroller;
-class CFlowLayout;
-class CTimelineControl;
-class CSnapper;
-class IDoc;
-class CHotKeys;
-class CTimeMeasure;
-class CPlayhead;
-
-//=============================================================================
-/**
- * Right-hand pane of the Timeline containing timebars, keyframes, etc.
- */
-class CTimelineTimelineLayout : public QObject,
- public CControl,
- public CScalingListener,
- public CScrollListener,
- public ISnappingListProvider
-{
- Q_OBJECT
-
- typedef std::vector<CTimelineRow *> TTimelineRowList;
- typedef std::map<qt3dsdm::Qt3DSDMSlideHandle, double> TSlideRatioMap;
-
-public:
- static const long END_BUFFER_SIZE = 20;
- static const double SCALING_PERCENTAGE_INC;
- static const double SCALING_PERCENTAGE_DEC;
- static const double MAX_ZOOM_OUT;
-
- CTimelineTimelineLayout(CTimelineControl *inView, IDoc *inDoc);
- virtual ~CTimelineTimelineLayout();
-
- void SetSize(CPt inSize) override;
-
- void AddRow(CTimelineRow *inRow);
-
- void OnScalingRight(long inLength, long inTotalLength, long inOffset) override;
- void OnScalingLeft(long inLength, long inTotalLength, long inOffset) override;
- void OnScalingReset() override;
-
- long ScrollLayout(long inAmount);
-
- void Filter();
-
- void OnScroll(CScroller *inScroller, CPt inScrollAmount) override;
- void SetScrollPositionY(CScroller *inSource, long inPositionY, bool inAbsolute = true);
-
- void ClearRows();
-
- 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 inAmount, Qt::KeyboardModifiers inFlags) override;
-
- CScalableScroller *GetScroller();
- CPlayhead *GetPlayhead();
- CTimeMeasure *GetTimeMeasure();
- void RecalcTime(bool inUpdateClient, long inFlags);
- void SetTime(long inTime, bool inIsSecondary = false);
- void OnTimeMeasureMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags);
- long GetViewTimeOffset();
- void RecalcLayout();
- void RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler, QWidget *actionParent);
- void SetTimeRatio(double inTimeRatio);
- void OnTimelineLayoutChanged();
-
- void DeleteTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide);
- void ClearAllTimeRatios();
- double GetTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide);
-
- // ISnappingListProvider
- void PopulateSnappingList(CSnapper *inSnappingList) override;
-
-protected:
- void SetTimelineRatio(qt3dsdm::Qt3DSDMSlideHandle inSlide, double inRatio);
-
- long GetMaximumTimebarTime();
- void OnScalingZoomIn();
- void OnScalingZoomOut();
- void CenterToPlayhead();
-
- bool m_CommitKeyframeSelection; ///< flag for saving previous keyframe selection when the mouse
- ///is released.
- CTimelineControl *m_TimelineControl;
- CTimeMeasure *m_TimeMeasure;
- CScalableScroller *m_Scroller;
- CFlowLayout *m_TimebarList;
- double m_TimeRatio = DEFAULT_TIME_RATIO;
-
- TTimelineRowList m_Rows;
- CPlayhead m_Playhead;
- CSnapper m_Snapper;
- bool m_IsLayoutChanged; ///< flag to keep track of a need for a delayed RecalcLayout
-
- bool m_IsMouseDown;
- CPt m_DragBeginPoint;
- CAreaBoundingRect *m_BoundingRect;
-
- TSlideRatioMap m_TimelineRatio; ///< stores the time zooming ratios for each slide
-};
-#endif // INCLUDED_TIMELINE_TIMELINE_LAYOUT_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.cpp
deleted file mode 100644
index a9a7dda4..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.cpp
+++ /dev/null
@@ -1,338 +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 "TimelineTreeLayout.h"
-#include "FlowLayout.h"
-#include "Scroller.h"
-#include "StateRow.h"
-#include "FilterToolbar.h"
-#include "ToggleToolbar.h"
-#include "StudioPreferences.h"
-#include "TimelineControl.h"
-#include "Renderer.h"
-#include "ToggleBlankControl.h"
-#include "ColorBlankControl.h"
-#include "TreeBlankControl.h"
-#include "AbstractTimelineRowUI.h"
-#include "TimelineUIFactory.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CTimelineTreeLayout::CTimelineTreeLayout(CTimelineControl *inTimelineControl, IDoc *inDoc)
- : m_IsScrolling(false)
-{
- m_TimelineControl = inTimelineControl;
-
- m_ColorScroller = new CScroller();
- m_ColorScroller->SetHorizontalScrollMode(CScroller::NEVER);
- m_ColorScroller->SetVerticalScrollMode(CScroller::NEVER);
- m_ColorScroller->AddScrollListener(this);
-
- m_ColorBlankControl = new CColorBlankControl();
- m_ColorList = new CFlowLayout(m_ColorBlankControl);
- m_ColorScroller->AddChild(m_ColorList);
-
- m_ToggleScroller = new CScroller();
- m_ToggleScroller->SetHorizontalScrollMode(CScroller::NEVER);
- m_ToggleScroller->SetVerticalScrollMode(CScroller::NEVER);
-
- m_ToggleBlankControl = new CToggleBlankControl();
- m_ToggleList = new CFlowLayout(m_ToggleBlankControl);
- m_ToggleScroller->AddChild(m_ToggleList);
- m_ToggleScroller->AddScrollListener(this);
-
- m_TreeScroller = new CScroller();
- m_TreeScroller->SetVerticalScrollMode(CScroller::NEVER);
- m_TreeScroller->SetHorizontalScrollMode(CScroller::ALWAYS);
- m_TreeScroller->AddScrollListener(this);
-
- m_TreeBlankControl = new CTreeBlankControl();
- m_TreeList = new CFlowLayout(m_TreeBlankControl);
- m_TreeScroller->AddChild(m_TreeList);
-
- m_FilterToolbar = new CFilterToolbar(this);
- m_ToggleToolbar = new CToggleToolbar(this);
-
- AddChild(m_TreeScroller);
- AddChild(m_ToggleScroller);
- AddChild(m_ToggleToolbar);
- AddChild(m_ColorScroller);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTimelineTreeLayout::~CTimelineTreeLayout()
-{
- m_ColorScroller->RemoveChild(m_ColorList);
- m_ToggleScroller->RemoveChild(m_ToggleList);
- m_TreeScroller->RemoveChild(m_TreeList);
-
- RemoveChild(m_TreeScroller);
- RemoveChild(m_ToggleScroller);
- RemoveChild(m_FilterToolbar);
- RemoveChild(m_ToggleToolbar);
- RemoveChild(m_ColorScroller);
- // RemoveChild( m_BreadCrumbToolbar );
-
- delete m_FilterToolbar;
- delete m_ToggleToolbar;
- delete m_ColorScroller;
- delete m_ColorList;
- delete m_ToggleScroller;
- delete m_ToggleList;
- delete m_TreeList;
- delete m_TreeScroller;
- // delete m_BreadCrumbToolbar;
-
- // Delete all the rows, this control is responsible for the rows, maybe it should not
- // be but currently it is.
- TTimelineRowList::iterator thePos = m_Rows.begin();
- for (; thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = (*thePos);
- theRow->Dispose(); // Dispose will delete the row as well
- }
-}
-
-//=============================================================================
-/**
- * Clear out all the contents of this tree layout.
- * This will also delete all the rows, so make sure it is called after the
- * TimelineTimelineLayout::ClearRows is called.
- */
-void CTimelineTreeLayout::ClearRows()
-{
- TTimelineRowList::iterator thePos = m_Rows.begin();
- for (; thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = (*thePos);
- auto uiRow = TimelineUIFactory::instance()->uiForRow(theRow);
-
- m_ColorList->RemoveChild(uiRow->GetColorControl());
- m_TreeList->RemoveChild(uiRow->GetTreeControl());
- m_ToggleList->RemoveChild(uiRow->GetToggleControl());
-
- theRow->Dispose();
- }
-
- m_Rows.clear();
-}
-
-//=============================================================================
-/**
- * Set the filter back to it's default state.
- */
-void CTimelineTreeLayout::ResetFilter()
-{
- m_FilterToolbar->FilterBehaviors(false);
- m_FilterToolbar->FilterProperties(false);
- m_FilterToolbar->FilterMaterials(false);
- m_FilterToolbar->FilterShy(false);
-}
-
-//=============================================================================
-/**
- * Set the size of this control.
- * Overrides CControl::SetSize so that RecalcLayout can be called.
- */
-void CTimelineTreeLayout::SetSize(CPt inSize)
-{
- if (inSize != GetSize()) {
- CControl::SetSize(inSize);
-
- RecalcLayout();
- }
-}
-
-//=============================================================================
-/**
- * Recalculate the layout of all the child components.
- * Called when this changes size and all the children need to be repositioned.
- */
-void CTimelineTreeLayout::RecalcLayout()
-{
- CPt mySize = GetSize();
- long theHeaderHeight = CStudioPreferences::GetHeaderHeight();
-
- m_FilterToolbar->SetSize(CPt(120, theHeaderHeight));
- m_FilterToolbar->SetPosition(0, 0);
-
- m_ToggleToolbar->SetSize(CPt(61, theHeaderHeight));
- m_ToggleToolbar->SetPosition(mySize.x - m_ToggleToolbar->GetSize().x, 0);
-
- m_ColorScroller->SetSize(CPt(CStudioPreferences::GetRowSize(), mySize.y - theHeaderHeight
- - m_TreeScroller->GetHorizontalBar()->GetMinimumSize().y
- - theHeaderHeight));
- m_ColorScroller->SetPosition(0, theHeaderHeight);
-
- m_ToggleScroller->SetSize(CPt(m_ToggleToolbar->GetSize().x, mySize.y - theHeaderHeight
- - m_TreeScroller->GetHorizontalBar()->GetMinimumSize().y
- - theHeaderHeight));
- m_ToggleScroller->SetPosition(mySize.x - m_ToggleScroller->GetSize().x, theHeaderHeight);
-
- m_TreeScroller->SetSize(
- CPt(mySize.x, mySize.y - m_FilterToolbar->GetSize().y - theHeaderHeight));
- m_TreeScroller->SetPosition(0, theHeaderHeight);
-
- m_TreeScroller->SetAdditionalClippingRect(
- CRct(m_ColorScroller->GetSize().x, 0,
- m_ToggleScroller->GetPosition().x - m_ColorScroller->GetSize().x,
- m_TreeScroller->GetSize().y));
-}
-
-//=============================================================================
-/**
- * Add another top level item to the left side of the timeline.
- * If there is already a top level item then this one will be appended to the
- * list.
- * @param inRow the row to be added.
- */
-void CTimelineTreeLayout::AddRow(CTimelineRow *inRow)
-{
- CAbstractTimelineRowUI *uiRow = TimelineUIFactory::instance()->uiForRow(inRow);
- m_ColorList->AddChild(uiRow->GetColorControl());
- m_TreeList->AddChild(uiRow->GetTreeControl());
- m_ToggleList->AddChild(uiRow->GetToggleControl());
-
- m_Rows.push_back(inRow);
-
- uiRow->SetIndent(20);
-
- inRow->Filter(m_Filter);
-}
-
-//=============================================================================
-/**
- * Applies the current filter settings to the timeline. Although the filter
- * preferences can be set independently, they are not actually applied until
- * this function is called.
- */
-void CTimelineTreeLayout::Filter()
-{
- for (TTimelineRowList::iterator thePos = m_Rows.begin(); thePos != m_Rows.end(); ++thePos) {
- CTimelineRow *theRow = *thePos;
- theRow->Filter(m_Filter);
- }
-
- // TODO: sk - it is unclear to me what this is trying to do.. I am leavint this here till it
- // becomes obvious it is totally redundant OR someone finds a related bug
- /*
- // Call OnSelect( ) on the selected object (if there is one) to get the timeline to scroll down.
- CAsset* theSelectedObject = dynamic_cast<CAsset*>( m_Doc->GetSelectedObject( ) );
- if ( theSelectedObject )
- theSelectedObject->OnSelect( );
-
- m_TimelineControl->GetTimelineLayout( )->RecalcLayout( );
- */
-}
-
-void CTimelineTreeLayout::OnScroll(CScroller *inSource, CPt inScrollAmount)
-{
- Q_UNUSED(inScrollAmount);
-
- // SetScrollPositionY triggers another onScroll event and potentially causes the position
- // to be set incorrectly.
- if (!m_IsScrolling) {
- m_IsScrolling = true;
- m_TreeBlankControl->SetVisiblePositionX(inSource->GetVisiblePosition().x);
- m_TimelineControl->SetScrollPositionY(inSource, inSource->GetVisiblePosition().y);
- m_IsScrolling = false;
- }
-}
-
-//=============================================================================
-/**
- * Set the vertical position of all the scrollers in this view.
- * This is used to sync up the positions with the timebar scroller view.
- * @param inScrollPositionY the position of the scroller.
- */
-void CTimelineTreeLayout::SetScrollPositionY(CScroller *inSource, long inScrollPositionY,
- bool inAbsolute)
-{
- Q_UNUSED(inSource);
-
- if (!inAbsolute) {
- CRct theVisibleRect(m_ColorScroller->GetVisiblePosition(),
- m_ColorScroller->GetVisibleSize());
- CPt thePoint(m_ColorScroller->GetVisiblePosition().x, inScrollPositionY);
- if (!theVisibleRect.IsInRect(thePoint)) {
- m_ColorScroller->SetVisiblePosition(
- CPt(m_ColorScroller->GetVisiblePosition().x, inScrollPositionY));
- m_TreeScroller->SetVisiblePosition(
- CPt(m_TreeScroller->GetVisiblePosition().x, inScrollPositionY));
- m_ToggleScroller->SetVisiblePosition(
- CPt(m_ToggleScroller->GetVisiblePosition().x, inScrollPositionY));
- }
- } else {
- m_ColorScroller->SetVisiblePosition(
- CPt(m_ColorScroller->GetVisiblePosition().x, inScrollPositionY));
- m_TreeScroller->SetVisiblePosition(
- CPt(m_TreeScroller->GetVisiblePosition().x, inScrollPositionY));
- m_ToggleScroller->SetVisiblePosition(
- CPt(m_ToggleScroller->GetVisiblePosition().x, inScrollPositionY));
- }
-}
-
-//=============================================================================
-/**
- * This is overridden so the Gesture can Notify Drop Listeners that its time to Drop.
- * If the gesture is dragging something then wee will drop.
- */
-void CTimelineTreeLayout::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags)
-{
- CControl::OnMouseUp(inPoint, inFlags);
-}
-
-//=============================================================================
-/**
- * @return rectangle describing the visible area of the tree control
- */
-CRct CTimelineTreeLayout::GetVisibleArea()
-{
- CPt theUpperLeftCorner;
- CPt theSize;
-
- theUpperLeftCorner.x = m_ColorScroller->GetSize().x;
- theUpperLeftCorner.y = CStudioPreferences::GetHeaderHeight();
- theSize.x = m_ToggleScroller->GetPosition().x - theUpperLeftCorner.x;
- theSize.y = ::abs(m_ToggleScroller->GetPosition().y - m_ToggleScroller->GetSize().y)
- - theUpperLeftCorner.y;
-
- return CRct(theUpperLeftCorner, theSize);
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.h b/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.h
deleted file mode 100644
index d426dc7b..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeLayout.h
+++ /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
-//=============================================================================
-#ifndef INCLUDED_TIMELINE_TREE_LAYOUT_H
-#define INCLUDED_TIMELINE_TREE_LAYOUT_H 1
-
-#pragma once
-
-//=============================================================================
-// Includes
-//=============================================================================
-#include "Control.h"
-#include "TimelineFilter.h"
-#include "Scroller.h"
-#include <vector>
-
-//=============================================================================
-// Forwards
-//=============================================================================
-class CFlowLayout;
-class CScroller;
-class CFilterToolbar;
-class CTimelineRow;
-class CToggleToolbar;
-class CTimelineControl;
-class IDoc;
-class CRenderer;
-class CToggleBlankControl;
-class CColorBlankControl;
-class CTreeBlankControl;
-
-//=============================================================================
-/**
- * Class for tree control on the timeline palette.
- */
-class CTimelineTreeLayout : public CControl, public CScrollListener
-{
- typedef std::vector<CTimelineRow *> TTimelineRowList;
-
-public:
- CTimelineTreeLayout(CTimelineControl *inTimelineControl, IDoc *inDoc);
- virtual ~CTimelineTreeLayout();
-
- // CControl
- void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void SetSize(CPt inSize) override;
-
- virtual void AddRow(CTimelineRow *inRow);
-
- /// Returns a filter object so that filter preferences can be set. You must call Filter() in
- /// order to apply the filters once you make your changes.
- CFilter *GetFilter() { return &m_Filter; }
- void Filter();
-
- void OnScroll(CScroller *inScroller, CPt inScrollAmount) override;
- void SetScrollPositionY(CScroller *inSource, long inPositionY, bool inAbsolute = true);
-
- void ClearRows();
-
- void ResetFilter();
- CRct GetVisibleArea();
- void RecalcLayout();
-
-protected:
- CFilter m_Filter;
- CFilterToolbar
- *m_FilterToolbar; ///< Control at the top of the timeline containing filter buttons.
- CToggleToolbar
- *m_ToggleToolbar; ///< Control at the top containing a header for the toggle column.
-
- CScroller *m_ColorScroller;
- CFlowLayout *m_ColorList;
- CColorBlankControl *m_ColorBlankControl;
-
- CScroller *m_ToggleScroller;
- CFlowLayout *m_ToggleList;
- CToggleBlankControl *m_ToggleBlankControl;
-
- CScroller *m_TreeScroller;
- CFlowLayout *m_TreeList;
- CTreeBlankControl *m_TreeBlankControl;
-
- TTimelineRowList m_Rows;
- CTimelineControl *m_TimelineControl; ///< Parent control of this control
-
- bool
- m_IsScrolling; ///< Flag to not process onScroll that was triggered from a previous onScroll
-};
-#endif // INCLUDED_TIMELINE_TREE_LAYOUT_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp
index e4ab15f5..32d3958e 100644
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp
@@ -31,9 +31,6 @@
#include "StateRow.h"
#include "SlideRow.h"
#include "PropertyRow.h"
-#include "SlideRowUI.h"
-#include "StateRowUI.h"
-#include "PropertyRowUI.h"
#include "Bindings/ITimelineItemProperty.h"
@@ -60,9 +57,7 @@ CPropertyRow *TimelineUIFactory::createPropertyRow(CBaseStateRow *parentRow,
ITimelineItemProperty *inTimelineItemPropertyBinding)
{
auto propertyRow = new CPropertyRow(inTimelineItemPropertyBinding, parentRow);
- createRowUI(propertyRow, parentRow);
- parentRow->AddPropertyRow(propertyRow, nextRow);
inTimelineItemPropertyBinding->Bind(propertyRow);
return propertyRow;
@@ -72,22 +67,8 @@ CStateRow *TimelineUIFactory::createStateRow(CBaseStateRow *parentRow,
ITimelineItemBinding *inTimelineItem)
{
auto stateRow = new CStateRow(parentRow);
- auto stateRowUI = createRowUI(stateRow, parentRow);
- Q_ASSERT(stateRowUI);
+
stateRow->Initialize(inTimelineItem);
- CAbstractTimelineRowUI *parentUiRow =nullptr;
- ISnappingListProvider *snappingListProvider = nullptr;
- do {
- parentUiRow = m_uiRows.value(parentRow, nullptr);
- if (parentUiRow) {
- snappingListProvider = parentUiRow->GetSnappingListProvider();
- parentRow = dynamic_cast<CBaseStateRow*>(parentRow->GetParentRow());
- }
- } while (parentUiRow && !snappingListProvider);
- if (parentUiRow) {
- Q_ASSERT(snappingListProvider);
- stateRowUI->SetSnappingListProvider(snappingListProvider);
- }
return stateRow;
}
@@ -96,35 +77,12 @@ CSlideRow *TimelineUIFactory::createSlideRow(CBaseStateRow *parentRow,
ITimelineItemBinding *inTimelineItem)
{
auto slideRow = new CSlideRow(parentRow);
- auto slideRowUI = createRowUI(slideRow, parentRow);
- Q_ASSERT(slideRowUI);
+
slideRow->Initialize(inTimelineItem);
- CAbstractTimelineRowUI *parentUiRow = m_uiRows.value(parentRow, nullptr);
- if (parentUiRow)
- slideRowUI->SetSnappingListProvider(parentUiRow->GetSnappingListProvider());
return slideRow;
}
-CAbstractTimelineRowUI *TimelineUIFactory::createRowUI(CTimelineRow *row, CTimelineRow *parentRow)
-{
- CAbstractTimelineRowUI *parentUiRow = m_uiRows.value(parentRow, nullptr);
- CAbstractTimelineRowUI *uiRow = nullptr;
- if (auto castedRow = qobject_cast<CSlideRow *>(row)) {
- uiRow = new CSlideRowUI(castedRow, parentUiRow);
- } else if (auto castedRow = qobject_cast<CStateRow *>(row)) {
- uiRow = new CStateRowUI(castedRow, parentUiRow);
- } else if (auto castedRow = qobject_cast<CPropertyRow *>(row)) {
- uiRow = new CPropertyRowUI(castedRow, parentUiRow);
- }
-
- if (uiRow) {
- m_uiRows[row] = uiRow;
- }
-
- return uiRow;
-}
-
void TimelineUIFactory::deleteRowUI(CTimelineRow *row)
{
auto it = m_uiRows.find(row);
diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp
index da51d34d..b1821235 100644
--- a/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp
@@ -269,7 +269,7 @@ void TimelineView::OnActiveSlide(const qt3dsdm::Qt3DSDMSlideHandle &inMaster, in
m_translationManager->Clear();
m_activeSlide = inSlide;
-
+ qDebug() << "OnActiveSlide";
auto *theSlideSystem = GetDoc()->GetStudioSystem()->GetSlideSystem();
auto theSlideInstance = theSlideSystem->GetSlideInstance(inSlide);
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.cpp b/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.cpp
deleted file mode 100644
index c9ffff8e..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.cpp
+++ /dev/null
@@ -1,86 +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 "ToggleBlankControl.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CToggleBlankControl::CToggleBlankControl(CColor inColor)
- : CBlankControl(inColor)
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CToggleBlankControl::~CToggleBlankControl()
-{
-}
-
-//=============================================================================
-/**
- * Handles custom drawing of the blank control underneath the tree control
- * on the timeline palette.
- */
-void CToggleBlankControl::Draw(CRenderer *inRenderer)
-{
- CBlankControl::Draw(inRenderer);
-
- // Draw the line on the right side of this control
- CPt theSize = GetSize();
- inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor());
- inRenderer->MoveTo(theSize.x - 1, 0);
- inRenderer->LineTo(theSize.x - 1, theSize.y - 1);
- inRenderer->PopPen();
-
- // Draw the line on the left side of this control
- inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor());
- inRenderer->MoveTo(CPt(0, 0));
- inRenderer->LineTo(CPt(0, theSize.y - 1));
- inRenderer->PopPen();
-
- // Draw the highlight
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(CPt(1, 0));
- inRenderer->LineTo(CPt(1, theSize.y - 1));
- inRenderer->PopPen();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.h b/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.h
deleted file mode 100644
index ac07f7db..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleBlankControl.h
+++ /dev/null
@@ -1,60 +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_TOGGLE_BLANK_CONTROL_H
-#define INCLUDED_TOGGLE_BLANK_CONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BlankControl.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//=============================================================================
-/**
- * Extends the blank control to draw items specific to the tree view side of the
- * timeline palette.
- */
-class CToggleBlankControl : public CBlankControl
-{
-public:
- CToggleBlankControl(CColor inColor = CStudioPreferences::GetBaseColor());
- virtual ~CToggleBlankControl();
- void Draw(CRenderer *inRenderer) override;
-
-protected:
-};
-
-#endif // INCLUDED_TOGGLE_BLANK_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleControl.cpp b/src/Authoring/Studio/Palettes/Timeline/ToggleControl.cpp
deleted file mode 100644
index 845b8fc6..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleControl.cpp
+++ /dev/null
@@ -1,181 +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 "ToggleControl.h"
-#include "Renderer.h"
-#include "StateRow.h"
-#include "StateRowUI.h"
-#include "BlankControl.h"
-#include "HotKeys.h"
-#include "TimelineUIFactory.h"
-#include "AbstractTimelineRowUI.h"
-
-#include "Bindings/ITimelineItemBinding.h"
-
-CToggleControl::CToggleControl(CStateRowUI *inStateRowUI, ITimelineItemBinding *inTimelineItemBinding)
- : CBlankToggleControl(inStateRowUI)
- , m_TimelineItemBinding(inTimelineItemBinding)
-{
- long theLeftOffset = 4;
-
- m_Shy = new CToggleButton();
- m_Shy->SetName("ShyToggle");
- m_Shy->SetUpImage("Toggle-Empty.png");
- m_Shy->SetDownImage("Toggle-Shy.png");
- m_Shy->SetPosition(CPt(theLeftOffset, 0));
- CPt theShySize = m_Shy->GetSize();
-
- m_Visible = new CToggleButton();
- m_Visible->SetName("VisibilityToggle");
- m_Visible->SetUpImage("Toggle-Empty.png");
- m_Visible->SetDownImage("Toggle-HideShow.png");
- m_Visible->SetUpDisabledImage("Toggle-Empty.png"); // show empty if disabled
- m_Visible->SetDisabledImage("Toggle-HideShow-disabled.png");
- m_Visible->SetPosition(CPt(theShySize.x + 7, 0));
- CPt theVisibleSize = m_Visible->GetSize();
-
- m_Locked = new CToggleButton();
- m_Locked->SetName("LockToggle");
- m_Locked->SetUpImage("Toggle-Empty.png");
- m_Locked->SetDownImage("Toggle-Lock.png");
- m_Locked->SetPosition(CPt(theVisibleSize.x + theShySize.x + 10, 0));
- CPt theLockedSize = m_Locked->GetSize();
-
- AddChild(m_Shy);
- AddChild(m_Visible);
- AddChild(m_Locked);
-
- SetAbsoluteSize(CPt(theShySize.x + theVisibleSize.x + theLockedSize.x + 1, theShySize.y));
-
- // Button down listeners
- QObject::connect(m_Shy,&CToggleButton::SigToggle,
- std::bind(&CToggleControl::OnShyClicked, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_Visible,&CToggleButton::SigToggle,
- std::bind(&CToggleControl::OnVisibleClicked, this,
- std::placeholders::_1, std::placeholders::_2));
- QObject::connect(m_Locked,&CToggleButton::SigToggle,
- std::bind(&CToggleControl::OnLockClicked, this,
- std::placeholders::_1, std::placeholders::_2));
-
-
-
- ITimelineItem *theTimelineItem = m_TimelineItemBinding->GetTimelineItem();
- // Initial toggle state of the eye visibility button
- // Note GetViewToggleOff==FALSE means visible
- m_Visible->SetToggleState(theTimelineItem->IsVisible());
-
- // Initial toggle state of the button
- m_Locked->SetToggleState(theTimelineItem->IsLocked());
-
- // Initial toggle state of the button
- m_Shy->SetToggleState(theTimelineItem->IsShy());
-
- // sk - if anything, this should be checked in the data model level, not here.
- // The tri-state (on, off, dim) of visibility depends on two bools:
- // GetViewToggleOff and IsEnabled. Ensure that any bogus 4th permutation
- // is detected ASAP
- // ASSERT( !inStateRow->GetState( )->GetViewToggleOff( ) ||
- // !inStateRow->GetState( )->IsEnabled( ) );
-}
-
-CToggleControl::~CToggleControl()
-{
- delete m_Shy;
- delete m_Visible;
- delete m_Locked;
-}
-
-//==============================================================================
-/**
- * Handles clicking on the Shy button. Toggles the shy state on the asset. Shy
- * objects can be filtered out of the timeline.
- */
-void CToggleControl::OnShyClicked(CToggleButton *, CToggleButton::EButtonState inButtonState)
-{
- m_TimelineItemBinding->GetTimelineItem()->SetShy(inButtonState
- == CToggleButton::EBUTTONSTATE_DOWN);
-
- m_StateRow->Filter(*m_StateRow->GetFilter());
- CTimelineRow *theParentRow = m_StateRow->GetParentRow();
- if (theParentRow != nullptr) {
- auto parentRowUI = TimelineUIFactory::instance()->uiForRow(theParentRow);
- parentRowUI->OnChildVisibilityChanged();
- }
-}
-
-//==============================================================================
-/**
- * Handles clicking on the Visible button. Toggles the Visible state on the asset.
- */
-void CToggleControl::OnVisibleClicked(CToggleButton *inButton,
- CToggleButton::EButtonState inButtonState)
-{
- Q_UNUSED(inButton);
-
- m_TimelineItemBinding->GetTimelineItem()->SetVisible(inButtonState
- == CToggleButton::EBUTTONSTATE_DOWN);
- m_StateRow->Filter(*m_StateRow->GetFilter());
-}
-
-//==============================================================================
-/**
- * Handles clicking on the Lock button. Toggles the Lock state on the asset.
- */
-void CToggleControl::OnLockClicked(CToggleButton *inButton,
- CToggleButton::EButtonState inButtonState)
-{
- Q_UNUSED(inButton);
-
- m_TimelineItemBinding->GetTimelineItem()->SetLocked(inButtonState
- == CToggleButton::EBUTTONSTATE_DOWN);
- m_StateRow->Filter(*m_StateRow->GetFilter());
-}
-
-//==============================================================================
-/**
- * Refreshes the state of this control accd to the asset state
- */
-void CToggleControl::Refresh()
-{
- CBlankToggleControl::Refresh();
-
- ITimelineItem *theTimelineItem = m_TimelineItemBinding->GetTimelineItem();
- m_Shy->SetToggleState(theTimelineItem->IsShy());
- m_Locked->SetToggleState(theTimelineItem->IsLocked());
-
- bool theEnabled = m_TimelineItemBinding->IsVisibleEnabled();
- m_Visible->SetEnabled(theEnabled);
- if (theEnabled) // only valid to update this if the enabled flag is true.
- m_Visible->SetToggleState(theTimelineItem->IsVisible());
-
- this->Invalidate();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleControl.h b/src/Authoring/Studio/Palettes/Timeline/ToggleControl.h
deleted file mode 100644
index 978b1954..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleControl.h
+++ /dev/null
@@ -1,61 +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_TOGGLE_CONTROL_H
-#define INCLUDED_TOGGLE_CONTROL_H 1
-
-#pragma once
-
-#include "BlankToggleControl.h"
-#include "ToggleButton.h"
-
-class CStateRowUI;
-class CBlankControl;
-class ITimelineItemBinding;
-
-class CToggleControl : public CBlankToggleControl
-{
-public:
- CToggleControl(CStateRowUI *inStateRow, ITimelineItemBinding *inTimelineItemBinding);
- virtual ~CToggleControl();
-
- void OnShyClicked(CToggleButton *inButton, CToggleButton::EButtonState inState);
- void OnVisibleClicked(CToggleButton *inButton, CToggleButton::EButtonState inState);
- void OnLockClicked(CToggleButton *inButton, CToggleButton::EButtonState inState);
-
- void Refresh() override;
-
-protected:
- CToggleButton *m_Shy;
- CToggleButton *m_Visible;
- CToggleButton *m_Locked;
-
- ITimelineItemBinding *m_TimelineItemBinding;
-};
-#endif // INCLUDED_TOGGLE_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.cpp b/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.cpp
deleted file mode 100644
index da95d447..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.cpp
+++ /dev/null
@@ -1,200 +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 "ToggleToolbar.h"
-#include "Renderer.h"
-#include "StudioPreferences.h"
-#include "TimelineTreeLayout.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CToggleToolbar::CToggleToolbar(CTimelineTreeLayout *inTreeLayout)
- : CFlowLayout(new CBlankControl(CStudioPreferences::GetTopRowColor()))
-{
- m_TreeLayout = inTreeLayout;
-
- m_Color = CStudioPreferences::GetBaseColor();
-
- SetFlowDirection(FLOW_HORIZONTAL);
- SetAlignment(ALIGN_TOP, ALIGN_LEFT);
- SetLeftMargin(1);
-
- CProceduralButton<CToggleButton>::SBorderOptions theBorderOptions(false, false, false, false);
-
- m_FltrShyBtn = new CProceduralButton<CToggleButton>();
- m_FltrShyBtn->SetUpImage("Toggle-Shy.png");
- m_FltrShyBtn->SetDownImage("Toggle-Shy.png");
- m_FltrShyBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrShyBtn->SetCenterImage(true, true);
- m_FltrShyBtn->SetAbsoluteSize(CPt(20, 20));
- m_FltrShyBtn->SetTooltipText(QObject::tr("Hide shy objects"));
- m_FltrShyBtn->SetFillStyleUp(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- m_FltrShyBtn->SetFillStyleDown(CProceduralButton<CToggleButton>::EFILLSTYLE_FLOOD);
- m_FltrShyBtn->SetFillStyleOver(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- QObject::connect(m_FltrShyBtn,&CToggleButton::SigToggle,
- std::bind(&CToggleToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- AddChild(m_FltrShyBtn);
- m_FltrShyBtn->SetToggleState(false);
-
- m_FltrVisibleBtn = new CProceduralButton<CToggleButton>();
- m_FltrVisibleBtn->SetUpImage("filter-toggle-eye-up.png");
- m_FltrVisibleBtn->SetDownImage("filter-toggle-eye-down.png");
- m_FltrVisibleBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrVisibleBtn->SetCenterImage(true, true);
- m_FltrVisibleBtn->SetAbsoluteSize(CPt(20, 20));
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Hide inactive objects"));
- m_FltrVisibleBtn->SetFillStyleUp(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- m_FltrVisibleBtn->SetFillStyleDown(CProceduralButton<CToggleButton>::EFILLSTYLE_FLOOD);
- m_FltrVisibleBtn->SetFillStyleOver(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- QObject::connect(m_FltrVisibleBtn,&CToggleButton::SigToggle,
- std::bind(&CToggleToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- AddChild(m_FltrVisibleBtn);
- m_FltrVisibleBtn->SetToggleState(false);
-
- m_FltrLockBtn = new CProceduralButton<CToggleButton>();
- m_FltrLockBtn->SetUpImage("Toggle-Lock.png");
- m_FltrLockBtn->SetDownImage("Toggle-Lock.png");
- m_FltrLockBtn->SetBorderVisibilityAll(theBorderOptions);
- m_FltrLockBtn->SetCenterImage(true, true);
- m_FltrLockBtn->SetAbsoluteSize(CPt(20, 20));
- m_FltrLockBtn->SetTooltipText(QObject::tr("Hide locked objects"));
- m_FltrLockBtn->SetFillStyleUp(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- m_FltrLockBtn->SetFillStyleDown(CProceduralButton<CToggleButton>::EFILLSTYLE_FLOOD);
- m_FltrLockBtn->SetFillStyleOver(CProceduralButton<CToggleButton>::EFILLSTYLE_NONE);
- QObject::connect(m_FltrLockBtn,&CToggleButton::SigToggle,
- std::bind(&CToggleToolbar::OnButtonToggled, this,
- std::placeholders::_1, std::placeholders::_2));
- AddChild(m_FltrLockBtn);
- m_FltrLockBtn->SetToggleState(false);
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CToggleToolbar::~CToggleToolbar()
-{
- delete m_FltrShyBtn;
- delete m_FltrVisibleBtn;
- delete m_FltrLockBtn;
-}
-
-//=============================================================================
-/**
- * Fills in the background color and highlighting for this control.
- */
-void CToggleToolbar::Draw(CRenderer *inRenderer)
-{
- CRct theRect(0, 0, GetSize().x, GetSize().y - 1);
- inRenderer->FillSolidRect(theRect, m_Color);
- CFlowLayout::Draw(inRenderer);
-}
-
-//=============================================================================
-/**
- * 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 CToggleToolbar::OnButtonToggled(CToggleButton *inButton, CButtonControl::EButtonState inState)
-{
- bool theFilterNeedsApplied = (inState == CButtonControl::EBUTTONSTATE_UP);
-
- if (inButton == m_FltrShyBtn)
- FilterShy(theFilterNeedsApplied);
- else if (inButton == m_FltrVisibleBtn)
- FilterVisible(theFilterNeedsApplied);
- else if (inButton == m_FltrLockBtn)
- FilterLocked(theFilterNeedsApplied);
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for shy objects.
- * @param inFilter true to filter shy objects out of the timeline, false to show
- * shy objects in the timeline.
- */
-void CToggleToolbar::FilterShy(bool inFilter)
-{
- if (inFilter)
- m_FltrShyBtn->SetTooltipText(QObject::tr("Hide shy objects"));
- else
- m_FltrShyBtn->SetTooltipText(QObject::tr("Show shy objects"));
-
- m_TreeLayout->GetFilter()->SetShy(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for visible objects.
- * @param inFilter true to filter visible objects out of the timeline, false to show
- * visible objects in the timeline.
- */
-void CToggleToolbar::FilterVisible(bool inFilter)
-{
- if (inFilter)
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Hide inactive objects"));
- else
- m_FltrVisibleBtn->SetTooltipText(QObject::tr("Show inactive objects"));
-
- m_TreeLayout->GetFilter()->SetVisible(inFilter);
- m_TreeLayout->Filter();
-}
-
-//=============================================================================
-/**
- * Turns filtering on and off for locked objects.
- * @param inFilter true to filter locked objects out of the timeline, false to show
- * locked objects in the timeline.
- */
-void CToggleToolbar::FilterLocked(bool inFilter)
-{
- if (inFilter)
- m_FltrLockBtn->SetTooltipText(QObject::tr("Hide locked objects"));
- else
- m_FltrLockBtn->SetTooltipText(QObject::tr("Show locked objects"));
-
- m_TreeLayout->GetFilter()->SetLocked(inFilter);
- m_TreeLayout->Filter();
-}
diff --git a/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.h b/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.h
deleted file mode 100644
index f3685af4..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/ToggleToolbar.h
+++ /dev/null
@@ -1,78 +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_TOOLBAR_H
-#define INCLUDED_TOGGLE_TOOLBAR_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-
-#include "FlowLayout.h"
-#include "ProceduralButton.h"
-#include "ToggleButton.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-
-class CRenderer;
-class CTimelineTreeLayout;
-
-//=============================================================================
-/**
- * Control at the top of the time display and a header for the toggle column.
- */
-class CToggleToolbar : public CFlowLayout
-{
-public:
- CToggleToolbar(CTimelineTreeLayout *inTreeLayout);
- virtual ~CToggleToolbar();
- void Draw(CRenderer *inRenderer) override;
-
- void FilterShy(bool inFilter);
- void FilterVisible(bool inFilter);
- void FilterLocked(bool inFilter);
- void OnButtonToggled(CToggleButton *inButton, CToggleButton::EButtonState inState);
-
-protected:
- CProceduralButton<CToggleButton> *m_FltrShyBtn;
- CProceduralButton<CToggleButton> *m_FltrVisibleBtn;
- CProceduralButton<CToggleButton> *m_FltrLockBtn;
- CTimelineTreeLayout *m_TreeLayout;
- CColor m_Color;
-};
-
-#endif // INCLUDED_TOGGLE_TOOLBAR_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.cpp b/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.cpp
deleted file mode 100644
index b49eabb5..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.cpp
+++ /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
-//==============================================================================
-#include "stdafx.h"
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "TreeBlankControl.h"
-#include "Renderer.h"
-
-//=============================================================================
-/**
- * Constructor
- */
-CTreeBlankControl::CTreeBlankControl(CColor inColor)
- : CBlankControl(inColor)
- , m_LeftEdgeOffset(0)
-{
-}
-
-//=============================================================================
-/**
- * Destructor
- */
-CTreeBlankControl::~CTreeBlankControl()
-{
-}
-
-//=============================================================================
-/**
- * Handles custom drawing of the blank control underneath the tree control
- * on the timeline palette.
- */
-void CTreeBlankControl::Draw(CRenderer *inRenderer)
-{
- CBlankControl::Draw(inRenderer);
-
- // Draw the highlight on the left side of this control
- CPt theSize = GetSize();
- inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor());
- inRenderer->MoveTo(CStudioPreferences::GetRowSize() + m_LeftEdgeOffset, 0);
- inRenderer->LineTo(CStudioPreferences::GetRowSize() + m_LeftEdgeOffset, theSize.y - 1);
- inRenderer->PopPen();
-}
-
-//=============================================================================
-/**
- * xxx
- */
-void CTreeBlankControl::SetVisiblePositionX(long inPosition)
-{
- m_LeftEdgeOffset = inPosition;
-} \ No newline at end of file
diff --git a/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.h b/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.h
deleted file mode 100644
index 0d0df3ab..00000000
--- a/src/Authoring/Studio/Palettes/Timeline/TreeBlankControl.h
+++ /dev/null
@@ -1,63 +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_TREE_BLANK_CONTROL_H
-#define INCLUDED_TREE_BLANK_CONTROL_H 1
-
-#pragma once
-
-//==============================================================================
-// Includes
-//==============================================================================
-#include "BlankControl.h"
-
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-//=============================================================================
-/**
- * Extends the blank control to draw items specific to the tree view side of the
- * timeline palette.
- */
-class CTreeBlankControl : public CBlankControl
-{
-public:
- CTreeBlankControl(CColor inColor = CStudioPreferences::GetBaseColor());
- virtual ~CTreeBlankControl();
- void Draw(CRenderer *inRenderer) override;
- void SetVisiblePositionX(long inPosition);
-
-protected:
- long m_LeftEdgeOffset; ///< Visibility offset of the left edge in case timeline is scrolled
- ///horizontally
-};
-
-#endif // INCLUDED_TREE_BLANK_CONTROL_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/Keyframe.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/Keyframe.h
new file mode 100644
index 00000000..99ad423e
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/Keyframe.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 KEYFRAME_H
+#define KEYFRAME_H
+
+class RowTimeline;
+enum class PropertyType;
+
+struct Keyframe
+{
+ Keyframe(double time, double value, RowTimeline *propRow)
+ : time(time)
+ , value(value)
+ , rowProperty(propRow)
+ , rowMaster(propRow->parentRow())
+ , propertyType(propRow->rowTree()->propertyType())
+ {}
+
+ double time;
+ double value;
+ bool selected = false;
+ PropertyType propertyType;
+ RowTimeline *rowProperty;
+ RowTimeline *rowMaster;
+};
+
+#endif // KEYFRAME_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
new file mode 100644
index 00000000..8912f84b
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
@@ -0,0 +1,417 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "KeyframeManager.h"
+#include "RowTree.h"
+#include "RowTimeline.h"
+#include "Keyframe.h"
+#include "RowTypes.h"
+#include "TimelineConstants.h"
+#include "Ruler.h"
+#include "PlayHead.h"
+#include "RowManager.h"
+#include "TimelineGraphicsScene.h"
+
+#include <qglobal.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qdebug.h>
+
+KeyframeManager::KeyframeManager(TimelineGraphicsScene *scene) : m_scene(scene)
+{
+}
+
+QList<Keyframe *> KeyframeManager::insertKeyframe(RowTimeline *row, double time, double value,
+ bool selectInsertedKeyframes)
+{
+ QList<Keyframe *> addedKeyframes;
+ QList<RowTimeline *> propRows;
+ if (row->rowTree()->rowType() != RowType::Property) {
+ const auto childRows = row->rowTree()->childRows();
+ for (const auto r : childRows) {
+ if (r->rowType() == RowType::Property)
+ propRows.append(r->rowTimeline());
+ }
+ } else {
+ propRows.append(row);
+ }
+
+ if (!propRows.empty()) {
+ Keyframe *keyframe = nullptr;
+ for (const auto &r : qAsConst(propRows)) {
+ keyframe = new Keyframe(time, value, r);
+ r->insertKeyframe(keyframe);
+ r->parentRow()->insertKeyframe(keyframe);
+ addedKeyframes.append(keyframe);
+ }
+
+ if (selectInsertedKeyframes && !addedKeyframes.empty()) {
+ deselectAllKeyframes();
+ selectKeyframes(addedKeyframes);
+ }
+ }
+
+ return addedKeyframes;
+}
+
+void KeyframeManager::selectKeyframe(Keyframe *keyframe)
+{
+ if (!m_selectedKeyframes.contains(keyframe)) {
+ keyframe->selected = true;
+ m_selectedKeyframes.append(keyframe);
+
+ if (!m_selectedKeyframesMasterRows.contains(keyframe->rowMaster))
+ m_selectedKeyframesMasterRows.append(keyframe->rowMaster);
+
+ keyframe->rowMaster->putSelectedKeyframesOnTop();
+ keyframe->rowMaster->updateKeyframes();
+ }
+}
+
+void KeyframeManager::selectKeyframes(const QList<Keyframe *> &keyframes)
+{
+ for (const auto keyframe : keyframes) {
+ if (!m_selectedKeyframes.contains(keyframe)) {
+ m_selectedKeyframes.append(keyframe);
+
+ if (!m_selectedKeyframesMasterRows.contains(keyframe->rowMaster))
+ m_selectedKeyframesMasterRows.append(keyframe->rowMaster);
+ }
+ }
+
+ for (auto keyframe : qAsConst(m_selectedKeyframes))
+ keyframe->selected = true;
+
+ for (auto row : qAsConst(m_selectedKeyframesMasterRows)) {
+ row->putSelectedKeyframesOnTop();
+ row->updateKeyframes();
+ }
+}
+
+void KeyframeManager::selectKeyframesInRect(const QRectF &rect)
+{
+ deselectAllKeyframes();
+
+ int idx1 = (rect.top() + 4) / TimelineConstants::ROW_H;
+ int idx2 = (rect.bottom() - 4) / TimelineConstants::ROW_H;
+
+ m_scene->rowManager()->clampIndex(idx1);
+ m_scene->rowManager()->clampIndex(idx2);
+
+ // TODO: remove
+ qDebug() << "idx1=" << idx1 << ", idx2=" << idx2;
+
+ RowTimeline *rowTimeline;
+ for (int i = idx1; i <= idx2; ++i) {
+ rowTimeline = m_scene->rowManager()->rowTimelineAt(i);
+
+ if (rowTimeline != nullptr) {
+ const auto keyframes = rowTimeline->getKeyframesInRange(rect.left(), rect.right());
+ for (auto keyframe : keyframes) {
+ if (!m_selectedKeyframes.contains(keyframe)) {
+ m_selectedKeyframes.append(keyframe);
+
+ if (!m_selectedKeyframesMasterRows.contains(keyframe->rowMaster))
+ m_selectedKeyframesMasterRows.append(keyframe->rowMaster);
+ }
+ }
+ }
+ }
+
+ for (auto keyframe : qAsConst(m_selectedKeyframes))
+ keyframe->selected = true;
+
+ for (auto row : qAsConst(m_selectedKeyframesMasterRows)) {
+ row->putSelectedKeyframesOnTop();
+ row->updateKeyframes();
+ }
+}
+
+void KeyframeManager::deselectKeyframe(Keyframe *keyframe)
+{
+ if (m_selectedKeyframes.contains(keyframe)) {
+ keyframe->selected = false;
+ m_selectedKeyframes.removeAll(keyframe);
+ keyframe->rowMaster->updateKeyframes();
+ m_selectedKeyframesMasterRows.removeAll(keyframe->rowMaster);
+ }
+}
+
+void KeyframeManager::deselectAllKeyframes()
+{
+ for (auto keyframe : qAsConst(m_selectedKeyframes))
+ keyframe->selected = false;
+
+ for (auto row : qAsConst(m_selectedKeyframesMasterRows))
+ row->updateKeyframes();
+
+ m_selectedKeyframes.clear();
+ m_selectedKeyframesMasterRows.clear();
+}
+
+void KeyframeManager::deleteSelectedKeyframes()
+{
+ if (!m_selectedKeyframes.empty()) {
+ for (auto keyframe : qAsConst(m_selectedKeyframes)) {
+ keyframe->rowMaster->removeKeyframe(keyframe);
+ keyframe->rowProperty->removeKeyframe(keyframe);
+
+ delete keyframe;
+ }
+
+ for (auto row : qAsConst(m_selectedKeyframesMasterRows))
+ row->updateKeyframes();
+
+ m_selectedKeyframes.clear();
+ m_selectedKeyframesMasterRows.clear();
+ }
+}
+
+// delete all keyframes on a row
+void KeyframeManager::deleteKeyframes(RowTimeline *row)
+{
+ const auto keyframes = row->keyframes();
+ for (auto keyframe : keyframes) {
+ keyframe->rowMaster->removeKeyframe(keyframe);
+ keyframe->rowProperty->removeKeyframe(keyframe);
+
+ if (m_selectedKeyframes.contains(keyframe))
+ m_selectedKeyframes.removeAll(keyframe);
+
+ delete keyframe;
+ }
+
+ if (m_selectedKeyframesMasterRows.contains(row))
+ m_selectedKeyframesMasterRows.removeAll(row);
+
+ row->updateKeyframes();
+}
+
+void KeyframeManager::copySelectedKeyframes()
+{
+ if (!m_selectedKeyframes.empty()
+ && m_selectedKeyframesMasterRows.count() == 1) {
+ // delete old copies
+ for (auto keyframe : qAsConst(m_copiedKeyframes))
+ delete keyframe;
+
+ m_copiedKeyframes.clear();
+
+ Keyframe *copyKeyframe;
+ for (auto keyframe : qAsConst(m_selectedKeyframes)) {
+ copyKeyframe = new Keyframe(*keyframe);
+ copyKeyframe->rowMaster = nullptr;
+ copyKeyframe->rowProperty = nullptr;
+ m_copiedKeyframes.append(copyKeyframe);
+ }
+ }
+}
+
+void KeyframeManager::pasteKeyframes(RowTimeline *row)
+{
+ if (row == nullptr)
+ return;
+
+ if (row->rowTree()->rowType() == RowType::Property)
+ row = row->parentRow();
+
+ if (!m_copiedKeyframes.empty()) {
+ // filter copied keyframes to the row supported properties
+ const QList<Keyframe *> filteredKeyframes = filterKeyframesForRow(row, m_copiedKeyframes);
+
+ // calc min/max copied frames time
+ double minTime = 999999; // seconds (~277.78 hrs)
+ double maxTime = 0;
+ for (auto keyframe : filteredKeyframes) {
+ if (keyframe->time < minTime)
+ minTime = keyframe->time;
+
+ if (keyframe->time > maxTime)
+ maxTime = keyframe->time;
+ }
+
+ double dt = m_scene->playHead()->time() - minTime;
+
+ if (maxTime + dt > m_scene->ruler()->duration())
+ dt = m_scene->ruler()->duration() - maxTime;
+
+ RowTree *propRow;
+ QList<Keyframe *> addedKeyframes;
+ for (auto keyframe : filteredKeyframes) {
+ propRow = m_scene->rowManager()->getOrCreatePropertyRow(keyframe->propertyType,
+ row->rowTree());
+ addedKeyframes.append(insertKeyframe(propRow->rowTimeline(), keyframe->time + dt,
+ keyframe->value, false));
+ }
+
+ if (!addedKeyframes.empty()) {
+ deselectAllKeyframes();
+ selectKeyframes(addedKeyframes);
+ }
+ }
+}
+
+QList<Keyframe *> KeyframeManager::filterKeyframesForRow(RowTimeline *row,
+ const QList<Keyframe *> &keyframes)
+{
+ QList<Keyframe *> result;
+
+ for (auto keyframe : keyframes) {
+ if (SUPPORTED_ROW_PROPS[row->rowTree()->rowType()].contains(keyframe->propertyType))
+ result.append(keyframe);
+ }
+
+ return result;
+}
+
+void KeyframeManager::moveSelectedKeyframes(double dx)
+{
+ double dt = m_scene->ruler()->distanceToTime(dx);
+
+ if (dt > 0) { // check max limit
+ double maxTime = 0;
+ for (auto keyframe : qAsConst(m_selectedKeyframes)) {
+ if (keyframe->time > maxTime)
+ maxTime = keyframe->time;
+ }
+
+ if (maxTime + dt > m_scene->ruler()->duration())
+ dt = m_scene->ruler()->duration() - maxTime;
+ } else if (dt < 0) { // check min limit
+ double minTime = 999999; // seconds (~277.78 hrs)
+ for (auto keyframe : qAsConst(m_selectedKeyframes)) {
+ if (keyframe->time < minTime)
+ minTime = keyframe->time;
+ }
+
+ if (minTime + dt < 0)
+ dt = -minTime;
+ }
+
+ for (auto keyframe : qAsConst(m_selectedKeyframes))
+ keyframe->time += dt;
+
+ for (auto row : qAsConst(m_selectedKeyframesMasterRows))
+ row->updateKeyframes();
+}
+
+// selected keyframes belong to only one master row
+bool KeyframeManager::oneMasterRowSelected() const
+{
+ return m_selectedKeyframesMasterRows.count() == 1;
+}
+
+bool KeyframeManager::hasSelectedKeyframes() const
+{
+ return !m_selectedKeyframes.empty();
+}
+
+bool KeyframeManager::hasCopiedKeyframes() const
+{
+ return !m_copiedKeyframes.empty();
+}
+
+const QHash<RowType, QList<PropertyType>> KeyframeManager::SUPPORTED_ROW_PROPS {
+ { RowType::Layer, {
+ PropertyType::Left,
+ PropertyType::Width,
+ PropertyType::Top,
+ PropertyType::Height,
+ PropertyType::AO,
+ PropertyType::AODistance,
+ PropertyType::AOSoftness,
+ PropertyType::AOThreshold,
+ PropertyType::AOSamplingRate,
+ PropertyType::IBLBrightness,
+ PropertyType::IBLHorizonCutoff,
+ PropertyType::IBLFOVAngle }
+ },
+ { RowType::Camera, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::FieldOfView,
+ PropertyType::ClippingStart,
+ PropertyType::ClippingEnd }
+ },
+ { RowType::Light, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::LightColor,
+ PropertyType::SpecularColor,
+ PropertyType::AmbientColor,
+ PropertyType::Brightness,
+ PropertyType::ShadowDarkness,
+ PropertyType::ShadowSoftness,
+ PropertyType::ShadowDepthBias,
+ PropertyType::ShadowFarClip,
+ PropertyType::ShadowFOV }
+ },
+ { RowType::Object, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::Opacity,
+ PropertyType::EdgeTessellation,
+ PropertyType::InnerTessellation }
+ },
+ { RowType::Text, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::Opacity,
+ PropertyType::TextColor,
+ PropertyType::Leading,
+ PropertyType::Tracking }
+ },
+ { RowType::Alias, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::Opacity }
+ },
+ { RowType::Group, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::Opacity }
+ },
+ { RowType::Component, {
+ PropertyType::Position,
+ PropertyType::Rotation,
+ PropertyType::Scale,
+ PropertyType::Pivot,
+ PropertyType::Opacity }
+ }
+};
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.h
new file mode 100644
index 00000000..251f5f91
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/KeyframeManager.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 KEYFRAMEMANAGER_H
+#define KEYFRAMEMANAGER_H
+
+#include <QtCore/qlist.h>
+
+class RowTimeline;
+class TimelineGraphicsScene;
+enum class RowType;
+enum class PropertyType;
+struct Keyframe;
+
+QT_FORWARD_DECLARE_CLASS(QGraphicsSceneContextMenuEvent)
+QT_FORWARD_DECLARE_CLASS(QRectF)
+
+class KeyframeManager
+{
+public:
+ KeyframeManager(TimelineGraphicsScene *m_scene);
+
+ QList<Keyframe *> insertKeyframe(RowTimeline *row, double time, double value,
+ bool selectInsertedKeyframes = true);
+ void selectKeyframe(Keyframe *keyframe);
+ void selectKeyframesInRect(const QRectF &rect);
+ void selectKeyframes(const QList<Keyframe *> &keyframes);
+ void deselectKeyframe(Keyframe *keyframe);
+ void deselectAllKeyframes();
+ void deleteSelectedKeyframes();
+ void deleteKeyframes(RowTimeline *row);
+ void copySelectedKeyframes();
+ void pasteKeyframes(RowTimeline *row);
+ void moveSelectedKeyframes(double dx);
+ bool oneMasterRowSelected() const;
+ bool hasSelectedKeyframes() const;
+ bool hasCopiedKeyframes() const;
+
+ TimelineGraphicsScene *m_scene;
+
+ QList<Keyframe *> m_selectedKeyframes;
+ QList<Keyframe *> m_copiedKeyframes; // for copy, cut, paste
+ QList<RowTimeline *> m_selectedKeyframesMasterRows;
+
+
+private:
+ static const QHash<RowType, QList<PropertyType>> SUPPORTED_ROW_PROPS;
+
+ QList<Keyframe *> filterKeyframesForRow(RowTimeline *row, const QList<Keyframe *> &keyframes);
+};
+
+#endif // KEYFRAMEMANAGER_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
new file mode 100644
index 00000000..93227365
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
@@ -0,0 +1,223 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "RowManager.h"
+#include "RowTree.h"
+#include "TimelineGraphicsScene.h"
+#include "Ruler.h"
+#include "KeyframeManager.h"
+
+#include <QtWidgets/qgraphicslinearlayout.h>
+#include <QtCore/qdebug.h>
+
+RowManager::RowManager(TimelineGraphicsScene *scene, QGraphicsLinearLayout *layoutLabels,
+ QGraphicsLinearLayout *layoutTimeline)
+ : m_scene(scene)
+ , m_layoutLabels(layoutLabels)
+ , m_layoutTimeline(layoutTimeline)
+{
+
+}
+
+RowTree *RowManager::getOrCreatePropertyRow(PropertyType propType, RowTree *masterRow)
+{
+ if (masterRow->hasPropertyChildren()) {
+ const auto childRows = masterRow->childRows();
+ for (const auto child : childRows) {
+ if (child->propertyType() == propType)
+ return child;
+ }
+ }
+
+ return createRow(RowType::Property, masterRow, 0, propType);
+}
+
+RowTree *RowManager::createRow(RowType rowType, RowTree *parentRow, const QString &label,
+ PropertyType propType)
+{
+ if (parentRow == nullptr && rowType != RowType::Scene) {
+ qWarning() << __FUNCTION__ << "Invalid parent. Row must have a valid parent row."
+ " No row added.";
+ } else if (parentRow != nullptr && parentRow->rowType() == RowType::Property) {
+ qWarning() << __FUNCTION__ << "Property row cannot have children. No row added.";
+ } else {
+ RowTree *rowLabel = nullptr;
+
+ if (propType != PropertyType::None)
+ rowLabel = new RowTree(m_scene->ruler(), propType);
+ else
+ rowLabel = new RowTree(m_scene->ruler(), rowType, label);
+
+ if (parentRow != nullptr)
+ parentRow->addChild(rowLabel);
+
+ rowLabel->rowTimeline()->setStartTime(0);
+ rowLabel->rowTimeline()->setEndTime(qMin(10.0, m_scene->ruler()->duration()));
+
+ int index = getRowIndex(parentRow) + 1;
+ if (index == 0)
+ index = 1;
+
+ m_layoutLabels->insertItem(index, rowLabel);
+ m_layoutTimeline->insertItem(index, rowLabel->rowTimeline());
+
+ return rowLabel;
+ }
+
+ return nullptr;
+}
+
+RowTree *RowManager::getRowAbove(RowTree *row)
+{
+ int rowIndex = getRowIndex(row);
+
+ if (rowIndex > 1) {
+ RowTree *rowAbove = static_cast<RowTree *>(m_layoutLabels->itemAt(rowIndex - 1));
+
+ if (rowAbove != nullptr) {
+ while (rowAbove != nullptr && rowAbove->depth() > row->depth())
+ rowAbove = rowAbove->parentRow();
+
+ return rowAbove;
+ }
+ }
+
+ return nullptr;
+}
+
+RowTree *RowManager::rowAt(int idx)
+{
+ correctIndex(idx);
+
+ if (idx != -1)
+ return static_cast<RowTree *>(m_layoutTimeline->itemAt(idx)->graphicsItem());
+
+ return nullptr;
+}
+
+RowTimeline *RowManager::rowTimelineAt(int idx)
+{
+ correctIndex(idx);
+
+ if (idx != -1)
+ return static_cast<RowTimeline *>(m_layoutTimeline->itemAt(idx)->graphicsItem());
+
+ return nullptr;
+}
+
+void RowManager::selectRow(RowTree *row)
+{
+ if (row != nullptr && row != m_selectedRow && row->rowType() != RowType::Property) {
+ if (m_selectedRow != nullptr)
+ m_selectedRow->setState(InteractiveTimelineItem::Normal);
+
+ row->setState(InteractiveTimelineItem::Selected);
+ m_selectedRow = row;
+ }
+}
+
+void RowManager::deleteRow(RowTree *row)
+{
+ if (row != nullptr && row->rowType() != RowType::Scene) {
+ if (m_selectedRow == row)
+ selectRow(getRowAbove(row));
+
+ deleteRowRecursive(row);
+ }
+}
+
+void RowManager::deleteRowRecursive(RowTree *row)
+{
+ if (!row->childRows().empty()) {
+ for (auto child : row->childRows())
+ deleteRowRecursive(child);
+ }
+
+ if (row == m_selectedRow)
+ m_selectedRow = nullptr;
+
+ if (row->parentRow() != nullptr)
+ row->parentRow()->removeChild(row);
+
+ m_scene->keyframeManager()->deleteKeyframes(row->rowTimeline());
+
+ m_layoutTimeline->removeItem(row->rowTimeline());
+ m_layoutLabels->removeItem(row);
+ delete row->rowTimeline();
+ delete row;
+}
+
+RowTree *RowManager::selectedRow() const
+{
+ return m_selectedRow;
+}
+
+int RowManager::getRowIndex(RowTree *row)
+{
+ if (row != nullptr) {
+ for (int i = 1; i < m_layoutLabels->count(); ++i) {
+ if (row == m_layoutLabels->itemAt(i)->graphicsItem())
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+void RowManager::clampIndex(int &idx)
+{
+ if (idx < 1)
+ idx = 1;
+ else if (idx > m_layoutLabels->count() - 1)
+ idx = m_layoutLabels->count() - 1;
+}
+
+// Index within rows indices bounds
+bool RowManager::validIndex(int idx) const
+{
+ return idx > 0 && idx < m_layoutLabels->count();
+}
+
+// Adjust index to point to the correct row taking into consideration collaped rows
+void RowManager::correctIndex(int &idx)
+{
+ if (!validIndex(idx)) {
+ idx = -1;
+ return;
+ }
+
+ // adjust for collapsed items (invisible)
+ for (int i = 1; i <= idx; ++i) {
+ if (!m_layoutTimeline->itemAt(i)->graphicsItem()->isVisible()) {
+ if (++idx > m_layoutTimeline->count() - 1) {
+ idx = -1;
+ return;
+ }
+ }
+ }
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.h
index f86a50b0..929a8ecf 100644
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyTreeControl.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,42 +26,46 @@
**
****************************************************************************/
-#ifndef INCLUDED_PROPERTY_TREE_CONTROL_H
-#define INCLUDED_PROPERTY_TREE_CONTROL_H 1
+#ifndef ROWMANAGER_H
+#define ROWMANAGER_H
-#pragma once
+#include "RowTypes.h"
+#include <QtCore/qstring.h>
-#include "Control.h"
-#include "SIcon.h"
-#include "StringEdit.h"
+class TimelineGraphicsScene;
+class RowTree;
+class RowTimeline;
-class CPropertyRowUI;
+QT_FORWARD_DECLARE_CLASS(QGraphicsLinearLayout)
-class CPropertyTreeControl : public CControl
+class RowManager
{
public:
- CPropertyTreeControl(CPropertyRowUI *inPropRowUI);
- virtual ~CPropertyTreeControl();
+ RowManager(TimelineGraphicsScene *scene, QGraphicsLinearLayout *layoutLabels,
+ QGraphicsLinearLayout *layoutTimeline);
- void Draw(CRenderer *inRenderer) override;
+ void clampIndex(int &idx);
+ void correctIndex(int &idx);
+ void selectRow(RowTree *row);
+ void deleteRow(RowTree *row);
+ RowTree *getOrCreatePropertyRow(PropertyType propType, RowTree *masterRow);
+ RowTree *createRow(RowType rowType, RowTree *parentRow = nullptr, const QString &label = {},
+ PropertyType propType = PropertyType::None);
+ RowTree *rowAt(int idx);
+ RowTree *getRowAbove(RowTree *row);
+ RowTimeline *rowTimelineAt(int idx);
- void SetIndent(long inIndent);
- long GetIndent();
+ RowTree *selectedRow() const;
- void SetHighlighted(bool inIsHighlighted);
+private:
+ int getRowIndex(RowTree *row);
+ bool validIndex(int idx) const;
+ void deleteRowRecursive(RowTree *row);
- CDropTarget *FindDropCandidate(CPt &inMousePoint, Qt::KeyboardModifiers inFlags) override;
-
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
-
-protected:
- long m_Indent;
- CPropertyRowUI *m_PropRowUI;
- CSIcon m_Icon;
- CStringEdit m_Text;
- ::CColor m_BackgroundColor;
+ RowTree *m_selectedRow = nullptr;
+ TimelineGraphicsScene *m_scene;
+ QGraphicsLinearLayout *m_layoutLabels;
+ QGraphicsLinearLayout *m_layoutTimeline;
};
-#endif // INCLUDED_PROPERTY_TREE_CONTROL_H
+
+#endif // ROWMANAGER_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
new file mode 100644
index 00000000..ed447bb7
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "RowMover.h"
+#include "RowTree.h"
+#include "TimelineConstants.h"
+
+#include <QtGui/qpainter.h>
+#include <QtWidgets/qapplication.h>
+#include <QtWidgets/qgraphicsitem.h>
+
+RowMover::RowMover() : QGraphicsRectItem()
+{
+ setZValue(99);
+ setRect(0, -2, 20, 2);
+}
+
+void RowMover::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ painter->setPen(QPen(QColor(TimelineConstants::ROW_MOVER_COLOR), 4));
+ painter->drawLine(0, -.5, 10, -.5);
+ painter->fillRect(0, -2.5, rect().width() - x(), 2, QColor(TimelineConstants::ROW_MOVER_COLOR));
+}
+
+RowTree *RowMover::insertionParent() const
+{
+ return m_insertionParent;
+}
+
+void RowMover::resetInsertionParent(RowTree *newTarget)
+{
+ if (m_insertionParent != nullptr) {
+ m_insertionParent->setMoveTarget(false);
+ m_insertionParent = nullptr;
+ }
+
+ if (newTarget != nullptr) {
+ m_insertionParent = newTarget;
+ m_insertionParent->setMoveTarget(true);
+ }
+}
+
+int RowMover::sourceIndex() const
+{
+ return m_sourceIndex;
+}
+
+int RowMover::targetIndex() const
+{
+ return m_targetIndex;
+}
+
+bool RowMover::movingDown() const
+{
+ return m_targetIndex >= m_sourceIndex;
+}
+
+RowTree *RowMover::sourceRow() const
+{
+ return m_sourceRow;
+}
+
+bool RowMover::isActive()
+{
+ return m_active;
+}
+
+void RowMover::start(RowTree *row, int index)
+{
+ m_sourceRow = row;
+ m_sourceIndex = index;
+ m_active = true;
+
+ m_sourceRow->setMoveSourceRecursive(true);
+
+ qApp->setOverrideCursor(Qt::ClosedHandCursor);
+}
+
+void RowMover::end()
+{
+ if (m_active) {
+ m_sourceRow->setMoveSourceRecursive(false);
+
+ m_active = false;
+ m_sourceRow = nullptr;
+ m_sourceIndex = -1;
+
+ setVisible(false);
+ resetInsertionParent();
+
+ qApp->changeOverrideCursor(Qt::ArrowCursor);
+ qApp->restoreOverrideCursor();
+ }
+}
+
+
+void RowMover::updateState(int index, int depth, int rawIndex)
+{
+ m_targetIndex = index;
+
+ setPos(20 + depth * 15, (rawIndex + 1) * TimelineConstants::ROW_H);
+ setVisible(true);
+}
+
+// TODO: not used, probably delete
+bool RowMover::isValidMove(int index, RowTree *rowAtIndex)
+{
+ return
+ // not the same row
+ //index != m_currentIndex &&
+
+ // not moving an ancestor into a decendent
+ !rowAtIndex->isDecendentOf(m_sourceRow) &&
+
+ // not at the top of an expanded object with property children
+ (rowAtIndex->childRows().empty()
+ || rowAtIndex->childRows().first()->rowType() != RowType::Property
+ || !rowAtIndex->expanded());
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h
index e36870b9..ca598c6a 100644
--- a/src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,34 +26,42 @@
**
****************************************************************************/
-#ifndef INCLUDED_TIME_CONTEXT_TIMEBAR_ROW_H
-#define INCLUDED_TIME_CONTEXT_TIMEBAR_ROW_H 1
+#ifndef ROWMOVER_H
+#define ROWMOVER_H
-#pragma once
+#include "TimelineConstants.h"
-#include "BaseTimebarlessRow.h"
+#include <QtWidgets/qgraphicsitem.h>
-class CSlideRowUI;
+class RowTree;
-class CSlideTimebarRow : public CBaseTimebarlessRow
+class RowMover : public QGraphicsRectItem
{
public:
- CSlideTimebarRow(CSlideRowUI *inSlideRow);
- virtual ~CSlideTimebarRow();
+ RowMover();
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
- void CommitSelections() override;
+ void start(RowTree *row, int index);
+ void end();
+ void resetInsertionParent(RowTree *newTarget = nullptr);
+ void updateState(int index, int depth, int rawIndex);
- void SelectKeysInRect(CRct inRect, bool inModifierKeyDown) override;
- void SelectKeysByTime(long inTime, bool inSelected) override;
- void SelectAllKeys() override;
+ RowTree *insertionParent() const;
+ RowTree *sourceRow() const;
- void PopulateSnappingList(CSnapper *inSnappingList) override;
- ISnappingListProvider &GetSnappingListProvider() const override;
+ int targetIndex() const;
+ int sourceIndex() const;
+ bool isActive();
+ bool isValidMove(int index, RowTree *rowAtIndex);
+ bool movingDown() const;
-protected:
- CBaseStateRowUI *GetBaseStateRowUI() const override;
-
-protected:
- CSlideRowUI *m_SlideRowUi;
+private:
+ RowTree *m_insertionParent = nullptr; // insertion parent
+ RowTree *m_sourceRow = nullptr; // dragged row
+ int m_targetIndex = -1; // insertion index
+ int m_sourceIndex = -1;
+ bool m_active = false;
};
-#endif // INCLUDED_TIME_CONTEXT_TIMEBAR_ROW_H
+
+#endif // ROWMOVER_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowTypes.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowTypes.h
new file mode 100644
index 00000000..f666c3c2
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowTypes.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 ROWTYPES_H
+#define ROWTYPES_H
+
+#include <qglobal.h>
+
+//namespace timeline {
+
+enum class RowType {
+ Scene = 90,
+ Layer,
+ Camera,
+ Light,
+ Object,
+ Text,
+ Alias,
+ Group,
+ Component,
+ Property
+};
+
+enum class PropertyType {
+ None = 540,
+ Position,
+ Rotation,
+ Scale,
+ Pivot,
+ Opacity,
+ EdgeTessellation,
+ InnerTessellation,
+ TextColor, // Text
+ Leading, // Text
+ Tracking, // Text
+ LightColor, // Light
+ SpecularColor, // Light
+ AmbientColor, // Light
+ Brightness, // Light
+ ShadowDarkness, // Light
+ ShadowSoftness, // Light
+ ShadowDepthBias, // Light
+ ShadowFarClip, // Light
+ ShadowFOV, // Light
+ FieldOfView, // Camera
+ ClippingStart, // Camera
+ ClippingEnd, // Camera
+ Left, // Layer
+ Top, // Layer
+ Width, // Layer
+ Height, // Layer
+ AO, // Layer
+ AODistance, // Layer
+ AOSoftness, // Layer
+ AOThreshold, // Layer
+ AOSamplingRate, // Layer
+ IBLBrightness, // Layer
+ IBLHorizonCutoff, // Layer
+ IBLFOVAngle, // Layer
+ ProbeCrossfade, // Layer
+};
+
+inline uint qHash(RowType key) {
+ return static_cast<uint>(key);
+}
+
+#endif // ROWTYPES_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp
index c9ab2211..ffc3bdc8 100644
--- a/src/Authoring/Studio/Palettes/Timeline/SlideTimebarRow.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,53 +26,52 @@
**
****************************************************************************/
-#include "stdafx.h"
+#include "SelectionRect.h"
+#include "TimelineConstants.h"
+#include "Ruler.h"
-#include "SlideTimebarRow.h"
-#include "SlideRow.h"
-#include "SlideRowUI.h"
+#include <QtGui/qpainter.h>
-CSlideTimebarRow::CSlideTimebarRow(CSlideRowUI *inSlideRow)
- : m_SlideRowUi(inSlideRow)
+SelectionRect::SelectionRect(Ruler *ruler) : m_ruler(ruler)
{
+ setZValue(100);
+ setActive(false);
}
-CSlideTimebarRow::~CSlideTimebarRow()
+void SelectionRect::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
{
+ if (m_active)
+ painter->drawRect(m_rect);
}
-void CSlideTimebarRow::CommitSelections()
+void SelectionRect::start(const QPointF &origin)
{
-}
+ m_rect.setTopLeft(origin);
-void CSlideTimebarRow::SelectKeysInRect(CRct inRect, bool inModifierKeyDown)
-{
- Q_UNUSED(inRect);
- Q_UNUSED(inModifierKeyDown);
+ m_active = true;
}
-void CSlideTimebarRow::SelectKeysByTime(long inTime, bool inSelected)
+void SelectionRect::updateSize(const QPointF &pos)
{
- Q_UNUSED(inTime);
- Q_UNUSED(inSelected);
-}
+ QPointF newPos = pos;
+ if (newPos.x() < m_ruler->x())
+ newPos.setX(m_ruler->x());
-void CSlideTimebarRow::SelectAllKeys()
-{
-}
+ if (newPos.y() < TimelineConstants::ROW_H)
+ newPos.setY(TimelineConstants::ROW_H);
-void CSlideTimebarRow::PopulateSnappingList(CSnapper *inSnapper)
-{
- Q_UNUSED(inSnapper);
+ m_rect.setBottomRight(newPos);
+ setRect(m_rect.normalized());
}
-CBaseStateRowUI *CSlideTimebarRow::GetBaseStateRowUI() const
+void SelectionRect::end()
{
- return m_SlideRowUi;
+ setRect(QRectF());
+ m_active = false;
}
-// This is not applicable to a SlideTimebarRow!!
-ISnappingListProvider &CSlideTimebarRow::GetSnappingListProvider() const
+bool SelectionRect::isActive()
{
- throw;
+ return m_active;
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h
new file mode 100644
index 00000000..36ea3fb7
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/SelectionRect.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 SELECTIONRECT_H
+#define SELECTIONRECT_H
+
+class Ruler;
+
+#include <QtWidgets/qgraphicsitem.h>
+
+class SelectionRect : public QGraphicsRectItem
+{
+public:
+ explicit SelectionRect(Ruler *ruler);
+
+ void start(const QPointF &origin);
+ void updateSize(const QPointF &pos);
+ void end();
+ bool isActive();
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+
+private:
+ Ruler *m_ruler = nullptr;
+ bool m_active = false;
+ QRectF m_rect;
+};
+
+#endif // SELECTIONRECT_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineConstants.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineConstants.h
new file mode 100644
index 00000000..22494a5a
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineConstants.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TIMELINECONSTANTS_H
+#define TIMELINECONSTANTS_H
+
+namespace TimelineConstants
+{
+ // Dimensions
+ const int ROW_H = 20;
+ const int ROW_SPACING = 2;
+ const int RULER_SEC_W = 30; // width of 1 second section (at scale 1)
+ const int RULER_SEC_DIV = 10; // second divisions
+ const int RULER_DIV_H1 = 5; // height of main divisions
+ const int RULER_DIV_H2 = 2; // height of secondary divisions
+ const int RULER_BASE_Y = 18; // baseline Y
+ const int RULER_EDGE_OFFSET = 15;
+ const double LABELS_MIN_W = 160;
+ const double LABELS_MAX_W = 600;
+ const int LABELS_DEFAULT_W = 250;
+ const int SEPARATOR_W = 8;
+ const int PLAYHEAD_W = 14;
+ const int DURATION_HANDLE_W = 14; // width of duration end handles in a timeline row
+
+ // Colors
+ const char ROW_COLOR_NORMAL[] = "#404040";
+ const char ROW_COLOR_NORMAL_PROP[] = "#373737";
+ const char ROW_COLOR_OVER[] = "#4d4d4d";
+ const char ROW_COLOR_SELECTED[] = "#336699";
+ const char ROW_COLOR_DURATION[] = "#66CCFF";
+ const char ROW_COLOR_DURATION_OFF1[] = "#3388B3";
+ const char ROW_COLOR_DURATION_OFF2[] = "#222222";
+ const char ROW_COLOR_DURATION_EDGE[] = "#000000";
+ const char ROW_COLOR_DURATION_SELECTED[] = "#4D99CC";
+ const char ROW_COLOR_MOVE_SRC[] = "#464600";
+ const char ROW_TEXT_COLOR[] = "#bbbbbb";
+ const char PLAYHEAD_COLOR[] = "#ff0066";
+ const char RULER_COLOR[] = "#666666";
+ const char ROW_MOVER_COLOR[] = "#ffff00";
+ const char WIDGET_BG_COLOR[] = "#222222";
+ const char PLAYHEAD_LINE_COLOR[] = "#b20808";
+
+ // TODO: move the colors (and maybe dimensions) to StudioPreferences.
+}
+
+#endif // TIMELINECONSTANTS_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
new file mode 100644
index 00000000..05b7c840
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -0,0 +1,657 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineGraphicsScene.h"
+#include "TimelineItem.h"
+#include "TreeHeader.h"
+#include "Ruler.h"
+#include "Separator.h"
+#include "PlayHead.h"
+#include "RowTree.h"
+#include "RowMover.h"
+#include "RowTimeline.h"
+#include "Separator.h"
+#include "TimelineConstants.h"
+#include "TimelineToolbar.h"
+#include "SelectionRect.h"
+#include "RowManager.h"
+#include "KeyframeManager.h"
+#include "Keyframe.h"
+
+#include <QtWidgets/qcombobox.h>
+#include <QtWidgets/qgraphicssceneevent.h>
+#include <QtWidgets/qgraphicslinearlayout.h>
+#include <QtWidgets/qgraphicswidget.h>
+#include <QtWidgets/qgraphicsview.h>
+#include <QtWidgets/qscrollbar.h>
+#include <QtWidgets/qmenu.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qdebug.h>
+#include <QtWidgets/qaction.h>
+
+TimelineGraphicsScene::TimelineGraphicsScene(QGraphicsView *viewTimelineContent,
+ TimelineWidget *parent)
+ : QGraphicsScene (parent)
+ , m_layoutRoot(new QGraphicsLinearLayout)
+ , m_layoutLabels(new QGraphicsLinearLayout(Qt::Vertical))
+ , m_layoutTimeline(new QGraphicsLinearLayout(Qt::Vertical))
+ , m_separator(new Separator)
+ , m_ruler(new Ruler)
+ , m_playHead(new PlayHead(m_ruler))
+ , m_selectionRect(new SelectionRect(m_ruler))
+ , m_rowMover(new RowMover)
+ , m_widget(parent)
+ , m_viewTimelineContent(viewTimelineContent)
+ , m_widgetRoot(new QGraphicsWidget)
+ , m_rowManager(new RowManager(this, m_layoutLabels, m_layoutTimeline))
+ , m_keyframeManager(new KeyframeManager(this))
+{
+ addItem(m_playHead);
+ addItem(m_selectionRect);
+ addItem(m_rowMover);
+
+ m_rowMover->setVisible(false);
+ m_rowMover->setRect(0, 0, TimelineConstants::LABELS_MIN_W, TimelineConstants::ROW_H-1);
+
+ // TODO: remove
+// m_widgetRoot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
+ addItem(m_widgetRoot);
+
+ m_layoutRoot->setSpacing(0);
+ m_layoutRoot->setContentsMargins(0, 0, 0, 0);
+ m_layoutRoot->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ m_widgetRoot->setLayout(m_layoutRoot);
+
+ m_layoutLabels->setSpacing(0);
+ m_layoutLabels->setContentsMargins(0, 0, 0, 0);
+ m_layoutLabels->setMinimumWidth(TimelineConstants::LABELS_DEFAULT_W);
+ m_layoutLabels->setMaximumWidth(TimelineConstants::LABELS_DEFAULT_W);
+ m_layoutLabels->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+
+ setTimelineScale(m_ruler->timelineScale()); // refresh timeline width
+ m_layoutTimeline->setSpacing(0);
+ m_layoutTimeline->setContentsMargins(0, 0, 0, 0);
+ m_layoutTimeline->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
+
+ m_layoutRoot->addItem(m_layoutLabels);
+ m_layoutRoot->addItem(m_separator);
+ m_layoutRoot->addItem(m_layoutTimeline);
+
+ m_layoutLabels->addItem(new TreeHeader);
+ m_layoutTimeline->addItem(m_ruler);
+
+ QTimer::singleShot(0, this, [this]() {
+ m_playHead->setPosition(0);
+ });
+
+ connect(m_ruler, &Ruler::rulerClicked, [this](const double &posX) {
+ m_playHead->setPosition(posX);
+ m_widget->toolbar()->setTime(m_playHead->time());
+ });
+
+ m_sceneRow = m_rowManager->createRow(RowType::Scene);
+
+// add some test rows
+ // TODO: remove after connecting the view to the app data model
+ RowTree *layer1 = m_rowManager->createRow(RowType::Layer, m_sceneRow, tr("layer 1"));
+ RowTree *layer2 = m_rowManager->createRow(RowType::Layer, m_sceneRow, tr("layer 2"));
+
+ RowTree *obj1 = m_rowManager->createRow(RowType::Object, layer1, tr("Cone"));
+ RowTree *group1= m_rowManager->createRow(RowType::Group, layer1, tr("group 1"));
+ RowTree *cam = m_rowManager->createRow(RowType::Camera, layer1, tr("cam 1"));
+ RowTree *light = m_rowManager->createRow(RowType::Light, layer2);
+ RowTree *obj2 = m_rowManager->createRow(RowType::Object, layer1, tr("Cube"));
+
+ RowTree *alias = m_rowManager->createRow(RowType::Alias, layer2);
+ RowTree *comp = m_rowManager->createRow(RowType::Component, layer2);
+ RowTree *group2= m_rowManager->createRow(RowType::Group, comp, tr("group 2"));
+ RowTree *obj3 = m_rowManager->createRow(RowType::Object, comp, tr("Sphere"));
+ RowTree *cam2 = m_rowManager->createRow(RowType::Camera, group2, tr("cam 2"));
+ RowTree *obj4 = m_rowManager->createRow(RowType::Object, group2, tr("Cylinder"));
+ RowTree *text = m_rowManager->createRow(RowType::Text, group2);
+
+ // properties
+ RowTree *prop1 = m_rowManager->getOrCreatePropertyRow(PropertyType::Scale, cam);
+ RowTree *prop2 = m_rowManager->getOrCreatePropertyRow(PropertyType::Opacity, obj2);
+ RowTree *prop3 = m_rowManager->getOrCreatePropertyRow(PropertyType::Position, obj3);
+ RowTree *prop4 = m_rowManager->getOrCreatePropertyRow(PropertyType::Rotation, obj3);
+ RowTree *prop5 = m_rowManager->getOrCreatePropertyRow(PropertyType::Rotation, obj3);
+
+ // keyframes
+ m_keyframeManager->insertKeyframe(prop1->rowTimeline(), 5, 7);
+ m_keyframeManager->insertKeyframe(prop1->rowTimeline(), 3, 52);
+ m_keyframeManager->insertKeyframe(prop2->rowTimeline(), 12, 34);
+ m_keyframeManager->insertKeyframe(prop3->rowTimeline(), 4.5, 6);
+ m_keyframeManager->deselectAllKeyframes();
+}
+
+void TimelineGraphicsScene::setTimelineScale(int scl)
+{
+ m_ruler->setTimelineScale(scl);
+ m_playHead->updatePosition();
+
+ m_layoutTimeline->setMinimumWidth(TimelineConstants::RULER_EDGE_OFFSET * 2
+ + m_ruler->duration() * TimelineConstants::RULER_SEC_W * scl);
+ m_layoutTimeline->setMaximumWidth(TimelineConstants::RULER_EDGE_OFFSET * 2
+ + m_ruler->duration() * TimelineConstants::RULER_SEC_W * scl);
+
+ for (int i = 1; i < m_layoutTimeline->count(); i++)
+ static_cast<RowTimeline *>(m_layoutTimeline->itemAt(i)->graphicsItem())->updatePosition();
+}
+
+void TimelineGraphicsScene::addNewLayer()
+{
+ RowTree *newLayer = m_rowManager->createRow(RowType::Layer, m_sceneRow);
+
+ m_rowManager->selectRow(newLayer);
+
+ // scroll to top
+ m_viewTimelineContent->verticalScrollBar()->setValue(0);
+}
+
+// TODO: test function, to be removed
+void debugPrintRows(RowTree *row)
+{
+ qDebug().noquote().nospace() << "|" << QString("-").repeated(row->depth()) << row->label();
+
+ if (!row->empty()) {
+ for (auto child : row->childRows())
+ debugPrintRows(child);
+ }
+}
+
+void TimelineGraphicsScene::deleteSelectedRow() {
+ // TODO: test code, to be removed
+// MainRowLabel *row_i = nullptr;
+// for (int i = 1; i < m_layoutLabels->count(); ++i)
+// {
+// row_i = static_cast<MainRowLabel *>(m_layoutLabels->itemAt(i)->graphicsItem());
+// qDebug().noquote().nospace() << "|" << QString("-").repeated(row_i->depth()) << row_i->label();
+// }
+// qDebug() << "------------------------------";
+
+ debugPrintRows(m_sceneRow);
+
+// m_rowManager->deleteRow(m_rowManager->selectedRow());
+}
+
+void TimelineGraphicsScene::commitMoveRows()
+{
+ int sourceIndex = m_rowMover->sourceIndex();
+ int targetIndex = m_rowMover->targetIndex();
+ int rowSrcDepth = m_rowMover->sourceRow()->depth();
+
+ // same place, abort
+ if ((sourceIndex == targetIndex || sourceIndex == targetIndex + 1)
+ && m_rowMover->sourceRow()->parentRow() == m_rowMover->insertionParent()) {
+ return;
+ }
+
+ // TODO: remove
+// qDebug() << "sourceIndex=" << sourceIndex << ", targetIndex=" << targetIndex << ", rowSrcDepth=" << rowSrcDepth;
+
+ // gather the rows to be moved
+ RowTree *row_i = nullptr;
+ QList<RowTree *> itemsToMove { m_rowMover->sourceRow() };
+ for (int i = sourceIndex + 1; i < m_layoutLabels->count();) {
+ row_i = static_cast<RowTree *>(m_layoutLabels->itemAt(i)->graphicsItem());
+
+ // TODO: remove
+// qDebug() << "i=" << i << ", row_i->depth()=" << row_i->depth();
+
+ if (row_i->depth() <= rowSrcDepth)
+ break;
+
+ m_layoutLabels->removeAt(i);
+ m_layoutTimeline->removeAt(i);
+ itemsToMove.append(row_i);
+ }
+
+ m_rowMover->insertionParent()->addChild(m_rowMover->sourceRow());
+
+ // TODO: remove
+// qDebug() << "itemsToMove.count()=" << itemsToMove.count();
+
+ // commit the move
+ if (m_rowMover->movingDown())
+ targetIndex -= itemsToMove.count();
+
+ for (auto child : qAsConst(itemsToMove)) {
+ ++targetIndex;
+ m_layoutLabels->insertItem(targetIndex, child);
+ m_layoutTimeline->insertItem(targetIndex, child->rowTimeline());
+ }
+}
+
+void TimelineGraphicsScene::getLastChildRow(RowTree *row, int index, RowTree *outLastChild,
+ RowTree *outNextSibling, int &outLastChildIndex) const
+{
+ if (row != nullptr) {
+ RowTree *row_i = nullptr;
+ RowTree *row_i_prev = nullptr;
+ for (int i = index + 1; i < m_layoutLabels->count() - 1; ++i) {
+ row_i = static_cast<RowTree *>(m_layoutLabels->itemAt(i)->graphicsItem());
+
+ if (row_i->depth() <= row->depth()) {
+ outLastChild = row_i_prev;
+ outNextSibling = row_i;
+ outLastChildIndex = i-1;
+ return;
+ }
+
+ row_i_prev = row_i;
+ }
+ }
+
+ outLastChild = nullptr;
+ outNextSibling = nullptr;
+ outLastChildIndex = -1;
+}
+
+// TODO: not used, remove
+bool TimelineGraphicsScene::lastRowInAParent(RowTree *rowAtIndex, int index)
+{
+ int depth = nextRowDepth(index);
+
+ return depth == -1 || depth < rowAtIndex->depth();
+}
+
+// not used except in lastRowInAParent()
+int TimelineGraphicsScene::nextRowDepth(int index) {
+ if (index < m_layoutLabels->count() - 1)
+ index ++;
+
+ return static_cast<RowTree *>(m_layoutLabels->itemAt(index)->graphicsItem())->depth();
+}
+
+bool TimelineGraphicsScene::validLayerMove(RowTree *rowAtIndex, RowTree *nextRowAtIndex)
+{
+ // we don't care about non-layers in this method
+ if (m_rowMover->sourceRow()->rowType() != RowType::Layer)
+ return true;
+
+ if (rowAtIndex->rowType() == RowType::Scene)
+ return true;
+
+ if (rowAtIndex->rowType() == RowType::Layer)
+ return rowAtIndex->empty() || !rowAtIndex->expanded();
+
+ if (nextRowAtIndex == nullptr || (nextRowAtIndex->depth() <= rowAtIndex->depth()
+ && nextRowAtIndex->depth() == 2))
+ return true;
+
+ return false;
+}
+
+void TimelineGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ m_dragging = false;
+ m_pressPos = event->scenePos();
+ QGraphicsItem *item = itemAt(m_pressPos, QTransform());
+ if (item != nullptr) {
+ // select next item below playhead
+ if (item->type() == TimelineItem::TypePlayHead)
+ item = items(m_pressPos).at(1);
+
+ if (item->type() == TimelineItem::TypeSeparator) {
+ m_separatorPressed = true;
+ } else if (item->type() == TimelineItem::TypeRuler) {
+ m_rulerPressed = true;
+ } else if (item->type() == TimelineItem::TypeRowTree) {
+ RowTree *rowLabel = static_cast<RowTree *>(item);
+
+ if (rowLabel->rowType() != RowType::Property) {
+ if (!rowLabel->handleButtonsClick(event)) {
+ // dragging layers to reorder
+ int index = event->scenePos().y() / TimelineConstants::ROW_H;
+ m_rowManager->correctIndex(index);
+
+ if (rowLabel->rowType() != RowType::Scene
+ && rowLabel->rowType() != RowType::Property) {
+ m_rowMover->start(rowLabel, index);
+ }
+ }
+ }
+ } else if (item->type() == TimelineItem::TypeRowTimeline) {
+ m_editedTimelineRow = static_cast<RowTimeline *>(item);
+ Keyframe *keyframe = m_editedTimelineRow->getClickedKeyframe(m_pressPos);
+ if (keyframe != nullptr) { // pressed a keyframe
+ const bool ctrlKeyDown = event->modifiers() & Qt::ControlModifier;
+
+ if (ctrlKeyDown && keyframe->selected) {
+ m_keyframeManager->deselectKeyframe(keyframe);
+ } else {
+ if (!ctrlKeyDown && !keyframe->selected)
+ m_keyframeManager->deselectAllKeyframes();
+
+ m_keyframeManager->selectKeyframe(keyframe);
+ m_keyframePressed = true;
+ }
+ } else {
+ m_keyframeManager->deselectAllKeyframes();
+ m_clickedTimelineControlType =
+ m_editedTimelineRow->getClickedControl(m_pressPos);
+
+ // clicked an empty spot on a timeline row, start selection rect.
+ if (m_editedTimelineRow->getClickedControl(m_pressPos) == RowTimeline::TypeNone)
+ m_selectionRect->start(m_pressPos);
+ }
+ }
+ } else {
+ if (m_pressPos.x() > m_separator->x() && m_pressPos.y() > TimelineConstants::ROW_H)
+ m_selectionRect->start(m_pressPos);
+ }
+ }
+
+ QGraphicsScene::mousePressEvent(event);
+}
+
+void TimelineGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (qAbs(event->scenePos().x() - m_pressPos.x()) > 10
+ || qAbs(event->scenePos().y() - m_pressPos.y()) > 10)
+ m_dragging = true;
+
+ if (m_rulerPressed) {
+ m_playHead->setPosition(event->scenePos().x() - m_ruler->pos().x());
+ m_widget->toolbar()->setTime(m_playHead->time());
+ } else if (m_dragging) {
+ if (m_separatorPressed) { // resizing labels part
+ double x = event->scenePos().x() - m_separator->size().width() * .5;
+ x = qBound(TimelineConstants::LABELS_MIN_W, x, TimelineConstants::LABELS_MAX_W);
+ m_layoutLabels->setMinimumWidth(x);
+ m_layoutLabels->setMaximumWidth(x);
+ m_rowMover->setRect(0, -5, x, 10);
+
+ m_playHead->updatePosition();
+ } else if (m_clickedTimelineControlType == RowTimeline::TypeStartHandle) {
+ // resizing layer timline duration from left
+ m_editedTimelineRow->setStartX(event->scenePos().x() - m_ruler->pos().x());
+ } else if (m_clickedTimelineControlType == RowTimeline::TypeEndHandle) {
+ // resizing layer timline duration from right
+ m_editedTimelineRow->setEndX(event->scenePos().x() - m_ruler->pos().x());
+ } else if (m_clickedTimelineControlType == RowTimeline::TypeDuration) {
+ // moving layer timline duration
+ m_editedTimelineRow->moveDurationBy(event->scenePos().x() - m_pressPos.x());
+ m_pressPos = event->scenePos();
+ } else if (m_selectionRect->isActive()) {
+ // resizing keyframe selection rect
+ m_selectionRect->updateSize(event->scenePos());
+ m_keyframeManager->selectKeyframesInRect(m_selectionRect->rect());
+ } else if (m_rowMover->isActive()) {
+ // moving rows vertically (reorder/reparent)
+ int indexRaw = qRound(event->scenePos().y() / TimelineConstants::ROW_H) - 1;
+ int index = indexRaw;
+ m_rowManager->correctIndex(index);
+ bool valid = index != -1;
+
+ RowTree *rowAtIndex;
+ RowTree *nextRowAtIndex;
+ RowTree *lastChildAtIndex; // so far not used
+
+ if (valid) { // valid row index
+ rowAtIndex = static_cast<RowTree *>(m_layoutLabels->itemAt(index)->graphicsItem());
+ nextRowAtIndex = index > m_layoutLabels->count() - 2 ? nullptr :
+ static_cast<RowTree *>(m_layoutLabels->itemAt(index + 1)->graphicsItem());
+
+ if (!rowAtIndex->expanded())
+ getLastChildRow(rowAtIndex, index, lastChildAtIndex, nextRowAtIndex, index);
+
+ // not moving an ancestor into a decendent
+ valid = !rowAtIndex->isDecendentOf(m_rowMover->sourceRow())
+
+ // not inserting next to property rows
+ && !(nextRowAtIndex != nullptr
+ && nextRowAtIndex->rowType() == RowType::Property)
+
+ // not inserting as a first child of self
+ && !(rowAtIndex == m_rowMover->sourceRow() && !rowAtIndex->empty())
+
+ // not inserting non-layer under the scene
+ && !(m_rowMover->sourceRow()->rowType() != RowType::Layer
+ && rowAtIndex->rowType() == RowType::Scene)
+
+ // Layer cases
+ && validLayerMove(rowAtIndex, nextRowAtIndex);
+ }
+
+ if (valid) {
+ // calc insertion depth
+ int depth = rowAtIndex->depth();
+ int depthNextRow = nextRowAtIndex != nullptr ? nextRowAtIndex->depth() : 3;
+ int depthBasedOnX = (event->scenePos().x() - 20) / 15;
+
+ if (rowAtIndex->isContainer() && rowAtIndex->expanded()
+ && rowAtIndex != m_rowMover->sourceRow()) {
+ depth++; // Container: allow insertion as a child
+ } else if (rowAtIndex->rowType() == RowType::Property) {
+ depth--; // Property: prevent insertion as a sibling
+ }
+
+ depthBasedOnX = qMax(depthBasedOnX, depthNextRow);
+ depth = qBound(3, depth, depthBasedOnX);
+
+ if (m_rowMover->sourceRow()->rowType() == RowType::Layer)
+ depth = 2;
+
+ // calc insertion parent
+ RowTree *insertParent = rowAtIndex;
+ for (int i = rowAtIndex->depth(); i >= depth; --i)
+ insertParent = insertParent->parentRow();
+
+ m_rowMover->resetInsertionParent(insertParent);
+ m_rowMover->updateState(index, depth, indexRaw);
+ }
+
+ if (!valid) {
+ m_rowMover->setVisible(false);
+ m_rowMover->resetInsertionParent();
+ }
+ } else if (m_keyframePressed) { // moving selected keyframes
+ QPointF scenePos = event->scenePos();
+
+ if (scenePos.x() < m_ruler->durationStartX())
+ scenePos.setX(m_ruler->durationStartX());
+ else if (scenePos.x() > m_ruler->durationEndX())
+ scenePos.setX(m_ruler->durationEndX());
+
+ m_keyframeManager->moveSelectedKeyframes(scenePos.x() - m_pressPos.x());
+
+ m_pressPos = scenePos;
+ }
+ }
+
+ QGraphicsScene::mouseMoveEvent(event);
+}
+
+void TimelineGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton) {
+ QGraphicsItem *item = itemAt(event->scenePos(), QTransform());
+
+ if (item != nullptr && !m_dragging && (item->type() == TimelineItem::TypeRowTree
+ || item->type() == TimelineItem::TypeRowTimeline)) {
+ // select row
+ if (item->type() == TimelineItem::TypeRowTree)
+ m_rowManager->selectRow( static_cast<RowTree *>(item) );
+ else if (item->type() == TimelineItem::TypeRowTimeline)
+ m_rowManager->selectRow( static_cast<RowTimeline *>(item)->rowTree() );
+ } else if (m_rowMover->isActive()) { // moving rows (reorder/reparent)
+ if (m_rowMover->insertionParent() != nullptr) // valid row move, commit it
+ commitMoveRows();
+ }
+
+ // reset mouse drag params
+ m_selectionRect->end();
+ m_rowMover->end();
+ m_separatorPressed = false;
+ m_rulerPressed = false;
+ m_dragging = false;
+ m_clickedTimelineControlType = RowTimeline::TypeNone;
+ m_keyframePressed = false;
+ m_editedTimelineRow = nullptr;
+ }
+
+ QGraphicsScene::mouseReleaseEvent(event);
+}
+
+void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ QGraphicsScene::mouseDoubleClickEvent(event);
+}
+
+void TimelineGraphicsScene::keyPressEvent(QKeyEvent *keyEvent)
+{
+ bool ctrl = keyEvent->modifiers() & Qt::ControlModifier;
+
+ if (keyEvent->key() == Qt::Key_Delete) {
+ m_keyframeManager->deleteSelectedKeyframes();
+ } else if (keyEvent->key() == Qt::Key_C && ctrl) { // Ctrl+C
+ m_keyframeManager->copySelectedKeyframes();
+ } else if (keyEvent->key() == Qt::Key_X && ctrl) { // Ctrl+X
+ if (m_keyframeManager->oneMasterRowSelected()) { // must be from a single master row
+ m_keyframeManager->copySelectedKeyframes();
+ m_keyframeManager->deleteSelectedKeyframes();
+ }
+ } else if (keyEvent->key() == Qt::Key_V && ctrl) { // Ctrl+V
+ if (m_rowManager->selectedRow() != nullptr)
+ m_keyframeManager->pasteKeyframes(m_rowManager->selectedRow()->rowTimeline());
+ }
+
+ QGraphicsScene::keyPressEvent(keyEvent);
+}
+
+void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
+{
+ QGraphicsScene::keyReleaseEvent(keyEvent);
+}
+
+void TimelineGraphicsScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
+{
+ QMenu contextMenu;
+
+ int index = event->scenePos().y() / TimelineConstants::ROW_H;
+
+ RowTimeline *row = rowManager()->rowTimelineAt(index);
+
+ if (row != nullptr) { // timeline context menu
+ Keyframe *keyframe = row->getClickedKeyframe(event->scenePos());
+ bool propRow = row->rowTree()->rowType() == RowType::Property;
+ bool hasPropRows = row->rowTree()->hasPropertyChildren();
+ bool ctrlPressed = event->modifiers() & Qt::ControlModifier;
+
+ //TODO: remove
+// qDebug() << "index=" << index;
+// qDebug() << "keyframe=" << (keyframe != nullptr);
+// qDebug() << "propRow=" << propRow;
+// qDebug() << "hasPropRows=" << hasPropRows;
+// qDebug() << "---------------------";
+
+ if (keyframe) {
+ if (!keyframe->selected && !ctrlPressed)
+ m_keyframeManager->deselectAllKeyframes();
+
+ m_keyframeManager->selectKeyframe(keyframe);
+ } else {
+ m_keyframeManager->deselectAllKeyframes();
+ }
+
+ auto actionInsertKeyframe = contextMenu.addAction(QObject::tr("Insert Keyframe"));
+ auto actionCutSelectedKeyframes =
+ contextMenu.addAction(QObject::tr("Cut Selected Keyframe"));
+ auto actionCopySelectedKeyframes =
+ contextMenu.addAction(QObject::tr("Copy Selected Keyframe"));
+ auto actionPasteKeyframes = contextMenu.addAction(QObject::tr("Paste Keyframes"));
+ auto actionDeleteSelectedKeyframes =
+ contextMenu.addAction(QObject::tr("Delete Selected Keyframe"));
+ auto actionDeleteRowKeyframes =
+ contextMenu.addAction(QObject::tr(propRow ? "Delete All Property Keyframes"
+ : "Delete All Channel Keyframes"));
+
+ actionInsertKeyframe ->setEnabled(!keyframe && (propRow || hasPropRows));
+ actionCutSelectedKeyframes ->setEnabled(m_keyframeManager->oneMasterRowSelected());
+ actionCopySelectedKeyframes ->setEnabled(m_keyframeManager->oneMasterRowSelected());
+ actionPasteKeyframes ->setEnabled(m_keyframeManager->hasCopiedKeyframes());
+ actionDeleteSelectedKeyframes->setEnabled(m_keyframeManager->hasSelectedKeyframes());
+ actionDeleteRowKeyframes ->setEnabled(!row->keyframes().empty());
+
+ // connections
+ connect(actionInsertKeyframe, &QAction::triggered, this, [=]() {
+ m_keyframeManager->insertKeyframe(row, m_playHead->time(), 0);
+ });
+
+ connect(actionCutSelectedKeyframes, &QAction::triggered, this, [=]() {
+ m_keyframeManager->copySelectedKeyframes();
+ m_keyframeManager->deleteSelectedKeyframes();
+ });
+
+ connect(actionCopySelectedKeyframes, &QAction::triggered, this, [=]() {
+ m_keyframeManager->copySelectedKeyframes();
+ });
+
+ connect(actionPasteKeyframes, &QAction::triggered, this, [=]() {
+ m_keyframeManager->pasteKeyframes(row);
+ });
+
+ connect(actionDeleteSelectedKeyframes, &QAction::triggered, this, [=]() {
+ m_keyframeManager->deleteSelectedKeyframes();
+ });
+
+ connect(actionDeleteRowKeyframes, &QAction::triggered, this, [=]() {
+ m_keyframeManager->deleteKeyframes(row);
+ });
+ }
+
+ contextMenu.exec(event->screenPos());
+}
+
+bool TimelineGraphicsScene::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::ShortcutOverride:
+ if (static_cast<QKeyEvent *>(event)->key() == Qt::Key_Delete) {
+ QGraphicsScene::keyPressEvent(static_cast<QKeyEvent *>(event));
+ event->accept();
+ return true;
+ }
+ Q_FALLTHROUGH();
+
+ default:
+ return QGraphicsScene::event(event);
+ }
+}
+
+Ruler *TimelineGraphicsScene::ruler() const { return m_ruler; }
+PlayHead *TimelineGraphicsScene::playHead() const { return m_playHead; }
+Separator *TimelineGraphicsScene::separator() const { return m_separator; }
+RowManager *TimelineGraphicsScene::rowManager() const { return m_rowManager; }
+QGraphicsWidget *TimelineGraphicsScene::widgetRoot() const { return m_widgetRoot; }
+KeyframeManager *TimelineGraphicsScene::keyframeManager() const { return m_keyframeManager; }
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
new file mode 100644
index 00000000..a50e2bbd
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TIMELINEGRAPHICSSCENE_H
+#define TIMELINEGRAPHICSSCENE_H
+
+#include "TimelineWidget.h"
+#include "RowTimeline.h"
+#include "RowTypes.h"
+
+#include <QtWidgets/qgraphicsscene.h>
+
+class Separator;
+class Ruler;
+class PlayHead;
+class TimelineItem;
+class RowTree;
+class SelectionRect;
+class RowMover;
+class RowManager;
+class KeyframeManager;
+struct Keyframe;
+
+QT_FORWARD_DECLARE_CLASS(QGraphicsLinearLayout)
+QT_FORWARD_DECLARE_CLASS(QGraphicsView)
+
+class TimelineGraphicsScene : public QGraphicsScene
+{
+ Q_OBJECT
+
+public:
+ explicit TimelineGraphicsScene(QGraphicsView *viewTimelineContent, TimelineWidget *parent);
+
+ void setTimelineScale(int scale);
+ void addNewLayer();
+ void deleteSelectedRow();
+ Ruler *ruler() const;
+ PlayHead *playHead() const;
+ Separator *separator() const;
+ RowManager *rowManager() const;
+ QGraphicsWidget *widgetRoot() const;
+ KeyframeManager *keyframeManager() const;
+
+protected:
+ bool event(QEvent *event) override;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
+
+ void keyPressEvent(QKeyEvent *keyEvent) override;
+ void keyReleaseEvent(QKeyEvent *keyEvent) override;
+
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
+
+private:
+ void getLastChildRow(RowTree *row, int index, RowTree *outLastChild, RowTree *outNextSibling,
+ int &outLastChildIndex) const;
+ void commitMoveRows();
+ int nextRowDepth(int index);
+ bool lastRowInAParent(RowTree *rowAtIndex, int index);
+ bool validLayerMove(RowTree *rowAtIndex, RowTree *nextRowAtIndex);
+
+ QGraphicsLinearLayout *m_layoutRoot;
+ QGraphicsLinearLayout *m_layoutLabels;
+ QGraphicsLinearLayout *m_layoutTimeline;
+
+ Separator *m_separator;
+ Ruler *m_ruler;
+ PlayHead *m_playHead;
+ TimelineWidget *m_widget;
+ QGraphicsWidget *m_widgetRoot;
+ QGraphicsView *m_viewTimelineContent;
+ RowMover *m_rowMover = nullptr;
+ RowTree *m_sceneRow = nullptr;
+ RowTimeline *m_editedTimelineRow = nullptr;
+ SelectionRect *m_selectionRect;
+ RowManager *m_rowManager = nullptr;
+ KeyframeManager *m_keyframeManager = nullptr;
+ QPointF m_pressPos;
+
+ bool m_separatorPressed = false;
+ bool m_rulerPressed = false;
+ bool m_keyframePressed = false;
+ bool m_dragging = false;
+ int m_clickedTimelineControlType = RowTimeline::TypeNone;
+
+};
+
+#endif // TIMELINEGRAPHICSSCENE_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.cpp
new file mode 100644
index 00000000..4c9a0bf8
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineUtils.h"
+
+TimelineUtils::TimelineUtils()
+{
+ // TODO: delete if not needed by the end of the timeline task
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.h
new file mode 100644
index 00000000..fd5889a1
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineUtils.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TIMELINEUTILS_H
+#define TIMELINEUTILS_H
+
+
+class TimelineUtils
+{
+public:
+ TimelineUtils();
+};
+
+#endif // TIMELINEUTILS_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.cpp
new file mode 100644
index 00000000..08dc3984
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineViewGV.h"
+
+TimelineViewGV::TimelineViewGV(QWidget *parent)
+{
+ // TODO: to be deleted, not really useful
+}
+
+TimelineViewGV::~TimelineViewGV()
+{
+
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideRowUI.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.h
index a684cd06..1beedcf4 100644
--- a/src/Authoring/Studio/Palettes/Timeline/SlideRowUI.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineViewGV.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -25,23 +25,22 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef SLIDEROWUI_H
-#define SLIDEROWUI_H
-#include "BaseStateRowUI.h"
+#ifndef TIMELINEVIEWGV_H
+#define TIMELINEVIEWGV_H
-class CSlideRowUI : public CBaseStateRowUI
+#include "TimelineWidget.h"
+
+class TimelineViewGV : public QObject
{
Q_OBJECT
-public:
- CSlideRowUI(CBaseStateRow *baseStateRow, CAbstractTimelineRowUI *parentUiRow);
- CSlideRowUI(ITimelineItemBinding *inTimelineItem);
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider) override;
- ISnappingListProvider *GetSnappingListProvider() const override;
+public:
+ explicit TimelineViewGV(QWidget *parent = nullptr);
+ ~TimelineViewGV();
- CBaseTimebarlessRow *CreateTimebarRow() override;
+private:
+ TimelineWidget *m_timelineWidget = nullptr;
};
-#endif // SLIDEROWUI_H
+#endif // TIMELINEVIEWGV_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
new file mode 100644
index 00000000..152f40b0
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineWidget.h"
+#include "TimelineGraphicsScene.h"
+#include "TimelineConstants.h"
+#include "TimelineToolbar.h"
+#include "PlayHead.h"
+#include "Ruler.h"
+#include "Separator.h"
+#include "StudioApp.h"
+#include "Core.h"
+#include "Doc.h"
+
+#include <QtWidgets/qgraphicssceneevent.h>
+#include <QtWidgets/qgraphicslinearlayout.h>
+#include <QtWidgets/qgraphicsview.h>
+#include <QtWidgets/qboxlayout.h>
+#include <QtWidgets/qscrollbar.h>
+#include <QtWidgets/qslider.h>
+#include <QtWidgets/qsplitter.h>
+#include <QtWidgets/qlabel.h>
+
+class Eventfilter : public QObject {
+public:
+ Eventfilter(QObject *parent) : QObject(parent) {}
+
+ bool eventFilter(QObject *, QEvent *event) override {
+ if (event->type() == QEvent::Wheel) {
+ event->accept();
+ return true;
+ }
+
+ return false;
+ }
+};
+
+TimelineWidget::TimelineWidget(QWidget *parent)
+ : QWidget()
+ , m_toolbar(new TimelineToolbar())
+ , m_viewTreeHeader(new QGraphicsView(this))
+ , m_viewTreeContent(new QGraphicsView(this))
+ , m_viewTimelineHeader(new QGraphicsView(this))
+ , m_viewTimelineContent(new QGraphicsView(this))
+ , m_graphicsScene(new TimelineGraphicsScene(m_viewTimelineContent, this)) {
+ setWindowTitle(tr("Timeline", "Title of timeline view"));
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+ QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ sizePolicy1.setHorizontalStretch(0);
+ sizePolicy1.setVerticalStretch(0);
+ sizePolicy1.setHeightForWidth(m_viewTimelineContent->sizePolicy().hasHeightForWidth());
+
+ m_viewTimelineHeader->setScene(m_graphicsScene);
+ m_viewTimelineHeader->setFixedHeight(TimelineConstants::ROW_H);
+ m_viewTimelineHeader->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ m_viewTimelineHeader->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_viewTimelineHeader->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_viewTimelineHeader->viewport()->installEventFilter(new Eventfilter(this));
+ m_viewTimelineHeader->viewport()->setFocusPolicy(Qt::NoFocus);
+
+ m_viewTimelineContent->setScene(m_graphicsScene);
+ m_viewTimelineContent->setSizePolicy(sizePolicy1);
+ m_viewTimelineContent->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ m_viewTimelineContent->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+
+ m_viewTreeHeader->setScene(m_graphicsScene);
+ m_viewTreeHeader->setFixedHeight(TimelineConstants::ROW_H);
+ m_viewTreeHeader->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ m_viewTreeHeader->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_viewTreeHeader->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_viewTreeHeader->viewport()->installEventFilter(new Eventfilter(this));
+ m_viewTreeHeader->viewport()->setFocusPolicy(Qt::NoFocus);
+
+ m_viewTreeContent->setScene(m_graphicsScene);
+ m_viewTreeContent->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ m_viewTreeContent->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_viewTreeContent->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ setStyleSheet(QStringLiteral("background-color:%1;").arg(TimelineConstants::WIDGET_BG_COLOR));
+
+ auto *layoutTree = new QVBoxLayout;
+ layoutTree->setContentsMargins(QMargins(0, 0, 0, 0));
+ layoutTree->addWidget(m_viewTreeHeader);
+ layoutTree->addWidget(m_viewTreeContent);
+
+ auto *layoutTimeline = new QVBoxLayout;
+ layoutTimeline->setContentsMargins(QMargins(0, 0, 0, 0));
+ layoutTimeline->addWidget(m_viewTimelineHeader);
+ layoutTimeline->addWidget(m_viewTimelineContent);
+
+ auto *layoutContent = new QHBoxLayout;
+ layoutContent->setContentsMargins(QMargins(0, 0, 0, 10));
+ layoutContent->addLayout(layoutTree);
+ layoutContent->addLayout(layoutTimeline);
+
+ auto *widgetLayout = new QVBoxLayout;
+ widgetLayout->setContentsMargins(0, 0, 0, 0);
+ widgetLayout->setSpacing(0);
+ widgetLayout->addLayout(layoutContent);
+ widgetLayout->addWidget(m_toolbar);
+ setLayout(widgetLayout);
+
+ // connections
+ connect(m_graphicsScene->widgetRoot(), &QGraphicsWidget::geometryChanged, this, [this]() {
+ // TODO: work in progress
+ qDebug() << "geometryChanged";
+ qDebug() << m_graphicsScene->widgetRoot()->rect();
+ m_viewTimelineHeader->setSceneRect(m_graphicsScene->widgetRoot()->rect().adjusted(
+ m_graphicsScene->ruler()->x(), 0, 0, 0));
+
+ m_viewTimelineContent->setSceneRect(m_graphicsScene->widgetRoot()->rect().adjusted(
+ m_graphicsScene->ruler()->x(),
+ TimelineConstants::ROW_H, 0, 0));
+
+ m_viewTreeContent->setSceneRect(QRectF(
+ 0, TimelineConstants::ROW_H,
+ m_graphicsScene->ruler()->x(), 0));
+
+ m_graphicsScene->playHead()->setHeight(m_graphicsScene->widgetRoot()->geometry().height());
+
+ m_viewTreeHeader->setFixedWidth(m_graphicsScene->ruler()->x());
+ m_viewTreeContent->setFixedWidth(m_graphicsScene->ruler()->x());
+ });
+
+ // connect timeline and ruler horizontalScrollBars
+ connect(m_viewTimelineContent->horizontalScrollBar(), &QAbstractSlider::valueChanged, this,
+ [this](int value) {
+ m_viewTimelineHeader->horizontalScrollBar()->setValue(value);
+ });
+
+ // connect timeline and tree verticalScrollBars
+ connect(m_viewTimelineContent->verticalScrollBar(), &QAbstractSlider::valueChanged, this,
+ [this](int value) {
+ m_viewTreeContent->verticalScrollBar()->setValue(value);
+ });
+
+ // connect tree and timeline verticalScrollBars
+ connect(m_viewTreeContent->verticalScrollBar(), &QAbstractSlider::valueChanged, this,
+ [this](int value) {
+ m_viewTimelineContent->verticalScrollBar()->setValue(value);
+ });
+
+ // connect tree and tree header horizontalScrollBars
+ connect(m_viewTreeContent->horizontalScrollBar(), &QAbstractSlider::valueChanged, this,
+ [this](int value) {
+ m_viewTreeHeader->horizontalScrollBar()->setValue(value);
+ });
+
+ connect(m_toolbar, &TimelineToolbar::newLayerTriggered, this, [this]() {
+ m_graphicsScene->addNewLayer();
+ });
+
+ connect(m_toolbar, &TimelineToolbar::deleteLayerTriggered, this, [this]() {
+ m_graphicsScene->deleteSelectedRow();
+ });
+
+ connect(m_toolbar, &TimelineToolbar::gotoTimeTriggered, this, [this]() {
+ // TODO: implement
+ });
+
+ connect(m_toolbar, &TimelineToolbar::firstFrameTriggered, this, [this]() {
+ m_graphicsScene->playHead()->setTime(0);
+ m_toolbar->setTime(0);
+ g_StudioApp.GetCore()->GetDoc()->NotifyTimeChanged(0);
+ });
+
+ connect(m_toolbar, &TimelineToolbar::stopTriggered, this, [this]() {
+ g_StudioApp.PlaybackStop();
+ });
+
+ connect(m_toolbar, &TimelineToolbar::playTriggered, this, [this]() {
+ g_StudioApp.PlaybackPlay();
+ });
+
+ connect(m_toolbar, &TimelineToolbar::lastFrameTriggered, this, [this]() {
+ double dur = m_graphicsScene->ruler()->duration();
+ m_graphicsScene->playHead()->setTime(dur);
+ m_toolbar->setTime(dur);
+ g_StudioApp.GetCore()->GetDoc()->NotifyTimeChanged(dur);
+ });
+
+ connect(m_toolbar, &TimelineToolbar::timelineScaleChanged, this, [this](int scale) {
+ m_graphicsScene->setTimelineScale(scale);
+ });
+}
+
+TimelineToolbar *TimelineWidget::toolbar() const
+{
+ return m_toolbar;
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h
index e75cc2b3..6ed3fe87 100644
--- a/src/Authoring/Studio/Palettes/Timeline/PropertyToggleControl.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,32 +26,32 @@
**
****************************************************************************/
-#ifndef INCLUDED_PROPERTY_TOGGLE_CONTROL_H
-#define INCLUDED_PROPERTY_TOGGLE_CONTROL_H 1
+#ifndef TIMELINEWIDGET_H
+#define TIMELINEWIDGET_H
-#pragma once
+#include <QtWidgets/qwidget.h>
-#include "Control.h"
-#include "CColor.h"
+class TimelineGraphicsScene;
+class TimelineToolbar;
-class CPropertyRowUI;
+QT_FORWARD_DECLARE_CLASS(QGraphicsView)
-class CPropertyToggleControl : public CControl
+class TimelineWidget : public QWidget
{
-public:
- CPropertyToggleControl(CPropertyRowUI *inPropertyRow);
- virtual ~CPropertyToggleControl();
-
- void Draw(CRenderer *inRenderer) override;
+ Q_OBJECT
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
+public:
+ explicit TimelineWidget(QWidget *parent = nullptr);
- void SetHighlighted(bool inIsHightlighted);
+ TimelineToolbar *toolbar() const;
-protected:
- CPropertyRowUI *m_PropertyRowUI;
- ::CColor m_BackgroundColor;
+private:
+ QGraphicsView *m_viewTreeHeader = nullptr;
+ QGraphicsView *m_viewTreeContent = nullptr;
+ QGraphicsView *m_viewTimelineHeader = nullptr;
+ QGraphicsView *m_viewTimelineContent = nullptr;
+ TimelineToolbar *m_toolbar = nullptr;
+ TimelineGraphicsScene *m_graphicsScene;
};
-#endif // INCLUDED_PROPERTY_TOGGLE_CONTROL_H
+
+#endif // TIMELINEWIDGET_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.cpp
new file mode 100644
index 00000000..163c55ad
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "InteractiveTimelineItem.h"
+
+#include <QtGui/qpainter.h>
+
+InteractiveTimelineItem::InteractiveTimelineItem(TimelineItem *parent) : TimelineItem(parent)
+{
+ setAcceptHoverEvents(true);
+}
+
+void InteractiveTimelineItem::setState(State state)
+{
+ m_state = state;
+}
+
+int InteractiveTimelineItem::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeInteractiveTimelineItem;
+}
+
+void InteractiveTimelineItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ if (m_state != Selected)
+ setState(Hovered);
+}
+
+void InteractiveTimelineItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ if (m_state != Selected)
+ setState(Normal);
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.h
index 1ec98c55..ca88e6cc 100644
--- a/src/Authoring/Studio/Palettes/Timeline/AreaBoundingRect.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2002 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,27 +26,33 @@
**
****************************************************************************/
-#ifndef INCLUDED_AREA_BOUNDING_RECT
-#define INCLUDED_AREA_BOUNDING_RECT 1
+#ifndef INTERACTIVETIMELINEITEM_H
+#define INTERACTIVETIMELINEITEM_H
-#pragma once
+#include "TimelineItem.h"
-//==============================================================================
-// Includes
-//==============================================================================
-#include "OverlayControl.h"
+class InteractiveTimelineItem : public TimelineItem {
+ Q_OBJECT
-//==============================================================================
-// Forwards
-//==============================================================================
-class CRenderer;
-
-class CAreaBoundingRect : public COverlayControl
-{
public:
- virtual ~CAreaBoundingRect(){}
- void Draw(CRenderer *inRenderer) override;
+ enum State {
+ Pressed,
+ Hovered,
+ Selected,
+ Normal
+ };
+
+ explicit InteractiveTimelineItem(TimelineItem *parent = nullptr);
+
+ virtual void setState(State state);
+
+ int type() const;
protected:
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+
+ State m_state = Normal;
};
-#endif // INCLUDED_AREA_BOUNDING_RECT
+
+#endif // INTERACTIVETIMELINEITEM_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.cpp
new file mode 100644
index 00000000..e3bda369
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "PlayHead.h"
+#include "Ruler.h"
+#include "TimelineConstants.h"
+
+#include <QtGui/qpainter.h>
+#include <QtGui/qcursor.h>
+
+PlayHead::PlayHead(Ruler *ruler)
+ : QGraphicsRectItem()
+ , m_ruler(ruler)
+{
+ setZValue(99);
+ setRect(-TimelineConstants::PLAYHEAD_W * .5, 0, TimelineConstants::PLAYHEAD_W, 0);
+}
+
+void PlayHead::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ static const QPixmap pixHead = QPixmap(":/images/PlaybackHead.png");
+
+ painter->drawPixmap(-TimelineConstants::PLAYHEAD_W * .5, 0, pixHead);
+ painter->setPen(QColor(TimelineConstants::PLAYHEAD_LINE_COLOR));
+ painter->drawLine(0, 0, 0, 3000);
+}
+
+void PlayHead::setHeight(int height)
+{
+ setRect(
+ rect().x(),
+ rect().y(),
+ rect().width(),
+ height);
+}
+
+void PlayHead::setTime(double time)
+{
+ if (time < 0)
+ time = 0;
+ else if (time > m_ruler->duration())
+ time = m_ruler->duration();
+
+ m_time = time;
+ updatePosition();
+}
+
+void PlayHead::setPosition(double posX)
+{
+ if (posX < TimelineConstants::RULER_EDGE_OFFSET) {
+ posX = TimelineConstants::RULER_EDGE_OFFSET;
+ } else if (posX > m_ruler->duration() * TimelineConstants::RULER_SEC_W
+ * m_ruler->timelineScale() + TimelineConstants::RULER_EDGE_OFFSET) {
+ posX = m_ruler->duration() * TimelineConstants::RULER_SEC_W * m_ruler->timelineScale()
+ + TimelineConstants::RULER_EDGE_OFFSET;
+ }
+
+ setX(m_ruler->x() + posX);
+ m_time = (posX - TimelineConstants::RULER_EDGE_OFFSET)
+ / (TimelineConstants::RULER_SEC_W * m_ruler->timelineScale());
+}
+
+void PlayHead::updatePosition()
+{
+ setX(m_ruler->x() + TimelineConstants::RULER_EDGE_OFFSET
+ + m_time * TimelineConstants::RULER_SEC_W * m_ruler->timelineScale());
+}
+
+double PlayHead::time() const
+{
+ return m_time;
+}
+
+int PlayHead::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TimelineItem::TypePlayHead;
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.h
new file mode 100644
index 00000000..ef628f51
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/PlayHead.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 PLAYHEAD_H
+#define PLAYHEAD_H
+
+#include "TimelineItem.h"
+
+#include <QtWidgets/qgraphicsitem.h>
+
+class Ruler;
+
+class PlayHead : public QGraphicsRectItem
+{
+
+public:
+ explicit PlayHead(Ruler *m_ruler);
+
+ void setHeight(int height);
+ void setPosition(double posX); // set x poisiotn
+ void updatePosition(); // sync x poisiotn based on time value
+ void setTime(double time); // set time (sets x based on time input)
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+ double time() const;
+ int type() const;
+
+private:
+ double m_time = 0;
+ Ruler *m_ruler;
+};
+
+#endif // PLAYHEAD_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
new file mode 100644
index 00000000..ae2fba7c
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
@@ -0,0 +1,435 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "RowTimeline.h"
+#include "RowTree.h"
+#include "Ruler.h"
+#include "TimelineConstants.h"
+#include "Keyframe.h"
+
+#include <QtGui/qpainter.h>
+#include <QtWidgets/qgraphicssceneevent.h>
+
+RowTimeline::RowTimeline(Ruler *ruler)
+ : InteractiveTimelineItem()
+ , m_ruler(ruler)
+{
+}
+
+void RowTimeline::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ // Background
+ QColor bgColor;
+ if (m_state == Selected)
+ bgColor = TimelineConstants::ROW_COLOR_SELECTED;
+ else if (m_state == Hovered)
+ bgColor = TimelineConstants::ROW_COLOR_OVER;
+ else if (m_rowTree->rowType() == RowType::Property)
+ bgColor = TimelineConstants::ROW_COLOR_NORMAL_PROP;
+ else
+ bgColor = TimelineConstants::ROW_COLOR_NORMAL;
+ painter->fillRect(QRect(0, 0, size().width(), size().height() - 1), bgColor);
+
+ // Duration
+ if (m_rowTree->rowType() != RowType::Property) {
+ painter->save();
+
+ // fully outside ancestors' limits, draw fully hashed
+ if (m_minStartX > m_endX || m_maxEndX < m_startX) {
+ painter->setBrush(QBrush(QColor(TimelineConstants::ROW_COLOR_DURATION_OFF1),
+ Qt::BDiagPattern));
+ painter->setPen(Qt::NoPen);
+ painter->fillRect(QRect(m_startX, 0, m_endX - m_startX, size().height() - 1),
+ QColor(TimelineConstants::ROW_COLOR_DURATION_OFF2));
+ painter->drawRect(QRect(m_startX, 0, m_endX - m_startX, size().height() - 1));
+
+ painter->setPen(QPen(QColor(TimelineConstants::ROW_COLOR_DURATION_EDGE), 3));
+ painter->drawLine(m_startX, 0, m_startX, size().height() - 1);
+ painter->drawLine(m_endX, 0, m_endX, size().height() - 1);
+ } else {
+ // draw main duration part
+ double x = std::max(m_startX, m_minStartX);
+ double w = std::min(m_endX, m_maxEndX) - x;
+ painter->setPen(Qt::NoPen);
+ painter->fillRect(QRect(x, 0, w, size().height() - 1), m_state == Selected
+ ? TimelineConstants::ROW_COLOR_DURATION_SELECTED
+ : TimelineConstants::ROW_COLOR_DURATION);
+
+ // draw hashed part before
+ painter->setBrush(QBrush(QColor(TimelineConstants::ROW_COLOR_DURATION_OFF1),
+ Qt::BDiagPattern));
+ if (m_startX < m_minStartX) {
+ painter->setPen(Qt::NoPen);
+ painter->fillRect(QRect(m_startX, 0, m_minStartX - m_startX, size().height() - 1),
+ QColor(TimelineConstants::ROW_COLOR_DURATION_OFF2));
+ painter->drawRect(QRect(m_startX, 0, m_minStartX - m_startX, size().height() - 1));
+ painter->setPen(QColor(TimelineConstants::ROW_COLOR_DURATION_EDGE));
+ painter->drawLine(m_minStartX, 0, m_minStartX, size().height() - 1);
+ }
+
+ // draw hashed part after
+ if (m_endX > m_maxEndX) {
+ painter->setPen(Qt::NoPen);
+ painter->fillRect(QRect(m_maxEndX, 0, m_endX - m_maxEndX, size().height() - 1),
+ QColor(TimelineConstants::ROW_COLOR_DURATION_OFF2));
+ painter->drawRect(QRect(m_maxEndX, 0, m_endX - m_maxEndX, size().height() - 1));
+ painter->setPen(QColor(TimelineConstants::ROW_COLOR_DURATION_EDGE));
+ painter->drawLine(m_maxEndX, 0, m_maxEndX, size().height() - 1);
+ }
+
+ painter->setPen(QPen(QColor(TimelineConstants::ROW_COLOR_DURATION_EDGE), 2));
+ painter->drawLine(m_startX, 0, m_startX, size().height() - 1);
+ painter->drawLine(m_endX, 0, m_endX, size().height() - 1);
+ }
+
+ painter->restore();
+ }
+
+ // Keyframes
+ if (m_rowTree->hasPropertyChildren()) { // master keyframes
+ static const QPixmap pixKeyframeMasterNormal
+ = QPixmap(":/images/Keyframe-Master-Normal.png");
+ static const QPixmap pixKeyframeMasterSelected
+ = QPixmap(":/images/Keyframe-Master-Selected.png");
+
+ for (auto keyframe : m_keyframes) {
+ painter->drawPixmap(timeToX(keyframe->time) - 8.5, 2, keyframe->selected
+ ? pixKeyframeMasterSelected : pixKeyframeMasterNormal);
+ }
+ } else if (m_rowTree->rowType() == RowType::Property) {
+ static const QPixmap pixKeyframePropertyNormal
+ = QPixmap(":/images/Keyframe-Property-Normal.png");
+ static const QPixmap pixKeyframePropertySelected
+ = QPixmap(":/images/Keyframe-Property-Selected.png");
+
+ for (auto keyframe : m_keyframes) {
+ painter->drawPixmap(timeToX(keyframe->time) - (keyframe->selected ? 7.5 : 5.5), 2,
+ keyframe->selected ? pixKeyframePropertySelected
+ : pixKeyframePropertyNormal);
+ }
+ }
+}
+
+Keyframe *RowTimeline::getClickedKeyframe(const QPointF &scenePos)
+{
+ QPointF p = mapFromScene(scenePos.x(), scenePos.y());
+ double x;
+
+ QList<Keyframe *> keyframes;
+ if (m_rowTree->hasPropertyChildren()) {
+ const auto childRows = m_rowTree->childRows();
+ for (auto child : childRows)
+ keyframes.append(child->rowTimeline()->m_keyframes);
+ } else {
+ keyframes = m_keyframes;
+ }
+
+ for (const auto keyframe : qAsConst(keyframes)) {
+ x = timeToX(keyframe->time);
+
+ if (p.x() > x - 5 && p.x() < x + 5 && p.y() > 3 && p.y() < 16)
+ return keyframe;
+ }
+
+ return nullptr;
+}
+
+QList<Keyframe *> RowTimeline::getKeyframesInRange(const double left, const double right)
+{
+ double x;
+ double x1 = mapFromScene(left, 0).x();
+ double x2 = mapFromScene(right, 0).x();
+
+ QList<Keyframe *> result;
+ QList<Keyframe *> keyframes;
+
+ if (m_rowTree->hasPropertyChildren()) {
+ const auto childRows = m_rowTree->childRows();
+ for (auto child : childRows) {
+ if (child->rowType() == RowType::Property)
+ keyframes.append(child->rowTimeline()->m_keyframes);
+ }
+ } else {
+ keyframes = m_keyframes;
+ }
+
+ for (auto keyframe : qAsConst(keyframes)) {
+ x = timeToX(keyframe->time);
+
+ if (x1 < x && x2 > x)
+ result.append(keyframe);
+ }
+
+ return result;
+}
+
+void RowTimeline::insertKeyframe(Keyframe *keyframe)
+{
+ if (!m_keyframes.contains(keyframe))
+ m_keyframes.append(keyframe);
+}
+
+void RowTimeline::removeKeyframe(Keyframe *keyframe)
+{
+ m_keyframes.removeAll(keyframe);
+}
+
+void RowTimeline::putSelectedKeyframesOnTop()
+{
+ if (!m_keyframes.empty())
+ std::partition(m_keyframes.begin(), m_keyframes.end(), [](Keyframe *kf) {
+ return !kf->selected;
+ });
+
+ if (m_rowTree->hasPropertyChildren()) { // has property rows
+ const auto childRows = m_rowTree->childRows();
+ for (auto child : childRows) {
+ std::partition(child->rowTimeline()->m_keyframes.begin(),
+ child->rowTimeline()->m_keyframes.end(), [](Keyframe *kf) {
+ return !kf->selected;
+ });
+ }
+ }
+}
+
+void RowTimeline::updateKeyframes()
+{
+ update();
+
+ if (m_rowTree->hasPropertyChildren()) { // master keyframes
+ const auto childRows = m_rowTree->childRows();
+ for (const auto child : childRows)
+ child->rowTimeline()->update();
+ }
+}
+
+int RowTimeline::getClickedControl(const QPointF &scenePos)
+{
+ if (m_rowTree->rowType() == RowType::Property)
+ return TypeNone;
+
+ QPointF p = mapFromScene(scenePos.x(), scenePos.y());
+ if (p.x() > m_startX - TimelineConstants::DURATION_HANDLE_W * .5
+ && p.x() < m_startX + TimelineConstants::DURATION_HANDLE_W * .5) {
+ return TypeStartHandle;
+ } else if (p.x() > m_endX - TimelineConstants::DURATION_HANDLE_W * .5
+ && p.x() < m_endX + TimelineConstants::DURATION_HANDLE_W * .5) {
+ return TypeEndHandle;
+ } else if (p.x() > m_startX && p.x() < m_endX) {
+ return TypeDuration;
+ }
+
+ return TypeNone;
+}
+
+// move the duration area (start/end x)
+void RowTimeline::moveDurationBy(double dx)
+{
+ double dur = m_endX - m_startX;
+
+ m_startX += dx;
+ m_endX += dx;
+
+ if (m_startX < TimelineConstants::RULER_EDGE_OFFSET) {
+ m_startX = TimelineConstants::RULER_EDGE_OFFSET;
+ m_endX = m_startX + dur;
+ } else if (m_endX > timeToX(m_ruler->duration())) {
+ m_endX = timeToX(m_ruler->duration());
+ m_startX = m_endX - dur;
+ }
+
+ if (m_rowTree->parentRow() == nullptr) {
+ m_minStartX = m_startX;
+ m_maxEndX = m_endX;
+ }
+
+ m_startTime = xToTime(m_startX);
+ m_endTime = xToTime(m_endX);
+
+ updateChildrenMinStartXRecursive(m_rowTree);
+ updateChildrenMaxEndXRecursive(m_rowTree);
+
+ update();
+}
+
+// convert time values to x
+double RowTimeline::timeToX(double time)
+{
+ return TimelineConstants::RULER_EDGE_OFFSET
+ + time * TimelineConstants::RULER_SEC_W * m_ruler->timelineScale();
+}
+
+// convert x values to time
+double RowTimeline::xToTime(double xPos)
+{
+ return (xPos - TimelineConstants::RULER_EDGE_OFFSET)
+ / (TimelineConstants::RULER_SEC_W * m_ruler->timelineScale());
+}
+
+// called after timeline scale is changed to update duration star/end positions
+void RowTimeline::updatePosition()
+{
+ setStartX(timeToX(m_startTime));
+ setEndX(timeToX(m_endTime));
+}
+
+// Set the position of the start of the row duration
+void RowTimeline::setStartX(double startX)
+{
+ if (startX < TimelineConstants::RULER_EDGE_OFFSET)
+ startX = TimelineConstants::RULER_EDGE_OFFSET;
+ else if (startX > m_endX - 1)
+ startX = m_endX - 1;
+
+ m_startX = startX;
+ m_startTime = xToTime(startX);
+
+ if (m_rowTree->parentRow() == nullptr)
+ m_minStartX = m_startX;
+
+ updateChildrenMinStartXRecursive(m_rowTree);
+ update();
+}
+
+// Set the position of the end of the row duration
+void RowTimeline::setEndX(double endX)
+{
+ if (endX < m_startX + 1)
+ endX = m_startX + 1;
+ else if (endX > timeToX(m_ruler->duration()))
+ endX = timeToX(m_ruler->duration());
+
+ m_endX = endX;
+ m_endTime = xToTime(endX);
+
+ if (m_rowTree->parentRow() == nullptr)
+ m_maxEndX = m_endX;
+
+ updateChildrenMaxEndXRecursive(m_rowTree);
+ update();
+}
+
+void RowTimeline::updateChildrenMinStartXRecursive(RowTree *rowTree)
+{
+ if (!rowTree->empty()) {
+ const auto childRows = rowTree->childRows();
+ for (auto child : childRows) {
+ child->rowTimeline()->m_minStartX = std::max(rowTree->rowTimeline()->m_startX,
+ rowTree->rowTimeline()->m_minStartX);
+ child->rowTimeline()->update();
+
+ updateChildrenMinStartXRecursive(child);
+ }
+ }
+}
+
+void RowTimeline::updateChildrenMaxEndXRecursive(RowTree *rowTree)
+{
+ if (!rowTree->empty()) {
+ const auto childRows = rowTree->childRows();
+ for (auto child : childRows) {
+ child->rowTimeline()->m_maxEndX = std::min(rowTree->rowTimeline()->m_endX,
+ rowTree->rowTimeline()->m_maxEndX);
+ child->rowTimeline()->update();
+
+ updateChildrenMaxEndXRecursive(child);
+ }
+ }
+}
+
+void RowTimeline::setStartTime(double startTime)
+{
+ m_startTime = startTime;
+ m_startX = timeToX(startTime);
+
+ if (m_rowTree->parentRow() == nullptr)
+ m_minStartX = m_startX;
+
+ updateChildrenMinStartXRecursive(m_rowTree);
+ update();
+}
+
+void RowTimeline::setEndTime(double endTime)
+{
+ m_endTime = endTime;
+ m_endX = timeToX(endTime);
+
+ if (m_rowTree->parentRow() == nullptr)
+ m_maxEndX = m_endX;
+
+ updateChildrenMaxEndXRecursive(m_rowTree);
+ update();
+}
+
+double RowTimeline::getStartTime() const
+{
+ return m_startTime;
+}
+
+double RowTimeline::getEndTime() const
+{
+ return m_endTime;
+}
+
+void RowTimeline::setState(State state)
+{
+ m_state = state;
+ m_rowTree->m_state = state;
+
+ update();
+ m_rowTree->update();
+}
+
+void RowTimeline::setRowTree(RowTree *rowTree)
+{
+ m_rowTree = rowTree;
+}
+
+RowTree *RowTimeline::rowTree() const
+{
+ return m_rowTree;
+}
+
+QList<Keyframe *> RowTimeline::keyframes() const
+{
+ return m_keyframes;
+}
+
+RowTimeline *RowTimeline::parentRow() const
+{
+ if (m_rowTree->m_parentRow == nullptr)
+ return nullptr;
+
+ return m_rowTree->m_parentRow->rowTimeline();
+}
+
+int RowTimeline::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeRowTimeline;
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h
new file mode 100644
index 00000000..50b95838
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 ROWTIMELINE_H
+#define ROWTIMELINE_H
+
+#include "InteractiveTimelineItem.h"
+
+class RowTree;
+class Ruler;
+struct Keyframe;
+
+class RowTimeline : public InteractiveTimelineItem
+{
+ Q_OBJECT
+
+public:
+ enum ControlType {
+ TypeNone,
+ TypeKeyFrame,
+ TypeDuration,
+ TypeStartHandle,
+ TypeEndHandle
+ };
+
+ explicit RowTimeline(Ruler *ruler);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+ void setState(State state) override;
+ void setRowTree(RowTree *rowTree);
+ void updatePosition();
+ void moveDurationBy(double dx);
+ void setStartTime(double startTime);
+ void setEndTime(double endTime);
+ void setStartX(double startX);
+ void setEndX(double endX);
+ void putSelectedKeyframesOnTop();
+ void updateKeyframes();
+ void insertKeyframe(Keyframe *keyframe);
+ void removeKeyframe(Keyframe *keyframe);
+ int getClickedControl(const QPointF &scenePos);
+ double getStartTime() const;
+ double getEndTime() const;
+ int type() const;
+ RowTimeline *parentRow() const;
+ RowTree *rowTree() const;
+ Keyframe *getClickedKeyframe(const QPointF &scenePos);
+ QList<Keyframe *> getKeyframesInRange(const double left, const double right);
+ QList<Keyframe *> keyframes() const;
+
+private:
+ void updateChildrenMinStartXRecursive(RowTree *rowTree);
+ void updateChildrenMaxEndXRecursive(RowTree *rowTree);
+ double timeToX(double time);
+ double xToTime(double xPos);
+
+ RowTree *m_rowTree;
+ Ruler *m_ruler;
+ double m_startTime;
+ double m_endTime;
+ double m_startX;
+ double m_endX;
+ double m_minStartX;
+ double m_maxEndX;
+ QList<Keyframe *> m_keyframes;
+
+ friend class RowTree;
+};
+
+#endif // ROWTIMELINE_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
new file mode 100644
index 00000000..ef6b67ea
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -0,0 +1,481 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "RowTree.h"
+#include "RowTimeline.h"
+#include "TimelineConstants.h"
+
+#include <QtGui/qpainter.h>
+#include <QtWidgets/qgraphicssceneevent.h>
+
+RowTree::RowTree(Ruler *ruler, RowType rowType, const QString &label)
+ : InteractiveTimelineItem()
+ , m_rowTimeline(new RowTimeline(ruler))
+{
+ m_rowType = rowType;
+ m_label = label;
+
+ setTimelineRow(m_rowTimeline);
+ m_rowTimeline->setRowTree(this);
+}
+
+RowTree::RowTree(Ruler *ruler, PropertyType propType)
+ : InteractiveTimelineItem()
+ , m_rowTimeline(new RowTimeline(ruler))
+{
+ m_rowType = RowType::Property;
+ m_propertyType = propType;
+ updatePropertyLabel();
+
+ setTimelineRow(m_rowTimeline);
+ m_rowTimeline->setRowTree(this);
+}
+
+void RowTree::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ int offset = 5 + m_depth * 15;
+
+ // update button bounds rects
+ m_rectArrow .setRect(offset, size().height() * .5 - 8, 16, 16);
+ m_rectShy .setRect(size().width() - 16 * 3.3, size().height() * .5 - 8, 16, 16);
+ m_rectVisible.setRect(size().width() - 16 * 2.2, size().height() * .5 - 8, 16, 16);
+ m_rectLocked .setRect(size().width() - 16 * 1.1, size().height() * .5 - 8, 16, 16);
+
+ // Background
+ QColor bgColor;
+ if (m_moveSource)
+ bgColor = TimelineConstants::ROW_COLOR_MOVE_SRC;
+ else if (m_state == Selected)
+ bgColor = TimelineConstants::ROW_COLOR_SELECTED;
+ else if (m_state == Hovered)
+ bgColor = TimelineConstants::ROW_COLOR_OVER;
+ else if (m_rowType == RowType::Property)
+ bgColor = TimelineConstants::ROW_COLOR_NORMAL_PROP;
+ else
+ bgColor = TimelineConstants::ROW_COLOR_NORMAL;
+
+ painter->fillRect(QRect(0, 0, size().width(), size().height() - 1), bgColor);
+
+ // left divider
+ painter->setPen(TimelineConstants::WIDGET_BG_COLOR);
+ painter->drawLine(18, 0, 18, size().height() - 1);
+
+ // expand/collapse arrow
+ static const QPixmap pixArrow = QPixmap(":/images/arrow.png");
+ static const QPixmap pixArrowDown = QPixmap(":/images/arrow_down.png");
+ double y = (size().height() - pixArrow.height()) * .5;
+ if (!m_childRows.empty())
+ painter->drawPixmap(m_rectArrow, m_expanded ? pixArrowDown : pixArrow);
+
+ // Row type icon
+ static const QPixmap pixScene = QPixmap(":/images/Objects-Scene-Normal.png");
+ static const QPixmap pixLayer = QPixmap(":/images/Asset-Layer-Normal.png");
+ static const QPixmap pixObject = QPixmap(":/images/Asset-Cube-Normal.png");
+ static const QPixmap pixLight = QPixmap(":/images/Asset-Light-Normal.png");
+ static const QPixmap pixCamera = QPixmap(":/images/Asset-Camera-Normal.png");
+ static const QPixmap pixText = QPixmap(":/images/Asset-Text-Normal.png");
+ static const QPixmap pixAlias = QPixmap(":/images/Asset-Alias-Normal.png");
+ static const QPixmap pixGroup = QPixmap(":/images/Asset-Group-Normal.png");
+ static const QPixmap pixComponent = QPixmap(":/images/Asset-Component-Normal.png");
+ static const QPixmap pixProperty = QPixmap(":/images/Objects-Property-Normal.png");
+
+ QPixmap pixRowType;
+ QString rowLabel;
+ switch (m_rowType) {
+ case RowType::Scene:
+ pixRowType = pixScene;
+ rowLabel = tr("Scene");
+ break;
+ case RowType::Layer:
+ pixRowType = pixLayer;
+ rowLabel = tr("Layer");
+ break;
+ case RowType::Object:
+ pixRowType = pixObject;
+ rowLabel = tr("Object");
+ break;
+ case RowType::Light:
+ pixRowType = pixLight;
+ rowLabel = tr("Light");
+ break;
+ case RowType::Camera:
+ pixRowType = pixCamera;
+ rowLabel = tr("Camera");
+ break;
+ case RowType::Text:
+ pixRowType = pixText;
+ rowLabel = tr("Text");
+ break;
+ case RowType::Alias:
+ pixRowType = pixAlias;
+ rowLabel = tr("Alias");
+ break;
+ case RowType::Group:
+ pixRowType = pixGroup;
+ rowLabel = tr("Group");
+ break;
+ case RowType::Component:
+ pixRowType = pixComponent;
+ rowLabel = tr("Component");
+ break;
+ case RowType::Property:
+ pixRowType = pixProperty;
+ rowLabel = tr("Property");
+ break;
+ default:
+ pixRowType = pixLayer;
+ rowLabel = tr("Layer");
+ }
+
+ if (m_label == 0)
+ m_label = rowLabel;
+
+ y = (size().height() - 16) * .5;
+ painter->drawPixmap(offset + 15, y, 16, 16, pixRowType);
+
+ // Label
+ painter->setPen(QColor(TimelineConstants::ROW_TEXT_COLOR));
+ painter->drawText(offset + 35, size().height() * .5 + 4, tr("%1").arg(m_label));
+
+ // Shy, eye, lock BG (to hide the label when overlapping)
+ painter->fillRect(QRect(size().width() - 53, 0, 53, size().height() - 1), bgColor);
+
+ // Shy, eye, lock
+ static const QPixmap pixEmpty = QPixmap(":/images/Toggle-Empty.png");
+ static const QPixmap pixShy = QPixmap(":/images/Toggle-Shy.png");
+ static const QPixmap pixHide = QPixmap(":/images/Toggle-HideShow.png");
+ static const QPixmap pixLock = QPixmap(":/images/Toggle-Lock.png");
+ if (m_rowType != RowType::Property) {
+ painter->drawPixmap(m_rectShy , m_shy ? pixShy : pixEmpty);
+ painter->drawPixmap(m_rectVisible, m_visible ? pixHide : pixEmpty);
+ painter->drawPixmap(m_rectLocked , m_locked ? pixLock : pixEmpty);
+ }
+
+ // Candidate parent of a dragged row
+ if (m_moveTarget) {
+ painter->setPen(QPen(QColor(TimelineConstants::ROW_MOVER_COLOR), 1));
+ painter->drawRect(QRect(1, 1, size().width()-2, size().height() - 3));
+ }
+}
+
+void RowTree::updatePropertyLabel()
+{
+ switch (m_propertyType) {
+ case PropertyType::Position:
+ m_label = tr("Position");
+ break;
+ case PropertyType::Rotation:
+ m_label = tr("Rotation");
+ break;
+ case PropertyType::Scale:
+ m_label = tr("Scale");
+ break;
+ case PropertyType::Pivot:
+ m_label = tr("Pivot");
+ break;
+ case PropertyType::Opacity:
+ m_label = tr("Opacity");
+ break;
+ case PropertyType::EdgeTessellation:
+ m_label = tr("Edge Tessellation");
+ break;
+ case PropertyType::InnerTessellation:
+ m_label = tr("Inner Tessellation");
+ break;
+ case PropertyType::TextColor:
+ m_label = tr("Text Color");
+ break;
+ case PropertyType::Leading:
+ m_label = tr("Leading");
+ break;
+ case PropertyType::Tracking:
+ m_label = tr("Tracking");
+ break;
+ case PropertyType::LightColor:
+ m_label = tr("Light Color");
+ break;
+ case PropertyType::SpecularColor:
+ m_label = tr("Specular Color");
+ break;
+ case PropertyType::AmbientColor:
+ m_label = tr("Ambient Color");
+ break;
+ case PropertyType::Brightness:
+ m_label = tr("Brightness");
+ break;
+ case PropertyType::ShadowDarkness:
+ m_label = tr("Shadow Darkness");
+ break;
+ case PropertyType::ShadowSoftness:
+ m_label = tr("Shadow Softness");
+ break;
+ case PropertyType::ShadowDepthBias:
+ m_label = tr("Shadow Depth Bias");
+ break;
+ case PropertyType::FieldOfView:
+ m_label = tr("Field Of View");
+ break;
+ case PropertyType::ClippingStart:
+ m_label = tr("Clipping Start");
+ break;
+ case PropertyType::ClippingEnd:
+ m_label = tr("Clipping End");
+ break;
+ case PropertyType::Left:
+ m_label = tr("Left");
+ break;
+ case PropertyType::Top:
+ m_label = tr("Top");
+ break;
+ case PropertyType::Width:
+ m_label = tr("Width");
+ break;
+ case PropertyType::Height:
+ m_label = tr("Height");
+ break;
+ case PropertyType::AO:
+ m_label = tr("Ambient Occlusion");
+ break;
+ case PropertyType::AODistance:
+ m_label = tr("AO Distance");
+ break;
+ case PropertyType::AOSoftness:
+ m_label = tr("AO Softness");
+ break;
+ case PropertyType::AOThreshold:
+ m_label = tr("AO Threshold");
+ break;
+ case PropertyType::AOSamplingRate:
+ m_label = tr("AO Sampling Rate");
+ break;
+ case PropertyType::IBLBrightness:
+ m_label = tr("IBL Brightness");
+ break;
+ case PropertyType::IBLHorizonCutoff:
+ m_label = tr("IBL Horizon Cutoff");
+ break;
+ case PropertyType::IBLFOVAngle:
+ m_label = tr("IBL FOV Angle");
+ break;
+ case PropertyType::ProbeCrossfade:
+ m_label = tr("Probe Crossfade");
+ break;
+ default:
+ m_label = tr("Unnamed Property");
+ }
+}
+
+void RowTree::setState(State state)
+{
+ m_state = state;
+ m_rowTimeline->m_state = state;
+
+ update();
+ m_rowTimeline->update();
+}
+
+void RowTree::setTimelineRow(RowTimeline *rowTimeline)
+{
+ m_rowTimeline = rowTimeline;
+}
+
+RowTree *RowTree::parentRow() const
+{
+ return m_parentRow;
+}
+
+int RowTree::depth() const
+{
+ return m_depth;
+}
+
+RowType RowTree::rowType() const
+{
+ return m_rowType;
+}
+
+PropertyType RowTree::propertyType() const
+{
+ return m_propertyType;
+}
+
+int RowTree::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeRowTree;
+}
+
+void RowTree::addChild(RowTree *child)
+{
+ if (child->parentRow() != this) {
+ if (child->parentRow() != nullptr)
+ child->parentRow()->removeChild(child);
+
+ if (!m_childRows.contains(child)) {
+ m_childRows.prepend(child);
+ child->m_depth = m_depth + 1;
+ child->m_parentRow = this;
+
+ child->updateDepthRecursive();
+ m_rowTimeline->updateChildrenMinStartXRecursive(this);
+ m_rowTimeline->updateChildrenMaxEndXRecursive(this);
+ }
+ }
+}
+
+void RowTree::updateDepthRecursive()
+{
+ m_depth = m_parentRow->m_depth + 1;
+
+ if (!empty()) {
+ for (auto child : qAsConst(m_childRows))
+ child->updateDepthRecursive();
+ }
+}
+
+// TODO: so far not used, delete if end up not used
+void RowTree::moveChild(int from, int to)
+{
+ m_childRows.move(from, to);
+}
+
+void RowTree::removeChild(RowTree *child)
+{
+ if (m_childRows.contains(child)) {
+ m_childRows.removeAll(child);
+ child->m_depth = -1;
+ child->m_parentRow = nullptr;
+
+ if (m_childRows.empty())
+ m_expanded = true;
+ }
+}
+
+bool RowTree::hasPropertyChildren()
+{
+ return !m_childRows.empty() && m_childRows.first()->rowType() == RowType::Property;
+}
+
+bool RowTree::handleButtonsClick(QGraphicsSceneMouseEvent *event)
+{
+ if (rowType() == RowType::Property)
+ return false;
+
+ QPointF p = mapFromScene(event->scenePos().x(), event->scenePos().y());
+
+ if (m_rectArrow.contains(p.x(), p.y())) {
+ m_expanded = !m_expanded;
+ updateExpandStatus(m_expanded, true);
+ update();
+ return true;
+ } else if (m_rectShy.contains(p.x(), p.y())) {
+ m_shy = !m_shy;
+ update();
+ return true;
+ } else if (m_rectVisible.contains(p.x(), p.y())) {
+ m_visible = !m_visible;
+ update();
+ return true;
+ } else if (m_rectLocked.contains(p.x(), p.y())) {
+ m_locked = !m_locked;
+ update();
+ return true;
+ }
+
+ return false;
+}
+
+void RowTree::updateExpandStatus(bool expand, bool childrenOnly)
+{
+ if (!childrenOnly) {
+ setVisible(expand);
+ m_rowTimeline->setVisible(expand);
+ }
+
+ if (!m_childRows.empty()) {
+ for (auto child : qAsConst(m_childRows))
+ child->updateExpandStatus(expand && child->parentRow()->m_expanded);
+ }
+}
+
+bool RowTree::expanded() const
+{
+ return m_expanded;
+}
+
+bool RowTree::isDecendentOf(RowTree *row) const
+{
+ RowTree *parentRow = m_parentRow;
+
+ while (parentRow != nullptr) {
+ if (parentRow == row)
+ return true;
+
+ parentRow = parentRow->parentRow();
+ }
+
+ return false;
+}
+
+void RowTree::setMoveSourceRecursive(bool value)
+{
+ m_moveSource = value;
+ update();
+ if (!m_childRows.empty()) {
+ for (auto child : qAsConst(m_childRows))
+ child->setMoveSourceRecursive(value);
+ }
+}
+
+bool RowTree::isContainer() const
+{
+ return m_rowType == RowType::Scene
+ || m_rowType == RowType::Layer
+ || m_rowType == RowType::Group
+ || m_rowType == RowType::Component;
+}
+
+bool RowTree::empty() const {
+ return m_childRows.empty();
+}
+
+void RowTree::setMoveTarget(bool value) {
+ m_moveTarget = value;
+}
+
+QList<RowTree *> RowTree::childRows() const {
+ return m_childRows;
+}
+
+RowTimeline *RowTree::rowTimeline() const {
+ return m_rowTimeline;
+}
+
+QString RowTree::label() const {
+ return m_label;
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
new file mode 100644
index 00000000..4b89a02a
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 ROWTREE_H
+#define ROWTREE_H
+
+#include "InteractiveTimelineItem.h"
+#include "RowTypes.h"
+
+class RowTimeline;
+class Ruler;
+
+class RowTree : public InteractiveTimelineItem
+{
+ Q_OBJECT
+
+public:
+ explicit RowTree(Ruler *ruler, RowType rowType = RowType::Layer, const QString &label = {});
+ explicit RowTree(Ruler *ruler, PropertyType propType); // property row constructor
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+ void setState(State state) override;
+ void setTimelineRow(RowTimeline *rowTimeline);
+ void setParent(RowTree *parent);
+ void addChild(RowTree *child);
+ void moveChild(int from, int to); // NOT USED
+ void removeChild(RowTree *child);
+ void setMoveSourceRecursive(bool value);
+ void setMoveTarget(bool value);
+
+ bool handleButtonsClick(QGraphicsSceneMouseEvent *event);
+ bool hasPropertyChildren();
+ bool shy() const;
+ bool visible() const;
+ bool locked() const;
+ bool expanded() const;
+ bool isDecendentOf(RowTree *row) const;
+ bool isContainer() const;
+ bool empty() const;
+
+ int depth() const;
+ int type() const;
+ RowType rowType() const;
+ PropertyType propertyType() const;
+
+ RowTree *parentRow() const;
+ QList<RowTree *> childRows() const;
+ RowTimeline *rowTimeline() const;
+ QString label() const;
+
+private:
+ void updateExpandStatus(bool expand, bool childrenOnly = false);
+ void updateDepthRecursive();
+ void updatePropertyLabel();
+
+ RowTree *m_parentRow = nullptr;
+ RowTimeline *m_rowTimeline = nullptr;
+ int m_depth = 1;
+ bool m_shy = false;
+ bool m_visible = true;
+ bool m_locked = false;
+ bool m_expanded = true;
+ bool m_moveSource = false;
+ bool m_moveTarget = false;
+ RowType m_rowType = RowType::Layer;
+ PropertyType m_propertyType = PropertyType::None; // for property rows
+ QString m_label = 0;
+ QList<RowTree *> m_childRows;
+
+ QRect m_rectArrow;
+ QRect m_rectShy;
+ QRect m_rectVisible;
+ QRect m_rectLocked;
+
+ friend class RowTimeline;
+};
+
+#endif // ROWTREE_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.cpp
new file mode 100644
index 00000000..17f26637
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "Ruler.h"
+#include "TimelineConstants.h"
+
+#include <QtGui/qpainter.h>
+
+Ruler::Ruler(TimelineItem *parent) : TimelineItem(parent)
+{
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+}
+
+void Ruler::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ double xStep = TimelineConstants::RULER_SEC_W / TimelineConstants::RULER_SEC_DIV * m_timeScale;
+ double totalSegments = m_duration * TimelineConstants::RULER_SEC_DIV;
+
+ painter->save();
+ painter->setPen(QColor(TimelineConstants::RULER_COLOR));
+
+ painter->drawLine(QPointF(0, TimelineConstants::RULER_BASE_Y),
+ QPointF(10000, TimelineConstants::RULER_BASE_Y));
+
+ QFont font = painter->font();
+ font.setPointSize(8);
+ painter->setFont(font);
+
+ for (int i = 0; i <= totalSegments; i++) {
+ int h = (i % TimelineConstants::RULER_SEC_DIV == 0
+ || i % TimelineConstants::RULER_SEC_DIV == TimelineConstants::RULER_SEC_DIV * .5)
+ ? TimelineConstants::RULER_DIV_H1 : TimelineConstants::RULER_DIV_H2;
+
+ painter->drawLine(QPointF(TimelineConstants::RULER_EDGE_OFFSET + xStep * i,
+ TimelineConstants::RULER_BASE_Y - h),
+ QPointF(TimelineConstants::RULER_EDGE_OFFSET + xStep * i,
+ TimelineConstants::RULER_BASE_Y));
+
+ if (i % TimelineConstants::RULER_SEC_DIV == 0) {
+ painter->drawText(QRectF(TimelineConstants::RULER_EDGE_OFFSET
+ + xStep * i - 10, 2, 20, 10), Qt::AlignCenter,
+ tr("%1s").arg(i / TimelineConstants::RULER_SEC_DIV));
+ }
+ }
+
+ painter->restore();
+}
+
+void Ruler::setTimelineScale(double scl)
+{
+ m_timeScale = scl;
+ update();
+}
+
+// convert distance values to time
+double Ruler::distanceToTime(double distance) const
+{
+ return distance / (TimelineConstants::RULER_SEC_W * m_timeScale);
+}
+
+// convert distance values to time
+double Ruler::timeToDistance(double time) const
+{
+ return time * TimelineConstants::RULER_SEC_W * m_timeScale;
+}
+
+// x position of ruler value 0
+double Ruler::durationStartX() const
+{
+ return x() + TimelineConstants::RULER_EDGE_OFFSET;
+}
+
+// x position of ruler max value (duration)
+double Ruler::durationEndX() const
+{
+ return durationStartX() + timeToDistance(m_duration);
+}
+
+double Ruler::timelineScale() const
+{
+ return m_timeScale;
+}
+
+double Ruler::duration() const
+{
+ return m_duration;
+}
+
+int Ruler::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeRuler;
+}
diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRowUI.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.h
index 1a4c94bb..9370797d 100644
--- a/src/Authoring/Studio/Palettes/Timeline/StateRowUI.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Ruler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -25,34 +25,38 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef STATEROWUI_H
-#define STATEROWUI_H
-#include "BaseStateRowUI.h"
+#ifndef RULER_H
+#define RULER_H
-class CStateRow;
+#include "TimelineItem.h"
-class CStateRowUI : public CBaseStateRowUI
+class Ruler : public TimelineItem
{
Q_OBJECT
-public:
- CStateRowUI(CStateRow *stateRow, CAbstractTimelineRowUI *parentUiRow);
-
- void SetSnappingListProvider(ISnappingListProvider *inProvider) override;
- ISnappingListProvider *GetSnappingListProvider() const override;
- void SetIndent(long inIndent) override;
+signals:
+ void rulerClicked(const double &pos);
- // CControl
- void OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
+public:
+ explicit Ruler(TimelineItem *parent = nullptr);
-private Q_SLOTS:
- void handleTimeChanged();
- void handleRecalcLayoutRequested();
+ void setTimelineScale(double scl);
+ double distanceToTime(double distance) const;
+ double timeToDistance(double time) const;
+ double durationStartX() const;
+ double durationEndX() const;
+ double timelineScale() const;
+ double duration() const;
+ int type() const;
protected:
- CBlankToggleControl *CreateToggleControl() override;
- CBaseTimebarlessRow *CreateTimebarRow() override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+
+private:
+ double m_timeScale = 2;
+ double m_duration = 20; // in seconds
};
-#endif // STATEROWUI_H
+#endif // RULER_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.cpp
index cafb5cee..d76949b1 100644
--- a/src/Authoring/Studio/Palettes/Timeline/BlankToggleControl.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -27,43 +26,42 @@
**
****************************************************************************/
-#ifndef INCLUDED_BLANK_TOGGLE_CONTROL_H
-#define INCLUDED_BLANK_TOGGLE_CONTROL_H 1
+#include "Separator.h"
+#include "TimelineConstants.h"
-#pragma once
+#include <QtGui/qpainter.h>
+#include <QtGui/qcursor.h>
+#include <QtWidgets/qapplication.h>
-#include "Control.h"
-#include "CColor.h"
-
-class CBaseStateRow;
-class CBaseStateRowUI;
-
-class CBlankToggleControl : public CControl
+Separator::Separator(TimelineItem *parent) : TimelineItem(parent)
{
-public:
- CBlankToggleControl(CBaseStateRowUI *inStateRow);
- virtual ~CBlankToggleControl();
-
- void Draw(CRenderer *inRenderer) override;
-
- void OnSelect();
- void OnDeselect();
-
- void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
- bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override;
+ setMinimumWidth(TimelineConstants::SEPARATOR_W);
+ setMaximumWidth(TimelineConstants::SEPARATOR_W);
+ setMaximumHeight(10000);
+ // TODO: remove
+// setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+ setAcceptHoverEvents(true);
+}
- void SetBackgroundColor(::CColor inBackgroundColor);
-
- virtual void Refresh();
+void Separator::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ // TODO: remove
+// painter->fillRect(0, 0, size().width(), size().height(), QColor("#666666"));
+}
-protected:
- CBaseStateRow *baseStateRow() const;
+void Separator::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ qApp->setOverrideCursor(Qt::SplitHCursor);
+}
- CBaseStateRow *m_StateRow;
- CBaseStateRowUI *m_StateRowUI;
- bool m_Selected;
+void Separator::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ qApp->changeOverrideCursor(Qt::ArrowCursor);
+ qApp->restoreOverrideCursor();
+}
- ::CColor m_BackgroundColor;
-};
-#endif // INCLUDED_BLANK_TOGGLE_CONTROL_H
+int Separator::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeSeparator;
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.h
new file mode 100644
index 00000000..e74fe0c5
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/Separator.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 SEPARATOR_H
+#define SEPARATOR_H
+
+#include "TimelineItem.h"
+
+class Separator : public TimelineItem
+{
+ Q_OBJECT
+
+public:
+ explicit Separator(TimelineItem *parent = nullptr);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+ int type() const;
+
+ protected:
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+};
+
+#endif // SEPARATOR_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.cpp
new file mode 100644
index 00000000..d2169cca
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineItem.h"
+#include "TimelineConstants.h"
+
+#include <QtGui/qpainter.h>
+
+TimelineItem::TimelineItem(TimelineItem *parent) : QGraphicsWidget(parent)
+{
+ setMaximumHeight(TimelineConstants::ROW_H);
+}
+
+int TimelineItem::type() const
+{
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeTimelineItem;
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.h
new file mode 100644
index 00000000..184795b7
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineItem.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TIMELINEITEM_H
+#define TIMELINEITEM_H
+
+#include <QtWidgets/qgraphicswidget.h>
+
+class TimelineItem : public QGraphicsWidget
+{
+ Q_OBJECT
+
+public:
+ explicit TimelineItem(TimelineItem *parent = nullptr);
+
+ enum {
+ TypeTimelineItem = UserType + 1,
+ TypeInteractiveTimelineItem,
+ TypeTreeHeader,
+ TypeRowTree,
+ TypeRowTimeline,
+ TypePlayHead,
+ TypeRuler,
+ TypeSeparator
+ };
+
+ int type() const;
+};
+
+#endif // TIMELINEITEM_H
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp
new file mode 100644
index 00000000..3855fb4a
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "TimelineToolbar.h"
+
+#include <QtWidgets/qslider.h>
+
+TimelineToolbar::TimelineToolbar() : QToolBar()
+{
+ setContentsMargins(0, 0, 0, 0);
+ setIconSize(QSize(15, 15));
+
+ // create icons
+ static const QIcon iconLayer = QIcon(":/images/Asset-Layer-Normal.png");
+ static const QIcon iconDelete = QIcon(":/images/Action-Trash-Normal.png");
+ static const QIcon iconFirst = QIcon(":/images/playback_tools_low-00.png");
+ static const QIcon iconStop = QIcon(":/images/playback_tools_low-01.png");
+ static const QIcon iconPlay = QIcon(":/images/playback_tools_low-02.png");
+ static const QIcon iconLast = QIcon(":/images/playback_tools_low-04.png");
+
+ // create actions
+ QAction *actionNewLayer = new QAction(iconLayer, tr("Add New Layer"));
+ QAction *actionDeleteLayer = new QAction(iconDelete, tr("Delete Layer"));
+ m_actionTime = new QAction("0:00.000");
+ QAction *actionFirst = new QAction(iconFirst, tr("Go to Timeline Start"));
+ QAction *actionStop = new QAction(iconStop, tr("Stop Playing"));
+ QAction *actionPlay = new QAction(iconPlay, tr("Start Playing"));
+ QAction *actionLast = new QAction(iconLast, tr("Go to Timeline End"));
+
+ m_scaleSlider = new QSlider();
+ m_scaleSlider->setOrientation(Qt::Horizontal);
+ m_scaleSlider->setMaximumWidth(200);
+ m_scaleSlider->setMinimumWidth(100);
+ m_scaleSlider->setMinimum(1);
+ m_scaleSlider->setMaximum(8);
+ m_scaleSlider->setPageStep(.1);
+ m_scaleSlider->setValue(2);
+ m_scaleSlider->setStyleSheet("background-color:0,0,0,0;");
+
+ m_actionDuration = new QAction("0:20");
+
+ // connections
+ connect(actionNewLayer , &QAction::triggered, this, &TimelineToolbar::newLayerTriggered);
+ connect(actionDeleteLayer, &QAction::triggered, this, &TimelineToolbar::deleteLayerTriggered);
+ connect(m_actionTime , &QAction::triggered, this, &TimelineToolbar::gotoTimeTriggered);
+ connect(actionFirst , &QAction::triggered, this, &TimelineToolbar::firstFrameTriggered);
+ connect(actionStop , &QAction::triggered, this, &TimelineToolbar::stopTriggered);
+ connect(actionPlay , &QAction::triggered, this, &TimelineToolbar::playTriggered);
+ connect(actionLast , &QAction::triggered, this, &TimelineToolbar::lastFrameTriggered);
+ connect(m_scaleSlider , &QSlider::valueChanged, this, &TimelineToolbar::timelineScaleChanged);
+ connect(m_actionDuration , &QAction::triggered, this, &TimelineToolbar::setDurationTriggered);
+
+ // add actions
+ addAction(actionNewLayer);
+ addAction(actionDeleteLayer);
+ addSpacing(100);
+ addAction(m_actionTime);
+ addSpacing(10);
+ addAction(actionFirst);
+ addAction(actionStop);
+ addAction(actionPlay);
+ addAction(actionLast);
+ addSpacing(20);
+ addWidget(m_scaleSlider);
+ addSeparator();
+ addAction(m_actionDuration);
+}
+
+// add a spacer widget
+void TimelineToolbar::addSpacing(int width)
+{
+ auto *widget = new QWidget;
+ widget->setStyleSheet("background-color:0,0,0,0;"); // make the widget transparent
+ widget->setFixedWidth(width);
+ addWidget(widget);
+}
+
+void TimelineToolbar::setTime(double secsAndmillis)
+{
+ long totalMillis = secsAndmillis * 1000;
+ long mins = totalMillis % 3600000 / 60000;
+ long secs = totalMillis % 60000 / 1000;
+ long millis = totalMillis % 1000;
+
+ m_actionTime->setText(QString::asprintf("%01d:%02d.%03d", mins, secs, millis));
+}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h
new file mode 100644
index 00000000..1cac830d
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TIMELINETOOLBAR_H
+#define TIMELINETOOLBAR_H
+
+#include <QtWidgets/qtoolbar.h>
+
+QT_FORWARD_DECLARE_CLASS(QAction)
+QT_FORWARD_DECLARE_CLASS(QSlider)
+
+class TimelineToolbar : public QToolBar
+{
+ Q_OBJECT
+
+signals:
+ void newLayerTriggered();
+ void deleteLayerTriggered();
+ void gotoTimeTriggered();
+ void firstFrameTriggered();
+ void stopTriggered();
+ void playTriggered();
+ void lastFrameTriggered();
+ void timelineScaleChanged(int scale);
+ void setDurationTriggered();
+
+public:
+ TimelineToolbar();
+
+ void setTime(double millis);
+
+private:
+ void addSpacing(int width);
+
+ QAction *m_actionTime;
+ QAction *m_actionDuration;
+ QSlider *m_scaleSlider;
+};
+
+#endif // TIMELINETOOLBAR_H
diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideRowUI.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.cpp
index 2f4b7d05..8766ff12 100644
--- a/src/Authoring/Studio/Palettes/Timeline/SlideRowUI.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
@@ -25,37 +25,33 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "SlideRowUI.h"
-#include "SlideRow.h"
+#include "TreeHeader.h"
-#include "ITimelineControl.h"
-#include "SlideTimebarRow.h"
+#include <QtGui/qpainter.h>
-CSlideRowUI::CSlideRowUI(CBaseStateRow *baseStateRow, CAbstractTimelineRowUI *parentUiRow)
- : CBaseStateRowUI(baseStateRow, parentUiRow)
-{
-}
-void CSlideRowUI::SetSnappingListProvider(ISnappingListProvider *inProvider)
+TreeHeader::TreeHeader(TimelineItem *parent) : TimelineItem(parent)
{
- Q_UNUSED(inProvider);
+
}
-ISnappingListProvider *CSlideRowUI::GetSnappingListProvider() const
+void TreeHeader::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
{
- Q_ASSERT(m_TimelineControl);
- return m_TimelineControl->GetSnappingListProvider();
+ static const QPixmap pixShy = QPixmap(":/images/Toggle-Shy.png");
+ static const QPixmap pixHide = QPixmap(":/images/Toggle-HideShow.png");
+ static const QPixmap pixLock = QPixmap(":/images/Toggle-Lock.png");
+
+ double y = (size().height() - pixHide.height()) * .5;
+
+ painter->drawPixmap(size().width() - pixHide.width() * 1.1 * 3, y, pixShy);
+ painter->drawPixmap(size().width() - pixHide.width() * 1.1 * 2, y, pixHide);
+ painter->drawPixmap(size().width() - pixHide.width() * 1.1 , y, pixLock);
}
-//=============================================================================
-/**
- * Create a new CStateTimebarRow.
- * This is virtual and used for objects to return their type specific
- * timebar rows if they want to.
- * @return the created timebar row.
- */CBaseTimebarlessRow *CSlideRowUI::CreateTimebarRow()
+int TreeHeader::type() const
{
- return new CSlideTimebarRow(this);
-
+ // Enable the use of qgraphicsitem_cast with this item.
+ return TypeTreeHeader;
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.h
new file mode 100644
index 00000000..2f90b8fc
--- /dev/null
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TreeHeader.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 TREEHEADER_H
+#define TREEHEADER_H
+
+#include "TimelineItem.h"
+
+class RowTimeline;
+
+class TreeHeader : public TimelineItem
+{
+ Q_OBJECT
+
+public:
+ explicit TreeHeader(TimelineItem *parent = nullptr);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = nullptr) override;
+
+ int type() const;
+};
+
+#endif // TREEHEADER_H
diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro
index 639781dd..0add9a50 100644
--- a/src/Authoring/Studio/Qt3DStudio.pro
+++ b/src/Authoring/Studio/Qt3DStudio.pro
@@ -38,6 +38,8 @@ INCLUDEPATH += \
Palettes/Project \
Palettes/Slide \
Palettes/Timeline \
+ Palettes/TimelineGraphicsView \
+ Palettes/TimelineGraphicsView/ui \
Render \
UI \
Utils \
@@ -146,19 +148,35 @@ HEADERS += \
Controls/TreeItem.h \
Palettes/Timeline/AbstractTimelineRowUI.h \
Palettes/Timeline/BaseStateRow.h \
- Palettes/Timeline/BaseStateRowUI.h \
Palettes/Timeline/SlideRow.h \
- Palettes/Timeline/SlideRowUI.h \
Palettes/Timeline/StateRow.h \
Palettes/Timeline/StateRowUI.h \
Palettes/Timeline/PropertyRow.h \
- Palettes/Timeline/PropertyRowUI.h \
Palettes/Timeline/TimelineRow.h \
Palettes/Timeline/TimelineUIFactory.h \
Palettes/Timeline/TimelineView.h \
Palettes/Timeline/TimelineObjectModel.h \
Palettes/Timeline/TimeMeasureItem.h \
- Application/DataInputSelectDlg.h
+ Application/DataInputSelectDlg.h \
+ Palettes/TimelineGraphicsView/TimelineWidget.h \
+ Palettes/TimelineGraphicsView/TimelineGraphicsScene.h \
+ Palettes/TimelineGraphicsView/ui/TimelineItem.h \
+ Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.h \
+ Palettes/TimelineGraphicsView/ui/Separator.h \
+ Palettes/TimelineGraphicsView/ui/Ruler.h \
+ Palettes/TimelineGraphicsView/ui/PlayHead.h \
+ Palettes/TimelineGraphicsView/TimelineConstants.h \
+ Palettes/TimelineGraphicsView/ui/TimelineToolbar.h \
+ Palettes/TimelineGraphicsView/SelectionRect.h \
+ Palettes/TimelineGraphicsView/RowMover.h \
+ Palettes/TimelineGraphicsView/Keyframe.h \
+ Palettes/TimelineGraphicsView/rowtypes.h \
+ Palettes/TimelineGraphicsView/KeyframeManager.h \
+ Palettes/TimelineGraphicsView/RowManager.h \
+ Palettes/TimelineGraphicsView/TimelineUtils.h \
+ Palettes/TimelineGraphicsView/ui/RowTree.h \
+ Palettes/TimelineGraphicsView/ui/RowTimeline.h \
+ Palettes/TimelineGraphicsView/ui/TreeHeader.h
FORMS += \
Application/TimeEditDlg.ui \
@@ -169,8 +187,6 @@ FORMS += \
_Win/UI/InterpolationDlg.ui \
_Win/UI/ResetKeyframeValuesDlg.ui \
_Win/UI/GLVersionDlg.ui \
- Application/StudioTutorialWidget.ui \
- _Win/UI/TimeLineToolbar.ui \
MainFrm.ui \
_Win/Application/AboutDlg.ui \
_Win/UI/StartupDlg.ui \
@@ -178,7 +194,8 @@ FORMS += \
_Win/Application/SubPresentationListDlg.ui \
Application/DataInputDlg.ui \
Application/DataInputListDlg.ui \
- _Win/Palettes/Progress/ProgressDlg.ui
+ _Win/Palettes/Progress/ProgressDlg.ui \
+ Application/StudioTutorialWidget.ui
SOURCES += \
MainFrm.cpp \
@@ -210,7 +227,6 @@ SOURCES += \
_Win/UI/StudioProjectSettingsPage.cpp \
Application/TimeEditDlg.cpp \
Application/DurationEditDlg.cpp \
- _Win/UI/TimeLineToolbar.cpp \
_Win/Utils/MouseCursor.cpp \
_Win/Workspace/Dialogs.cpp \
_Win/Workspace/Views.cpp \
@@ -300,50 +316,23 @@ SOURCES += \
Palettes/Slide/SlideModel.cpp \
Palettes/Slide/SlideView.cpp \
Palettes/Slide/SlideContextMenu.cpp \
- Palettes/Timeline/AreaBoundingRect.cpp \
- Palettes/Timeline/AssetTimelineKeyframe.cpp \
Palettes/Timeline/BaseStateRow.cpp \
- Palettes/Timeline/BaseTimebarlessRow.cpp \
- Palettes/Timeline/BaseTimelineTreeControl.cpp \
- Palettes/Timeline/BlankToggleControl.cpp \
Palettes/Timeline/ColorBlankControl.cpp \
Palettes/Timeline/ColorControl.cpp \
Palettes/Timeline/CommentEdit.cpp \
- Palettes/Timeline/ComponentContextMenu.cpp \
- Palettes/Timeline/FilterToolbar.cpp \
- Palettes/Timeline/KeyframeContextMenu.cpp \
- Palettes/Timeline/Playhead.cpp \
Palettes/Timeline/PropertyColorControl.cpp \
Palettes/Timeline/PropertyGraphKeyframe.cpp \
Palettes/Timeline/PropertyRow.cpp \
Palettes/Timeline/PropertyTimebarGraph.cpp \
- Palettes/Timeline/PropertyTimebarRow.cpp \
- Palettes/Timeline/PropertyTimelineKeyframe.cpp \
- Palettes/Timeline/PropertyToggleControl.cpp \
- Palettes/Timeline/PropertyTreeControl.cpp \
Palettes/Timeline/ScalableScroller.cpp \
Palettes/Timeline/ScalableScrollerBar.cpp \
Palettes/Timeline/SlideRow.cpp \
- Palettes/Timeline/SlideTimebarRow.cpp \
Palettes/Timeline/Snapper.cpp \
Palettes/Timeline/StateRow.cpp \
Palettes/Timeline/StateRowFactory.cpp \
- Palettes/Timeline/StateTimebarlessRow.cpp \
- Palettes/Timeline/StateTimebarRow.cpp \
- Palettes/Timeline/TimebarControl.cpp \
- Palettes/Timeline/TimebarTip.cpp \
- Palettes/Timeline/TimelineControl.cpp \
Palettes/Timeline/TimelineFilter.cpp \
Palettes/Timeline/TimelineKeyframe.cpp \
Palettes/Timeline/TimelineRow.cpp \
- Palettes/Timeline/TimelineSplitter.cpp \
- Palettes/Timeline/TimelineTimelineLayout.cpp \
- Palettes/Timeline/TimelineTreeLayout.cpp \
- Palettes/Timeline/TimeMeasure.cpp \
- Palettes/Timeline/ToggleBlankControl.cpp \
- Palettes/Timeline/ToggleControl.cpp \
- Palettes/Timeline/ToggleToolbar.cpp \
- Palettes/Timeline/TreeBlankControl.cpp \
Palettes/Timeline/Bindings/BehaviorTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/DataInputTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/EmptyTimelineTimebar.cpp \
@@ -382,23 +371,34 @@ SOURCES += \
_Win/Application/SubPresentationDlg.cpp \
_Win/Application/SubPresentationListDlg.cpp \
Palettes/Timeline/AbstractTimelineRowUI.cpp \
- Palettes/Timeline/BaseStateRowUI.cpp \
- Palettes/Timeline/SlideRowUI.cpp \
- Palettes/Timeline/StateRowUI.cpp \
Palettes/Timeline/TimelineUIFactory.cpp \
- Palettes/Timeline/PropertyRowUI.cpp \
Palettes/Timeline/TimelineView.cpp \
Palettes/Timeline/TimelineObjectModel.cpp \
Palettes/Timeline/TimeMeasureItem.cpp \
Palettes/Timeline/TimePropertyItem.cpp \
Application/DataInputDlg.cpp \
Application/DataInputListDlg.cpp \
- Application/DataInputSelectDlg.cpp
+ Application/DataInputSelectDlg.cpp \
+ Palettes/TimelineGraphicsView/TimelineWidget.cpp \
+ Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp \
+ Palettes/TimelineGraphicsView/ui/TimelineItem.cpp \
+ Palettes/TimelineGraphicsView/ui/InteractiveTimelineItem.cpp \
+ Palettes/TimelineGraphicsView/ui/Separator.cpp \
+ Palettes/TimelineGraphicsView/ui/PlayHead.cpp \
+ Palettes/TimelineGraphicsView/ui/Ruler.cpp \
+ Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp \
+ Palettes/TimelineGraphicsView/SelectionRect.cpp \
+ Palettes/TimelineGraphicsView/RowMover.cpp \
+ Palettes/TimelineGraphicsView/KeyframeManager.cpp \
+ Palettes/TimelineGraphicsView/RowManager.cpp \
+ Palettes/TimelineGraphicsView/TimelineUtils.cpp \
+ Palettes/TimelineGraphicsView/ui/RowTree.cpp \
+ Palettes/TimelineGraphicsView/ui/RowTimeline.cpp \
+ Palettes/TimelineGraphicsView/ui/TreeHeader.cpp
HEADERS += \
Application/TimeEditDlg.h \
Application/DurationEditDlg.h \
- _Win/UI/TimeLineToolbar.h \
_Win/Application/StudioApp.h \
Controls/TextEditContextMenu.h \
Palettes/Action/ActionModel.h \
@@ -413,8 +413,6 @@ HEADERS += \
Palettes/Inspector/InspectorControlModel.h \
Palettes/Slide/SlideModel.h \
Palettes/Slide/SlideView.h \
- Palettes/Timeline/ComponentContextMenu.h \
- Palettes/Timeline/KeyframeContextMenu.h \
Palettes/Timeline/Bindings/IKeyframeSelector.h \
Palettes/Timeline/Bindings/ITimelineItemBinding.h \
Palettes/Timeline/Bindings/ITimelineItem.h \
diff --git a/src/Authoring/Studio/_Win/Palettes/PaletteManager.cpp b/src/Authoring/Studio/_Win/Palettes/PaletteManager.cpp
index dacc290f..f4ece159 100644
--- a/src/Authoring/Studio/_Win/Palettes/PaletteManager.cpp
+++ b/src/Authoring/Studio/_Win/Palettes/PaletteManager.cpp
@@ -33,8 +33,8 @@
#include "PaletteManager.h"
#include "StudioApp.h"
#include "MainFrm.h"
-#include "TimelineControl.h"
#include "TimelineView.h"
+#include "TimelineWidget.h"
#include "BasicObjectsView.h"
#include "SlideView.h"
#include "WidgetControl.h"
@@ -45,7 +45,6 @@
#include "ProjectView.h"
#include "TabOrderHandler.h"
#include "StudioPreferences.h"
-#include "TimeLineToolbar.h"
#include <QtWidgets/qdockwidget.h>
#include <QtWidgets/qboxlayout.h>
@@ -109,47 +108,18 @@ CPaletteManager::CPaletteManager(CMainFrame *inMainFrame)
inMainFrame->tabifyDockWidget(m_basicObjectsDock, m_slideDock);
m_ControlList.insert(std::make_pair(CONTROLTYPE_BASICOBJECTS, m_basicObjectsDock));
- m_timelineDock = new QDockWidget(QObject::tr("Timeline (old)"), inMainFrame);
- m_timelineDock->setObjectName("timeline_old");
- m_timelineDock->setAllowedAreas(Qt::BottomDockWidgetArea);
+ // TODO: remove after the new timeline is complete (leaving it as reference for now)
+// m_timelineQmlDock = new QDockWidget(QObject::tr("Timeline"), inMainFrame);
+// m_timelineQmlDock->setObjectName("timeline");
+// m_timelineQmlDock->setAllowedAreas(Qt::BottomDockWidgetArea);
+// m_timelineView = new TimelineView(m_timelineQmlDock);
+// m_timelineQmlDock->setWidget(m_timelineView);
- QWidget *timeLineParent = new QWidget(inMainFrame);
- timeLineParent->setObjectName("TimeLineParent");
- // Give the preferred size as percentages of the mainframe size
- // -25 is applied to width to compensate the action palette having no tabs by default
- m_timeLineToolbar = new TimeLineToolbar(inMainFrame,
- QSize(inMainFrame->width() * 0.8 - 25, 26),
- timeLineParent);
- m_timeLineToolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
- QVBoxLayout *layout = new QVBoxLayout(timeLineParent);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
-
- // Use spacer widget instead of just layout spacing to get the color of the space correct
- QWidget *spacer = new QWidget(timeLineParent);
- spacer->setMaximumHeight(2);
- spacer->setMinimumHeight(2);
-
- // Give the preferred size as percentages of the mainframe size
- // -25 is applied to width to compensate the action palette having no tabs by default
- // -26 is applied to height, as that is the height of the timeline toolbar
- auto c = new CTimelineControl(QSize(inMainFrame->width() * 0.8 - 25,
- inMainFrame->height() * 0.2 - 26));
- m_timeLineWidgetControl = new WidgetControl(c, timeLineParent);
-
- layout->addWidget(m_timeLineWidgetControl);
- layout->addWidget(spacer);
- layout->addWidget(m_timeLineToolbar);
-
- m_timelineDock->setWidget(timeLineParent);
- inMainFrame->addDockWidget(Qt::BottomDockWidgetArea, m_timelineDock);
- m_ControlList.insert(std::make_pair(CONTROLTYPE_TIMELINE, m_timelineDock));
-
- m_timelineQmlDock = new QDockWidget(QObject::tr("Timeline"), inMainFrame);
- m_timelineQmlDock->setObjectName("timeline");
- m_timelineDock->setAllowedAreas(Qt::BottomDockWidgetArea);
- m_timelineView = new TimelineView(m_timelineQmlDock);
- m_timelineQmlDock->setWidget(m_timelineView);
+ m_timelineGVDock = new QDockWidget(QObject::tr("Timeline GV"), inMainFrame);
+ m_timelineGVDock->setObjectName("timeline GV.");
+ m_timelineGVDock->setAllowedAreas(Qt::BottomDockWidgetArea);
+ m_timelineWidget = new TimelineWidget(m_timelineGVDock);
+ m_timelineGVDock->setWidget(m_timelineWidget);
m_actionDock = new QDockWidget(QObject::tr("Action"), inMainFrame);
m_actionDock->setObjectName("action");
@@ -168,17 +138,8 @@ CPaletteManager::CPaletteManager(CMainFrame *inMainFrame)
m_basicObjectsDock->setEnabled(false);
m_projectDock->setEnabled(false);
m_slideDock->setEnabled(false);
- m_timelineDock->setEnabled(false);
m_actionDock->setEnabled(false);
m_inspectorDock->setEnabled(false);
-
- m_timeLineWidgetControl->RegisterForDnd(m_timeLineWidgetControl);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_LISTBOX);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_FILE);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_ASSET_UICFILE);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_ASSET_LIB);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_ASSET_TL);
- m_timeLineWidgetControl->AddMainFlavor(QT3DS_FLAVOR_BASIC_OBJECTS);
}
//==============================================================================
@@ -288,13 +249,6 @@ bool CPaletteManager::tabNavigateFocusedWidget(bool tabForward)
* A helper for CMainFrame::GetTimelineControl() to access the CTimelineControl
* inside the QDockWidget
*/
-CTimelineControl *CPaletteManager::GetTimelineControl() const
-{
- if (m_timeLineWidgetControl)
- return static_cast<CTimelineControl *>(m_timeLineWidgetControl->getControl());
-
- return nullptr;
-}
TimelineView *CPaletteManager::GetTimelineView() const
{
@@ -303,7 +257,7 @@ TimelineView *CPaletteManager::GetTimelineView() const
void CPaletteManager::onTimeChanged(long time)
{
- m_timeLineToolbar->onTimeChanged(time);
+ //m_timeLineToolbar->onTimeChanged(time);
}
ProjectView *CPaletteManager::projectView() const
@@ -316,7 +270,8 @@ void CPaletteManager::EnablePalettes()
m_basicObjectsDock->setEnabled(true);
m_projectDock->setEnabled(true);
m_slideDock->setEnabled(true);
- m_timelineDock->setEnabled(true);
+// m_timelineQmlDock->setEnabled(true);
+ m_timelineGVDock->setEnabled(true);
m_actionDock->setEnabled(true);
m_inspectorDock->setEnabled(true);
}
diff --git a/src/Authoring/Studio/_Win/Palettes/PaletteManager.h b/src/Authoring/Studio/_Win/Palettes/PaletteManager.h
index 569b6dcd..07e94f6c 100644
--- a/src/Authoring/Studio/_Win/Palettes/PaletteManager.h
+++ b/src/Authoring/Studio/_Win/Palettes/PaletteManager.h
@@ -36,7 +36,7 @@
//==============================================================================
// Includes
//==============================================================================
-#include "TimelineControl.h"
+#include <QtWidgets/qdockwidget.h>
//==============================================================================
// Forwards
@@ -46,6 +46,7 @@ class WidgetControl;
class TimeLineToolbar;
class TimelineView;
class ProjectView;
+class TimelineWidget;
QT_FORWARD_DECLARE_CLASS(QDockWidget)
@@ -82,15 +83,14 @@ protected:
QDockWidget *m_basicObjectsDock;
QDockWidget *m_projectDock;
QDockWidget *m_slideDock;
- QDockWidget *m_timelineDock;
QDockWidget *m_timelineQmlDock;
+ QDockWidget *m_timelineGVDock;
QDockWidget *m_actionDock;
QDockWidget *m_inspectorDock;
- WidgetControl *m_timeLineWidgetControl;
- TimeLineToolbar *m_timeLineToolbar;
TimelineView *m_timelineView;
ProjectView *m_projectView = nullptr;
+ TimelineWidget *m_timelineWidget;
public:
CPaletteManager(CMainFrame *inMainFrame);
@@ -104,7 +104,6 @@ public:
QDockWidget *GetControl(long inType) const;
QWidget *getFocusWidget() const;
bool tabNavigateFocusedWidget(bool tabForward);
- CTimelineControl *GetTimelineControl() const;
TimelineView *GetTimelineView() const;
void onTimeChanged(long time);
ProjectView *projectView() const;
diff --git a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.cpp b/src/Authoring/Studio/_Win/UI/TimeLineToolbar.cpp
deleted file mode 100644
index 2d8c460f..00000000
--- a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** 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 "TimeLineToolbar.h"
-#include "ui_TimeLineToolbar.h"
-#include "StudioApp.h"
-#include "MainFrm.h"
-#include "TimeEditDlg.h"
-#include "DataInputSelectDlg.h"
-#include "DataInputDlg.h"
-#include "Doc.h"
-#include "Core.h"
-#include "Dispatch.h"
-#include "Qt3DSDMStudioSystem.h"
-#include "ClientDataModelBridge.h"
-#include "StudioObjectTypes.h"
-#include "IDocumentEditor.h"
-#include "DocumentEditorEnumerations.h"
-#include "StudioPreferences.h"
-
-#include <QtCore/qdatetime.h>
-
-TimeLineToolbar::TimeLineToolbar(CMainFrame *mainFrame, const QSize &preferredSize,
- QWidget *pParent)
- : QWidget(pParent)
- , m_ui(new QT_PREPEND_NAMESPACE(Ui::TimeLineToolbar))
- , m_preferredSize(preferredSize)
- , m_mainFrame(mainFrame)
- , m_DataInputSelector(nullptr)
-{
- m_ui->setupUi(this);
-
- connect(m_ui->playButton, &QToolButton::clicked,
- this, &TimeLineToolbar::onPlayButtonClicked);
- connect(m_ui->rewindButton, &QToolButton::clicked,
- mainFrame, &CMainFrame::OnPlaybackRewind);
- connect(mainFrame, &CMainFrame::playStateChanged,
- [this](bool started) {
- if (started) {
- m_ui->playButton->setIcon(QIcon(":/images/playback_tools_low-01.png"));
- m_ui->playButton->setToolTip(tr("Stop animation"));
- } else {
- m_ui->playButton->setIcon(QIcon(":/images/playback_tools_low-02.png"));
- m_ui->playButton->setToolTip(tr("Play animation"));
- }
- });
-
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- connect(m_ui->timeButton, &QPushButton::clicked,
- [this, doc](){
- CTimeEditDlg timeEditDlg;
- timeEditDlg.showDialog(doc->GetCurrentViewTime(), doc, PLAYHEAD);
- });
-
- connect(m_ui->deleteObject, &QPushButton::clicked,
- doc, &CDoc::DeleteSelectedObject);
-
- CDispatch *theDispatch = g_StudioApp.GetCore()->GetDispatch();
- m_Connections.push_back(theDispatch->ConnectSelectionChange(
- std::bind(&TimeLineToolbar::OnSelectionChange, this, std::placeholders::_1)));
-
- connect(m_ui->addLayerButton, &QPushButton::clicked,
- this, &TimeLineToolbar::onAddLayerClicked);
- // Set as parent to mainframe to allow positioning in the main window
- m_DataInputSelector = new DataInputSelectDlg(mainFrame);
- m_DataInputSelector->hide();
- m_DataInputSelector->setWindowTitle(tr("Select timeline controller"));
-
-
- connect(m_ui->addDataInputButton, &QPushButton::clicked,
- this, &TimeLineToolbar::onAddDataInputClicked);
-
- theDispatch->AddDataModelListener(this);
- connect(m_DataInputSelector, &DataInputSelectDlg::dataInputChanged,
- this, &TimeLineToolbar::onDataInputChange);
-}
-
-TimeLineToolbar::~TimeLineToolbar()
-{
- delete m_ui;
- delete m_DataInputSelector;
- m_Connections.clear();
-}
-
-QSize TimeLineToolbar::sizeHint() const
-{
- return m_preferredSize;
-}
-
-void TimeLineToolbar::onTimeChanged(long time)
-{
- QString formattedTime;
- if (time < 1000 * 60 * 60) {
- formattedTime = QTime::fromMSecsSinceStartOfDay(time).toString(
- QStringLiteral("m:ss.zzz"));
- } else {
- formattedTime = QTime::fromMSecsSinceStartOfDay(time).toString(
- QStringLiteral("H:mm:ss.zzz"));
- }
- m_ui->timeButton->setText(formattedTime);
-
- m_ui->rewindButton->setEnabled(time != 0);
-}
-
-void TimeLineToolbar::OnSelectionChange(Q3DStudio::SSelectedValue newSelectable)
-{
- qt3dsdm::TInstanceHandleList selectedInstances = newSelectable.GetSelectedInstances();
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- CClientDataModelBridge *theClientBridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- bool canDelete = false;
- for (size_t idx = 0, end = selectedInstances.size(); idx < end; ++idx) {
- if (theClientBridge->CanDelete(selectedInstances[idx])) {
- canDelete = true;
- break;
- }
- }
- m_ui->deleteObject->setEnabled(canDelete);
-
- updateDataInputStatus(false);
-}
-
-void TimeLineToolbar::onAddDataInputClicked()
-{
- showDataInputChooser();
-}
-
-// Update datainput button state according to this timecontext
-// control state. If triggered via datamodel change i.e. dispatch message,
-// force update from actual property values
-void TimeLineToolbar::updateDataInputStatus(bool isViaDispatch)
-{
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- qt3dsdm::Qt3DSDMPropertyHandle ctrldProp;
- qt3dsdm::Qt3DSDMInstanceHandle timeCtxRoot = doc->GetActiveRootInstance();
- CClientDataModelBridge *theClientBridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- // Only check for updates if we have entered new time context or receive dispatch (undo/redo).
- // Actual control changes in this time context are handled in onDataInputChange
- if (m_currTimeCtxRoot != timeCtxRoot || isViaDispatch) {
- if (theClientBridge->GetObjectType(timeCtxRoot) == EStudioObjectType::OBJTYPE_SCENE) {
- ctrldProp = theClientBridge->GetObjectDefinitions().m_Scene.m_ControlledProperty;
- } else if (theClientBridge->GetObjectType(timeCtxRoot) ==
- EStudioObjectType::OBJTYPE_COMPONENT) {
- ctrldProp = theClientBridge->GetObjectDefinitions().m_Component.m_ControlledProperty;
- } else {
- Q_ASSERT(false);
- }
-
- qt3dsdm::Option<qt3dsdm::SValue> controlledPropertyVal
- = Q3DStudio::SCOPED_DOCUMENT_EDITOR(
- *doc,
- QObject::tr("Get Timeline control"))->GetInstancePropertyValue(timeCtxRoot,
- ctrldProp);
- auto existingCtrl = qt3dsdm::get<QString>(controlledPropertyVal.getValue());
-
- if (existingCtrl.contains("@timeline")) {
- int slideStrPos = existingCtrl.indexOf("@timeline");
- int ctrStrPos = existingCtrl.lastIndexOf(" ", slideStrPos - 2);
- m_currController = existingCtrl.mid(ctrStrPos + 1, slideStrPos - ctrStrPos - 2);
- } else {
- m_currController.clear();
- }
- // Toggle if we changed to a controlled time context, or if icon current state
- // differs from the control state of current time context
- if (m_currController.size()) {
- m_ui->addDataInputButton->setToolTip(
- tr("Timeline Controller:\n%1").arg(m_currController));
- m_ui->addDataInputButton->setIcon(QIcon(":/images/Objects-DataInput-Normal.png"));
- } else {
- // TODO actually delete the entire property instead of setting it as empty string
- m_ui->addDataInputButton->setIcon(QIcon(":/images/Objects-DataInput-Disabled.png"));
- m_ui->addDataInputButton->setToolTip(tr("No control"));
- }
-
- m_currTimeCtxRoot = timeCtxRoot;
- }
-}
-
-void TimeLineToolbar::showDataInputChooser()
-{
- QStringList dataInputList;
- dataInputList.append(tr("[No control]"));
- for (int i = 0; i < g_StudioApp.m_dataInputDialogItems.size(); i++) {
- if (g_StudioApp.m_dataInputDialogItems[i]->type == EDataType::DataTypeRangedNumber)
- dataInputList.append(g_StudioApp.m_dataInputDialogItems[i]->name);
- }
- QString currCtr = m_currController.size() ?
- m_currController : tr("[No control]");
- m_DataInputSelector->setData(dataInputList, currCtr);
- m_DataInputSelector->showDialog(QCursor::pos());
-
- return;
-}
-
-void TimeLineToolbar::onDataInputChange(const QString &dataInputName)
-{
- if (dataInputName == m_currController ||
- (dataInputName == tr("[No Control]") && !m_currController.size())) {
- return;
- }
-
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- CClientDataModelBridge *bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
- QString fullTimeControlStr;
-
- if (dataInputName != tr("[No control]")) {
- m_ui->addDataInputButton->setToolTip(tr("Timeline Controller:\n%1").arg(dataInputName));
- fullTimeControlStr = dataInputName + " @timeline";
- m_ui->addDataInputButton->setIcon(QIcon(":/images/Objects-DataInput-Normal.png"));
- m_currController = dataInputName;
- } else {
- m_ui->addDataInputButton->setToolTip(tr("No control"));
- // TODO actually delete the entire property instead of setting it as empty string
- m_ui->addDataInputButton->setIcon(QIcon(":/images/Objects-DataInput-Disabled.png"));
- m_currController.clear();
- }
-
- // To indicate that this presentation timeline is controlled by data input,
- // we set "controlled property" of this time context root (scene or component)
- // to contain the name of controller followed by special indicator "@timeline".
- // Either replace existing timeline control indicator string or append new one
- // but do not touch @slide indicator string as scene can have both
- qt3dsdm::Qt3DSDMPropertyHandle ctrldPropertyHandle;
- qt3dsdm::Qt3DSDMInstanceHandle timeCtxRoot = doc->GetActiveRootInstance();
- // Time context root is either scene or component
- if (bridge->GetObjectType(timeCtxRoot) == EStudioObjectType::OBJTYPE_SCENE)
- ctrldPropertyHandle = bridge->GetObjectDefinitions().m_Scene.m_ControlledProperty;
- else if (bridge->GetObjectType(timeCtxRoot) == EStudioObjectType::OBJTYPE_COMPONENT)
- ctrldPropertyHandle = bridge->GetObjectDefinitions().m_Component.m_ControlledProperty;
- else
- Q_ASSERT(false);
-
- qt3dsdm::Option<qt3dsdm::SValue> controlledPropertyVal
- = Q3DStudio::SCOPED_DOCUMENT_EDITOR(
- *doc,
- QObject::tr("Get DataInput control"))->GetInstancePropertyValue(timeCtxRoot,
- ctrldPropertyHandle);
-
- auto existingCtrl = qt3dsdm::get<QString>(controlledPropertyVal.getValue());
- if (existingCtrl.contains("@timeline")) {
- int slideStrPos = existingCtrl.indexOf("@timeline");
- // find the controlling datainput name and build the string to replace
- int ctrStrPos = existingCtrl.lastIndexOf(" ", slideStrPos - 2);
- QString prevCtrler = existingCtrl.mid(ctrStrPos + 1, slideStrPos - ctrStrPos - 1);
- existingCtrl.replace(prevCtrler + "@timeline", fullTimeControlStr);
- } else {
- if (!existingCtrl.isEmpty() && m_currController.size())
- existingCtrl.append(" ");
- existingCtrl.append(fullTimeControlStr);
- }
-
- if (existingCtrl.endsWith(" "))
- existingCtrl.chop(1);
-
- if (existingCtrl.startsWith(" "))
- existingCtrl.remove(0, 1);
-
- m_currTimeCtxRoot = timeCtxRoot;
-
- qt3dsdm::SValue fullCtrlPropVal
- = std::make_shared<qt3dsdm::CDataStr>(
- Q3DStudio::CString::fromQString(existingCtrl));
- Q3DStudio::SCOPED_DOCUMENT_EDITOR(*doc, QObject::tr("Set Timeline control"))
- ->SetInstancePropertyValue(timeCtxRoot, ctrldPropertyHandle, fullCtrlPropVal);
- return;
-}
-
-void TimeLineToolbar::onAddLayerClicked()
-{
- using namespace Q3DStudio;
-
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- CClientDataModelBridge *bridge = doc->GetStudioSystem()->GetClientDataModelBridge();
-
- // If active instance is component, just bail as we can't add layers to components
- qt3dsdm::Qt3DSDMInstanceHandle rootInstance = doc->GetActiveRootInstance();
- if (bridge->GetObjectType(rootInstance) == OBJTYPE_COMPONENT)
- return;
-
- qt3dsdm::Qt3DSDMSlideHandle slide = doc->GetActiveSlide();
- qt3dsdm::Qt3DSDMInstanceHandle layer = doc->GetActiveLayer();
-
- SCOPED_DOCUMENT_EDITOR(*doc, QObject::tr("Add Layer"))
- ->CreateSceneGraphInstance(qt3dsdm::ComposerObjectTypes::Layer, layer, slide,
- DocumentEditorInsertType::PreviousSibling,
- CPt(), PRIMITIVETYPE_UNKNOWN, -1);
-}
-
-void TimeLineToolbar::onPlayButtonClicked()
-{
- CDoc *doc = g_StudioApp.GetCore()->GetDoc();
- if (doc->IsPlaying())
- m_mainFrame->OnPlaybackStop();
- else
- m_mainFrame->OnPlaybackPlay();
-}
-
-void TimeLineToolbar::OnBeginDataModelNotifications()
-{
-}
-
-void TimeLineToolbar::OnEndDataModelNotifications()
-{
- updateDataInputStatus(true);
-}
-
-void TimeLineToolbar::OnImmediateRefreshInstanceSingle(qt3dsdm::Qt3DSDMInstanceHandle inInstance)
-{
- updateDataInputStatus(true);
-}
-
-void TimeLineToolbar::OnImmediateRefreshInstanceMultiple(
- qt3dsdm::Qt3DSDMInstanceHandle *inInstance, long inInstanceCount)
-{
- updateDataInputStatus(true);
-}
diff --git a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.h b/src/Authoring/Studio/_Win/UI/TimeLineToolbar.h
deleted file mode 100644
index 238f9349..00000000
--- a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** 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_TIMELINETOOLBAR_H
-#define INCLUDED_TIMELINETOOLBAR_H 1
-
-#include "Qt3DSDMSignals.h"
-#include "SelectedValueImpl.h"
-#include "DataInputSelectDlg.h"
-#include "DispatchListeners.h"
-#include "Dispatch.h"
-#include <QtWidgets/qwidget.h>
-
-QT_BEGIN_NAMESPACE
-namespace Ui {
- class TimeLineToolbar;
-}
-QT_END_NAMESPACE
-
-class CMainFrame;
-
-class TimeLineToolbar : public QWidget,
- public IDataModelListener
-{
- Q_OBJECT
-public:
- TimeLineToolbar(CMainFrame *mainFrame, const QSize &preferredSize, QWidget *pParent = nullptr);
- virtual ~TimeLineToolbar();
-
- void onTimeChanged(long time);
- void OnSelectionChange(Q3DStudio::SSelectedValue newSelectable);
-
- void showDataInputChooser();
- void onDataInputChange(const QString &dataInputName);
-
- QSize sizeHint() const;
-
- // IDataModelListener
- void OnBeginDataModelNotifications() override;
- void OnEndDataModelNotifications() override;
- void OnImmediateRefreshInstanceSingle(qt3dsdm::Qt3DSDMInstanceHandle inInstance) override;
- void OnImmediateRefreshInstanceMultiple(qt3dsdm::Qt3DSDMInstanceHandle *inInstance,
- long inInstanceCount) override;
-private Q_SLOTS:
- void onAddLayerClicked();
- void onPlayButtonClicked();
- void onAddDataInputClicked();
-
-protected:
- QT_PREPEND_NAMESPACE(Ui::TimeLineToolbar) *m_ui;
- QSize m_preferredSize;
- CMainFrame *m_mainFrame;
- qt3dsdm::Qt3DSDMInstanceHandle m_currTimeCtxRoot = 0;
- QString m_currController;
-
- std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> m_Connections;
- DataInputSelectDlg *m_DataInputSelector;
- void updateDataInputStatus(bool isViaDispatch);
-};
-#endif // INCLUDED_TIMELINETOOLBAR_H
diff --git a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.ui b/src/Authoring/Studio/_Win/UI/TimeLineToolbar.ui
deleted file mode 100644
index ff1da953..00000000
--- a/src/Authoring/Studio/_Win/UI/TimeLineToolbar.ui
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>TimeLineToolbar</class>
- <widget class="QWidget" name="TimeLineToolbar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>507</width>
- <height>24</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>24</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>24</height>
- </size>
- </property>
- <property name="windowTitle">
- <string/>
- </property>
- <property name="accessibleName">
- <string>TimeLineToolbar</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>503</width>
- <height>25</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>4</number>
- </property>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>12</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="addDataInputButton">
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../images.qrc">
- <normaloff>:/images/Objects-DataInput-Disabled.png</normaloff>:/images/Objects-DataInput-Disabled.png</iconset>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="addLayerButton">
- <property name="toolTip">
- <string>Add new Layer</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../images.qrc">
- <normaloff>:/images/Asset-Layer-Normal.png</normaloff>:/images/Asset-Layer-Normal.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>24</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="deleteObject">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Delete selected item</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../images.qrc">
- <normaloff>:/images/Action-Trash-Normal.png</normaloff>:/images/Action-Trash-Normal.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>200</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="timeButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Playhead time</string>
- </property>
- <property name="text">
- <string>0:00.000</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>8</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="rewindButton">
- <property name="toolTip">
- <string>Rewind</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../images.qrc">
- <normaloff>:/images/playback_tools_low-00.png</normaloff>:/images/playback_tools_low-00.png</iconset>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="playButton">
- <property name="toolTip">
- <string>Play</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="../../images.qrc">
- <normaloff>:/images/playback_tools_low-02.png</normaloff>:/images/playback_tools_low-02.png</iconset>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- <resources>
- <include location="../../images.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/src/Authoring/Studio/images.qrc b/src/Authoring/Studio/images.qrc
index 0728504d..7f2fcb20 100644
--- a/src/Authoring/Studio/images.qrc
+++ b/src/Authoring/Studio/images.qrc
@@ -190,6 +190,7 @@
<file>images/playback_tools_low-01.png</file>
<file>images/playback_tools_low-02.png</file>
<file>images/playback_tools_low-03.png</file>
+ <file>images/playback_tools_low-04.png</file>
<file>images/Toolbar-00.png</file>
<file>images/Toolbar-01.png</file>
<file>images/Toolbar-02.png</file>
diff --git a/src/Authoring/Studio/images/playback_tools_low-04.png b/src/Authoring/Studio/images/playback_tools_low-04.png
new file mode 100644
index 00000000..3819e1e3
--- /dev/null
+++ b/src/Authoring/Studio/images/playback_tools_low-04.png
Binary files differ