From eab7b5f670ea6d24879c2060f2aa1844103b3d19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= <tseeker@nocternity.net>
Date: Wed, 22 Nov 2017 20:28:12 +0100
Subject: [PATCH] Sequencer - Preparing for curve display

---
 sync.cc     |  6 ++++++
 sync.hh     |  2 ++
 syncview.cc | 30 ++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/sync.cc b/sync.cc
index 5acf01e..8337752 100644
--- a/sync.cc
+++ b/sync.cc
@@ -615,6 +615,12 @@ void T_SyncManager::removeCurve(
 	}
 }
 
+T_SyncCurve const* T_SyncManager::getCurve(
+		T_String const& name ) const noexcept
+{
+	return curves_.curves.get( name );
+}
+
 void T_SyncManager::curvesChanged_( )
 {
 	if ( modified_ ) {
diff --git a/sync.hh b/sync.hh
index f0f3cd0..ebfe2a8 100644
--- a/sync.hh
+++ b/sync.hh
@@ -346,6 +346,8 @@ struct T_SyncManager : public virtual A_MouseCtrl
 	void clearCurves( );
 	void setCurve( T_SyncCurve curve );
 	void removeCurve( T_String const& curve ) noexcept;
+	T_SyncCurve const* getCurve(
+			T_String const& name ) const noexcept;
 
 	T_Array< T_SyncCurve > const& curves( ) const noexcept
 		{ return curves_.curves.values( ); }
diff --git a/syncview.cc b/syncview.cc
index d162fba..5547bc8 100644
--- a/syncview.cc
+++ b/syncview.cc
@@ -166,6 +166,8 @@ struct T_SyncViewImpl_
 	void sequencerWidget( ) noexcept;
 	void sequencerHeader( ImRect const& bb ) noexcept;
 	void sequencerBody( ImRect const& bb ) noexcept;
+	void sequencerCurves( ) noexcept;
+	void sequencerCurve( T_SyncCurve const& curve ) noexcept;
 
 	void displayCurveSelectorWindow( ) noexcept;
 	void displayCurveSelector( ) noexcept;
@@ -575,6 +577,14 @@ void T_SyncViewImpl_::sequencerBody(
 		bar ++;
 	}
 
+	// Display the curve / override controls
+	if ( sCurves.size( ) != 0 ) {
+		BeginGroup( );
+		// TODO: display overrides
+		sequencerCurves( );
+		EndGroup( );
+	}
+
 	if ( cursorPos >= 0 && cursorPos <= inner.GetWidth( ) ) {
 		auto* const dl( GetWindowDrawList( ) );
 		dl->AddLine( inner.Min + ImVec2{ cursorPos , -1 } ,
@@ -583,6 +593,26 @@ void T_SyncViewImpl_::sequencerBody(
 	}
 }
 
+void T_SyncViewImpl_::sequencerCurves( ) noexcept
+{
+	auto& sync{ Globals::Sync( ) };
+	const auto nc{ sCurves.size( ) };
+	for ( auto i = 0u ; i < nc ; i ++ ) {
+		if ( sCurves.values( )[ i ] ) {
+			continue;
+		}
+		auto* const curve{ sync.getCurve( sCurves.keys( )[ i ] ) };
+		assert( curve );
+		sequencerCurve( *curve );
+	}
+}
+
+void T_SyncViewImpl_::sequencerCurve(
+		T_SyncCurve const& curve ) noexcept
+{
+#warning implement the fuck
+}
+
 /*----------------------------------------------------------------------------*/
 
 void T_SyncViewImpl_::displayCurveSelectorWindow( ) noexcept