65 lines
1.4 KiB
C++
65 lines
1.4 KiB
C++
#include "externals.hh"
|
|
#include "syncview.hh"
|
|
#include "globals.hh"
|
|
|
|
using namespace ebcl;
|
|
|
|
|
|
/*= T_SyncViewImpl_ ============================================================*/
|
|
namespace {
|
|
|
|
struct T_SyncViewImpl_
|
|
{
|
|
bool display( ) noexcept;
|
|
};
|
|
|
|
|
|
bool T_SyncViewImpl_::display( ) noexcept
|
|
{
|
|
using namespace ImGui;
|
|
auto const& dspSize( GetIO( ).DisplaySize );
|
|
auto& sync( Globals::Sync( ) );
|
|
|
|
// Window set-up
|
|
SetNextWindowSize( ImVec2( dspSize.x , 150 ) , ImGuiSetCond_Appearing );
|
|
SetNextWindowPos( ImVec2( 0 , dspSize.y - 150 ) , ImGuiSetCond_Appearing );
|
|
bool displayed{ true };
|
|
Begin( "Sequencer" , &displayed , ImGuiWindowFlags_NoCollapse );
|
|
if ( !displayed ) {
|
|
return false;
|
|
}
|
|
|
|
PushID( "playing" );
|
|
if ( Button( sync.playing( ) ? "Stop" : "Play" ) ) {
|
|
sync.playing( ) = !sync.playing( ) && !sync.finished( );
|
|
}
|
|
PopID( );
|
|
|
|
const float d( sync.duration( ) );
|
|
float tm( sync.time( ) );
|
|
SameLine( );
|
|
PushID( "sequencer" );
|
|
PushItemWidth( -1 );
|
|
if ( SliderFloat( "" , &tm , 0 , d , "%.1fs" ) ) {
|
|
sync.setTime( tm );
|
|
sync.playing( ) = sync.playing( ) && !sync.finished( );
|
|
}
|
|
PopItemWidth( );
|
|
PopID( );
|
|
End( );
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
} // namespace
|
|
/*= T_SyncView =================================================================*/
|
|
|
|
T_SyncView::T_SyncView( ) noexcept
|
|
: A_PrivateImplementation( new T_SyncViewImpl_( ) )
|
|
{ }
|
|
|
|
bool T_SyncView::display( ) noexcept
|
|
{
|
|
return p< T_SyncViewImpl_ >( ).display( );
|
|
}
|