From 052d51a22f947885332c3207f9cc4c8e5fa1662c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 26 Nov 2017 11:57:26 +0100 Subject: [PATCH] Sequencer - Tweaking colors Also fixed a bug where selecting a track wouldn't unselect previously selected segment. --- ui-sequencer.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ui-sequencer.cc b/ui-sequencer.cc index c80fe5c..31bc132 100644 --- a/ui-sequencer.cc +++ b/ui-sequencer.cc @@ -559,8 +559,8 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept if ( io.MouseDown[ 0 ] || io.MouseDown[ 1 ] ) { selId = dTrack.id; selIsOverride = dTrack.isOverride; - selSegment = {}; - selPoint = {}; + selSegment = decltype( selSegment ){}; + selPoint = decltype( selPoint ){}; sub = E_SubWindow::SW_TRACK; } } else if ( mp.type == E_MousePosType::SEGMENT ) { @@ -570,7 +570,7 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept selId = dTrack.id; selIsOverride = dTrack.isOverride; selSegment = dSeg.seg; - selPoint = {}; + selPoint = decltype( selPoint ){}; sub = E_SubWindow::SW_SEGMENT; } } @@ -765,9 +765,13 @@ void T_SyncViewImpl_::sequencerTrack( // Compute colors using namespace ImGui; - const auto bgColor{ ColorHSVAToU32( hue , .25f , 1.f , .25f ) } , - borderColor{ ColorHSVAToU32( hue , .88f , 1.f , 1.f ) }; - const uint32_t segColors[ 2 ] = { + const bool sCurve{ selId && !selIsOverride && selId == id }; + const float scv{ sCurve ? 1.f : .7f }; + const auto bgColor{ ColorHSVAToU32( hue , .25f , scv , .25f ) } , + borderColor{ ColorHSVAToU32( hue , .5f , scv , 1.f ) }; + const uint32_t segColors[] = { + ColorHSVAToU32( hue - .03f , .4f , .7f , 1.f ) , + ColorHSVAToU32( hue + .03f , .4f , .7f , 1.f ) , ColorHSVAToU32( hue - .03f , .4f , 1.f , 1.f ) , ColorHSVAToU32( hue + .03f , .4f , 1.f , 1.f ) , }; @@ -802,7 +806,6 @@ void T_SyncViewImpl_::sequencerTrack( const auto nSeg{ curve ? curve->segments.size( ) : 0u }; uint32_t segStart{ 0 }; for ( auto i = 0u ; i < nSeg ; i ++ ) { - const auto color{ segColors[ i % 2 ] }; auto const& seg{ curve->segments[ i ] }; const auto segDur{ [&](){ auto t{ 0u }; @@ -823,6 +826,11 @@ void T_SyncViewImpl_::sequencerTrack( } // Add segment to displayed list + const bool sSegment{ sCurve && selSegment && *selSegment == i }; + if ( sSegment ) { + printf( "SelSeg! %d\n" , *selSegment ); + } + const auto color{ segColors[ i % 2 + ( sSegment ? 2 : 0 ) ] }; auto dSegIdx{ dspSegments.size( ) }; auto& dSeg{ dspSegments.addNew( ) }; dSeg.area = segFull; @@ -1362,7 +1370,7 @@ void T_SyncViewImpl_::displaySegmentWindow( ) noexcept if ( curve->segments.size( ) > 1 ) { selSegment = ( sid == 0 ? 0 : ( sid - 1 ) ); } else { - selSegment = {}; + selSegment = decltype( selSegment ){}; } SyncEditor::DeleteSegment( selId , sid ); }