From eb7bd8bcbea0052252e4edf16d3d36081705bfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 30 Nov 2017 11:25:20 +0100 Subject: [PATCH] Sequencer - Full titles for overrides --- TODO | 1 - c-sync.cc | 31 +++++++++++++++++++++++++++++-- c-sync.hh | 6 ++++++ ui-sequencer.cc | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index bd34c1f..941d5c2 100644 --- a/TODO +++ b/TODO @@ -29,7 +29,6 @@ Sync / inputs: * Mouse controls for overrides * Zoom level is mostly useless, fix it * Save/restore sets of tracks -* Full titles (including sections) for overrides * Edition buttons in toolbar * Fix drag-and-drop * Moving tracks diff --git a/c-sync.cc b/c-sync.cc index 982c177..f4b9336 100644 --- a/c-sync.cc +++ b/c-sync.cc @@ -838,14 +838,41 @@ void T_SyncManager::mergeOverrides( assert( overrides.overrides.empty( ) ); soRoot_.merge( overrides ); + T_StringBuilder sb; + T_AutoArray< uint32_t , 16 > sbParts; soVisitor_.visitor.visit( &soRoot_ , - [this]( T_SyncOverrideVisitor::T_Element node , bool exit ) -> bool { - if ( exit || node.hasType< T_SyncOverrideSection* >( ) ) { + [&]( T_SyncOverrideVisitor::T_Element node , bool exit ) -> bool { + if ( node.hasType< T_SyncOverrideSection* >( ) ) { + T_SyncOverrideSection const& sos{ + *node.value< T_SyncOverrideSection* >( ) + }; + if ( sos.title == "*root*" ) { + return true; + } + + if ( exit ) { + sb.truncate( sbParts.last( ) ); + sbParts.removeLast( ); + } else { + sbParts.add( sb.length( ) ); + sb << sos.title << " \u00bb "; + } return true; } + + if ( exit ) { + return true; + } + auto& ovr( *node.value< A_SyncOverride* >( ) ); ovr.setup( ); soTable_.add( ovr.id( ) , &ovr ); + + const uint32_t sblen{ sb.length( ) }; + sb << ovr.title( ); + ovr.fullTitle( sb ); + sb.truncate( sblen ); + return false; } ); diff --git a/c-sync.hh b/c-sync.hh index 52e750b..59326f7 100644 --- a/c-sync.hh +++ b/c-sync.hh @@ -233,6 +233,7 @@ class A_SyncOverride ebcl::T_Set< T_String > inputs_{ ebcl::UseTag< ebcl::ArrayBacked< 8 > >( ) }; T_AutoArray< uint32_t , 8 > inputPos_; + T_String fullTitle_; A_SyncOverride( char const* type , T_String const& title ) noexcept; @@ -264,6 +265,11 @@ class A_SyncOverride ebcl::T_SRDLocation const& location( ) const noexcept { return location_; } + T_String const& fullTitle( ) const noexcept + { return fullTitle_; } + void fullTitle( T_String ft ) noexcept + { assert( !fullTitle_ ); fullTitle_ = std::move( ft ); } + // Connect the required inputs to the sync manager. Called once // the inputs have been added. virtual void setup( ) noexcept; diff --git a/ui-sequencer.cc b/ui-sequencer.cc index cf3e0b6..3ab3522 100644 --- a/ui-sequencer.cc +++ b/ui-sequencer.cc @@ -1076,7 +1076,7 @@ void T_SyncViewImpl_::sequencerTracks( stringBuffer.clear( ); if ( id.isOverride ) { stringBuffer << "[O] " - << Common::Sync( ).getOverride( id.id )->title( ); + << sync.getOverride( id.id )->fullTitle( ); } else { stringBuffer << "[I] " << id.id; }