//| Copyright: (C) 2019-2020 Kevin Larke //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file. #ifndef tlCtl_h #define tlCtl_h class Fl_Menu_Bar; class cmGrTlFltk; class cmGrScFltk; class cmGrTksbFltk; class cmGrTksrFltk; class cmGr2dFltk; class tlStatusWnd; class tlCtl; class tlCtlRspdr { public: virtual ~tlCtlRspdr(){} virtual void tlCtlNewTimeLineFile( tlCtl* tlCtl, const cmChar_t* fn ) = 0; virtual void tlCtlNewScoreFile( tlCtl* tlCtl, const cmChar_t* fn ) = 0; }; class tlCtl : public cmdIfRspdr { public: tlCtl( cmCtx_t* ctx, Fl_Window* app, Fl_Menu_Bar* menuBar, tlCtlRspdr* rspdr ); virtual ~tlCtl(); // // This group of functions represent commands from the application (kcApp) to the // time-line control. // Fl_Widget* initTimeLineCtlr( int x, int y, int w, int h ); Fl_Widget* initScoreCtlr( int x, int y, int w, int h ); Fl_Widget* initTakeSeqBldrCtlr( int x, int y, int w, int h ); Fl_Widget* initTakeSeqRendCtlr( int x, int y, int w, int h ); Fl_Widget* init2dCtlr( int x, int y, int w, int h ); void openTlFile( const cmChar_t* fn ); void openScoreFile( const cmChar_t* fn ); void openTakeSeqBldr( void* v ); void openTakeSeqRend( void* v ); void setAudioFilePath( const cmChar_t* path ); void setAudioFileCursor( unsigned smpIdx ); void setTimeLineSelectBar( unsigned barNumb ); void setScoreSelectBar( unsigned barNumb ); // Set the currrent score location void setScoreLocation( unsigned locIdx, unsigned smpIdx, unsigned pitch, unsigned vel ); // Set the value of a score variable. void setScoreVarValue( unsigned locIdx, unsigned varId, double value ); // Set the performed dynamic level of a score event. void setScoreDynLevel( unsigned evtIdx, unsigned dynLvl ); void refreshTakeSeqRend(); void onIdle(); // // cmdIfRspdr Interface // // These functions are callbacks from cmdIf to communicate // from cmdIf processes to the UI or back to the engine. virtual void cmdIfShowStatusMsg( const char* msg ); virtual void cmdIfHideStatus(); virtual void cmdIfErrorMsg( const char* msg ); virtual void cmdIfTimeLineMsg( const void* msg, unsigned msgByteCnt ); virtual void cmdIfAudioFileLoad( unsigned fileId ); virtual void cmdIfScoreMsg( const void* msg, unsigned msgByteCnt ); virtual void cmdIfOnTimeLineMarkerSelect( unsigned markerId ); virtual void cmdIfOnTimeLineMidiEvtSelect(unsigned midiEvtId ); virtual void cmdIfOnScoreBarSelect( unsigned scoreIndex ); unsigned timeLineSelectedMarkerId() const; unsigned scoreSelectedEleIndex() const; unsigned tksbSelectedEleIndex() const; void testStub(); private: cmErr_t _err; cmCtx_t* _ctx; tlCtlRspdr* _rspdr; cmdIf* _cmdIf; cmGrTlFltk* _tlCtlr; cmGrScFltk* _scCtlr; cmGrTksbFltk* _tksbCtlr; cmGrTksrFltk* _tksrCtlr; cmGr2dFltk* _2dCtlr; tlStatusWnd* _statusWnd; Fl_Menu_Bar* _menu; }; #endif