1 /*
2     TiMidity++ -- MIDI to WAVE converter and player
3     Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
4     Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 
20     xaw.h: written by Yoshishige Arai (ryo2@on.rim.or.jp) 12/8/98
21            modified by Yair Kalvariski (cesium2@gmail.com)
22     */
23 #ifndef _XAW_H_
24 #define _XAW_H_
25 /*
26  * XAW configurations
27  */
28 
29 #if HAVE_SYS_PARAM_H
30 #include <sys/param.h>
31 #endif
32 #include "timidity.h"
33 #include "xaw_p.h"
34 
35 /* Define to use Xaw3d */
36 /* #define XAW3D */
37 
38 /* Define to use libXaw3d's tip widget (requires version 1.5E) */
39 /* #define HAVE_XAW3D_TIP */
40 
41 /* Define to use neXtaw */
42 /* #define NEXTAW */
43 
44 /* Define to use XawPlus */
45 /* #define XAWPLUS */
46 
47 /* Define to use code for old xaw versions (Xaw6 and such) */
48 /* #define OLDXAW */
49 
50 /* Define to use Timidity's implmentation of submenus for the titlebar menu */
51 /* #define TimNmenu */
52 
53 /* Define to use scrollable Text widget instead of Label widget */
54 /* #define WIDGET_IS_LABEL_WIDGET */
55 
56 /*** Initial dot file name at home directory ***/
57 #define INITIAL_CONFIG ".xtimidity"
58 
59 /*
60  * SET CORRECT PATHS AND CAPABILITIES.
61  */
62 
63 #ifdef XAW3D
64 #define XAWINCDIR(x) <X11/Xaw3d/x>
65 #elif defined(NEXTAW)
66 #define XAWINCDIR(x) <X11/neXtaw/x>
67 #include XAWINCDIR(XawVersion.h)
68 #elif defined(XAWPLUS)
69 #define XAWINCDIR(x) <X11/XawPlus/x>
70 #else
71 #define XAWINCDIR(x) <X11/Xaw/x>
72 #include <X11/Xmu/Converters.h>
73 #include XAWINCDIR(XawInit.h)
74 #ifndef XawVersion
75 #define OLDXAW
76 #else
77 #if XawVersion < 7000L
78 #define OLDXAW
79 #endif /* XawVersion < 7000L */
80 #endif /* !XawVersion */
81 #ifndef OLDXAW
82 #define XAW
83 #endif /* !OLDXAW */
84 #endif
85 
86 #if (defined (XAW3D) && !defined(HAVE_XAW3D_TIP)) || defined(OLDXAW) || \
87      defined(XAWPLUS) || defined(NEXTAW)
88 /*
89  * XtNmenuItem in SmeBSBObject Widgets is not supported in
90  * Xaw3d v1.5, Xaw6, XawPlus and neXtaw.
91  */
92 #define TimNmenu
93 #endif /* (XAW3D && !HAVE_XAW3D_TIP) || OLDXAW || XAWPLUS || NEXTAW */
94 
95 #if (defined(XAW3D) && defined(HAVE_XAW3D_TIP)) \
96       || (defined(XAW) && !(defined(OLDXAW))) || defined(XAWPLUS)
97 /* Tooltip support exists only in Xaw7 (and above), Xaw3d 1.5E and XawPlus */
98 #define HAVE_TIP
99 #endif /* (XAW3D && HAVE_XAW3D_TIP) || (XAW && !OLDXAW) || XAWPLUS */
100 
101 #if defined(XAW3D) || defined(XAWPLUS)
102   /*
103    * Xaw3D 1.5/1.5E crashes on XtVaSetValues to XtNvalue in Dialogwidget,
104    * where the string is used in place, internationalization is on,
105    * and a new string is set - it tries to free the wrong pointer.
106    * The Fedora package includes a one-line patch for this problem, but
107    * we can't rely on the user's Xaw3D package being patched.
108    * XawPlus has the same bug.
109    */
110 #define CLEARVALUE
111 #endif /* XAW3D || XAWPLUS */
112 
113 #if defined(NEXTAW) || defined(XAW3D) || defined(XAWPLUS)
114   /*
115    * These toolkits crash on XtDestroyWidget(w), when
116    * w == popup_sformat if this hack isn't used.
117    */
118 #define RECFMTGROUPDESTHACK
119 #endif /* NEXTAW || XAW3D || XAWPLUS */
120 
121 #if defined(NEXTAW) || defined(XAWPLUS)
122 #define DONTUSEOVALTOGGLES
123 #endif /* NEXTAW || XAWPLUS */
124 
125 #if defined(XAW) || defined(OLDXAW)
126   /*
127    * libXaw has a bug: it doesn't set length=width-minimumThumb, but
128    * length=width so the thumb may become invisible when it reaches the
129    * end of the scrollbar. (Other toolkits always substract minimumThumb
130    * from length, so we can't use the same codepath).
131    */
132 #define SCROLLBARLENGTHBUG
133 #endif /* XAW || OLDXAW */
134 
135 #if defined(NEXTAW) || defined(XAWPLUS) || defined(XAW3D)
136  /*
137   * These toolkits won't scroll textarea when sentence is wrapped.
138   * We'll redraw to get it to scroll.
139   */
140 #define BYPASSTEXTSCROLLBUG
141 #endif /* NEXTAW || XAW3D || XAWPLUS */
142 
143 /*
144  * CONSTANTS FOR XAW MENUS
145  */
146 #define MAXVOLUME MAX_AMPLIFICATION
147 #define MAX_XAW_MIDI_CHANNELS MAX_CHANNELS
148 
149 #define APP_CLASS "TiMidity"
150 #define APP_NAME "timidity"
151 
152 #ifndef PATH_MAX
153 #define PATH_MAX 512
154 #endif
155 #define PIPE_LENGTH PATH_MAX+3
156 #define MAX_DIRECTORY_ENTRY BUFSIZ
157 
158 #define MODUL_N 0
159 #define PORTA_N 1
160 #define NRPNV_N 2
161 #define REVERB_N 3
162 #define CHPRESSURE_N 4
163 #define OVERLAPV_N 5
164 #define TXTMETA_N 6
165 #define MAX_OPTION_N 7
166 
167 #define MODUL_BIT (1<<MODUL_N)
168 #define PORTA_BIT (1<<PORTA_N)
169 #define NRPNV_BIT (1<<NRPNV_N)
170 #define REVERB_BIT (1<<REVERB_N)
171 #define CHPRESSURE_BIT (1<<CHPRESSURE_N)
172 #define OVERLAPV_BIT (1<<OVERLAPV_N)
173 #define TXTMETA_BIT (1<<TXTMETA_N)
174 
175 #ifdef MODULATION_WHEEL_ALLOW
176 #define INIT_OPTIONS0 MODUL_BIT
177 #else
178 #define INIT_OPTIONS0 0
179 #endif
180 
181 #ifdef PORTAMENTO_ALLOW
182 #define INIT_OPTIONS1 PORTA_BIT
183 #else
184 #define INIT_OPTIONS1 0
185 #endif
186 
187 #ifdef NRPN_VIBRATO_ALLOW
188 #define INIT_OPTIONS2 NRPNV_BIT
189 #else
190 #define INIT_OPTIONS2 0
191 #endif
192 
193 #ifdef REVERB_CONTROL_ALLOW
194 #define INIT_OPTIONS3 REVERB_BIT
195 #define DEFAULT_REVERB 1
196 #else
197 #ifdef FREEVERB_CONTROL_ALLOW
198 #define INIT_OPTIONS3 REVERB_BIT
199 #define DEFAULT_REVERB 3
200 #else
201 #define INIT_OPTIONS3 0
202 #define DEFAULT_REVERB 1
203 #endif /* FREEVERB_CONTROL_ALLOW */
204 #endif /* REVERB_CONTROL_ALLOW */
205 
206 #ifdef GM_CHANNEL_PRESSURE_ALLOW
207 #define INIT_OPTIONS4 CHPRESSURE_BIT
208 #else
209 #define INIT_OPTIONS4 0
210 #endif
211 
212 #ifdef OVERLAP_VOICE_ALLOW
213 #define INIT_OPTIONS5 OVERLAPV_BIT
214 #else
215 #define INIT_OPTIONS5 0
216 #endif
217 
218 #ifdef ALWAYS_TRACE_TEXT_META_EVENT
219 #define INIT_OPTIONS6 TXTMETA_BIT
220 #else
221 #define INIT_OPTIONS6 0
222 #endif
223 
224 #define DEFAULT_OPTIONS (INIT_OPTIONS0+INIT_OPTIONS1+INIT_OPTIONS2+INIT_OPTIONS3+INIT_OPTIONS4+INIT_OPTIONS5+INIT_OPTIONS6)
225 
226 #ifdef CHORUS_CONTROL_ALLOW
227 #define DEFAULT_CHORUS 1
228 #else
229 #define DEFAULT_CHORUS 0
230 #endif
231 
232 #define XAW_UPDATE_TIME 0.1
233 
234 #ifndef XawFmt8Bit
235 #define XawFmt8Bit FMT8BIT
236 #endif
237 /* Only defined since X11R6 */
238 
239 #endif /* _XAW_H_ */
240