63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#ifndef XTC_SEQUENCER_WIDGET_HPP
|
|
#define XTC_SEQUENCER_WIDGET_HPP
|
|
#include <FL/Fl_Widget.H>
|
|
#include "xtc/xtc_project.h"
|
|
|
|
class SequencerWidget : public Fl_Widget {
|
|
public:
|
|
using BeforeEdit = xtc_result (*)(void *);
|
|
BeforeEdit before_edit = nullptr;
|
|
|
|
uint64_t selected_track() const
|
|
{
|
|
return track_;
|
|
}
|
|
|
|
uint64_t selected_clip() const
|
|
{
|
|
return clip_;
|
|
}
|
|
|
|
using Seek = xtc_result (*)(void *, uint64_t);
|
|
SequencerWidget(int x, int y, xtc_project *project, Seek seek, void *context);
|
|
void set_project(xtc_project *project, bool reset = true);
|
|
|
|
uint64_t position() const
|
|
{
|
|
return cursor_;
|
|
}
|
|
|
|
void position(uint64_t tick)
|
|
{
|
|
cursor_ = tick;
|
|
redraw();
|
|
}
|
|
|
|
xtc_result add_track();
|
|
xtc_result add_region();
|
|
xtc_result add_midi_clip();
|
|
xtc_result delete_selection();
|
|
void zoom(int direction);
|
|
|
|
xtc_project *project() const
|
|
{
|
|
return project_;
|
|
}
|
|
|
|
int handle(int event) override;
|
|
|
|
protected:
|
|
void draw() override;
|
|
|
|
private:
|
|
xtc_project *project_;
|
|
Seek seek_;
|
|
void *context_;
|
|
uint64_t track_ = UINT64_MAX, clip_ = UINT64_MAX, cursor_ = 0;
|
|
int scale_ = 48, drag_x_ = 0, mode_ = 0;
|
|
xtc_clip_info original_{};
|
|
uint64_t tick(int px) const;
|
|
void changed(xtc_result result);
|
|
void extent();
|
|
};
|
|
#endif
|