1 | /*
|
---|
2 | * (C) Chris Wohlgemuth 2002-2003
|
---|
3 | *
|
---|
4 | */
|
---|
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, or (at your option)
|
---|
9 | * 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; see the file COPYING. If not, write to
|
---|
18 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | */
|
---|
20 | /*
|
---|
21 | * If you need another license for your project/product contact me at
|
---|
22 | *
|
---|
23 | * http://www.os2world.com/cdwriting
|
---|
24 | * http://www.geocities.com/SiliconValley/Sector/5785/
|
---|
25 | */
|
---|
26 | /*
|
---|
27 | * This file was generated by the SOM Compiler and Emitter Framework.
|
---|
28 | * Generated using:
|
---|
29 | * SOM Emitter emitctm: 2.42
|
---|
30 | */
|
---|
31 |
|
---|
32 | #ifndef SOM_Module_cwmmdataf_Source
|
---|
33 | #define SOM_Module_cwmmdataf_Source
|
---|
34 | #endif
|
---|
35 | #define CWMMDataFile_Class_Source
|
---|
36 | #define M_CWMMDataFile_Class_Source
|
---|
37 |
|
---|
38 | #define INCL_PM
|
---|
39 | #define INCL_DOS
|
---|
40 | #define INCL_MMIOOS2
|
---|
41 | #define INCL_MCIOS2
|
---|
42 | #define INCL_REXXSAA
|
---|
43 |
|
---|
44 | #include <os2.h>
|
---|
45 | #include <stdio.h>
|
---|
46 | #include <rexxsaa.h> /* needed for Rexx */
|
---|
47 | #include "os2me.h"
|
---|
48 | #include "cwmmdataf.ih"
|
---|
49 | #include "cwaudio.h"
|
---|
50 | #include <wpfolder.h>
|
---|
51 | //#include "cwmmres.h"
|
---|
52 | #include "mmres.h"
|
---|
53 | #include "cwaudioinc.h"
|
---|
54 |
|
---|
55 | #include "except.h"
|
---|
56 |
|
---|
57 | #include "som_wps_funcs.h"
|
---|
58 | #include "sys_funcs.h"
|
---|
59 |
|
---|
60 | #define ID_STATUS_WINDOW 0x1000
|
---|
61 |
|
---|
62 | HAB globalHab=NULLHANDLE;
|
---|
63 | /* Window which receives messages asking for scanning audio files. */
|
---|
64 | static HWND globalHwndAudioWorker;
|
---|
65 | /* Status window handle for message when scanning audio files. */
|
---|
66 | static HWND globalHwndStatus;
|
---|
67 | ULONG globalClassVolume;
|
---|
68 |
|
---|
69 | HMODULE queryResModuleHandle(void);
|
---|
70 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
|
---|
71 | BOOL mmclsSetObjectType(WPFileSystem * somSelf);
|
---|
72 | PSZ _queryMMClassIniFile(void);
|
---|
73 |
|
---|
74 | /* The REXX function handler */
|
---|
75 | ULONG EXPENTRY rxCallCWMMFunc(PSZ name, LONG argc, RXSTRING argv[], PSZ queuename,PRXSTRING retstring);
|
---|
76 |
|
---|
77 | MRESULT EXPENTRY audioWorkerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
78 |
|
---|
79 | MRESULT EXPENTRY appTerminateHandlerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 | /*
|
---|
85 | Audio files are started on a separate thread. An object window is used for communication.
|
---|
86 | Every audio object must provide a window procedure to handle the start/stop/resume commands
|
---|
87 | sent to the object window. By using such an object specific window proc it's possible
|
---|
88 | to alter the start/stop behaviour in child classes.
|
---|
89 | */
|
---|
90 | /*!*******************************************************/
|
---|
91 | /* */
|
---|
92 | /* @@DESC */
|
---|
93 | /* */
|
---|
94 | /* This instance method is called to set the object */
|
---|
95 | /* window procedure handling the play commands. */
|
---|
96 | /* */
|
---|
97 | /* */
|
---|
98 | /* @@USAGE */
|
---|
99 | /* */
|
---|
100 | /* This method can be called at any time in order to */
|
---|
101 | /* set the window procedure handling play commands. */
|
---|
102 | /* :p. */
|
---|
103 | /* When a track is started the playing is done on a */
|
---|
104 | /* separate thread. Communication with this thread is */
|
---|
105 | /* done using window messages sent to an object window. */
|
---|
106 | /* There's a default window procedure which starts or */
|
---|
107 | /* stops audio playing. If there must be special */
|
---|
108 | /* processing to play a particular type of file a */
|
---|
109 | /* subclass may set a custom procedure handling the */
|
---|
110 | /* audio commands. */
|
---|
111 | /* */
|
---|
112 | /* @@PARAM */
|
---|
113 | /* */
|
---|
114 | /* CWMMDataFile *somSelf input */
|
---|
115 | /* */
|
---|
116 | /* Pointer to the object on which the method is being */
|
---|
117 | /* invoked. */
|
---|
118 | /* :p. */
|
---|
119 | /* Points to an object of class */
|
---|
120 | /* :hp2.CWMMDatafile:ehp2.. */
|
---|
121 | /* */
|
---|
122 | /* @@PARAM */
|
---|
123 | /* */
|
---|
124 | /* PFNWP pObjectProc input */
|
---|
125 | /* */
|
---|
126 | /* Window procedure for audio command handling. */
|
---|
127 | /* */
|
---|
128 | /* */
|
---|
129 | /* @@OVERRIDE */
|
---|
130 | /* */
|
---|
131 | /* This method is usually not overriden. */
|
---|
132 | /* */
|
---|
133 | /* @@RETURNS */
|
---|
134 | /* */
|
---|
135 | /* PFNWP pOldProc */
|
---|
136 | /* */
|
---|
137 | /* The previous window procedure handling the play */
|
---|
138 | /* commands. */
|
---|
139 | /* */
|
---|
140 | /* */
|
---|
141 | /* */
|
---|
142 | /* */
|
---|
143 | /*!!******************************************************/
|
---|
144 | SOM_Scope PFNWP SOMLINK cwmmdatafile_cwmmSetObjWindowProc(CWMMDataFile *somSelf,
|
---|
145 | PFNWP pObjectProc)
|
---|
146 | {
|
---|
147 | PFNWP pTemp;
|
---|
148 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
149 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_cwmmSetObjWindowProc");
|
---|
150 |
|
---|
151 | pTemp=_pfnwpObjectProc;
|
---|
152 | _pfnwpObjectProc=pObjectProc;
|
---|
153 |
|
---|
154 | return pTemp;
|
---|
155 | }
|
---|
156 |
|
---|
157 |
|
---|
158 | /*
|
---|
159 | Method used to query the window procedure address for subclassing object windows.
|
---|
160 | Every audio object may have a customized window procedure.
|
---|
161 | */
|
---|
162 | /*!*******************************************************/
|
---|
163 | /* */
|
---|
164 | /* @@DESC */
|
---|
165 | /* */
|
---|
166 | /* This instance method is called to query the object */
|
---|
167 | /* window procedure currently used for handling the play */
|
---|
168 | /* commands. */
|
---|
169 | /* */
|
---|
170 | /* */
|
---|
171 | /* @@USAGE */
|
---|
172 | /* */
|
---|
173 | /* This method can be called at any time in order to */
|
---|
174 | /* query the current window procedure handling play */
|
---|
175 | /* commands. */
|
---|
176 | /* :p. */
|
---|
177 | /* When a track is started the playing is done on a */
|
---|
178 | /* separate thread. Communication with this thread is */
|
---|
179 | /* done using window messages sent to an object window. */
|
---|
180 | /* There's a default window procedure which starts or */
|
---|
181 | /* stops audio playing. If there must be special */
|
---|
182 | /* processing to play a particular type of file a */
|
---|
183 | /* subclass may set a custom procedure handling the */
|
---|
184 | /* audio commands. */
|
---|
185 | /* */
|
---|
186 | /* @@PARAM */
|
---|
187 | /* */
|
---|
188 | /* CWMMDataFile *somSelf input */
|
---|
189 | /* */
|
---|
190 | /* Pointer to the object on which the method is being */
|
---|
191 | /* invoked. */
|
---|
192 | /* :p. */
|
---|
193 | /* Points to an object of class */
|
---|
194 | /* :hp2.CWMMDatafile:ehp2.. */
|
---|
195 | /* */
|
---|
196 | /* */
|
---|
197 | /* @@OVERRIDE */
|
---|
198 | /* */
|
---|
199 | /* This method is usually not overriden. */
|
---|
200 | /* */
|
---|
201 | /* @@RETURNS */
|
---|
202 | /* */
|
---|
203 | /* PFNWP pObjectProc */
|
---|
204 | /* */
|
---|
205 | /* The current window procedure handling the play */
|
---|
206 | /* commands. */
|
---|
207 | /* */
|
---|
208 | /* */
|
---|
209 | /* */
|
---|
210 | /* */
|
---|
211 | /*!!******************************************************/
|
---|
212 | SOM_Scope PFNWP SOMLINK cwmmdatafile_cwmmQueryObjWindowProc(CWMMDataFile *somSelf)
|
---|
213 | {
|
---|
214 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
215 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_cwmmQueryObjWindowProc");
|
---|
216 |
|
---|
217 | return _pfnwpObjectProc;
|
---|
218 | }
|
---|
219 |
|
---|
220 |
|
---|
221 | /*
|
---|
222 | * The prototype for cwmmdatafile_cwmmSetRecordTitles was replaced by the following prototype:
|
---|
223 | */
|
---|
224 | SOM_Scope BOOL SOMLINK cwmmdatafile_cwmmSetRecordTitles(CWMMDataFile *somSelf,
|
---|
225 | PSZ pTitle,
|
---|
226 | BOOL bAddToTitle)
|
---|
227 | {
|
---|
228 | PUSEITEM pUseItem;
|
---|
229 | PSZ pSZ;
|
---|
230 |
|
---|
231 | M_CWMMDataFileData *m_mmDfData = M_CWMMDataFileGetData(_CWMMDataFile);
|
---|
232 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
233 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_cwmmSetRecordTitles");
|
---|
234 |
|
---|
235 |
|
---|
236 | if(m_mmDfData->bNoExtendedIconTitles)
|
---|
237 | return NULLHANDLE;
|
---|
238 |
|
---|
239 | if(pTitle) {
|
---|
240 | if(!_pOrgTitle)
|
---|
241 | _pOrgTitle=_wpQueryTitle(somSelf);
|
---|
242 | if(bAddToTitle)
|
---|
243 | {
|
---|
244 | strncpy(_chrRecordTitle, _wpQueryTitle(somSelf), sizeof(_chrRecordTitle));
|
---|
245 | _chrRecordTitle[sizeof(_chrRecordTitle)-1]=0;
|
---|
246 | strncat(_chrRecordTitle,"\n", sizeof(_chrRecordTitle)-1-strlen(_chrRecordTitle));
|
---|
247 | strncat(_chrRecordTitle, pTitle, sizeof(_chrRecordTitle)-1-strlen(_chrRecordTitle));
|
---|
248 | }
|
---|
249 | else
|
---|
250 | strncpy(_chrRecordTitle, pTitle, sizeof(_chrRecordTitle));
|
---|
251 | _chrRecordTitle[sizeof(_chrRecordTitle)-1]=0;
|
---|
252 | pSZ=_chrRecordTitle;
|
---|
253 | }
|
---|
254 | else {
|
---|
255 | strncpy(_chrRecordTitle, _pOrgTitle, sizeof(_chrRecordTitle));
|
---|
256 | pSZ=_pOrgTitle;
|
---|
257 | _pOrgTitle=NULLHANDLE;
|
---|
258 | }
|
---|
259 | _chrRecordTitle[sizeof(_chrRecordTitle)-1]=0;
|
---|
260 |
|
---|
261 | for(pUseItem=_wpFindUseItem(somSelf, USAGE_RECORD, NULLHANDLE); pUseItem;
|
---|
262 | pUseItem=_wpFindUseItem(somSelf, USAGE_RECORD, pUseItem))
|
---|
263 | {
|
---|
264 | PRECORDITEM pRecordItem=(PRECORDITEM)++pUseItem;
|
---|
265 | pUseItem--;
|
---|
266 |
|
---|
267 | pRecordItem->pRecord->pszIcon=pSZ;
|
---|
268 | if(pRecordItem->hwndCnr)
|
---|
269 | WinSendMsg(pRecordItem->hwndCnr, CM_INVALIDATERECORD, MPFROMP(&(pRecordItem->pRecord)),
|
---|
270 | MPFROM2SHORT(1,CMA_TEXTCHANGED));
|
---|
271 | }
|
---|
272 |
|
---|
273 | for(pUseItem=_wpFindUseItem(somSelf, USAGE_LINK, NULLHANDLE); pUseItem;
|
---|
274 | pUseItem=_wpFindUseItem(somSelf, USAGE_LINK, pUseItem))
|
---|
275 | {
|
---|
276 | PLINKITEM pLinkItem=(PLINKITEM)++pUseItem;
|
---|
277 | pUseItem--;
|
---|
278 |
|
---|
279 | if(somIsObj(pLinkItem->LinkObj))
|
---|
280 | {
|
---|
281 | PUSEITEM pUI;
|
---|
282 |
|
---|
283 | for(pUI=_wpFindUseItem(pLinkItem->LinkObj, USAGE_RECORD, NULLHANDLE); pUI;
|
---|
284 | pUI=_wpFindUseItem(pLinkItem->LinkObj, USAGE_RECORD, pUI))
|
---|
285 | {
|
---|
286 | PRECORDITEM pRecordItem=(PRECORDITEM)++pUI;
|
---|
287 | pUI--;
|
---|
288 |
|
---|
289 | pRecordItem->pRecord->pszIcon=pSZ;
|
---|
290 | if(pRecordItem->hwndCnr)
|
---|
291 | WinPostMsg(pRecordItem->hwndCnr,CM_INVALIDATERECORD,
|
---|
292 | MPFROMP(&(pRecordItem->pRecord)),MPFROM2SHORT(1,CMA_TEXTCHANGED));
|
---|
293 | }
|
---|
294 | }
|
---|
295 | }
|
---|
296 |
|
---|
297 | /* Return statement to be customized: */
|
---|
298 | return TRUE;
|
---|
299 | }
|
---|
300 |
|
---|
301 |
|
---|
302 |
|
---|
303 | /*
|
---|
304 | * The prototype for cwmmdatafile_cwmmQueryTrackStatus was replaced by the following prototype:
|
---|
305 | */
|
---|
306 | /*
|
---|
307 | * Object window handling the start/stop/pause/resume commands.
|
---|
308 | */
|
---|
309 | /*!*******************************************************/
|
---|
310 | /* */
|
---|
311 | /* @@DESC */
|
---|
312 | /* */
|
---|
313 | /* This instance method is called to query the current */
|
---|
314 | /* state of the multimedia object.g. */
|
---|
315 | /* */
|
---|
316 | /* */
|
---|
317 | /* @@USAGE */
|
---|
318 | /* */
|
---|
319 | /* This method can be called at any time in order to */
|
---|
320 | /* query the state of the object. This method can be used*/
|
---|
321 | /* to check if an object is currently playing, paused */
|
---|
322 | /* etc. */
|
---|
323 | /* */
|
---|
324 | /* */
|
---|
325 | /* @@PARAM */
|
---|
326 | /* */
|
---|
327 | /* CWMMDataFile *somSelf input */
|
---|
328 | /* */
|
---|
329 | /* Pointer to the object on which the method is being */
|
---|
330 | /* invoked. */
|
---|
331 | /* :p. */
|
---|
332 | /* Points to an object of class */
|
---|
333 | /* :hp2.CWMMDatafile:ehp2.. */
|
---|
334 | /* */
|
---|
335 | /* @@OVERRIDE */
|
---|
336 | /* */
|
---|
337 | /* This method is usually not overriden. */
|
---|
338 | /* */
|
---|
339 | /* @@RETURNS */
|
---|
340 | /* */
|
---|
341 | /* ULONG ulStatus */
|
---|
342 | /* */
|
---|
343 | /* :parml compact tsize=35 break=none. */
|
---|
344 | /* :pt.TRACK_STATUS_STOPPED */
|
---|
345 | /* :pd.Track is not playing */
|
---|
346 | /* :pt.TRACK_STATUS_PLAYING */
|
---|
347 | /* :pd.Track is currently playing */
|
---|
348 | /* :pt.TRACK_STATUS_PAUSED */
|
---|
349 | /* :pd.Track is paused. */
|
---|
350 | /* :eparml. */
|
---|
351 | /* */
|
---|
352 | /* */
|
---|
353 | /* */
|
---|
354 | /* */
|
---|
355 | /*!!******************************************************/
|
---|
356 | SOM_Scope ULONG SOMLINK cwmmdatafile_cwmmQueryTrackStatus(CWMMDataFile *somSelf)
|
---|
357 | {
|
---|
358 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
359 | // CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_cwmmQueryTrackStatus");
|
---|
360 |
|
---|
361 | /* Return statement to be customized: */
|
---|
362 | return _ulTrackStatus;
|
---|
363 | }
|
---|
364 |
|
---|
365 |
|
---|
366 | /*
|
---|
367 | * The prototype for cwmmdatafile_wpFilterPopupMenu was replaced by the following prototype:
|
---|
368 | */
|
---|
369 | SOM_Scope ULONG SOMLINK cwmmdatafile_wpFilterPopupMenu(CWMMDataFile *somSelf,
|
---|
370 | ULONG ulFlags,
|
---|
371 | HWND hwndCnr,
|
---|
372 | BOOL fMultiSelect)
|
---|
373 | {
|
---|
374 | /* CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);*/
|
---|
375 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_wpFilterPopupMenu");
|
---|
376 |
|
---|
377 | /* Remove the print menu item. */
|
---|
378 | return (CWMMDataFile_parent_WPDataFile_wpFilterPopupMenu(somSelf,
|
---|
379 | ulFlags,
|
---|
380 | hwndCnr,
|
---|
381 | fMultiSelect)& ~CTXT_PRINT);
|
---|
382 | }
|
---|
383 |
|
---|
384 |
|
---|
385 | /*
|
---|
386 |
|
---|
387 | */
|
---|
388 | SOM_Scope BOOL SOMLINK cwmmdatafile_wpAddSettingsPages(CWMMDataFile *somSelf,
|
---|
389 | HWND hwndNotebook)
|
---|
390 | {
|
---|
391 | BOOL bRc;
|
---|
392 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
393 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_wpAddSettingsPages");
|
---|
394 |
|
---|
395 | bRc=(CWMMDataFile_parent_WPDataFile_wpAddSettingsPages(somSelf,
|
---|
396 | hwndNotebook));
|
---|
397 | /*
|
---|
398 | When the settings notebook is built the WPS resets the object title
|
---|
399 | (who knows why). If we have a custom title during playing this would
|
---|
400 | vanish. so check if we have a backup of the original title and if so
|
---|
401 | immediately set again the custom title.
|
---|
402 | */
|
---|
403 |
|
---|
404 | if(_pOrgTitle)
|
---|
405 | _cwmmSetRecordTitles(somSelf, _chrRecordTitle, FALSE);
|
---|
406 | return bRc;
|
---|
407 | }
|
---|
408 |
|
---|
409 |
|
---|
410 |
|
---|
411 | /*
|
---|
412 | * The prototype for cwmmdatafile_wpModifyPopupMenu was replaced by the following prototype:
|
---|
413 | */
|
---|
414 | SOM_Scope BOOL SOMLINK cwmmdatafile_wpModifyPopupMenu(CWMMDataFile *somSelf,
|
---|
415 | HWND hwndMenu,
|
---|
416 | HWND hwndCnr,
|
---|
417 | ULONG iPosition)
|
---|
418 | {
|
---|
419 | BOOL bRc;
|
---|
420 |
|
---|
421 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
422 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_wpModifyPopupMenu");
|
---|
423 |
|
---|
424 |
|
---|
425 | bRc=(CWMMDataFile_parent_WPDataFile_wpModifyPopupMenu(somSelf,
|
---|
426 | hwndMenu,
|
---|
427 | hwndCnr,
|
---|
428 | iPosition));
|
---|
429 | /*
|
---|
430 | When the settings notebook is built the WPS resets the object title
|
---|
431 | (who knows why). If we have a custom title during playing this would
|
---|
432 | vanish. so check if we have a backup of the original title and if so
|
---|
433 | immediately set again the custom title.
|
---|
434 | */
|
---|
435 | if(_pOrgTitle)
|
---|
436 | _cwmmSetRecordTitles(somSelf, _chrRecordTitle, FALSE);
|
---|
437 |
|
---|
438 | return bRc;
|
---|
439 | }
|
---|
440 |
|
---|
441 |
|
---|
442 | /*
|
---|
443 | * The prototype for cwmmdatafile_wpSetTitle was replaced by the following prototype:
|
---|
444 | */
|
---|
445 | SOM_Scope BOOL SOMLINK cwmmdatafile_wpSetTitle(CWMMDataFile *somSelf,
|
---|
446 | PSZ pszNewTitle)
|
---|
447 | {
|
---|
448 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
449 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_wpSetTitle");
|
---|
450 |
|
---|
451 | _pOrgTitle=NULLHANDLE;
|
---|
452 |
|
---|
453 | return (CWMMDataFile_parent_WPDataFile_wpSetTitle(somSelf,
|
---|
454 | pszNewTitle));
|
---|
455 | }
|
---|
456 |
|
---|
457 | /*
|
---|
458 | * The prototype for cwmmdatafile_wpQueryTitle was replaced by the following prototype:
|
---|
459 | */
|
---|
460 | SOM_Scope PSZ SOMLINK cwmmdatafile_wpQueryTitle(CWMMDataFile *somSelf)
|
---|
461 | {
|
---|
462 | CWMMDataFileData *somThis = CWMMDataFileGetData(somSelf);
|
---|
463 | CWMMDataFileMethodDebug("CWMMDataFile","cwmmdatafile_wpQueryTitle");
|
---|
464 |
|
---|
465 | /*
|
---|
466 | Alway return the default title not the custom title (playtime display)
|
---|
467 | which is only for display in containers.
|
---|
468 | */
|
---|
469 | if(_pOrgTitle)
|
---|
470 | return _pOrgTitle;
|
---|
471 |
|
---|
472 | return (CWMMDataFile_parent_WPDataFile_wpQueryTitle(somSelf));
|
---|
473 | }
|
---|
474 |
|
---|
475 |
|
---|
476 | SOM_Scope BOOL SOMLINK cwmmdatafileM_wpclsCreateDefaultTemplates(M_CWMMDataFile *somSelf,
|
---|
477 | WPObject* Folder)
|
---|
478 | {
|
---|
479 | /* M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf);*/
|
---|
480 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsCreateDefaultTemplates");
|
---|
481 |
|
---|
482 | return TRUE; /* We don't want a template for this base class */
|
---|
483 | }
|
---|
484 |
|
---|
485 |
|
---|
486 | /*
|
---|
487 | * The prototype for cwmmdatafileM_wpclsQueryTitle was replaced by the following prototype:
|
---|
488 | */
|
---|
489 | SOM_Scope PSZ SOMLINK cwmmdatafileM_wpclsQueryTitle(M_CWMMDataFile *somSelf)
|
---|
490 | {
|
---|
491 | static char chrTitle[20]={0};
|
---|
492 | /* M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf); */
|
---|
493 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsQueryTitle");
|
---|
494 |
|
---|
495 | if(chrTitle[0]==0)
|
---|
496 | if(!getMessage(chrTitle, IDSTR_CWMMDATAFILETITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
|
---|
497 | strcpy(chrTitle,"MMDatafile");
|
---|
498 |
|
---|
499 | return chrTitle;
|
---|
500 | }
|
---|
501 |
|
---|
502 |
|
---|
503 | /*
|
---|
504 | * The prototype for cwmmdatafileM_wpclsQueryIconData was replaced by the following prototype:
|
---|
505 | */
|
---|
506 | SOM_Scope ULONG SOMLINK cwmmdatafileM_wpclsQueryIconData(M_CWMMDataFile *somSelf,
|
---|
507 | PICONINFO pIconInfo)
|
---|
508 | {
|
---|
509 | /* M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf); */
|
---|
510 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsQueryIconData");
|
---|
511 |
|
---|
512 | return (M_CWMMDataFile_parent_M_WPDataFile_wpclsQueryIconData(somSelf,
|
---|
513 | pIconInfo));
|
---|
514 | }
|
---|
515 |
|
---|
516 | /*
|
---|
517 | Window telling the user we are currently scanning the audio file.
|
---|
518 | */
|
---|
519 | MRESULT EXPENTRY statusWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
520 | {
|
---|
521 | PFNWP proc;
|
---|
522 |
|
---|
523 | switch (msg)
|
---|
524 | {
|
---|
525 | case WM_APPTERMINATENOTIFY:
|
---|
526 | {
|
---|
527 | switch (LONGFROMMP(mp2))
|
---|
528 | {
|
---|
529 | case 0:
|
---|
530 | WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, 1, 1000);
|
---|
531 | break;
|
---|
532 | case 1:
|
---|
533 | WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 1);
|
---|
534 | break;
|
---|
535 | default:
|
---|
536 | break;
|
---|
537 | }
|
---|
538 | return (MRESULT) FALSE;
|
---|
539 | }
|
---|
540 | case WM_TIMER:
|
---|
541 | {
|
---|
542 | if(SHORT1FROMMP(mp1)==1) {
|
---|
543 | WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 1);
|
---|
544 | /* Hide the status window */
|
---|
545 | WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, 0, 0,SWP_SIZE);
|
---|
546 | return (MRESULT) FALSE;
|
---|
547 | }
|
---|
548 | }
|
---|
549 | default:
|
---|
550 | break;
|
---|
551 | }
|
---|
552 |
|
---|
553 | proc=(PFNWP) WinQueryWindowULong(hwnd, QWL_USER);
|
---|
554 | if(proc)
|
---|
555 | return proc( hwnd, msg, mp1, mp2);
|
---|
556 |
|
---|
557 | return WinDefWindowProc( hwnd, msg, mp1, mp2);
|
---|
558 | }
|
---|
559 |
|
---|
560 | /*
|
---|
561 | The window proc is in file cwaudio.c
|
---|
562 |
|
---|
563 | This thread scans the sudio files for gathering the audio information asynchronously.
|
---|
564 | */
|
---|
565 | void _Optlink audioWorkerThread (void *arg)
|
---|
566 | {
|
---|
567 |
|
---|
568 | HAB hab;
|
---|
569 | HMQ hmq;
|
---|
570 | QMSG qmsg;
|
---|
571 |
|
---|
572 | M_CWMMDataFileData *somThis = (M_CWMMDataFileData*)arg;
|
---|
573 |
|
---|
574 | DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, 0, 0);
|
---|
575 | hab=WinInitialize(0);
|
---|
576 | if(hab) {
|
---|
577 | hmq=WinCreateMsgQueue(hab, 50);
|
---|
578 | if(hmq) {
|
---|
579 | globalHwndAudioWorker=WinCreateWindow(HWND_OBJECT,WC_STATIC,"CWMMObj",0,0,0,0,0,NULLHANDLE,HWND_BOTTOM,13345,NULL,NULL);
|
---|
580 | //DosBeep(5000, 100);
|
---|
581 | if(globalHwndAudioWorker) {
|
---|
582 | WinSubclassWindow(globalHwndAudioWorker,&audioWorkerProc);
|
---|
583 | _hwndAudioWorker=globalHwndAudioWorker;
|
---|
584 | /* Window created. */
|
---|
585 | while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))
|
---|
586 | WinDispatchMsg(hab,&qmsg);
|
---|
587 |
|
---|
588 | WinDestroyWindow(globalHwndAudioWorker);
|
---|
589 | }
|
---|
590 | WinDestroyMsgQueue(hmq);
|
---|
591 | }
|
---|
592 | WinTerminate(hab);
|
---|
593 | }
|
---|
594 | }
|
---|
595 |
|
---|
596 |
|
---|
597 | /*********************************************************************************
|
---|
598 | * *
|
---|
599 | * Every app started by a MM object is started using WinStartApp(). The *
|
---|
600 | * notify window is this one. After starting a new view is added to the object. *
|
---|
601 | * When terminating a WM_APPTERMINATENOTIFY message is sent to this window. *
|
---|
602 | * We search the view item belonging to the app and remove it from the object *
|
---|
603 | * inuse list. *
|
---|
604 | * *
|
---|
605 | *********************************************************************************/
|
---|
606 | MRESULT EXPENTRY appTerminateHandlerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
607 | {
|
---|
608 |
|
---|
609 | switch (msg)
|
---|
610 | {
|
---|
611 | case WM_APPTERMINATENOTIFY:
|
---|
612 | {
|
---|
613 | for(;;) {
|
---|
614 | PUSEITEM pUseItem;
|
---|
615 | CWMMDataFile *somSelf= (CWMMDataFile *)WinQueryWindowULong(hwnd, QWL_USER);
|
---|
616 | if(!somIsObj(somSelf))
|
---|
617 | break;
|
---|
618 |
|
---|
619 | for(pUseItem=_wpFindUseItem(somSelf, USAGE_OPENVIEW, NULLHANDLE);
|
---|
620 | pUseItem;pUseItem=_wpFindUseItem(somSelf,USAGE_OPENVIEW, pUseItem))
|
---|
621 | {
|
---|
622 | PVIEWITEM pViewItem=(PVIEWITEM) ++pUseItem;
|
---|
623 | pUseItem--;
|
---|
624 | // HlpWriteToTrapLog("ViewItem: %x\n",pViewItem);
|
---|
625 | if(pViewItem->handle==LONGFROMMP(mp1)) {
|
---|
626 | _wpDeleteFromObjUseList(somSelf,pUseItem);
|
---|
627 | _wpFreeMem(somSelf, (PBYTE)pUseItem);
|
---|
628 | WinDestroyWindow(hwnd);
|
---|
629 | // WinPostMsg(hwnd, WM_DESTROY,0,0);
|
---|
630 | break;
|
---|
631 | }
|
---|
632 | }/* for() */
|
---|
633 | break;
|
---|
634 | };/* for() */
|
---|
635 | return (MRESULT) FALSE;
|
---|
636 | }
|
---|
637 | default:
|
---|
638 | break;
|
---|
639 | }
|
---|
640 | return WinDefWindowProc( hwnd, msg, mp1, mp2);
|
---|
641 | }
|
---|
642 |
|
---|
643 |
|
---|
644 | /*
|
---|
645 | * The prototype for cwmmdatafileM_wpclsInitData was replaced by the following prototype:
|
---|
646 | */
|
---|
647 | SOM_Scope void SOMLINK cwmmdatafileM_wpclsInitData(M_CWMMDataFile *somSelf)
|
---|
648 | {
|
---|
649 | HINI hini;
|
---|
650 | static BOOL bInit=FALSE;
|
---|
651 |
|
---|
652 | M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf);
|
---|
653 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsInitData");
|
---|
654 |
|
---|
655 | M_CWMMDataFile_parent_M_WPDataFile_wpclsInitData(somSelf);
|
---|
656 |
|
---|
657 | if(!globalHab)
|
---|
658 | globalHab=WinQueryAnchorBlock(HWND_DESKTOP);
|
---|
659 |
|
---|
660 | /* Create a status window to show user we're scanning the audio file for info */
|
---|
661 | if(!globalHwndStatus)
|
---|
662 | {
|
---|
663 | HWND hwndClient;
|
---|
664 | PFNWP proc;
|
---|
665 | char chrText[100];
|
---|
666 |
|
---|
667 | ULONG ulFL=FCF_BORDER | FCF_TITLEBAR;
|
---|
668 | globalHwndStatus=WinCreateStdWindow(HWND_DESKTOP,WS_VISIBLE|FS_BORDER,
|
---|
669 | &ulFL, WC_STATIC, "Audiofile scanning...",
|
---|
670 | WS_VISIBLE|SS_TEXT|DT_VCENTER|DT_CENTER, NULLHANDLE, ID_STATUS_WINDOW,
|
---|
671 | &hwndClient);
|
---|
672 | /* Set title */
|
---|
673 | if(getMessage(chrText, IDSTR_AUDIOSCANNING , sizeof(chrText), queryResModuleHandle(), globalHwndStatus))
|
---|
674 | WinSetWindowText(globalHwndStatus, chrText);
|
---|
675 | proc=WinSubclassWindow(globalHwndStatus,&statusWindowProc);
|
---|
676 | WinSetWindowULong(globalHwndStatus, QWL_USER,(ULONG)proc);
|
---|
677 | WinSetWindowPos(globalHwndStatus, HWND_TOP, 0, 0, 0, 0,SWP_MOVE|SWP_SIZE|SWP_ZORDER|SWP_DEACTIVATE);
|
---|
678 | /* Set window font to WarpSans */
|
---|
679 | WinSetPresParam(globalHwndStatus,
|
---|
680 | PP_FONTNAMESIZE, (ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
681 | DEFAULT_DIALOG_FONT );
|
---|
682 | WinSetPresParam(WinWindowFromID(globalHwndStatus, FID_CLIENT),
|
---|
683 | PP_FONTNAMESIZE, (ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
684 | DEFAULT_DIALOG_FONT );
|
---|
685 |
|
---|
686 | }
|
---|
687 | _hwndStatus=globalHwndStatus;
|
---|
688 |
|
---|
689 | /* Start audio worker thread */
|
---|
690 | if(!globalHwndAudioWorker)
|
---|
691 | _beginthread(audioWorkerThread, NULL, 8192*10, somThis);
|
---|
692 | else
|
---|
693 | _hwndAudioWorker=globalHwndAudioWorker;
|
---|
694 |
|
---|
695 | if(!bInit) {
|
---|
696 | /* Get special settings from the user INI file */
|
---|
697 | if(!PrfQueryProfileInt(HINI_USERPROFILE, "CWMM", MM_NO_EXTENDED_ICONTITLE, 0))
|
---|
698 | _bNoExtendedIconTitles=FALSE;
|
---|
699 | else
|
---|
700 | _bNoExtendedIconTitles=TRUE;
|
---|
701 |
|
---|
702 | /* Get additional settings from the MM class ini. */
|
---|
703 | if((hini=PrfOpenProfile(globalHab, _queryMMClassIniFile()))!=NULLHANDLE)
|
---|
704 | {
|
---|
705 | globalClassVolume=PrfQueryProfileInt(hini, CLASS_VOLUME_APP, CLASS_VOLUME_KEY,DEFVOLUME_AUDIO_FILE);
|
---|
706 | PrfCloseProfile(hini);
|
---|
707 | }
|
---|
708 | /* Register mmedia class REXX functions */
|
---|
709 | RexxRegisterFunctionExe("MMClsCallFunc", (PFN)rxCallCWMMFunc); /* This name is obsolete because it is hard
|
---|
710 | to tell if the function is used with objects
|
---|
711 | or with the class object. It's still here for
|
---|
712 | backwards compatibility. */
|
---|
713 | RexxRegisterFunctionExe("MMCallFunc", (PFN)rxCallCWMMFunc);
|
---|
714 | /* Don't deregister the function in wpclsUninitData. If doing it the function
|
---|
715 | may be unavailable if the class object goes dormant. */
|
---|
716 | bInit=TRUE;
|
---|
717 | }/* bInit */
|
---|
718 | }
|
---|
719 |
|
---|
720 |
|
---|
721 | /*
|
---|
722 | * The prototype for cwmmdatafileM_wpclsUnInitData was replaced by the following prototype:
|
---|
723 | */
|
---|
724 | SOM_Scope void SOMLINK cwmmdatafileM_wpclsUnInitData(M_CWMMDataFile *somSelf)
|
---|
725 | {
|
---|
726 | /* M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf); */
|
---|
727 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsUnInitData");
|
---|
728 |
|
---|
729 | M_CWMMDataFile_parent_M_WPDataFile_wpclsUnInitData(somSelf);
|
---|
730 | }
|
---|
731 |
|
---|
732 |
|
---|
733 | /*
|
---|
734 | * The prototype for cwmmdatafileM_wpclsQueryStyle was replaced by the following prototype:
|
---|
735 | */
|
---|
736 | SOM_Scope ULONG SOMLINK cwmmdatafileM_wpclsQueryStyle(M_CWMMDataFile *somSelf)
|
---|
737 | {
|
---|
738 | /* M_CWMMDataFileData *somThis = M_CWMMDataFileGetData(somSelf);*/
|
---|
739 | M_CWMMDataFileMethodDebug("M_CWMMDataFile","cwmmdatafileM_wpclsQueryStyle");
|
---|
740 |
|
---|
741 | return CLSSTYLE_DONTTEMPLATE;
|
---|
742 | }
|
---|
743 |
|
---|