| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef EVENTSHEET_H |
| 24 |
#define EVENTSHEET_H |
| 25 |
|
| 26 |
#include <QTableWidget> |
| 27 |
#include <QStandardItemModel> |
| 28 |
#include <QAction> |
| 29 |
#include <QTimer> |
| 30 |
|
| 31 |
class EventSheet : public QTableWidget |
| 32 |
{ |
| 33 |
Q_OBJECT |
| 34 |
public: |
| 35 |
|
| 36 |
EventSheet(QWidget *parent = 0); |
| 37 |
~EventSheet(); |
| 38 |
|
| 39 |
QString getPlainText(bool scaleTempo = false); |
| 40 |
QString getSelection(bool cut = false); |
| 41 |
QString getLine(int number, bool scaleTempo = false, |
| 42 |
bool storeNumber = false, bool preprocess = false, |
| 43 |
double startOffset = 0.0); |
| 44 |
QList< QList<QVariant> > getData(); |
| 45 |
|
| 46 |
|
| 47 |
void setFromText(QString text, int rowOffset = 0, int columnOffset = 0, |
| 48 |
int numRows = 0, int numColumns = 0, bool noHistoryMark = false); |
| 49 |
void setCell(int row, int column, QVariant text); |
| 50 |
void setDebug(bool debug); |
| 51 |
QPair<int, int> getSelectedRowsRange(); |
| 52 |
|
| 53 |
public slots: |
| 54 |
void setTempo(double value); |
| 55 |
void setLoopLength(double value); |
| 56 |
void sendEvents(); |
| 57 |
void sendAllEvents(); |
| 58 |
void sendEventsOffset(); |
| 59 |
void loopEvents(); |
| 60 |
void setLoopActive(bool loop); |
| 61 |
void markLoop(double start = -1, double end = -1); |
| 62 |
void setLoopRange(); |
| 63 |
void stopAllEvents(); |
| 64 |
void del(); |
| 65 |
void cut(); |
| 66 |
void copy(bool cut = false); |
| 67 |
void paste(); |
| 68 |
void undo(); |
| 69 |
void redo(); |
| 70 |
void markHistory(); |
| 71 |
void clearHistory(); |
| 72 |
void setScriptDirectory(QString dir); |
| 73 |
|
| 74 |
void subtract(); |
| 75 |
void add(); |
| 76 |
void multiply(); |
| 77 |
void divide(); |
| 78 |
|
| 79 |
void randomize(); |
| 80 |
void reverse(); |
| 81 |
void shuffle(); |
| 82 |
|
| 83 |
void rotate(); |
| 84 |
void fill(); |
| 85 |
|
| 86 |
void insertColumnHere(); |
| 87 |
void insertRowHere(); |
| 88 |
void appendColumn(); |
| 89 |
void appendRow(); |
| 90 |
void appendColumns(); |
| 91 |
void appendRows(); |
| 92 |
void deleteColumn(); |
| 93 |
void deleteRows(); |
| 94 |
|
| 95 |
protected: |
| 96 |
void contextMenuEvent(QContextMenuEvent * event); |
| 97 |
virtual void keyPressEvent(QKeyEvent * event); |
| 98 |
|
| 99 |
private: |
| 100 |
void createActions(); |
| 101 |
QList<QPair<QString, QString> > parseLine(QString line); |
| 102 |
bool m_stopScript; |
| 103 |
|
| 104 |
|
| 105 |
void add(double value); |
| 106 |
void multiply(double value); |
| 107 |
void divide(double value); |
| 108 |
void randomize(double min, double max, int mode); |
| 109 |
void shuffle(int iterations); |
| 110 |
void rotate(int amount); |
| 111 |
void fill(double start, double end, double slope); |
| 112 |
|
| 113 |
void runScript(QString script); |
| 114 |
QString generateDataText(QString outFileName); |
| 115 |
void addDirectoryToMenu(QMenu *m, QString dir, int depth = 0); |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
double m_tempo; |
| 120 |
QString m_name; |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
QAction *sendEventsAct; |
| 127 |
QAction *sendEventsOffsetAct; |
| 128 |
QAction *loopSelectionAct; |
| 129 |
QAction *enableLoopAct; |
| 130 |
QAction *markLoopAct; |
| 131 |
QAction *stopAllEventsAct; |
| 132 |
QAction *subtractAct; |
| 133 |
QAction *addAct; |
| 134 |
QAction *multiplyAct; |
| 135 |
QAction *divideAct; |
| 136 |
QAction *randomizeAct; |
| 137 |
QAction *reverseAct; |
| 138 |
QAction *shuffleAct; |
| 139 |
|
| 140 |
QAction *rotateAct; |
| 141 |
QAction *fillAct; |
| 142 |
QAction *stopScriptAct; |
| 143 |
|
| 144 |
QAction *insertColumnHereAct; |
| 145 |
QAction *insertRowHereAct; |
| 146 |
QAction *appendColumnAct; |
| 147 |
QAction *appendRowAct; |
| 148 |
QAction *appendColumnsAct; |
| 149 |
QAction *appendRowsAct; |
| 150 |
QAction *deleteColumnAct; |
| 151 |
QAction *deleteRowAct; |
| 152 |
|
| 153 |
QStringList columnNames; |
| 154 |
|
| 155 |
QList<double> activeInstruments; |
| 156 |
bool m_looping; |
| 157 |
bool m_debug; |
| 158 |
double m_loopLength; |
| 159 |
int noHistoryChange; |
| 160 |
|
| 161 |
|
| 162 |
int historyIndex; |
| 163 |
QVector<QString> history; |
| 164 |
|
| 165 |
|
| 166 |
QTimer loopTimer; |
| 167 |
int m_loopStart, m_loopEnd; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
QString scriptDir; |
| 172 |
QStringList builtinScripts; |
| 173 |
QStringList converterScripts; |
| 174 |
QStringList testScripts; |
| 175 |
|
| 176 |
private slots: |
| 177 |
void newSelection(); |
| 178 |
void cellDoubleClickedSlot(int row, int column); |
| 179 |
void cellChangedSlot(int row, int column); |
| 180 |
void stopScript(); |
| 181 |
|
| 182 |
void runScript(); |
| 183 |
|
| 184 |
signals: |
| 185 |
void sendEvent(QString event); |
| 186 |
void setLoopRangeFromSheet(double start, double end); |
| 187 |
void setLoopEnabledFromSheet(bool enabled); |
| 188 |
|
| 189 |
void modified(); |
| 190 |
}; |
| 191 |
|
| 192 |
#endif |