class library: Volume - remove debug message
[supercollider.git] / QtCollider / Common.h
blobe49acf1f7001225521b85bb3c9daf1c9ec912402
1 /************************************************************************
3 * Copyright 2010 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program 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 General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef _SC_QT_COMMON_H
23 #define _SC_QT_COMMON_H
25 #include "debug.h"
27 #include <QList>
28 #include <QVariant>
29 #include <QEvent>
30 #include <QMutex>
31 #include <QWaitCondition>
32 #include <QVector>
34 #include <SCBase.h>
35 #include <PyrSymbol.h>
36 #include <PyrObject.h>
38 #include <pthread.h>
40 extern pthread_mutex_t gLangMutex;
42 struct VariantList {
43 QList<QVariant> data;
46 Q_DECLARE_METATYPE( VariantList );
47 Q_DECLARE_METATYPE( PyrObject * );
48 Q_DECLARE_METATYPE( QVector<double> );
49 Q_DECLARE_METATYPE( QVector<int> );
51 namespace QtCollider {
53 enum MetaType {
54 Type_VariantList,
55 Type_Count
58 enum EventType {
59 Event_SCRequest_Input = QEvent::User,
60 Event_SCRequest_Sched,
61 Event_SCRequest_Quit,
62 Event_SCRequest_Recompile,
63 Event_SCRequest_Stop,
64 Event_ScMethodCall,
65 Event_Refresh,
66 Event_Proxy_SetProperty,
67 Event_Proxy_Destroy,
68 Event_Proxy_BringFront,
69 Event_Proxy_SetFocus,
70 Event_Proxy_SetAlwaysOnTop,
71 Event_Proxy_StartDrag,
72 Event_Proxy_Release
75 enum Synchronicity {
76 Synchronous,
77 Asynchronous
80 inline void lockLang()
82 qcDebugMsg(2,"locking lang!");
83 pthread_mutex_lock (&gLangMutex);
84 qcDebugMsg(2,"locked");
87 inline void unlockLang()
89 pthread_mutex_unlock(&gLangMutex);
90 qcDebugMsg(2,"unlocked");
93 void runLang (
94 PyrObjectHdr *receiver,
95 PyrSymbol *method,
96 const QList<QVariant> & args = QList<QVariant>(),
97 PyrSlot *result = 0 );
99 int wrongThreadError ();
101 QPalette systemPalette();
103 #define QC_DO_SYMBOLS \
104 QC_DO_SYMBOL(interpretCmdLine); \
105 QC_DO_SYMBOL(interpretPrintCmdLine); \
106 QC_DO_SYMBOL(doFunction); \
107 QC_DO_SYMBOL(doDrawFunc); \
108 QC_DO_SYMBOL(prRelease); \
109 QC_DO_SYMBOL(Rect); \
110 QC_DO_SYMBOL(Point); \
111 QC_DO_SYMBOL(Color); \
112 QC_DO_SYMBOL(Size); \
113 QC_DO_SYMBOL(QPalette); \
114 QC_DO_SYMBOL(QFont); \
115 QC_DO_SYMBOL(QObject); \
116 QC_DO_SYMBOL(QLayout); \
117 QC_DO_SYMBOL(QTreeViewItem); \
118 QC_DO_SYMBOL(Gradient); \
119 QC_DO_SYMBOL(HiliteGradient);
121 #define QC_DO_SYMBOL(SYM) extern PyrSymbol * sym_##SYM
122 QC_DO_SYMBOLS
123 #undef QC_DO_SYMBOL
125 #define SC_SYM( SYM ) QtCollider::sym_##SYM
126 #define SC_CLASS( SYM ) SC_SYM(SYM)->u.classobj
130 #endif //_SC_QT_COMMON_H