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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 
20 	Macintosh interface for TiMidity
21 	by T.Nogami	<t-nogami@happy.email.ne.jp>
22 
23     mac_main.h
24 */
25 
26 #ifndef MAC_MAIN_H
27 #define MAC_MAIN_H
28 
29 #include	<Sound.h>
30 #include	<Drag.h>
31 
32 #include "mfnode.h"
33 
34 extern SndChannelPtr	gSndCannel;
35 
36 extern Boolean	skin_f_repeat, gQuit,gBusy, gCursorIsWatch,
37 				gHasDragMgr, gShuffle;
38 extern int		mac_rc;
39 extern short	mac_amplitude;
40 extern long		gStartTick;
41 extern int		skin_state, mac_n_files, nPlaying;
42 extern double	gSilentSec;
43 
44 #define		LISTSIZE	1000
45 typedef struct _MidiFile{
46 //	FSSpec	spec;
47 	char	*filename;
48 	MFnode	*mfn;
49 } MidiFile;
50 extern MidiFile		fileList[];
51 
52 // **************************************
53 void	mac_ErrorExit(Str255 msg);
54 
55 void	mac_HandleEvent(EventRecord*);
56 void	mac_HandleControl();
57 void	HandleMouseDown(EventRecord *event);
58 void	mac_HandleMenuSelect(long select, short modifiers);
59 
60 OSErr	mac_SetPlayOption();
61 void	mac_DefaultOption();
62 OSErr	mac_GetPreference();
63 OSErr	mac_SetPreference();
64 
65 void	AddHFS2PlayList(HFSFlavor*);
66 OSErr	AddFolder2PlayList( short vRefNum, long dirID);
67 void	DoVolume();
68 void	DrawButton();
69 void	DoUpdate(WindowRef);
70 void	DoQuit();
71 void	add_ListWin(MidiFile * file);
72 void	change_ListRow( short row, const MidiFile* file);
73 void	init_ListWin();
74 void 	HandleSpecKeydownEvent(long message, short /*modifiers*/);
75 void	ShuffleList(int start, int end);
76 
77 void	mac_add_fsspec( FSSpec *spec );
78 void	read_viscolor(const char * viscolor_file);
79 /******************************/
80 enum{
81 	WAITING,	/* waiting at end of list*/
82 	PLAYING,
83 	PAUSE,
84 	STOP
85 };
86 /* ************************ */
87 /*	resurece */
88 enum{
89 	mApple=0x0080,
90 	iAbout=	0x00800001,
91 
92 	mFile=		0x0081,
93 	iOpen=		0x00810001,
94 	iClose=		0x00810002,
95 	//-                  3,
96 	iLogWindow=	0x00810004,
97 	iListWindow=0x00810005,
98 	iWrdWindow=	0x00810006,
99 	iDocWindow=	0x00810007,
100 	iSpecWindow=0x00810008,
101 	iTraceWindow=0x00810009,
102 	iSkinWindow=0x0081000A,
103 	//-                  B,
104 	//-                  C,
105 	iSaveAs=	0x0081000D,
106 	iPref=		0x0081000E,
107 	//-                  F,
108 	iQuit=		0x00810010,
109 
110 	mPlay=0x0082,
111 	iPlay=0x00820001,
112 	iStop=0x00820002,
113 	iPause=0x00820003,
114 	//-            4
115 	iPrev=0x00820005,
116 	iNext=0x00820006,
117 
118 	mSynth=0x00A0,
119 	iTiMidity=0x00A00001,
120 	iQuickTime=0x00A00002,
121 	iOMS=0x00A00003
122 
123 };
124 
125 #define	kPlayerWinID	128
126 #define	kLogWinID		129
127 #define kListWinID		130
128 #define	kWrdWinID		131
129 #define	kDocWinID		132
130 #define kSpecWinID		133
131 #define kTraceWinID		134
132 #define kSkinWinID		135
133 #define kOmsWinID		136
134 
135 enum{
136 	MW_NOMSG=0,
137 	MW_GROW=1
138 };
139 
140 typedef struct MacWindow_ {
141 	WindowRef	ref;
142 	int			(*open)();
143 						//return 0 if no error
144 	void		(*click)(Point local, short modifiers);
145 	void		(*update)();
146 	void		(*goaway)(struct MacWindow_* mwin);
147 	void		(*close)(struct MacWindow_* mwin);
148 	int			(*message)(int message, long param);
149 						//return -1 if message is not supported
150 	int			show, X, Y, width, hight, opened;
151 
152 }MacWindow;
153 
154 extern MacWindow 	mac_PlayerWindow,
155 					mac_LogWindow,
156 					mac_ListWindow,
157 					mac_WrdWindow,
158 					mac_DocWindow,
159 					mac_SpecWindow,
160 					mac_TraceWindow,
161 					mac_SkinWindow;
162 
163 #define SHOW_WINDOW(mwin) {ShowWindow(mwin.ref);SelectWindow(mwin.ref);mwin.show=true;}
164 
165 #ifdef __POWERPC__
166 #define PREF_FILENAME "\pTiMidity++ pref"
167 #elif __MC68881__
168 #define PREF_FILENAME "\pTiMidity++68kFPU pref"
169 #else
170 #define PREF_FILENAME "\pTiMidity++68k pref"
171 #endif
172 
173 extern int evil_level;
174 #define EVIL_NORMAL 	1
175 #define EVIL_SUPER		2
176 #define EVIL_SPECIAL 	3
177 
178 extern int		do_initial_filling;
179 extern volatile int	mac_buf_using_num, mac_flushing_flag;
180 
181 #endif //MAC_MAIN_H
182