source: trunk/classes/c/c_mm/cwmmdataf.c

Last change on this file was 215, checked in by gyoung, 4 months ago

Conditionally remove move, copy and create shadow when object is in a folder type where they don't function properly

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