Debian Codegraph @

src/liveeventframe.h

raw symbols SCIP
1 /*
2 Copyright (C) 2009 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #ifndef LIVEEVENTFRAME_H
24 #define LIVEEVENTFRAME_H
25
26 #include "ui_liveeventframe.h"
27 #include <cstdio>
28
29 class EventSheet;
30 class QTextEdit;
31
32 namespace Ui {
33 class LiveEventFrame;
34 }
35
36 class LiveEventFrame : public QWidget
37 {
38 Q_OBJECT
39 Q_PROPERTY(bool visibleEnabled READ getVisibleEnabled WRITE setVisibleEnabled)
40 public:
41 LiveEventFrame(QString csdName, QWidget *parent = 0, Qt::WindowFlags f = 0 );
42 ~LiveEventFrame();
43 EventSheet * getSheet();
44 void setName(QString name);
45 void setFromText(QString text);
46 void setVisibleEnabled(bool visible) {m_visibleEnabled = visible; }
47
48 double getTempo();
49 QString getName();
50 double getLoopLength();
51 double getLoopStart();
52 double getLoopEnd();
53 QString getPlainText();
54 bool getVisibleEnabled() { return m_visibleEnabled; }
55
56 void getEvents(unsigned long ksmps, QStringList *eventText);
57 bool isModified();
58 // void forceDestroy();
59
60 public slots:
61 void setMode(int mode);
62 void setTempo(double tempo);
63 void setLoopLength(double length);
64 void setLoopRange(double start, double end);
65 void setLoopEnabled(bool enabled);
66 void setModified(bool mod = true);
67 void doAction(int action);
68 void newFrame();
69 void cloneFrame();
70 void deleteFrame(bool ask = false);
71
72 // To pass directly to live event sheet
73 void markLoop(double start = -1, double end = -1);
74 void loopPanel(bool loop);
75
76 protected:
77 // void changeEvent(QEvent *e);
78 virtual void closeEvent(QCloseEvent * event);
79 // virtual void hideEvent(QHideEvent * event);
80 // virtual void showEvent(QShowEvent * event);
81
82 private:
83 void renameDialog();
84
85 int m_mode; // 0 = sheet 1 = text 2 = piano roll?
86 bool m_visibleEnabled;
87 QString m_name;
88 QTextEdit *m_editor; //TODO add text editor
89 EventSheet *m_sheet;
90 QString m_csdName;
91 bool m_modified;
92 double m_loopStart, m_loopEnd; // TODO move looping to this class
93
94 Ui::LiveEventFrame *m_ui;
95
96 signals:
97 void newFrameSignal(QString text);
98 void deleteFrameSignal(LiveEventFrame *frame);
99 void renamePanel(LiveEventFrame *frame, QString newName);
100 void setLoopRangeFromPanel(LiveEventFrame *frame, double start, double end);
101 void setLoopLengthFromPanel(LiveEventFrame *frame, double length);
102 void setTempoFromPanel(LiveEventFrame *frame, double tempo);
103 void setLoopEnabledFromPanel(LiveEventFrame *frame, bool enabled);
104 void closed(bool visible); // To inform Live Event Control that live event panel has been closed
105 };
106
107 #endif // LIVEEVENTFRAME_H