12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- //| 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 cmGrScFltk_h
- #define cmGrScFltk_h
-
- class Fl_Menu_Bar;
- class cmdIf;
-
- class cmGrScFltk : public cmGrPlotFltk, public gvHashFuncArg
- {
- public:
- cmGrScFltk(cmCtx_t* ctx, cmdIf* cp, Fl_Menu_Bar* menuBar, int x, int y, int w, int h);
- virtual ~cmGrScFltk();
-
- virtual cmScMsgTypeId_t recvScoreMsg( const void* msg, unsigned msgByteCnt );
-
- void setSampleRate( double srate );
- virtual double sampleRate() const;
-
- virtual bool on_plot_object( cmGrPlotCbArg_t* arg );
-
- virtual void selectBar( unsigned barNumb );
-
- virtual unsigned scoreSelectedEleIndex() const;
-
- virtual void setScoreLocation( unsigned locIdx, unsigned vel, unsigned smpIdx );
-
- private:
- enum
- {
- kOkRC,
- kInsertObjFailRC
- };
-
- enum
- {
- kPitchMId,
- kAttrMId,
- kDynMId,
- kLocIdxMId,
- kFracMId,
- kSectEvenMId,
- kSectDynMId,
- kSectTempoMId,
- kMenuItemCnt
- };
-
- typedef struct
- {
- cmGrScFltk* p;
- int id;
- } item_t;
-
- typedef struct scObj_str
- {
- cmScMsgTypeId_t id; // kEventMsgScId | kSectionMsgScId
- union
- {
- const cmScoreEvt_t* ep;
- const cmScoreSection_t* sp;
- } u;
-
- scObj_str( const cmScoreEvt_t* e) : id(kEventMsgScId) {u.ep=e;}
- scObj_str( const cmScoreSection_t* s) : id(kSectionMsgScId) {u.sp=s;}
- } scObj_t;
-
- double _srate;
- cmErr_t _err;
- cmdIf* _cmdIf;
- Fl_Menu_Bar* _menuBar;
- unsigned _samplesMetricId;
- unsigned _secondsMetricId;
- double _objSecs;
- unsigned _objId;
- bool _togFl;
- cmGrPlObjH_t _lastBarPlotObjH;
- item_t _menuArray[ kMenuItemCnt ];
-
- void _insertSection( const cmScoreSection_t* s );
- void _insertEvent( const cmScoreEvt_t* m );
- void _createMenu();
- bool _isMenuChecked( int id );
- void _setEventLabels();
- void _setSectionLabels();
-
- static void _s_menuCallback(Fl_Widget* w, void* arg);
-
- };
-
-
- #endif
|