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