| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef DOCUMENTPAGE_H |
| 24 |
#define DOCUMENTPAGE_H |
| 25 |
|
| 26 |
#include <QtPrintSupport/QPrinter> |
| 27 |
#include <QtPrintSupport/QPrintDialog> |
| 28 |
#include <QRegularExpression> |
| 29 |
#include <QTextEdit> |
| 30 |
#include <QDomElement> |
| 31 |
#include <QStack> |
| 32 |
#include <QDockWidget> |
| 33 |
#include <vector> |
| 34 |
#include "basedocument.h" |
| 35 |
|
| 36 |
class OpEntryParser; |
| 37 |
class DocumentView; |
| 38 |
class LiveEventFrame; |
| 39 |
class EventSheet; |
| 40 |
class LiveEventControl; |
| 41 |
class SndfileHandle; |
| 42 |
class MidiLearnDialog; |
| 43 |
class QuteWidget; |
| 44 |
|
| 45 |
class DocumentPage : public BaseDocument |
| 46 |
{ |
| 47 |
Q_OBJECT |
| 48 |
public: |
| 49 |
DocumentPage(QWidget *parent, OpEntryParser *opcodeTree, ConfigLists *configlists, |
| 50 |
MidiLearnDialog *midiLearn); |
| 51 |
~DocumentPage(); |
| 52 |
void setCompanionFileName(QString name); |
| 53 |
void setEditorFocus(); |
| 54 |
void showLineNumbers(bool show); |
| 55 |
void insertText(QString text, int section = -1); |
| 56 |
void setFullText(QString text); |
| 57 |
void setBasicText(QString text); |
| 58 |
void setOrc(QString text); |
| 59 |
void setSco(QString text); |
| 60 |
void setWidgetsText(QString text); |
| 61 |
void setPresetsText(QString text); |
| 62 |
void setOptionsText(QString text); |
| 63 |
void loadTextString(QString &text); |
| 64 |
int setTextString(QString &text); |
| 65 |
void toggleLineArea(); |
| 66 |
void toggleParameterMode(); |
| 67 |
void showParametersInEditor(); |
| 68 |
void setHighlightingTheme(QString theme); |
| 69 |
void setParsedUDOs(QStringList udos); |
| 70 |
void enableScoreSyntaxHighlighting(bool status); |
| 71 |
virtual QString getFullText(); |
| 72 |
QString getDotText(); |
| 73 |
QString getMacWidgetsText(); |
| 74 |
QString getMacPresetsText(); |
| 75 |
QString getMacOptionsText(); |
| 76 |
QString getSelectedText(int section = -1); |
| 77 |
QString getSelectedWidgetsText(); |
| 78 |
QString getMacOptions(QString option); |
| 79 |
QString getHtmlText(); |
| 80 |
int getViewMode(); |
| 81 |
QString getLiveEventsText(); |
| 82 |
QString wordUnderCursor(); |
| 83 |
QString lineUnderCursor(); |
| 84 |
QRect getWidgetLayoutOuterGeometry(); |
| 85 |
void setWidgetLayoutOuterGeometry(QRect r); |
| 86 |
void setLineEnding(int lineEndingMode); |
| 87 |
void setChannelValue(QString channel, double value); |
| 88 |
double getChannelValue(QString channel); |
| 89 |
void setChannelString(QString channel, QString value); |
| 90 |
QString getChannelString(QString channel); |
| 91 |
void setWidgetProperty(QString widgetid, QString property, QVariant value); |
| 92 |
QVariant getWidgetProperty(QString widgetid, QString property); |
| 93 |
QStringList getWidgetUuids(); |
| 94 |
QStringList listWidgetProperties(QString widgetid); |
| 95 |
bool destroyWidget(QString widgetid); |
| 96 |
void loadPreset(int preSetIndex); |
| 97 |
QString createNewLabel(int x = -1, int y = -1, QString channel = QString()); |
| 98 |
QString createNewDisplay(int x = -1, int y = -1, QString channel = QString()); |
| 99 |
QString createNewScrollNumber(int x = -1, int y = -1, QString channel = QString()); |
| 100 |
QString createNewLineEdit(int x = -1, int y = -1, QString channel = QString()); |
| 101 |
QString createNewSpinBox(int x = -1, int y = -1, QString channel = QString()); |
| 102 |
QString createNewSlider(int x = -1, int y = -1, QString channel = QString()); |
| 103 |
QString createNewButton(int x = -1, int y = -1, QString channel = QString()); |
| 104 |
QString createNewKnob(int x = -1, int y = -1, QString channel = QString()); |
| 105 |
QString createNewCheckBox(int x = -1, int y = -1, QString channel = QString()); |
| 106 |
QString createNewMenu(int x = -1, int y = -1, QString channel = QString()); |
| 107 |
QString createNewMeter(int x = -1, int y = -1, QString channel = QString()); |
| 108 |
QString createNewConsole(int x = -1, int y = -1, QString channel = QString()); |
| 109 |
QString createNewGraph(int x = -1, int y = -1, QString channel = QString()); |
| 110 |
QString createNewScope(int x = -1, int y = -1, QString channel = QString()); |
| 111 |
EventSheet* getSheet(int sheetIndex); |
| 112 |
EventSheet* getSheet(QString sheetName); |
| 113 |
int lineCount(bool countExtras = false); |
| 114 |
int characterCount(bool countExtras = false); |
| 115 |
int instrumentCount(); |
| 116 |
int udoCount(); |
| 117 |
int widgetCount(); |
| 118 |
QString embeddedFiles(); |
| 119 |
QString getFilePath(); |
| 120 |
QStringList getScheduledEvents(unsigned long ksmpscount); |
| 121 |
bool isModified(); |
| 122 |
bool isRunning(); |
| 123 |
bool isRecording(); |
| 124 |
bool usesFltk(); |
| 125 |
void updateCsLadspaText(); |
| 126 |
void updateCabbageText(); |
| 127 |
void focusWidgets(); |
| 128 |
QString getFileName(); |
| 129 |
QString getCompanionFileName(); |
| 130 |
|
| 131 |
void copy(); |
| 132 |
void cut(); |
| 133 |
void paste(); |
| 134 |
void undo(); |
| 135 |
void redo(); |
| 136 |
void gotoNextRow(); |
| 137 |
|
| 138 |
DocumentView *getView(); |
| 139 |
|
| 140 |
|
| 141 |
void setTextFont(QFont font); |
| 142 |
void setTabStopWidth(int tabWidth); |
| 143 |
void setTabIndents(bool indents); |
| 144 |
void setLineWrapMode(QTextEdit::LineWrapMode wrapLines); |
| 145 |
void setColorVariables(bool colorVariables); |
| 146 |
|
| 147 |
void setAutoComplete(bool autoComplete, int delay = 0); |
| 148 |
void setAutoParameterMode(bool autoParameterMode); |
| 149 |
QString getActiveSection(); |
| 150 |
QString getActiveText(); |
| 151 |
void print(QPrinter *printer); |
| 152 |
void findReplace(); |
| 153 |
void findString(); |
| 154 |
void getToIn(); |
| 155 |
void inToGet(); |
| 156 |
|
| 157 |
void showWidgetTooltips(bool visible); |
| 158 |
void setKeyRepeatMode(bool keyRepeat); |
| 159 |
void setOpenProperties(bool open); |
| 160 |
void setFontOffset(double offset); |
| 161 |
void setFontScaling(double offset); |
| 162 |
void setGraphUpdateRate(int rate); |
| 163 |
|
| 164 |
|
| 165 |
void setConsoleFont(QFont font); |
| 166 |
void setConsoleColors(QColor fontColor, QColor bgColor); |
| 167 |
void setEditorColors(QColor text, QColor background); |
| 168 |
|
| 169 |
|
| 170 |
void setScriptDirectory(QString dir); |
| 171 |
void setDebugLiveEvents(bool debug); |
| 172 |
|
| 173 |
void setConsoleBufferSize(int size); |
| 174 |
void setWidgetEnabled(bool enabled); |
| 175 |
void useOldFormat(bool use); |
| 176 |
void setPythonExecutable(QString pythonExec); |
| 177 |
virtual void registerButton(QuteButton *button); |
| 178 |
void queueMidiIn(std::vector<unsigned char> *message); |
| 179 |
void queueVirtualMidiIn(std::vector<unsigned char> &message); |
| 180 |
|
| 181 |
bool askForFile; |
| 182 |
bool readOnly; |
| 183 |
QVector<QString> widgetHistory; |
| 184 |
int widgetHistoryIndex; |
| 185 |
QString getQml(); |
| 186 |
QString getMidiControllerInstrument(); |
| 187 |
void parseUdos(bool force=false); |
| 188 |
void gotoLine(int line); |
| 189 |
void gotoLineDialog(); |
| 190 |
void goBackToPreviousPosition(); |
| 191 |
void autocomplete(); |
| 192 |
|
| 193 |
public slots: |
| 194 |
virtual int play(CsoundOptions *options); |
| 195 |
void stop(); |
| 196 |
int record(int format); |
| 197 |
void perfEnded(); |
| 198 |
void setHelp(); |
| 199 |
int runPython(); |
| 200 |
void closeExtraPanels(); |
| 201 |
void showWidgets(bool show = true); |
| 202 |
void hideWidgets(); |
| 203 |
void passSelectedWidget(QuteWidget* widget); |
| 204 |
void passUnselectedWidget(QuteWidget* widget); |
| 205 |
void showMidiLearn(QuteWidget *widget); |
| 206 |
void applyMacOptions(QStringList options); |
| 207 |
void setMacOption(QString option, QString newValue); |
| 208 |
void setModified(bool mod = true); |
| 209 |
|
| 210 |
void sendCodeToEngine(QString code); |
| 211 |
|
| 212 |
void setWidgetEditMode(bool active); |
| 213 |
void duplicateWidgets(); |
| 214 |
|
| 215 |
void jumpToLine(int line); |
| 216 |
void comment(); |
| 217 |
void uncomment(); |
| 218 |
void indent(); |
| 219 |
void unindent(); |
| 220 |
void killLine(); |
| 221 |
void killToEnd(); |
| 222 |
void setViewMode(int mode); |
| 223 |
void showOrc(bool); |
| 224 |
void showScore(bool); |
| 225 |
void showOptions(bool); |
| 226 |
void showFileB(bool); |
| 227 |
void showOther(bool); |
| 228 |
void showOtherCsd(bool); |
| 229 |
void showWidgetEdit(bool); |
| 230 |
|
| 231 |
void newLiveEventPanel(QString text = QString()); |
| 232 |
LiveEventFrame * createLiveEventPanel(QString text = QString()); |
| 233 |
void deleteLiveEventPanel(LiveEventFrame *frame); |
| 234 |
void showLiveEventControl(bool visible); |
| 235 |
void showLiveEventPanels(); |
| 236 |
void hideLiveEventPanels(); |
| 237 |
|
| 238 |
void stopAllSlot(); |
| 239 |
void newPanelSlot(); |
| 240 |
void playPanelSlot(int index); |
| 241 |
void loopPanelSlot(int index, bool loop); |
| 242 |
void stopPanelSlot(int index); |
| 243 |
void setPanelVisibleSlot(int index, bool visible); |
| 244 |
void setPanelSyncSlot(int index, int mode); |
| 245 |
void setPanelNameSlot(int index, QString name); |
| 246 |
void setPanelTempoSlot(int index, double tempo); |
| 247 |
void setPanelLoopLengthSlot(int index, double length); |
| 248 |
void setPanelLoopRangeSlot(int index, double start, double end); |
| 249 |
|
| 250 |
|
| 251 |
private: |
| 252 |
virtual void init(QWidget *parent,OpEntryParser *opcodeTree); |
| 253 |
CsoundOptions getParentOptions(); |
| 254 |
void deleteAllLiveEvents(); |
| 255 |
virtual WidgetLayout* newWidgetLayout(); |
| 256 |
QString companionFile; |
| 257 |
QStringList m_macOptions; |
| 258 |
QString m_macPresets; |
| 259 |
QString m_macGUI; |
| 260 |
bool m_pythonRunning; |
| 261 |
QString m_pythonExecutable; |
| 262 |
QList<LiveEventFrame *> m_liveFrames; |
| 263 |
LiveEventControl *m_liveEventControl; |
| 264 |
MidiLearnDialog *m_midiLearn; |
| 265 |
|
| 266 |
|
| 267 |
bool saveLiveEvents; |
| 268 |
bool saveOldFormat; |
| 269 |
int m_lineEnding; |
| 270 |
QString m_colorTheme; |
| 271 |
QStringList m_parsedUdos; |
| 272 |
bool m_parseUdosNeeded; |
| 273 |
QRegularExpression regexUdo; |
| 274 |
|
| 275 |
private slots: |
| 276 |
void textChanged(); |
| 277 |
void liveEventControlClosed(); |
| 278 |
void renamePanel(LiveEventFrame *panel,QString newName); |
| 279 |
void setPanelLoopRange(LiveEventFrame *panel, double start, double end); |
| 280 |
void setPanelLoopLength(LiveEventFrame *panel, double length); |
| 281 |
void setPanelTempo(LiveEventFrame *panel, double tempo); |
| 282 |
void setPanelLoopEnabled(LiveEventFrame *panel, bool enabled); |
| 283 |
void evaluatePython(QString code); |
| 284 |
|
| 285 |
signals: |
| 286 |
void currentTextUpdated(); |
| 287 |
void setCurrentAudioFile(QString name); |
| 288 |
void liveEventsVisible(bool); |
| 289 |
void modified(); |
| 290 |
void unmodified(); |
| 291 |
void stopSignal(); |
| 292 |
void setHelpSignal(); |
| 293 |
void setWidgetClipboardSignal(QString text); |
| 294 |
void evaluatePythonSignal(QString code); |
| 295 |
void closeExtraPanelsSignal(); |
| 296 |
}; |
| 297 |
|
| 298 |
#endif |