NAP
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SequenceGUIService Class Referencefinal

#include <sequenceguiservice.h>

Classes

struct  Colors
 

Public Member Functions

 SequenceGUIService (ServiceConfiguration *configuration)
 
 ~SequenceGUIService () override
 
template<typename T >
bool registerEventView ()
 
bool registerTrackViewFactory (rtti::TypeInfo trackType, SequenceTrackViewFactoryFunc factory)
 
bool registerTrackTypeForView (rtti::TypeInfo trackType, rtti::TypeInfo viewType)
 
std::unique_ptr< SequenceTrackViewinvokeTrackViewFactory (rtti::TypeInfo viewType, SequenceEditorGUIView &view, SequenceEditorGUIState &state)
 
std::unique_ptr< SequenceEventTrackSegmentViewBaseinvokeEventTrackSegmentViewFactory (rtti::TypeInfo eventType)
 
rtti::TypeInfo getViewTypeForTrackType (rtti::TypeInfo trackType) const
 
const std::vector< rtti::TypeInfo > & getRegisteredSegmentEventTypes () const
 
void invokeEditEventHandler (rtti::TypeInfo actionType, SequenceEventTrackView &view) const
 
void invokePasteEvent (rtti::TypeInfo eventType, SequenceEventTrackView &view, const std::string &trackID, const SequenceTrackSegmentEventBase &eventBase, double time) const
 
std::vector< rtti::TypeInfogetAllTrackTypes () const
 
std::vector< rtti::TypeInfogetAllRegisteredEventActions () const
 
nap::IMGuiServicegetGui ()
 
const nap::IMGuiServicegetGui () const
 
const ColorsgetColors () const
 
- Public Member Functions inherited from Service
UNPREFIXED_MODULE_NAME_INPUTCASE Service (ServiceConfiguration *configuration)
 
virtual void update (double deltaTime) override
 
virtual void shutdown () override
 
 Service (ServiceConfiguration *configuration)
 
virtual ~Service ()
 
CoregetCore ()
 
const CoregetCore () const
 
std::string getTypeName () const
 
const ModulegetModule () const
 
 Service (Service &)=delete
 
Serviceoperator= (const Service &)=delete
 
 Service (Service &&)=delete
 
Serviceoperator= (Service &&)=delete
 

Static Public Member Functions

static bool registerObjectCreator (std::unique_ptr< rtti::IObjectCreator >(*objectCreator)(SequenceGUIService *))
 

Protected Member Functions

void registerObjectCreators (rtti::Factory &factory) override
 
bool init (nap::utility::ErrorState &errorState) override
 
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies)
 
- Protected Member Functions inherited from Service
virtual void created ()
 
virtual void preUpdate (double deltaTime)
 
virtual void update (double deltaTime)
 
virtual void postUpdate (double deltaTime)
 
virtual void preShutdown ()
 
virtual void shutdown ()
 
virtual void preResourcesLoaded ()
 
virtual void postResourcesLoaded ()
 
template<typename SERVICE_CONFIG >
SERVICE_CONFIG * getConfiguration ()
 
template<typename SERVICE_CONFIG >
const SERVICE_CONFIG * getConfiguration () const
 
std::string getIniFilePath () const
 
std::string getIniFilePath (const std::string &appendix) const
 

Description

The SequenceGUIService is responsible for registering track, segment & popup views and supplying the GUI the necessary factory methods to dynamically create the views and handlers for all registered types. When adding a new track type, a new segment type or a new event type with new gui views outside the SequenceGUI module you need to register them by calling registerTrackTypeForView, registerTrackViewFactory and/or registerEventView on the SequenceGUIService after the service is initialized but before any SequenceEditorGUI is created. A good place to do this from is from your own Service that will always initialize itself before any SequenceEditorGUI Resource.

Inheritance diagram for SequenceGUIService:
[legend]
Collaboration diagram for SequenceGUIService:
[legend]

Constructor & Destructor Documentation

◆ SequenceGUIService()

◆ ~SequenceGUIService()

~SequenceGUIService ( )
override

Member Function Documentation

◆ getAllRegisteredEventActions()

std::vector<rtti::TypeInfo> getAllRegisteredEventActions ( ) const

returns a vector containing type info of all registered event actions (f.e. EditingEventSegment<T>)

Returns
the vector

◆ getAllTrackTypes()

std::vector<rtti::TypeInfo> getAllTrackTypes ( ) const

returns a vector containing type info of all registered track types

Returns
the vector

◆ getColors()

const Colors& getColors ( ) const

Returns the sequencer GUI color palette

Returns
sequencer GUI color palette

◆ getDependentServices()

virtual void getDependentServices ( std::vector< rtti::TypeInfo > &  dependencies)
protectedvirtual

Override this function to register service dependencies A service that depends on another service is initialized after all it's associated dependencies This will ensure correct order of initialization, update calls and shutdown of all services SequenceGUIService depends on SequenceService

Parameters
dependenciesrtti information of the services this service depends on

Reimplemented from Service.

◆ getGui() [1/2]

nap::IMGuiService& getGui ( )
Returns
gui service

◆ getGui() [2/2]

const nap::IMGuiService& getGui ( ) const
Returns
gui service

◆ getRegisteredSegmentEventTypes()

const std::vector<rtti::TypeInfo>& getRegisteredSegmentEventTypes ( ) const

returns all registered event segment types (SequenceTrackSegmentEvent<T>)

Returns
the vector containing type info of all registered event segment types

◆ getViewTypeForTrackType()

rtti::TypeInfo getViewTypeForTrackType ( rtti::TypeInfo  trackType) const

returns track view type for corresponding track type, asserts when track type not found

Parameters
trackTypetype info of track type
Returns
corresponding track view type

◆ init()

bool init ( nap::utility::ErrorState errorState)
overrideprotectedvirtual

initializes service

Parameters
errorStatecontains any errors
Returns
returns true on successful initialization

Reimplemented from Service.

◆ invokeEditEventHandler()

void invokeEditEventHandler ( rtti::TypeInfo  actionType,
SequenceEventTrackView view 
) const

call this method to invoke the edit event handler for a specific event action

Parameters
actionTypetype info of the action (f.e. EditingEventSegment<T>)
viewreference to the view invoking the edit event handler

◆ invokeEventTrackSegmentViewFactory()

std::unique_ptr<SequenceEventTrackSegmentViewBase> invokeEventTrackSegmentViewFactory ( rtti::TypeInfo  eventType)

invoke this method to create a event segment view for a certain event type, assert when event type is not found

Parameters
eventTypetype info of the event type
Returns
unique ptr to create segment view

◆ invokePasteEvent()

void invokePasteEvent ( rtti::TypeInfo  eventType,
SequenceEventTrackView view,
const std::string &  trackID,
const SequenceTrackSegmentEventBase eventBase,
double  time 
) const

invoke this method to paste an event of a certain type

Parameters
eventTypetypeInfo of the event to paste
viewreference to the view invoking the paste event
trackIDtrack id of the track on which to paste the event
eventBasereference to base of event
timetime at which to paste the event

◆ invokeTrackViewFactory()

std::unique_ptr<SequenceTrackView> invokeTrackViewFactory ( rtti::TypeInfo  viewType,
SequenceEditorGUIView view,
SequenceEditorGUIState state 
)

invoke this method to create a track view for a certain view type, asserts when view type is not found

Parameters
viewTypethe viewType to create
viewreference to editor view creating the view
statereference to gui state
Returns
unique ptr to created track view

◆ registerEventView()

bool registerEventView ( )

call this method to register a custom view for a custom event type T is the value type of the event (SequenceEvent<T>)

Template Parameters
Tvalue to of the event
Returns
true on successful registration

◆ registerObjectCreator()

static bool registerObjectCreator ( std::unique_ptr< rtti::IObjectCreator >(*)(SequenceGUIService *)  objectCreator)
static

registers object creator method that can be passed on to the rtti factory

Parameters
objectCreatorunique pointer to method

◆ registerObjectCreators()

void registerObjectCreators ( rtti::Factory factory)
overrideprotectedvirtual

registers all objects that need a specific way of construction

Parameters
factorythe factory to register the object creators with

Reimplemented from Service.

◆ registerTrackTypeForView()

bool registerTrackTypeForView ( rtti::TypeInfo  trackType,
rtti::TypeInfo  viewType 
)

registers the track view type that belongs to a track type

Parameters
trackTypethe track type
viewTypethe view type
Returns
true on success

◆ registerTrackViewFactory()

bool registerTrackViewFactory ( rtti::TypeInfo  trackType,
SequenceTrackViewFactoryFunc  factory 
)

registers a factory function for the creation of a certain track type,

Parameters
trackTypethe track type for which to register the factory function
factorythe factory function
Returns
true on success