123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //| Copyright: (C) 2019-2020 Kevin Larke <contact AT larke DOT org>
- //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
- #ifndef cmGrTlFltk_h
- #define cmGrTlFltk_h
-
- class Fl_Menu_Bar;
- class cmdIf;
-
-
- class cmGrTlFltk : public cmGrPlotFltk, public gvHashFuncArg
- {
- public:
- cmGrTlFltk(cmCtx_t* ctx, cmdIf* cp, Fl_Menu_Bar* menuBar, int x, int y, int w, int h);
- virtual ~cmGrTlFltk();
-
- virtual cmTlUiMsgTypeId_t recvTimeLineMsg( const void* msg, unsigned msgByteCnt );
- virtual void recvAudioFileLoad( unsigned fileId );
-
- virtual double sampleRate() const { return _srate; }
-
- // Call these functions to notify the UI of changes of state that
- // occurred programmatically. These notifications are bubbling up
- // from the engine.
- typedef enum { kSamplesMetricId, kSecondsMetricId } timeAxisMetricId_t;
- virtual void setTimeAxisMetric( timeAxisMetricId_t metricId );
- virtual void toggleMarkerText();
- virtual unsigned timeLineSelectedMarkerId() const;
- virtual void setAudioFileCursor( unsigned smpIdx );
- virtual void selectBar( unsigned barNumb );
-
- // This function is called to notify the timeline UI that that state of one of it's
- // UI elements has been changed/manipulated by the user. This is the first
- // point of contact with a requested change from the user which is being
- // directed down to the engine.
- virtual bool on_plot_object( cmGrPlotCbArg_t* arg );
-
- private:
- enum
- {
- kOkRC,
- kParentObjNotFoundRC,
- kInsertObjFailRC,
- kAudioObjFailRC,
- };
-
- enum
- {
- kAudioVwIdx,
- kMidiVwIdx,
- kViewCnt
- };
-
- enum
- {
- kViewSamplesMId,
- kViewSecondsMId,
- kViewMarkTextMId,
- kViewPitchMId,
- kViewVelocityMId,
- kViewIdMId,
- kGenOnsetMarksMId,
- kDelOnsetMarksMId,
- kMenuItemCnt
- };
-
- // Flags returned by _getMenuCheckFlags();
- enum { kPitchChkFl=0x01, kVelChkFl=0x02, kIdChkFl=0x04 };
-
-
- typedef struct item_str
- {
- cmGrTlFltk* p;
- int id;
- } item_t;
-
-
- cmErr_t _err;
- double _srate;
- cmdIf* _cmdIf;
- Fl_Menu_Bar* _menuBar;
- int _seqMenuIdx;
- int _seqCnt;
- item_t* _seqItemArray;
- int _markCnt;
- unsigned _samplesMetricId;
- unsigned _secondsMetricId;
- cmGrPlObjH_t _selMarkPlotObjH;
- unsigned _curSeqId;
- item_t _menuArray[ kMenuItemCnt ];
-
-
- void _insertTimeLineObj( const cmTlUiMsg_t* m );
- void _updateSeqMenu(int newSeqCnt, unsigned seqId);
- void _createMenu();
- bool _isMenuChecked(int id);
- unsigned _getMenuCheckFlags();
- void _setLabels();
- void _setMidiEventLabels( cmGrPlObjH_t poH, unsigned flags);
-
- static void _s_seqMenuCallback( Fl_Widget* w, void* vp );
-
- static void _s_midiSciPitchValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
- static void _s_roundHashValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
- static void _s_minSecMsHashValueFunc( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
- static void _s_menuCallback( Fl_Widget* w, void* arg );
- };
-
-
-
- #endif
|