source: trunk/classes/c/c_video/cwvideo.c

Last change on this file was 4, checked in by stevenhl, 8 years ago

Import modifications from cwmm-0_2_9-work-01_10_2006.zip dated 2006-08-27

File size: 11.3 KB
Line 
1/*
2 * (C) Chris Wohlgemuth 2002-2005
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_cwvideo_Source
33#define SOM_Module_cwvideo_Source
34#endif
35#define CWVideo_Class_Source
36#define M_CWVideo_Class_Source
37
38#define INCL_PM
39#include <os2.h>
40#include "cwvideo.ih"
41#include "cwaudioinc.h" /* For REXX script name */
42//#include "cwmmres.h"
43//#include "mmres.h"
44
45HMODULE queryResModuleHandle(void);
46HMODULE queryModuleHandle(void);
47BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
48ULONG launchPMProg(PSZ pszTitle, PSZ wrapperExe, PSZ parameters, CWMMDataFile *thisPtr, ULONG ulView);
49BOOL getStringFromRexxScript(PSZ rexxFile, char* chrResult, ULONG ulSize);
50
51char chrMMVideoExt[400]={0};/* Array holding the extensions for wpclsQueryInstanceFilter() */
52
53/*
54 * SOM_Scope BOOL SOMLINK cwvideo_wpModifyPopupMenu(CWVideo *somSelf,
55 * HWND hwndMenu,
56 * HWND hwndCnr,
57 * ULONG iPosition)
58 */
59
60/*
61 * The prototype for cwvideo_wpModifyPopupMenu was replaced by the following prototype:
62 */
63SOM_Scope BOOL SOMLINK cwvideo_wpModifyPopupMenu(MMVideo *somSelf,
64 HWND hwndMenu,
65 HWND hwndCnr,
66 ULONG iPosition)
67{
68 /* CWVideoData *somThis = CWVideoGetData(somSelf); */
69 MMVideoMethodDebug("MMVideo","cwvideo_wpModifyPopupMenu");
70
71 _wpInsertPopupMenuItems(somSelf, hwndMenu, 1, queryResModuleHandle(), ID_MENU_PLAYER, 1);
72 _wpInsertPopupMenuItems(somSelf, hwndMenu, 1, queryResModuleHandle(), ID_MENU_START, 1);
73 return (MMVideo_parent_CWMMDataFile_wpModifyPopupMenu(somSelf,
74 hwndMenu,
75 hwndCnr,
76 iPosition));
77}
78
79
80/*
81 * SOM_Scope BOOL SOMLINK cwvideo_wpMenuItemSelected(CWVideo *somSelf,
82 * HWND hwndFrame,
83 * ULONG ulMenuId)
84 */
85
86/*
87 * The prototype for cwvideo_wpMenuItemSelected was replaced by the following prototype:
88 */
89SOM_Scope BOOL SOMLINK cwvideo_wpMenuItemSelected(MMVideo *somSelf,
90 HWND hwndFrame,
91 ULONG ulMenuId)
92{
93 /* CWVideoData *somThis = CWVideoGetData(somSelf); */
94 MMVideoMethodDebug("MMVideo","cwvideo_wpMenuItemSelected");
95
96 switch(ulMenuId)
97 {
98 case ID_MENU_PLAYER:
99 case ID_MENU_START:
100 //_wpViewObject(somSelf, NULLHANDLE, ID_MENU_PLAYER ,0);
101 _wpViewObject(somSelf, NULLHANDLE, ulMenuId,0);
102 return TRUE;
103 default:
104 break;
105 }
106
107 return (MMVideo_parent_CWMMDataFile_wpMenuItemSelected(somSelf,
108 hwndFrame,
109 ulMenuId));
110}
111
112
113
114/*
115 * SOM_Scope HWND SOMLINK cwvideo_wpOpen(CWVideo *somSelf, HWND hwndCnr,
116 * ULONG ulView, ULONG param)
117 */
118
119/*
120 * The prototype for cwvideo_wpOpen was replaced by the following prototype:
121 */
122SOM_Scope HWND SOMLINK cwvideo_wpOpen(MMVideo *somSelf, HWND hwndCnr,
123 ULONG ulView, ULONG param)
124{
125 /* CWVideoData *somThis = CWVideoGetData(somSelf); */
126 MMVideoMethodDebug("MMVideo","cwvideo_wpOpen");
127
128 switch(ulView)
129 {
130 case ID_MENU_START:
131 case ID_MENU_PLAYER:
132 /*case 0xbbe5: Player */
133 {
134 char chrPlayer[CCHMAXPATH]={0};
135 char chrParams[CCHMAXPATH+2]="\"";
136 char chrTitle[50];
137 char *chrPtr=chrParams;
138 ULONG ulSize;
139 ULONG ulRc;
140
141 if(!PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "videoplayer", NULLHANDLE, chrPlayer,
142 sizeof(chrPlayer)))
143 PrfQueryProfileString(HINI_USERPROFILE, "CWMM", "vb", "vb.exe", chrPlayer,
144 sizeof(chrPlayer));
145
146 chrPtr++;
147 ulSize=sizeof(chrParams)-2;
148 _wpQueryRealName(somSelf, chrPtr, &ulSize, TRUE);
149 strcat(chrPtr,"\"");
150
151 /* Get the Title for the window list */
152 if(!getMessage(chrTitle, IDSTR_VIDPLAYERTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
153 strcpy(chrTitle, "Player");
154
155 if((ulRc=launchPMProg(chrTitle, chrPlayer, chrParams, somSelf, ulView))==NULLHANDLE) {
156 break;
157 }
158 return NULLHANDLE;
159 }
160
161 default:
162 break;
163 }
164
165 return (MMVideo_parent_CWMMDataFile_wpOpen(somSelf, hwndCnr,
166 ulView, param));
167}
168
169
170
171/*
172 * SOM_Scope BOOL SOMLINK cwvideoM_wpclsCreateDefaultTemplates(M_CWVideo *somSelf,
173 * WPObject* Folder)
174 */
175
176/*
177 * The prototype for cwvideoM_wpclsCreateDefaultTemplates was replaced by the following prototype:
178 */
179SOM_Scope BOOL SOMLINK cwvideoM_wpclsCreateDefaultTemplates(M_MMVideo *somSelf,
180 WPObject* Folder)
181{
182 /* M_CWVideoData *somThis = M_CWVideoGetData(somSelf); */
183 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsCreateDefaultTemplates");
184
185 return TRUE;
186}
187
188
189SOM_Scope PSZ SOMLINK cwvideoM_wpclsQueryInstanceType(M_MMVideo *somSelf)
190{
191 /* static char chrTitle[40]={0}; */
192 /* M_MMVideoData *somThis = M_MMVideoGetData(somSelf); */
193 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsQueryInstanceType");
194
195#if 0
196 /* The type probably shouldn't be translated to make changing files between languages
197 easier.*/
198 if(chrTitle[0]==0)
199 if(!getMessage(chrTitle, IDSTR_CWVIDEOTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
200 strcpy(chrTitle,"Digital video");
201#endif
202 return TYPE_DIGITALVIDEO;
203 /* return (M_MMVideo_parent_M_CWMMDataFile_wpclsQueryInstanceType(somSelf)); */
204}
205
206SOM_Scope PSZ SOMLINK cwvideoM_wpclsQueryInstanceFilter(M_MMVideo *somSelf)
207{
208 /* M_MMVideoData *somThis = M_MMVideoGetData(somSelf); */
209 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsQueryInstanceFilter");
210
211 /* The list of additional extensions is built in wpclsInitData().
212
213 FIXME
214 This is a static list read in only once during startup.
215 Should probably be changed later on.
216 */
217 return chrMMVideoExt;
218
219 /* return (M_MMVideo_parent_M_CWMMDataFile_wpclsQueryInstanceFilter(somSelf)); */
220}
221
222/*
223 * SOM_Scope PSZ SOMLINK cwvideoM_wpclsQueryTitle(M_CWVideo *somSelf)
224 */
225
226/*
227 * The prototype for cwvideoM_wpclsQueryTitle was replaced by the following prototype:
228 */
229SOM_Scope PSZ SOMLINK cwvideoM_wpclsQueryTitle(M_MMVideo *somSelf)
230{
231 static char chrTitle[20]={0};
232 /* M_CWVideoData *somThis = M_CWVideoGetData(somSelf); */
233 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsQueryTitle");
234
235 if(chrTitle[0]==0)
236 if(!getMessage(chrTitle, IDSTR_CWVIDEOTITLE, sizeof(chrTitle), queryResModuleHandle(), HWND_DESKTOP))
237 strcpy(chrTitle,"Digital video");
238
239 return chrTitle;
240}
241
242
243SOM_Scope void SOMLINK cwvideoM_wpclsInitData(M_MMVideo *somSelf)
244{
245 static BOOL bGotVideoExt=FALSE;
246
247 /* M_MMVideoData *somThis = M_MMVideoGetData(somSelf); */
248 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsInitData");
249
250 /*
251 Taken from the audio classes. I suspect the same is true for the video classes.
252 Anyway it wont hurt having this here.
253
254 Get extensions of additional audio procs. These extensions may be specified by
255 newly installed IO procs in MMPM2.INI or by using the Multimedia setup. For
256 example the MMIOMP3 procedure for reading MP3 files adds the MP3 extension this
257 way to the system. Extensions already handled by a specialized class will be
258 filtered in the called REXX script e.g. MP3 so only unknown extensions end up here.
259
260 Strangely enough wpclsQueryInstanceFilter() is called during wpclsInitData() so
261 we query the extensions here before calling the parent.
262
263 FIXME:
264 The check is only done once during initialization. This is a little annoyance for
265 the user because new extension specified in the settings will only be picked up
266 on next WPS start.
267 */
268 if(!bGotVideoExt)
269 {
270 /* REXX script: "videoext.rx" */
271 getStringFromRexxScript(MMVIDEO_GETEXT_RX, chrMMVideoExt, sizeof(chrMMVideoExt));
272 bGotVideoExt=TRUE;
273 }
274
275 M_MMVideo_parent_M_CWMMDataFile_wpclsInitData(somSelf);
276}
277
278/*
279 * SOM_Scope ULONG SOMLINK cwvideoM_wpclsQueryDefaultView(M_CWVideo *somSelf)
280 */
281
282/*
283 * The prototype for cwvideoM_wpclsQueryDefaultView was replaced by the following prototype:
284 */
285SOM_Scope ULONG SOMLINK cwvideoM_wpclsQueryDefaultView(M_MMVideo *somSelf)
286{
287 /* M_CWVideoData *somThis = M_CWVideoGetData(somSelf); */
288 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsQueryDefaultView");
289
290 return ID_MENU_START;
291 /* return (M_CWVideo_parent_M_CWMMDataFile_wpclsQueryDefaultView(somSelf));*/
292}
293
294
295/*
296 * SOM_Scope ULONG SOMLINK cwvideoM_wpclsQueryIconData(M_CWVideo *somSelf,
297 * PICONINFO pIconInfo)
298 */
299
300/*
301 * The prototype for cwvideoM_wpclsQueryIconData was replaced by the following prototype:
302 */
303SOM_Scope ULONG SOMLINK cwvideoM_wpclsQueryIconData(M_MMVideo *somSelf,
304 PICONINFO pIconInfo)
305{
306 HMODULE hmod;
307
308 /* M_CWVideoData *somThis = M_CWVideoGetData(somSelf); */
309 M_MMVideoMethodDebug("M_MMVideo","cwvideoM_wpclsQueryIconData");
310
311 hmod=queryModuleHandle();
312 if(!hmod)
313 return M_MMVideo_parent_M_CWMMDataFile_wpclsQueryIconData(somSelf, pIconInfo);
314
315 if (pIconInfo) {
316 pIconInfo->fFormat = ICON_RESOURCE;
317 pIconInfo->hmod = hmod;
318 pIconInfo->resid = ID_ICONCWVIDEOFILE;
319 } /* endif */
320
321 return ( sizeof(ICONINFO) );
322}
323
Note: See TracBrowser for help on using the repository browser.