UI - Refactoring progress
(see previous log message)
This commit is contained in:
parent
c8b673c51a
commit
8fc496b15a
22 changed files with 170 additions and 152 deletions
5
Makefile
5
Makefile
|
@ -15,13 +15,14 @@ FILEDUMPS =
|
|||
IMGUI = imgui.cpp imgui_draw.cpp
|
||||
|
||||
COMMON = \
|
||||
common.cc \
|
||||
c-filewatcher.cc \
|
||||
\
|
||||
utilities.cc \
|
||||
texture.cc \
|
||||
rendertarget.cc \
|
||||
camera.cc \
|
||||
\
|
||||
filewatcher.cc \
|
||||
globals.cc \
|
||||
profiling.cc \
|
||||
shaders.cc \
|
||||
odbg.cc \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "externals.hh"
|
||||
#include "filewatcher.hh"
|
||||
#include "c-filewatcher.hh"
|
||||
#include "utilities.hh"
|
||||
|
||||
|
56
common.cc
Normal file
56
common.cc
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include "externals.hh"
|
||||
#include "common.hh"
|
||||
|
||||
#include "c-filewatcher.hh"
|
||||
#include "opcomp.hh"
|
||||
#include "ops.hh"
|
||||
#include "profiling.hh"
|
||||
#include "sync.hh"
|
||||
#include "undo.hh"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct CommonData_
|
||||
{
|
||||
T_FilesWatcher watcher;
|
||||
T_Profiler profiler;
|
||||
T_SyncManager sync;
|
||||
T_ScriptManager ops;
|
||||
T_UndoManager undo;
|
||||
};
|
||||
|
||||
std::aligned_storage_t< sizeof( CommonData_ ) , alignof( CommonData_ ) > Instance_;
|
||||
|
||||
} // namespace <anon>
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
void Common::Init( ) noexcept
|
||||
{
|
||||
new ((char*)&Instance_) CommonData_( );
|
||||
}
|
||||
|
||||
void Common::Shutdown( ) noexcept
|
||||
{
|
||||
((CommonData_*)(char*)&Instance_)->~CommonData_( );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#define M_GET_( P ) ((CommonData_*)(char*)&Instance_)->P
|
||||
|
||||
T_FilesWatcher& Common::Watcher( ) noexcept
|
||||
{ return M_GET_( watcher ); }
|
||||
|
||||
T_Profiler& Common::Profiler( ) noexcept
|
||||
{ return M_GET_( profiler ); }
|
||||
|
||||
T_SyncManager& Common::Sync( ) noexcept
|
||||
{ return M_GET_( sync ); }
|
||||
|
||||
T_ScriptManager& Common::Ops( ) noexcept
|
||||
{ return M_GET_( ops ); }
|
||||
|
||||
T_UndoManager& Common::Undo( ) noexcept
|
||||
{ return M_GET_( undo ); }
|
29
common.hh
Normal file
29
common.hh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#ifndef REAL_BUILD
|
||||
# include "externals.hh"
|
||||
#endif
|
||||
|
||||
|
||||
struct T_FilesWatcher;
|
||||
struct T_Profiler;
|
||||
struct T_SyncManager;
|
||||
struct T_ScriptManager;
|
||||
class T_UndoManager;
|
||||
|
||||
|
||||
struct Common
|
||||
{
|
||||
static void Init( ) noexcept;
|
||||
static void Shutdown( ) noexcept;
|
||||
|
||||
static T_FilesWatcher& Watcher( ) noexcept;
|
||||
static T_Profiler& Profiler( ) noexcept;
|
||||
static T_SyncManager& Sync( ) noexcept;
|
||||
static T_ScriptManager& Ops( ) noexcept;
|
||||
static T_UndoManager& Undo( ) noexcept;
|
||||
|
||||
private:
|
||||
Common( ) = delete;
|
||||
NO_COPY( Common );
|
||||
NO_MOVE( Common );
|
||||
};
|
20
demo.cc
20
demo.cc
|
@ -2,7 +2,7 @@
|
|||
#include "demo.hh"
|
||||
#include "sync.hh"
|
||||
#include "rendertarget.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "opemu.hh"
|
||||
#include "opcomp.hh"
|
||||
#include <ebcl/Files.hh>
|
||||
|
@ -20,14 +20,14 @@ bool T_Demo::initialise(
|
|||
|
||||
void T_Demo::render( )
|
||||
{
|
||||
if ( Globals::Ops( ).hasNewProgram( ) ) {
|
||||
auto nProgram{ Globals::Ops( ).program( ) };
|
||||
if ( Common::Ops( ).hasNewProgram( ) ) {
|
||||
auto nProgram{ Common::Ops( ).program( ) };
|
||||
if ( runInit( *nProgram ) ) {
|
||||
program = std::move( nProgram );
|
||||
}
|
||||
}
|
||||
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
sync.updateTime( );
|
||||
|
||||
if ( context && !context->aborted ) {
|
||||
|
@ -55,23 +55,23 @@ bool T_Demo::runInit(
|
|||
}
|
||||
context = std::move( nContext );
|
||||
|
||||
Globals::Sync( ).clearInputs( );
|
||||
Globals::Sync( ).clearOverrides( );
|
||||
Common::Sync( ).clearInputs( );
|
||||
Common::Sync( ).clearOverrides( );
|
||||
|
||||
const auto n( context->initialInputs.size( ) );
|
||||
assert( n == p.inputs.size( ) );
|
||||
for ( auto i = 0u ; i < n ; i ++ ) {
|
||||
Globals::Sync( ).addInput( p.inputs[ i ] ,
|
||||
Common::Sync( ).addInput( p.inputs[ i ] ,
|
||||
context->initialInputs[ i ] );
|
||||
#ifdef INVASIVE_TRACES
|
||||
printf( "#%d %s pos %d\n" , i , p.inputs[ i ].toOSString( ).data( ) ,
|
||||
Globals::Sync( ).inputPos( p.inputs[ i ] ) );
|
||||
Common::Sync( ).inputPos( p.inputs[ i ] ) );
|
||||
#endif //INVASIVE_TRACES
|
||||
}
|
||||
Globals::Sync( ).updateCurveCaches( );
|
||||
Common::Sync( ).updateCurveCaches( );
|
||||
|
||||
if ( context->installOverrides ) {
|
||||
Globals::Sync( ).mergeOverrides( *( context->installOverrides ) );
|
||||
Common::Sync( ).mergeOverrides( *( context->installOverrides ) );
|
||||
context->installOverrides.clear( );
|
||||
}
|
||||
|
||||
|
|
35
globals.cc
35
globals.cc
|
@ -1,35 +0,0 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "filewatcher.hh"
|
||||
#include "opcomp.hh"
|
||||
#include "ops.hh"
|
||||
#include "profiling.hh"
|
||||
#include "sync.hh"
|
||||
#include "undo.hh"
|
||||
|
||||
|
||||
T_OwnPtr< T_FilesWatcher > Globals::watcher_;
|
||||
T_OwnPtr< T_Profiler > Globals::profiler_;
|
||||
T_OwnPtr< T_SyncManager > Globals::sync_;
|
||||
T_OwnPtr< T_ScriptManager > Globals::ops_;
|
||||
T_OwnPtr< T_UndoManager > Globals::undo_;
|
||||
|
||||
|
||||
void Globals::Init( )
|
||||
{
|
||||
watcher_ = NewOwned< T_FilesWatcher >( );
|
||||
profiler_ = NewOwned< T_Profiler >( );
|
||||
sync_ = NewOwned< T_SyncManager >( );
|
||||
ops_ = NewOwned< T_ScriptManager >( );
|
||||
undo_ = NewOwned< T_UndoManager >( );
|
||||
}
|
||||
|
||||
void Globals::Shutdown( )
|
||||
{
|
||||
undo_.clear( );
|
||||
ops_.clear( );
|
||||
sync_.clear( );
|
||||
profiler_.clear( );
|
||||
watcher_.clear( );
|
||||
}
|
31
globals.hh
31
globals.hh
|
@ -1,31 +0,0 @@
|
|||
#pragma once
|
||||
#ifndef REAL_BUILD
|
||||
# include "externals.hh"
|
||||
#endif
|
||||
|
||||
|
||||
struct T_FilesWatcher;
|
||||
struct T_Profiler;
|
||||
struct T_SyncManager;
|
||||
struct T_ScriptManager;
|
||||
class T_UndoManager;
|
||||
|
||||
|
||||
struct Globals
|
||||
{
|
||||
static void Init( );
|
||||
static void Shutdown( );
|
||||
|
||||
static T_FilesWatcher& Watcher( ) { return *watcher_; }
|
||||
static T_Profiler& Profiler( ) { return *profiler_; }
|
||||
static T_SyncManager& Sync( ) { return *sync_; }
|
||||
static T_ScriptManager& Ops( ) { return *ops_; }
|
||||
static T_UndoManager& Undo( ) { return *undo_; }
|
||||
|
||||
private:
|
||||
static T_OwnPtr< T_FilesWatcher > watcher_;
|
||||
static T_OwnPtr< T_Profiler > profiler_;
|
||||
static T_OwnPtr< T_SyncManager > sync_;
|
||||
static T_OwnPtr< T_ScriptManager > ops_;
|
||||
static T_OwnPtr< T_UndoManager > undo_;
|
||||
};
|
22
main.cc
22
main.cc
|
@ -1,7 +1,7 @@
|
|||
#include "externals.hh"
|
||||
#include "ui-imgui-sdl.hh"
|
||||
#include "demo.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "profiling.hh"
|
||||
#include "shaders.hh"
|
||||
#include "odbg.hh"
|
||||
|
@ -51,14 +51,14 @@ struct T_Main
|
|||
|
||||
T_Main::T_Main( )
|
||||
{
|
||||
Globals::Init( );
|
||||
Common::Init( );
|
||||
UI::Init( );
|
||||
prevSize = ImVec2( -1 , -1 );
|
||||
}
|
||||
|
||||
void T_Main::mainLoop( )
|
||||
{
|
||||
auto& p( Globals::Profiler( ) );
|
||||
auto& p( Common::Profiler( ) );
|
||||
while ( !done ) {
|
||||
auto const& dspSize( ImGui::GetIO( ).DisplaySize );
|
||||
if ( prevSize.x != dspSize.x || prevSize.y != dspSize.y ) {
|
||||
|
@ -84,7 +84,7 @@ void T_Main::mainLoop( )
|
|||
sequencer.setNew( );
|
||||
}
|
||||
|
||||
Globals::Watcher( ).check( );
|
||||
Common::Watcher( ).check( );
|
||||
UI::Shaders( ).update( );
|
||||
|
||||
glFinish( );
|
||||
|
@ -106,7 +106,7 @@ T_Main::~T_Main( )
|
|||
{
|
||||
demo.clear( );
|
||||
UI::Shutdown( );
|
||||
Globals::Shutdown( );
|
||||
Common::Shutdown( );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
@ -124,7 +124,7 @@ void T_Main::initDemo( )
|
|||
|
||||
printf( "init w/ dspsize %dx%d\n" , int( dspSize.x ) , int( dspSize.y ) );
|
||||
if ( demo->initialise( (uint32_t) dspSize.x , (uint32_t) dspSize.y ) ) {
|
||||
Globals::Profiler( ).clear( );
|
||||
Common::Profiler( ).clear( );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ void T_Main::handleCapture( )
|
|||
void T_Main::makeUI( )
|
||||
{
|
||||
using namespace ImGui;
|
||||
auto& undo( Globals::Undo( ) );
|
||||
auto& undo( Common::Undo( ) );
|
||||
bool eSequencer{ sequencer };
|
||||
if ( BeginMainMenuBar( ) ) {
|
||||
if ( BeginMenu( "File" ) ) {
|
||||
|
@ -233,7 +233,7 @@ void T_Main::makeUI( )
|
|||
MenuItemCheckbox( "Output debugger" ,
|
||||
&UI::ODbg( ).uiEnabled( ) );
|
||||
MenuItemCheckbox( "Profiler" ,
|
||||
&Globals::Profiler( ).uiEnabled( ) );
|
||||
&Common::Profiler( ).uiEnabled( ) );
|
||||
MenuItemCheckbox( "Sequencer" , &eSequencer );
|
||||
MenuItemCheckbox( "Shaders" ,
|
||||
&UI::Shaders( ).uiEnabled( ) );
|
||||
|
@ -248,7 +248,7 @@ void T_Main::makeUI( )
|
|||
sequencer.clear( );
|
||||
}
|
||||
|
||||
Globals::Profiler( ).makeUI( );
|
||||
Common::Profiler( ).makeUI( );
|
||||
UI::ODbg( ).makeUI( );
|
||||
UI::Shaders( ).makeUI( );
|
||||
UI::Sync( ).makeOverridesWindow( );
|
||||
|
@ -262,12 +262,12 @@ void T_Main::render( )
|
|||
if ( demo ) {
|
||||
demo->render( );
|
||||
|
||||
Globals::Profiler( ).start( "Debug" );
|
||||
Common::Profiler( ).start( "Debug" );
|
||||
T_Rendertarget::MainOutput( );
|
||||
if ( UI::ODbg( ).isActive( ) ) {
|
||||
UI::ODbg( ).debugOutput( );
|
||||
}
|
||||
glFinish( ); Globals::Profiler( ).end( "Debug" );
|
||||
glFinish( ); Common::Profiler( ).end( "Debug" );
|
||||
|
||||
} else {
|
||||
T_Rendertarget::MainOutput( );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "filewatcher.hh"
|
||||
#include "c-filewatcher.hh"
|
||||
#include "opast.hh"
|
||||
#include <ebcl/SRDData.hh>
|
||||
|
||||
|
|
10
opemu.cc
10
opemu.cc
|
@ -1,6 +1,6 @@
|
|||
#include "externals.hh"
|
||||
#include "opemu.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "ui.hh"
|
||||
#include "profiling.hh"
|
||||
#include "rendertarget.hh"
|
||||
|
@ -64,7 +64,7 @@ struct T_RunGuard
|
|||
~T_RunGuard( )
|
||||
{
|
||||
while ( !context.profiling.empty( ) ) {
|
||||
Globals::Profiler( ).end( context.profiling.last( ) );
|
||||
Common::Profiler( ).end( context.profiling.last( ) );
|
||||
context.profiling.removeLast( );
|
||||
}
|
||||
glUseProgram( 0 );
|
||||
|
@ -205,7 +205,7 @@ void T_OpContext::run(
|
|||
|
||||
case OP_GET_INPUT:
|
||||
ensureFpuStack( instr , 0 , 1 );
|
||||
x87stack[ x87sp ++ ] = Globals::Sync( ).inputs( )[ instr.args[ 0 ] ];
|
||||
x87stack[ x87sp ++ ] = Common::Sync( ).inputs( )[ instr.args[ 0 ] ];
|
||||
break;
|
||||
|
||||
case OP_FP_LOAD:
|
||||
|
@ -681,14 +681,14 @@ void T_OpContext::run(
|
|||
case OP_UI_PENTER:
|
||||
{
|
||||
T_String const& section( program.uiStrings[ instr.args[ 0 ] ] );
|
||||
Globals::Profiler( ).start( section );
|
||||
Common::Profiler( ).start( section );
|
||||
profiling.add( section );
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_UI_PEXIT:
|
||||
glFinish( );
|
||||
Globals::Profiler( ).end( profiling.last( ) );
|
||||
Common::Profiler( ).end( profiling.last( ) );
|
||||
profiling.removeLast( );
|
||||
break;
|
||||
|
||||
|
|
4
opmgr.cc
4
opmgr.cc
|
@ -1,5 +1,5 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "opcomp.hh"
|
||||
#include "ops.hh"
|
||||
|
||||
|
@ -40,7 +40,7 @@ void DumpSRDErrors(
|
|||
/*= T_ScriptManager ============================================================*/
|
||||
|
||||
T_ScriptManager::T_ScriptManager( ) noexcept
|
||||
: watcher_( Globals::Watcher( ) , [this](){
|
||||
: watcher_( Common::Watcher( ) , [this](){
|
||||
loadScript( );
|
||||
} ) ,
|
||||
parser_( ) , compiler_( )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "externals.hh"
|
||||
#include "shaders.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "ui.hh"
|
||||
#include "ui-utilities.hh"
|
||||
|
||||
|
@ -973,7 +973,7 @@ void T_ShaderManager::initProgram(
|
|||
}.buildCode( ) );
|
||||
|
||||
// Initialise file watcher + missing files
|
||||
program.watch = T_WatchedFiles{ Globals::Watcher( ) ,
|
||||
program.watch = T_WatchedFiles{ Common::Watcher( ) ,
|
||||
[this,name]() {
|
||||
programUpdated( name );
|
||||
} };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "filewatcher.hh"
|
||||
#include "c-filewatcher.hh"
|
||||
#include "utilities.hh"
|
||||
|
||||
|
||||
|
|
9
sync.cc
9
sync.cc
|
@ -1,10 +1,9 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "sync.hh"
|
||||
#include "syncedit.hh"
|
||||
#include "undo.hh"
|
||||
|
||||
#include <imgui_internal.h>
|
||||
#include <ebcl/Files.hh>
|
||||
#include <ebcl/SRDText.hh>
|
||||
#include <ebcl/SRDParser.hh>
|
||||
|
@ -411,7 +410,7 @@ void A_SyncOverride::setup( ) noexcept
|
|||
// FIXME: insufficient; the manager should be made aware of
|
||||
// the presence of an override for that value (and it should
|
||||
// fail for missing values).
|
||||
inputPos_.add( Globals::Sync( ).inputPos( inputs_[ i ] ) );
|
||||
inputPos_.add( Common::Sync( ).inputPos( inputs_[ i ] ) );
|
||||
if ( sb.size( ) ) {
|
||||
sb << ';';
|
||||
}
|
||||
|
@ -490,7 +489,7 @@ T_SyncOverrideVisitor::T_OpElement T_SyncOverrideVisitor::nodeBrowser(
|
|||
|
||||
T_SyncManager::T_SyncManager( )
|
||||
: pConfig_( MakeCurvesParser_( ) ) ,
|
||||
watcher_{ Globals::Watcher( ) , [this](){ curvesChanged_( ); } } ,
|
||||
watcher_{ Common::Watcher( ) , [this](){ curvesChanged_( ); } } ,
|
||||
soRoot_( "*root*" )
|
||||
{
|
||||
watcher_.watch( "curves.srd" );
|
||||
|
@ -671,7 +670,7 @@ void T_SyncManager::addReloadUndoData_(
|
|||
void* const data ) const noexcept
|
||||
{
|
||||
T_ParserOutput_& p{ *(T_ParserOutput_*)data };
|
||||
auto& undo{ Globals::Undo( ).add< T_UndoDurationChanges >(
|
||||
auto& undo{ Common::Undo( ).add< T_UndoDurationChanges >(
|
||||
p.time ? p.time->iDuration : 3600 ,
|
||||
time_.iDuration ,
|
||||
p.time ? p.time->uDuration : ( 1.f / 60.f ) ,
|
||||
|
|
2
sync.hh
2
sync.hh
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "filewatcher.hh"
|
||||
#include "c-filewatcher.hh"
|
||||
#include "utilities.hh"
|
||||
|
||||
#include <ebcl/SRDParserConfig.hh>
|
||||
|
|
14
syncedit.cc
14
syncedit.cc
|
@ -1,13 +1,13 @@
|
|||
#include "externals.hh"
|
||||
#include "syncedit.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
|
||||
|
||||
/*= T_UndoSyncChanges ========================================================*/
|
||||
|
||||
void T_UndoSyncChanges::undo( ) const noexcept
|
||||
{
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
const auto n{ changes_.size( ) };
|
||||
for ( auto i = 0u ; i < n ; i ++ ) {
|
||||
auto const& c( changes_[ i ] );
|
||||
|
@ -21,7 +21,7 @@ void T_UndoSyncChanges::undo( ) const noexcept
|
|||
|
||||
void T_UndoSyncChanges::redo( ) const noexcept
|
||||
{
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
const auto n{ changes_.size( ) };
|
||||
for ( auto i = 0u ; i < n ; i ++ ) {
|
||||
auto const& c( changes_[ i ] );
|
||||
|
@ -99,13 +99,13 @@ T_UndoDurationChanges::T_UndoDurationChanges(
|
|||
|
||||
void T_UndoDurationChanges::undo( ) const noexcept
|
||||
{
|
||||
Globals::Sync( ).setDuration( uSizeBefore_ , unitsBefore_ );
|
||||
Common::Sync( ).setDuration( uSizeBefore_ , unitsBefore_ );
|
||||
T_UndoSyncChanges::undo( );
|
||||
}
|
||||
|
||||
void T_UndoDurationChanges::redo( ) const noexcept
|
||||
{
|
||||
Globals::Sync( ).setDuration( uSizeAfter_ , unitsAfter_ );
|
||||
Common::Sync( ).setDuration( uSizeAfter_ , unitsAfter_ );
|
||||
T_UndoSyncChanges::redo( );
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void SyncEditor::SetDuration(
|
|||
const float uSize ,
|
||||
const bool scaleCurves ) noexcept
|
||||
{
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
const float oldUnitSize{ sync.durationUnitSize( ) };
|
||||
const uint32_t oldUnits{ sync.durationUnits( ) };
|
||||
if ( oldUnits == units && oldUnitSize == uSize ) {
|
||||
|
@ -153,7 +153,7 @@ void SyncEditor::SetDuration(
|
|||
}
|
||||
|
||||
auto& undo{ dynamic_cast< T_UndoDurationChanges& >(
|
||||
Globals::Undo( ).add< T_UndoDurationChanges >(
|
||||
Common::Undo( ).add< T_UndoDurationChanges >(
|
||||
units , oldUnits ,
|
||||
uSize , oldUnitSize ) ) };
|
||||
sync.setDuration( uSize , units );
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
#include "syncoverrides.hh"
|
||||
#include "ui-colorgrading.hh"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "ui.hh"
|
||||
#include "ui-colorgrading.hh"
|
||||
#include "ui-overrides.hh"
|
||||
|
@ -31,7 +31,7 @@ M_DECL_SOVUI( Float )
|
|||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Float& >( ovp ) };
|
||||
float v[ 1 ] = {
|
||||
Globals::Sync( ).inputs( )[ ov.inputPositions( )[ 0 ] ]
|
||||
Common::Sync( ).inputs( )[ ov.inputPositions( )[ 0 ] ]
|
||||
};
|
||||
|
||||
char const* const label( BuildLabel_( counter , sb ) );
|
||||
|
@ -41,7 +41,7 @@ M_DECL_SOVUI( Float )
|
|||
: DragFloat( label , v , ov.step( ) , ov.min( ) ,
|
||||
ov.max( ) , ov.decimals( ) , ov.power( ) ) );
|
||||
if ( changed ) {
|
||||
Globals::Sync( ).inputs( )[ ov.inputPositions( )[ 0 ] ] = v[ 0 ];
|
||||
Common::Sync( ).inputs( )[ ov.inputPositions( )[ 0 ] ] = v[ 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ M_DECL_SOVUI( Float2 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Float2& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
float v[ 2 ];
|
||||
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
||||
|
@ -73,7 +73,7 @@ M_DECL_SOVUI( Float3 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Float3& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
float v[ 3 ];
|
||||
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
||||
|
@ -97,7 +97,7 @@ M_DECL_SOVUI( Float4 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Float4& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
float v[ 4 ];
|
||||
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
||||
|
@ -124,7 +124,7 @@ M_DECL_SOVUI( Integer )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Integer& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
int32_t v[ 1 ] = {
|
||||
int32_t( sinp[ ovip[ 0 ] ] )
|
||||
|
@ -143,7 +143,7 @@ M_DECL_SOVUI( Integer2 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Integer2& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
int32_t v[ 2 ];
|
||||
for ( auto i = 0 ; i < 2 ; i ++ ) {
|
||||
|
@ -165,7 +165,7 @@ M_DECL_SOVUI( Integer3 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Integer3& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
int32_t v[ 3 ];
|
||||
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
||||
|
@ -187,7 +187,7 @@ M_DECL_SOVUI( Integer4 )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_Integer4& >( ovp ) };
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
int32_t v[ 4 ];
|
||||
for ( auto i = 0 ; i < 4 ; i ++ ) {
|
||||
|
@ -212,7 +212,7 @@ M_DECL_SOVUI( ColorGrading )
|
|||
{
|
||||
using namespace ImGui;
|
||||
auto& ov{ dynamic_cast< T_ColorGrading& >( ovp ) };
|
||||
auto& sinp{ Globals::Sync( ).inputs( ) };
|
||||
auto& sinp{ Common::Sync( ).inputs( ) };
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
float v[ 3 ];
|
||||
for ( auto i = 0 ; i < 3 ; i ++ ) {
|
||||
|
@ -241,7 +241,7 @@ glm::vec3 VectorFromInputs_(
|
|||
T_CamOverride::T_VectorConfig const& vc ,
|
||||
T_AutoArray< uint32_t , 8 > const& ovip ) noexcept
|
||||
{
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
return glm::vec3{
|
||||
sinp[ ovip[ vc.x ] ] ,
|
||||
sinp[ ovip[ vc.y ] ] ,
|
||||
|
@ -253,7 +253,7 @@ void InputsFromVector_(
|
|||
T_AutoArray< uint32_t , 8 > const& ovip ,
|
||||
glm::vec3 const& v ) noexcept
|
||||
{
|
||||
auto& sinp( Globals::Sync( ).inputs( ) );
|
||||
auto& sinp( Common::Sync( ).inputs( ) );
|
||||
sinp[ ovip[ vc.x ] ] = v.x;
|
||||
sinp[ ovip[ vc.y ] ] = v.y;
|
||||
sinp[ ovip[ vc.z ] ] = v.z;
|
||||
|
@ -289,7 +289,7 @@ void T_MouseCam_::handleDragAndDrop(
|
|||
T_KeyboardModifiers modifiers ,
|
||||
T_MouseButtons buttons ) noexcept
|
||||
{
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
if ( !ov.enabled( ) ) {
|
||||
UI::Sync( ).clearMouseDelegate( );
|
||||
return;
|
||||
|
@ -314,7 +314,7 @@ void T_MouseCam_::handleWheel(
|
|||
T_KeyboardModifiers modifiers ,
|
||||
T_MouseButtons buttons ) noexcept
|
||||
{
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
if ( !ov.enabled( ) ) {
|
||||
UI::Sync( ).clearMouseDelegate( );
|
||||
return;
|
||||
|
@ -348,7 +348,7 @@ void T_MouseCam_::handleWheel(
|
|||
M_DECL_SOVUI( Camera )
|
||||
{
|
||||
auto& ov{ dynamic_cast< T_CamOverride& >( ovp ) };
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
auto& sinp{ sync.inputs( ) };
|
||||
auto& camera{ ov.camData( ) };
|
||||
auto const& ovip{ ov.inputPositions( ) };
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "externals.hh"
|
||||
#include "ui-sequencer.hh"
|
||||
#include "sync.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "syncedit.hh"
|
||||
#include "ui.hh"
|
||||
#include "ui-app.hh"
|
||||
|
@ -246,7 +246,7 @@ bool T_SyncViewImpl_::display( ) noexcept
|
|||
|
||||
void T_SyncViewImpl_::checkSelectedCurves( ) noexcept
|
||||
{
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
|
||||
// Check for "dead" overrides
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ void T_SyncViewImpl_::checkSelectedCurves( ) noexcept
|
|||
void T_SyncViewImpl_::displayToolbar( ) noexcept
|
||||
{
|
||||
using namespace ImGui;
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
|
||||
if ( ToolbarButton( sync.playing( ) ? ICON_FA_STOP : ICON_FA_PLAY , BtSize ,
|
||||
sync.playing( ) ? "Stop" : "Play" ) ) {
|
||||
|
@ -396,8 +396,8 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
|||
} else if ( active ) {
|
||||
if ( io.MouseDown[ 0 ] ) {
|
||||
const float p{ io.MousePos.x - bbAll.Min.x + startPixel };
|
||||
auto& sync( Globals::Sync( ) );
|
||||
sync.setTime( p * Globals::Sync( ).duration( ) / totalPixels );
|
||||
auto& sync( Common::Sync( ) );
|
||||
sync.setTime( p * Common::Sync( ).duration( ) / totalPixels );
|
||||
}
|
||||
if ( io.MouseDown[ 1 ] ) {
|
||||
const float p{ io.MousePos.x - bbAll.Min.x + startPixel };
|
||||
|
@ -413,7 +413,7 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
|||
zMax{ std::max( firstZoomPixel , curZoomPixel ) } ,
|
||||
diff{ zMax - zMin };
|
||||
if ( diff > 4 ) {
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
const float u( sync.durationUnits( ) );
|
||||
startPos = zMin * u / totalPixels;
|
||||
if ( ( width - 2.f ) / u >= BarWidth ) {
|
||||
|
@ -436,7 +436,7 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
|
|||
void T_SyncViewImpl_::computeMetrics(
|
||||
const float innerWidth ) noexcept
|
||||
{
|
||||
auto& sync( Globals::Sync( ) );
|
||||
auto& sync( Common::Sync( ) );
|
||||
const uint32_t units{ sync.durationUnits( ) };
|
||||
zoomLevel = ImSaturate( zoomLevel );
|
||||
const float zoom1Pixels{ std::max( units * BarWidth , innerWidth ) };
|
||||
|
@ -576,7 +576,7 @@ void T_SyncViewImpl_::sequencerBody(
|
|||
|
||||
void T_SyncViewImpl_::sequencerCurves( ) noexcept
|
||||
{
|
||||
auto& sync{ Globals::Sync( ) };
|
||||
auto& sync{ Common::Sync( ) };
|
||||
const auto nc{ sCurves.size( ) };
|
||||
for ( auto i = 0u ; i < nc ; i ++ ) {
|
||||
if ( sCurves.values( )[ i ] ) {
|
||||
|
@ -646,7 +646,7 @@ void T_SyncViewImpl_::displayCurveSelectorWindow( ) noexcept
|
|||
void T_SyncViewImpl_::displayCurveSelector( ) noexcept
|
||||
{
|
||||
using namespace ImGui;
|
||||
T_Array< T_String > names{ Globals::Sync( ).inputNames( ) };
|
||||
T_Array< T_String > names{ Common::Sync( ).inputNames( ) };
|
||||
|
||||
// Search box; FIXME, this is utterly hacky
|
||||
stringBuffer.clear( ) << curveFinder;
|
||||
|
@ -706,7 +706,7 @@ void T_SyncViewImpl_::displayOverrideSelector( ) noexcept
|
|||
using namespace ImGui;
|
||||
|
||||
BeginChild( "content" );
|
||||
Globals::Sync( ).visitOverrides( [&]( T_SyncOverrideVisitor::T_Element element , const bool exit ) {
|
||||
Common::Sync( ).visitOverrides( [&]( T_SyncOverrideVisitor::T_Element element , const bool exit ) {
|
||||
if ( element.hasType< T_SyncOverrideSection* >( ) ) {
|
||||
auto const& sos{ *element.value< T_SyncOverrideSection* >( ) };
|
||||
if ( sos.title == "*root*" ) {
|
||||
|
|
18
ui-sync.cc
18
ui-sync.cc
|
@ -1,5 +1,5 @@
|
|||
#include "externals.hh"
|
||||
#include "globals.hh"
|
||||
#include "common.hh"
|
||||
#include "ui.hh"
|
||||
#include "ui-actions.hh"
|
||||
#include "ui-app.hh"
|
||||
|
@ -13,7 +13,7 @@
|
|||
T_UISync::T_UISync( )
|
||||
{
|
||||
UI::Main( ).newAction( "Save curves" , []() {
|
||||
if ( Globals::Sync( ).curvesFileChanged( ) ) {
|
||||
if ( Common::Sync( ).curvesFileChanged( ) ) {
|
||||
UI::Main( ).msgbox(
|
||||
"Curves file changed" ,
|
||||
"The file containing the curves has been modified "
|
||||
|
@ -21,14 +21,14 @@ T_UISync::T_UISync( )
|
|||
"Do you want to continue?" ,
|
||||
[]( auto b ) {
|
||||
if ( b == T_MessageBox::BT_YES ) {
|
||||
Globals::Sync( ).saveCurves( );
|
||||
Common::Sync( ).saveCurves( );
|
||||
}
|
||||
} , { T_MessageBox::BT_YES , T_MessageBox::BT_NO } );
|
||||
} else {
|
||||
Globals::Sync( ).saveCurves( );
|
||||
Common::Sync( ).saveCurves( );
|
||||
}
|
||||
} ).setEnabledCheck( []() {
|
||||
return Globals::Sync( ).curvesModified( );
|
||||
return Common::Sync( ).curvesModified( );
|
||||
} ).setIcon( ICON_FA_FLOPPY_O )
|
||||
.setShortcut( T_KeyboardShortcut{ 's' , E_KeyboardModifier::CTRL } );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -39,11 +39,11 @@ T_UISync::T_UISync( )
|
|||
"want to continue?" ,
|
||||
[]( auto b ) {
|
||||
if ( b == T_MessageBox::BT_YES ) {
|
||||
Globals::Sync( ).loadCurves( );
|
||||
Common::Sync( ).loadCurves( );
|
||||
}
|
||||
} , { T_MessageBox::BT_YES , T_MessageBox::BT_NO } );
|
||||
} ).setEnabledCheck( []() {
|
||||
return Globals::Sync( ).curvesModified( );
|
||||
return Common::Sync( ).curvesModified( );
|
||||
} ).setIcon( ICON_FA_DOWNLOAD )
|
||||
.setShortcut( T_KeyboardShortcut{ 'r' ,
|
||||
{ E_KeyboardModifier::CTRL , E_KeyboardModifier::SHIFT } } );
|
||||
|
@ -99,7 +99,7 @@ void HandleOverride_(
|
|||
bool& enabled{ ov.enabled( ) };
|
||||
if ( Checkbox( &ov.title( )[ 0 ] , &enabled ) ) {
|
||||
auto const& ipos( ov.inputPositions( ) );
|
||||
Globals::Sync( ).setOverridesActive( ov.enabled( ) ,
|
||||
Common::Sync( ).setOverridesActive( ov.enabled( ) ,
|
||||
ipos.size( ) , &ipos[ 0 ] );
|
||||
}
|
||||
if ( !enabled ) {
|
||||
|
@ -144,7 +144,7 @@ void T_UISync::makeOverridesWindow( )
|
|||
T_AutoArray< bool , 32 > stack;
|
||||
bool found{ false };
|
||||
using T_Ove_ = T_SyncOverrideVisitor::T_Element;
|
||||
Globals::Sync( ).visitOverrides( [&]( T_Ove_ element , bool exit ) {
|
||||
Common::Sync( ).visitOverrides( [&]( T_Ove_ element , bool exit ) {
|
||||
// Display sections
|
||||
if ( element.hasType< T_SyncOverrideSection* >( ) ) {
|
||||
auto& sos( *element.value< T_SyncOverrideSection* >( ) );
|
||||
|
|
4
ui.hh
4
ui.hh
|
@ -10,7 +10,7 @@ struct T_OutputDebugger;
|
|||
struct T_UISync;
|
||||
|
||||
|
||||
struct UI : public ebcl::A_PrivateImplementation
|
||||
struct UI
|
||||
{
|
||||
public:
|
||||
static void Init( ) noexcept;
|
||||
|
@ -23,7 +23,7 @@ struct UI : public ebcl::A_PrivateImplementation
|
|||
static T_UISync& Sync( ) noexcept;
|
||||
|
||||
private:
|
||||
UI( ) noexcept;
|
||||
UI( ) = delete;
|
||||
NO_COPY( UI );
|
||||
NO_MOVE( UI );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue