1 | /*
|
---|
2 | * This file is (C) Chris Wohlgemuth 2002-2003
|
---|
3 | *
|
---|
4 | * It's part of the Media-Folder distribution
|
---|
5 | */
|
---|
6 |
|
---|
7 | #define INCL_DOSERRORS
|
---|
8 |
|
---|
9 | #define INCL_REXXSAA
|
---|
10 |
|
---|
11 | #include <stdio.h>
|
---|
12 | #include <stdlib.h>
|
---|
13 | #include <ctype.h>
|
---|
14 | #include "m3ufolder.hh"
|
---|
15 | #include "except.h"
|
---|
16 | #include <rexxsaa.h> /* needed for RexxStart() */
|
---|
17 |
|
---|
18 | #include "mediafolderres.h"
|
---|
19 | #include "cwcdtrack.hh"
|
---|
20 |
|
---|
21 | #include "sys_funcs.h"
|
---|
22 | #include "menu_funcs.h"
|
---|
23 |
|
---|
24 | #if 0
|
---|
25 | #define _PMPRINTF_
|
---|
26 | #include "PMPRINTF.H"
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | extern BOOL g_fRegisteredWindowClass;
|
---|
30 | extern ULONG g_ulFrameDataOffset;
|
---|
31 |
|
---|
32 | /* The following offsets are calclated in wpOpen() of media folder */
|
---|
33 | extern ULONG ulQWP_CONTAINERPROC;
|
---|
34 | extern ULONG ulQWP_THISPTR;
|
---|
35 | extern ULONG ulQWL_TOPCTRLHWND;
|
---|
36 | extern ULONG ulQWL_BOTTOMCTRLHWND;
|
---|
37 | extern ULONG ulQWL_RIGHTCTRLHWND;
|
---|
38 | extern ULONG ulQWL_LEFTCTRLHWND;
|
---|
39 |
|
---|
40 | extern LOADEDBITMAP allBMPs[];
|
---|
41 | extern PFNWP pfnwpGenericFrame;
|
---|
42 | extern char chrInstallDir[];
|
---|
43 |
|
---|
44 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
|
---|
45 | ULONG messageBox( char* text, ULONG ulTextID , LONG lSizeText,
|
---|
46 | char* title, ULONG ulTitleID, LONG lSizeTitle,
|
---|
47 | HMODULE hResource, HWND hwnd, ULONG ulFlags);
|
---|
48 | HMODULE queryResModuleHandle(void);
|
---|
49 | void errorResource();
|
---|
50 |
|
---|
51 | MRESULT EXPENTRY topCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
52 | MRESULT EXPENTRY rightCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
53 | MRESULT EXPENTRY leftCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
54 | MRESULT EXPENTRY bottomCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
55 | MRESULT EXPENTRY mediaFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
56 | MRESULT EXPENTRY mediaFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
57 |
|
---|
58 |
|
---|
59 | void _Optlink rexxThreadFunc (void *arg);
|
---|
60 |
|
---|
61 | SOMClass* somhlpGetSomClass(char* chrClassName);
|
---|
62 |
|
---|
63 | //void HlpWriteToTrapLog(const char* chrFormat, ...);
|
---|
64 |
|
---|
65 | void writeLog(const char* chrFormat, ...)
|
---|
66 | {
|
---|
67 | char logNameLocal[CCHMAXPATH];
|
---|
68 | FILE *fHandle;
|
---|
69 |
|
---|
70 | sprintf(logNameLocal,"d:\\cwmm.log");
|
---|
71 | fHandle=fopen(logNameLocal,"a");
|
---|
72 | if(fHandle) {
|
---|
73 | va_list arg_ptr;
|
---|
74 | void *tb;
|
---|
75 |
|
---|
76 | va_start (arg_ptr, chrFormat);
|
---|
77 | vfprintf(fHandle, chrFormat, arg_ptr);
|
---|
78 | va_end (arg_ptr);
|
---|
79 | // fprintf(fHandle,logText);
|
---|
80 | fclose(fHandle);
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 | /*****************************************************/
|
---|
85 | /* */
|
---|
86 | /* New container procedure so tabbing to the play */
|
---|
87 | /* control dialog works. */
|
---|
88 | /* */
|
---|
89 | /*****************************************************/
|
---|
90 | MRESULT EXPENTRY m3uFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
91 | {
|
---|
92 | CWMediaFolder* thisPtr;
|
---|
93 | HWND hwndDialog;
|
---|
94 | PFNWP pfnwpContainer;
|
---|
95 |
|
---|
96 | switch(msg)
|
---|
97 | {
|
---|
98 | case WM_CONTROL:
|
---|
99 | if(SHORT2FROMMP(mp1)==CN_DROP) {
|
---|
100 | /* Get frame handle */
|
---|
101 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)
|
---|
102 | {
|
---|
103 | CWM3UFolder *thisPtr;
|
---|
104 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,ulQWP_THISPTR);
|
---|
105 | if(somIsObj(thisPtr))
|
---|
106 | thisPtr->fContentsChanged=TRUE;
|
---|
107 | }
|
---|
108 | }
|
---|
109 | break;
|
---|
110 | default:
|
---|
111 | break;
|
---|
112 | }
|
---|
113 |
|
---|
114 | /* Any other message is handled by the folder container procedure */
|
---|
115 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE) {
|
---|
116 | pfnwpContainer=(PFNWP)WinQueryWindowULong( hwndDialog, ulQWP_CONTAINERPROC);
|
---|
117 | if(pfnwpContainer)
|
---|
118 | return pfnwpContainer(hwnd, msg, mp1, mp2);
|
---|
119 | }
|
---|
120 | #if 0
|
---|
121 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)
|
---|
122 | {
|
---|
123 | if((hwndDialog=WinWindowFromID(hwndDialog,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
124 | {
|
---|
125 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
126 | if(somIsObj(thisPtr))
|
---|
127 | if(thisPtr->pfnwpContainer)
|
---|
128 | return thisPtr->pfnwpContainer(hwnd, msg, mp1, mp2);
|
---|
129 | }
|
---|
130 | }
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
134 | }
|
---|
135 |
|
---|
136 | BOOL CWM3UFolder::cwInsertAllTracks(char* chrM3UFile)
|
---|
137 | {
|
---|
138 | INSERTTRACKPARMS * threadParms;
|
---|
139 | ULONG ulError;
|
---|
140 |
|
---|
141 | if((threadParms=(INSERTTRACKPARMS*)wpAllocMem(sizeof(INSERTTRACKPARMS), &ulError))==NULLHANDLE)
|
---|
142 | return FALSE;
|
---|
143 | threadParms->thisPtr=this;
|
---|
144 | sprintf(threadParms->chrRexxScript,"%s%s", chrInstallDir, RX_INSERT_PLAYLISTTRACKS);
|
---|
145 |
|
---|
146 | _beginthread(rexxThreadFunc,NULL,8192*16,(void*)threadParms); //Fehlerbehandlung fehlt
|
---|
147 | return TRUE;
|
---|
148 | }
|
---|
149 |
|
---|
150 |
|
---|
151 |
|
---|
152 | /****************************************************************************/
|
---|
153 | /* */
|
---|
154 | /* This procedure handles the frame extension of the folder at the top */
|
---|
155 | /* */
|
---|
156 | /* The playcontrol dialog is a child of this 'background' dialog. */
|
---|
157 | /* */
|
---|
158 | /****************************************************************************/
|
---|
159 | MRESULT EXPENTRY m3uTopCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
160 | {
|
---|
161 |
|
---|
162 | switch(msg)
|
---|
163 | {
|
---|
164 | /*****************************************************/
|
---|
165 | /* Init the dialog */
|
---|
166 | /*****************************************************/
|
---|
167 | case WM_INITDLG :
|
---|
168 | {
|
---|
169 | ULONG ulStyle;
|
---|
170 | SWP swp;
|
---|
171 |
|
---|
172 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
173 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
174 | /* Set dialog font to WarpSans for Warp 4 and above */
|
---|
175 | if(SysQueryOSRelease()>=40) {
|
---|
176 | WinSetPresParam(hwnd,
|
---|
177 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
178 | DEFAULT_DIALOG_FONT );
|
---|
179 | }
|
---|
180 | return (MRESULT)FALSE;
|
---|
181 | }
|
---|
182 | case WM_CHAR:
|
---|
183 | // Set focus to container so the key will be processed as usual
|
---|
184 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
|
---|
185 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
186 |
|
---|
187 | /*****************************************************/
|
---|
188 | /* Paint the background. */
|
---|
189 | /*****************************************************/
|
---|
190 | case WM_PAINT:
|
---|
191 | {
|
---|
192 | HPS hps;
|
---|
193 | RECTL rcl, rclSave, rclSource;
|
---|
194 | SWP swp;
|
---|
195 |
|
---|
196 | if(allBMPs[CTRLIDX_BOTTOM].hbm) {
|
---|
197 | POINTL ptl;
|
---|
198 | LONG lTemp;
|
---|
199 |
|
---|
200 | hps=WinBeginPaint(hwnd, NULL, &rcl);
|
---|
201 | rclSource.xLeft=0;
|
---|
202 | rclSource.yBottom=0;
|
---|
203 | rclSource.yTop=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
|
---|
204 | rclSource.xRight=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
|
---|
205 | lTemp=rcl.xLeft/rclSource.xRight;
|
---|
206 | ptl.x=lTemp*rclSource.xRight;
|
---|
207 | lTemp=rcl.yBottom/rclSource.yTop;
|
---|
208 | lTemp*=rclSource.yTop;
|
---|
209 | while(ptl.x<rcl.xRight) {
|
---|
210 | ptl.y=lTemp;
|
---|
211 | while(ptl.y<rcl.yTop) {/* y direction */
|
---|
212 | WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm,
|
---|
213 | &rclSource,
|
---|
214 | (PPOINTL)&ptl,
|
---|
215 | 0, 0,
|
---|
216 | DBM_IMAGEATTRS);
|
---|
217 | ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
|
---|
218 | };
|
---|
219 | ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
|
---|
220 | };
|
---|
221 | WinEndPaint(hps);
|
---|
222 | return (MRESULT)0;
|
---|
223 | }
|
---|
224 | #if 0
|
---|
225 | hps=WinBeginPaint(hwnd, NULLHANDLE,NULL);
|
---|
226 | /* Get Window size */
|
---|
227 | WinQueryWindowRect(hwnd, &rcl);
|
---|
228 | rclSave=rcl;
|
---|
229 | /* Get size and pos of control area */
|
---|
230 | WinQueryWindowPos(WinWindowFromID(hwnd, IDDLG_TOPMIDDLE),&swp);
|
---|
231 | /* Left area */
|
---|
232 | rcl.xRight=swp.x;
|
---|
233 | rclSource.xLeft=0;
|
---|
234 | rclSource.yBottom=0;
|
---|
235 | rclSource.yTop=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cy;
|
---|
236 | rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
|
---|
237 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm,
|
---|
238 | &rclSource,
|
---|
239 | (PPOINTL)&rclSave,
|
---|
240 | 0, 0,
|
---|
241 | DBM_IMAGEATTRS | DBM_STRETCH);
|
---|
242 | //SysWriteToTrapLog("hbm: %x , yTop: %d xRight; %d\n", allBMPs[CTRLIDX_TOPLEFT].hbm, rclSource.yTop,rclSource.xRight);
|
---|
243 | // WinFillRect(hps, &rclSave, CLR_RED);
|
---|
244 | /* Right area */
|
---|
245 | rclSave.xLeft=swp.x+swp.cx;
|
---|
246 | rclSource.xLeft=0;
|
---|
247 | rclSource.yBottom=0;
|
---|
248 | rclSource.yTop=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cy;
|
---|
249 | rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
|
---|
250 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm,
|
---|
251 | &rclSource,
|
---|
252 | (PPOINTL)&rclSave,
|
---|
253 | 0, 0,
|
---|
254 | DBM_IMAGEATTRS | DBM_STRETCH);
|
---|
255 | WinFillRect(hps, &rclSave, CLR_BLUE);
|
---|
256 | WinEndPaint(hps);
|
---|
257 | return (MRESULT) 0;
|
---|
258 | #endif
|
---|
259 | break;
|
---|
260 | }
|
---|
261 | default:
|
---|
262 | break;
|
---|
263 | }
|
---|
264 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
265 | }
|
---|
266 |
|
---|
267 | /************************************************************
|
---|
268 | * *
|
---|
269 | * This frame proc handles the about menuitem of the *
|
---|
270 | * Warp 4 menu bar and removes some menu items. *
|
---|
271 | * *
|
---|
272 | ************************************************************/
|
---|
273 | MRESULT EXPENTRY m3uFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
274 | {
|
---|
275 | CWM3UFolder* thisPtr;
|
---|
276 | HWND hwndDialog;
|
---|
277 | MENUITEM mi;
|
---|
278 | char text[100];
|
---|
279 |
|
---|
280 | switch (msg)
|
---|
281 | {
|
---|
282 | case WM_INITMENU:
|
---|
283 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
284 | {
|
---|
285 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
286 | if(somIsObj(thisPtr)) {
|
---|
287 |
|
---|
288 | HMODULE hResource=queryResModuleHandle();
|
---|
289 | switch(thisPtr->usLastSelMenuItem)
|
---|
290 | {
|
---|
291 | //#ifndef ECS
|
---|
292 | case 0x2d3:/* Help menu */
|
---|
293 | {
|
---|
294 | if(hResource) {
|
---|
295 | /* insert separator */
|
---|
296 | getMessage(text, IDSTR_M3ULISTHELP ,sizeof(text), hResource, hwnd);
|
---|
297 | menuInsertMenuItem(HWNDFROMMP(mp2), NULL, 0, ID_M3ULISTHELP, text);
|
---|
298 | menuInsertMenuSeparator(HWNDFROMMP(mp2), NULL, MIT_END);
|
---|
299 | /* Insert 'About' item */
|
---|
300 | getMessage(text, IDSTR_MENUABOUT ,sizeof(text), hResource, hwnd);
|
---|
301 | menuInsertMenuItem(HWNDFROMMP(mp2), NULL, MIT_END, ID_ABOUTITEM, text);
|
---|
302 | break;
|
---|
303 | }
|
---|
304 | break;
|
---|
305 | }
|
---|
306 | //#endif
|
---|
307 | case 0x2d1: /* View menu */
|
---|
308 | /* Remove change to Tree from menubar menu */
|
---|
309 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
|
---|
310 | /* Icon view */
|
---|
311 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x2cc,TRUE),0);
|
---|
312 | /* Arrange */
|
---|
313 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x135,TRUE),0);
|
---|
314 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x136,TRUE),0);
|
---|
315 | // WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x,TRUE),0);
|
---|
316 |
|
---|
317 | break;
|
---|
318 | case 0x2d0: /* Edit menu */
|
---|
319 | /* Move */
|
---|
320 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x6b,TRUE),0);
|
---|
321 | /* Insert */
|
---|
322 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x2cb,TRUE),0);
|
---|
323 | /* Create shadow */
|
---|
324 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x13c,TRUE),0);
|
---|
325 | /* Create */
|
---|
326 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x65,TRUE),0);
|
---|
327 | break;
|
---|
328 | default:
|
---|
329 | break;
|
---|
330 | }
|
---|
331 | }
|
---|
332 | }
|
---|
333 | break;
|
---|
334 | /* Prevent title changing by XWP */
|
---|
335 | case WM_SETWINDOWPARAMS:
|
---|
336 | {
|
---|
337 | PWNDPARAMS pwp=(PWNDPARAMS)PVOIDFROMMP(mp1);
|
---|
338 | if(!pwp)
|
---|
339 | break;
|
---|
340 | if(pwp->fsStatus!=WPM_TEXT)
|
---|
341 | break;
|
---|
342 |
|
---|
343 | return MRFALSE;
|
---|
344 | }
|
---|
345 | case WM_COMMAND:
|
---|
346 | if(SHORT1FROMMP(mp2)==CMDSRC_MENU) {
|
---|
347 | switch(SHORT1FROMMP(mp1))
|
---|
348 | {
|
---|
349 | case ID_MENUITEMEXIT:
|
---|
350 | WinPostMsg(hwnd, WM_CLOSE, 0, 0);
|
---|
351 | return MRFALSE;
|
---|
352 | case ID_MENUITEMSAVE:
|
---|
353 | {
|
---|
354 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
355 | {
|
---|
356 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
357 | if(somIsObj(thisPtr)) {
|
---|
358 | thisPtr->cwSavePlaylist(NULLHANDLE, FALSE);
|
---|
359 | }
|
---|
360 | }
|
---|
361 | return MRFALSE;
|
---|
362 | }
|
---|
363 | default:
|
---|
364 | if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) {
|
---|
365 | BOOL bHandled=FALSE;
|
---|
366 |
|
---|
367 | TRY_LOUD(AF_MENU) {
|
---|
368 | #if 0
|
---|
369 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
370 | {
|
---|
371 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
372 | if(somIsObj(thisPtr)) {
|
---|
373 |
|
---|
374 | CWMenuFolder * wpFolder;
|
---|
375 | HOBJECT hObject;
|
---|
376 | somId id;
|
---|
377 | somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr;
|
---|
378 | M_WPObject *m_wpObject;
|
---|
379 |
|
---|
380 | if(!bHandled)
|
---|
381 | bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1));
|
---|
382 | }/* if(somIsObj(thisPtr)) */
|
---|
383 | }/* Dialog window */
|
---|
384 | #endif
|
---|
385 | }
|
---|
386 | CATCH(AF_MENU)
|
---|
387 | {
|
---|
388 | } END_CATCH;
|
---|
389 | if(bHandled)
|
---|
390 | return (MRESULT) 0;
|
---|
391 | }
|
---|
392 | break;
|
---|
393 | }/* switch() */
|
---|
394 | }
|
---|
395 | break;
|
---|
396 | case WM_MENUSELECT:
|
---|
397 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
398 | {
|
---|
399 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
400 | if(somIsObj(thisPtr)) {
|
---|
401 | thisPtr->usLastSelMenuItem=SHORT1FROMMP(mp1);
|
---|
402 | }
|
---|
403 | }
|
---|
404 | break;
|
---|
405 | case WM_CONTROL:
|
---|
406 | if(SHORT2FROMMP(mp1)==CN_DROP) {
|
---|
407 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
408 | {
|
---|
409 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
410 | if(somIsObj(thisPtr)) {
|
---|
411 | thisPtr->fContentsChanged=TRUE;
|
---|
412 | }
|
---|
413 | }
|
---|
414 | }
|
---|
415 | break;
|
---|
416 | default:
|
---|
417 | break;
|
---|
418 | }
|
---|
419 | /* Any other message is handled by the folder frame procedure */
|
---|
420 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
421 | {
|
---|
422 | thisPtr=(CWM3UFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
423 | if(somIsObj(thisPtr)) {
|
---|
424 | if(thisPtr->pfnwpFrame)
|
---|
425 | return thisPtr->pfnwpFrame(hwnd, msg, mp1, mp2);
|
---|
426 | }
|
---|
427 | }
|
---|
428 | return pfnwpGenericFrame(hwnd, msg, mp1, mp2);
|
---|
429 | }
|
---|
430 |
|
---|
431 |
|
---|
432 | HWND CWM3UFolder::wpOpen(HWND hwndCnr,ULONG ulView,ULONG ulParam)
|
---|
433 | {
|
---|
434 | HWND hwnd;
|
---|
435 | HMODULE hResource=queryResModuleHandle();
|
---|
436 | SIZEL sizel={0};
|
---|
437 | HWND myFrameCtrlHWND;
|
---|
438 | RECTL rectl;
|
---|
439 | MENUITEM mi={0};
|
---|
440 | HWND hwndMenu;
|
---|
441 | int iItemCount=0;
|
---|
442 | char text[200];
|
---|
443 | SWP swp;
|
---|
444 |
|
---|
445 | /* Reregister wpFolder window class on first opening */
|
---|
446 | /* We need this private code to have some private
|
---|
447 | window words */
|
---|
448 | if(!g_fRegisteredWindowClass)
|
---|
449 | {
|
---|
450 | CLASSINFO ci;
|
---|
451 |
|
---|
452 | if(WinQueryClassInfo(WinQueryAnchorBlock(HWND_DESKTOP),
|
---|
453 | (PSZ)"wpFolder window",
|
---|
454 | &ci))
|
---|
455 | {
|
---|
456 | g_ulFrameDataOffset=ci.cbWindowData;
|
---|
457 | //g_pfnwpOrgFrameProc=ci.pfnWindowProc;
|
---|
458 | if (WinRegisterClass(WinQueryAnchorBlock(HWND_DESKTOP),
|
---|
459 | (PSZ)"wpFolder window",
|
---|
460 | ci.pfnWindowProc,
|
---|
461 | ci.flClassStyle,
|
---|
462 | ci.cbWindowData + MFLDR_WINDOWBYTES))
|
---|
463 | {
|
---|
464 | /* */
|
---|
465 | ulQWP_CONTAINERPROC+=g_ulFrameDataOffset;
|
---|
466 | ulQWP_THISPTR+=g_ulFrameDataOffset;
|
---|
467 | ulQWL_TOPCTRLHWND+=g_ulFrameDataOffset;
|
---|
468 | ulQWL_BOTTOMCTRLHWND+=g_ulFrameDataOffset;
|
---|
469 | ulQWL_LEFTCTRLHWND+=g_ulFrameDataOffset;
|
---|
470 | ulQWL_RIGHTCTRLHWND+=g_ulFrameDataOffset;
|
---|
471 | g_fRegisteredWindowClass=TRUE;
|
---|
472 | }
|
---|
473 | }
|
---|
474 | }
|
---|
475 |
|
---|
476 | /* Skip media folder. Because of this skip we had to register the window words here (see above).
|
---|
477 | It's not asured a Mediafolder was already opended. Normaly the window words are added in
|
---|
478 | wpOpen() of the Mediafolder.
|
---|
479 | FIXME: This only works if CWProgFolder->CWMediaFolder->CWM3UFolder is the class hierarchy */
|
---|
480 | hwnd=CWProgFolder::wpOpen(hwndCnr, ulView, ulParam);
|
---|
481 |
|
---|
482 | /* Only subclass folder frames, not settings notebooks */
|
---|
483 | if(ulView!=OPEN_SETTINGS){
|
---|
484 | if(!hResource) {
|
---|
485 | errorResource();
|
---|
486 | return hwnd;
|
---|
487 | }
|
---|
488 |
|
---|
489 | TRY_LOUD(M3UFLDR_OPEN) {
|
---|
490 | THREADPARAMS* pTp;
|
---|
491 | ULONG ulErr;
|
---|
492 |
|
---|
493 | if (somIsObj(wpObjM3UFile)) {
|
---|
494 | /* Remove the title added by XWP */
|
---|
495 | WinSetWindowText(hwnd, wpObjM3UFile->wpQueryTitle());
|
---|
496 | }
|
---|
497 | if(!getMessage(text, IDSTR_PLAYLISTVIEWTITLE, sizeof(text), queryResModuleHandle(), HWND_DESKTOP))
|
---|
498 | sprintf(text, "Playlist Editor");
|
---|
499 | /* Set view title. By doing this the frame title isn't 'Details' anymore */
|
---|
500 | wpRegisterView(hwnd, text);
|
---|
501 |
|
---|
502 | if(!(ulFlags & FLAG_ALREADYSIZED)) {
|
---|
503 | /* Make sure on first open the container is visible */
|
---|
504 | SWP swp;
|
---|
505 | WinQueryWindowPos(hwnd, &swp);
|
---|
506 | WinSetWindowPos(hwnd, NULLHANDLE, swp.x, swp.y-100, swp.cx, swp.cy+100, SWP_SIZE|SWP_MOVE);
|
---|
507 | ulFlags|=FLAG_ALREADYSIZED;
|
---|
508 | }
|
---|
509 |
|
---|
510 | /* Build new menu entries. */
|
---|
511 | myFrameCtrlHWND=WinWindowFromID(hwnd,FID_MENU);//Get menu hwnd
|
---|
512 | if(WinIsWindow(WinQueryAnchorBlock(hwnd), myFrameCtrlHWND)) {
|
---|
513 | /* Menu bar found */
|
---|
514 |
|
---|
515 | /* Remove folder item from menubar menu */
|
---|
516 | WinSendMsg( myFrameCtrlHWND, MM_REMOVEITEM, MPFROM2SHORT(0x2cf,TRUE),0);
|
---|
517 |
|
---|
518 | /* Insert file menu for the folder */
|
---|
519 | hwndMenu=WinLoadMenu(myFrameCtrlHWND, hResource, ID_MENUFILE);
|
---|
520 | /* Fill the MENUITEM structure */
|
---|
521 | mi.iPosition=0;
|
---|
522 | mi.afStyle=MIS_TEXT|MIS_SUBMENU;
|
---|
523 | mi.id=ID_MENUFILE;
|
---|
524 | mi.afAttribute=NULL;
|
---|
525 | mi.hwndSubMenu=hwndMenu;
|
---|
526 | mi.hItem=NULL;
|
---|
527 | /* Add the item to the folder menubar */
|
---|
528 | /* Text: "~File" */
|
---|
529 | getMessage(text, IDSTR_MENUFILE,sizeof(text), hResource, hwnd);
|
---|
530 | WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
|
---|
531 | (MPARAM)text);
|
---|
532 |
|
---|
533 | /* Insert skript and user menu item if necessary */
|
---|
534 | if(WinSendMsg(myFrameCtrlHWND,MM_QUERYITEM,MPFROM2SHORT(ID_MBMENUSKRIPTS,FALSE),MPFROMP(&mi))) {
|
---|
535 | /* Script menu is inserted so WPS-Wizard is installed */
|
---|
536 | hwndMenu=mi.hwndSubMenu;
|
---|
537 | if(hwndMenu){
|
---|
538 | /* The class specific skript menu is inserted in class CWFolder */
|
---|
539 | /* Query the number of items in the menubar */
|
---|
540 | iItemCount=(int)WinSendMsg(hwndMenu,MM_QUERYITEMCOUNT,(MPARAM)0,
|
---|
541 | (MPARAM)0);
|
---|
542 | if(iItemCount)
|
---|
543 | cwInsertUserMenuItems(hwndMenu, USERMENUFOLDER_M3UFOLDER, FIRSTUSERITEM, TRUE);
|
---|
544 | else
|
---|
545 | cwInsertUserMenuItems(hwndMenu, USERMENUFOLDER_M3UFOLDER, FIRSTUSERITEM, FALSE);
|
---|
546 | }
|
---|
547 | }
|
---|
548 | #if 0
|
---|
549 | else {
|
---|
550 | /* Load the user menu from the resource if WPS-Wizard is not installed. If installed the menu item
|
---|
551 | is added by WPS-Wizzard. */
|
---|
552 | hwndMenu=WinLoadMenu(myFrameCtrlHWND,hResource, ID_MBMENUSKRIPTS);
|
---|
553 | if(hwndMenu){
|
---|
554 | /* Query the number of items in the menu */
|
---|
555 | iItemCount=(int)WinSendMsg(hwndMenu,MM_QUERYITEMCOUNT,(MPARAM)0,
|
---|
556 | (MPARAM)0);
|
---|
557 |
|
---|
558 | if(iItemCount)
|
---|
559 | cwInsertUserMenuItems(hwndMenu, USERMENUFOLDER_M3UFOLDER, FIRSTUSERITEM, TRUE);
|
---|
560 | else
|
---|
561 | cwInsertUserMenuItems(hwndMenu, USERMENUFOLDER_M3UFOLDER, FIRSTUSERITEM, FALSE);
|
---|
562 |
|
---|
563 | /* Query the number of items in the menubar */
|
---|
564 | iItemCount=(int)WinSendMsg(myFrameCtrlHWND,MM_QUERYITEMCOUNT,(MPARAM)0,
|
---|
565 | (MPARAM)0);
|
---|
566 |
|
---|
567 | /* Fill the MENUITEM structure */
|
---|
568 | mi.iPosition=iItemCount-1;
|
---|
569 | mi.afStyle=MIS_TEXT|MIS_SUBMENU;
|
---|
570 | mi.id=ID_MBMENUSKRIPTS;
|
---|
571 | mi.afAttribute=NULL;
|
---|
572 | mi.hwndSubMenu=hwndMenu;
|
---|
573 | mi.hItem=NULL;
|
---|
574 | /* Add the Misc-tools item to the folder menubar */
|
---|
575 | /* Text: "Skripts and tools" */
|
---|
576 | getMessage(text, IDSTR_MENUSKRIPTS,sizeof(text), hResource, hwnd);
|
---|
577 | WinSendMsg(myFrameCtrlHWND,MM_INSERTITEM,MPFROMP(&mi),
|
---|
578 | (MPARAM)text);
|
---|
579 | }/* end of if(hwndMenu) */
|
---|
580 | }
|
---|
581 | #endif
|
---|
582 | }
|
---|
583 |
|
---|
584 | /* Now add the framecontrols */
|
---|
585 |
|
---|
586 | /* This is the Top-frameCtrl. */
|
---|
587 | /* Load the dialog from the resource. The object pointer of this
|
---|
588 | folder is given to the dialog procedure (this). In WM_INITDLG
|
---|
589 | the procedure saves this pointer for later use. */
|
---|
590 | myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd, m3uTopCtrlDialogProc,hResource,IDDLG_TOPFRAME ,this);
|
---|
591 | /* Save the HWND in the instance data */
|
---|
592 | // hwndTop=myFrameCtrlHWND;
|
---|
593 | /* Save the HWND in the Window words */
|
---|
594 | WinSetWindowULong( hwnd, ulQWL_TOPCTRLHWND, myFrameCtrlHWND);
|
---|
595 |
|
---|
596 | if(myFrameCtrlHWND){
|
---|
597 | /* Query the size of the dialog */
|
---|
598 | WinQueryWindowRect(myFrameCtrlHWND,&rectl);
|
---|
599 | /* It's the top dialog so we need the height but not the width. The width
|
---|
600 | is always the width of the folder. */
|
---|
601 | // sizel.cy=rectl.yTop-rectl.yBottom;
|
---|
602 | sizel.cy=12;
|
---|
603 | /* Call a method of CWProgFolder to add the dialog as a framecontrol.
|
---|
604 | FCTL_TOP means put it at the top of the folder.
|
---|
605 | After calling cwUpdateFrame(hwnd) it will be visible */
|
---|
606 | cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_TOP,0);
|
---|
607 | }
|
---|
608 |
|
---|
609 | /* Load the dialog from the resource. The object pointer of this
|
---|
610 | folder is given to the dialog procedure (this). In WM_INITDLG
|
---|
611 | the procedure saves this pointer for later use. */
|
---|
612 | myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,leftCtrlDialogProc,hResource,IDDLG_LEFTFRAME ,this);
|
---|
613 | /* Save the HWND in the instance data */
|
---|
614 | // hwndLeft=myFrameCtrlHWND;
|
---|
615 | /* Save the HWND in the Window words */
|
---|
616 | WinSetWindowULong( hwnd, ulQWL_LEFTCTRLHWND, myFrameCtrlHWND);
|
---|
617 |
|
---|
618 |
|
---|
619 | if(myFrameCtrlHWND){
|
---|
620 | /* Query the size of the dialog */
|
---|
621 | WinQueryWindowRect(myFrameCtrlHWND, &rectl);
|
---|
622 | /* It's the right dialog so we need the width but not the height. */
|
---|
623 | sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;//rectl.xRight-rectl.xLeft;
|
---|
624 | // sizel.cx=rectl.xRight-rectl.xLeft;
|
---|
625 | /* Call a method of CWProgFolder to add the dialog as a framecontrol.
|
---|
626 | FCTL_RIGHT means put it at the RIGHT of the folder.
|
---|
627 | After calling cwUpdateFrame(hwnd) it will be visible */
|
---|
628 | cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_LEFT, FCTL_POSABOVE|FCTL_POSBELOW);
|
---|
629 | }
|
---|
630 |
|
---|
631 | /* Load the dialog from the resource. The object pointer of this
|
---|
632 | folder is given to the dialog procedure (this). In WM_INITDLG
|
---|
633 | the procedure saves this pointer for later use. */
|
---|
634 | myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,rightCtrlDialogProc,hResource,IDDLG_FRAMERIGHT ,this);
|
---|
635 | /* Save the HWND in the instance data */
|
---|
636 | // hwndRight=myFrameCtrlHWND;
|
---|
637 | /* Save the HWND in the Window words */
|
---|
638 | WinSetWindowULong( hwnd, ulQWL_RIGHTCTRLHWND, myFrameCtrlHWND);
|
---|
639 |
|
---|
640 | if(myFrameCtrlHWND){
|
---|
641 | CNRINFO cnrInfo;
|
---|
642 | HWND hwndContainer;
|
---|
643 | PVIEWITEM pView;
|
---|
644 |
|
---|
645 | /* Query the size of the dialog */
|
---|
646 | WinQueryWindowRect(myFrameCtrlHWND, &rectl);
|
---|
647 | /* It's the right dialog so we need the width but not the height. */
|
---|
648 | sizel.cx=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx-1-7-2;// rectl.xRight-rectl.xLeft;
|
---|
649 | /* Call a method of CWProgFolder to add the dialog as a framecontrol.
|
---|
650 | FCTL_RIGHT means put it at the RIGHT of the folder.
|
---|
651 | After calling cwUpdateFrame(hwnd) it will be visible */
|
---|
652 | cwAddFrameCtl(hwnd, myFrameCtrlHWND, sizel, FCTL_RIGHT, FCTL_POSABOVE|FCTL_POSBELOW);
|
---|
653 |
|
---|
654 | // hwndContainer=WinWindowFromID(myFrameCtrlHWND, IDCNR_PLAYLIST);
|
---|
655 | // WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),
|
---|
656 | // MPFROMLONG(sizeof(cnrInfo)));
|
---|
657 | }/* if(hwndRight) */
|
---|
658 |
|
---|
659 | /* Load the dialog from the resource. The object pointer of this
|
---|
660 | folder is given to the dialog procedure (this). In WM_INITDLG
|
---|
661 | the procedure saves this pointer for later use. */
|
---|
662 | myFrameCtrlHWND=WinLoadDlg(hwnd,hwnd,bottomCtrlDialogProc,hResource,IDDLG_BOTTOMFRAME ,this);
|
---|
663 | /* Save the HWND in the instance data */
|
---|
664 | hwndBottom=myFrameCtrlHWND;
|
---|
665 | /* Save the HWND in the Window words */
|
---|
666 | WinSetWindowULong( hwnd, ulQWL_BOTTOMCTRLHWND, myFrameCtrlHWND);
|
---|
667 |
|
---|
668 | if(hwndBottom){
|
---|
669 | /* Query the size of the dialog */
|
---|
670 | WinQueryWindowRect(hwndBottom,&rectl);
|
---|
671 | //sizel.cy=20;
|
---|
672 | sizel.cy=rectl.yTop-rectl.yBottom-2;
|
---|
673 | // sizel.cy=allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy;
|
---|
674 | /* Call a method of CWProgFolder to add the dialog as a framecontrol.
|
---|
675 | FCTL_TOP means put it at the top of the folder.
|
---|
676 | After calling cwUpdateFrame(hwnd) it will be visible */
|
---|
677 | cwAddFrameCtl(hwnd, hwndBottom, sizel, FCTL_BOTTOM,0);
|
---|
678 | }
|
---|
679 |
|
---|
680 | /* Refresh frame to show the new framecontrols */
|
---|
681 | cwUpdateFrame(hwnd);
|
---|
682 |
|
---|
683 | /* Subclass frame */
|
---|
684 | pfnwpFrame=WinSubclassWindow(hwnd, m3uFrameProc);
|
---|
685 | pfnwpGenericFrame=pfnwpFrame;
|
---|
686 |
|
---|
687 | /* Subclass container */
|
---|
688 | myFrameCtrlHWND=WinWindowFromID(hwnd,FID_CLIENT);//Get container hwnd
|
---|
689 | if(myFrameCtrlHWND){
|
---|
690 | PFNWP pfnwpContainer;
|
---|
691 | pfnwpContainer=WinSubclassWindow(myFrameCtrlHWND, m3uFldrContainerProc);
|
---|
692 | /* Save container proc in frame window words */
|
---|
693 | WinSetWindowULong( hwnd, ulQWP_CONTAINERPROC, (ULONG)pfnwpContainer);
|
---|
694 | }
|
---|
695 | cwInsertAllTracks(NULLHANDLE);
|
---|
696 | }
|
---|
697 | CATCH(M3UFLDR_OPEN)
|
---|
698 | {
|
---|
699 | SysWriteToTrapLog("\nTrap occured in %s, file: %s above line %d.\n",
|
---|
700 | __FUNCTION__, __FILE__, __LINE__);
|
---|
701 |
|
---|
702 | } END_CATCH;
|
---|
703 |
|
---|
704 | /* Make sure on open the container is visible */
|
---|
705 | WinQueryWindowPos(hwnd, &swp);
|
---|
706 | WinSetWindowPos(hwnd, NULLHANDLE, swp.x, swp.y-200, swp.cx, swp.cy+200, SWP_SIZE|SWP_MOVE);
|
---|
707 | }
|
---|
708 |
|
---|
709 | return hwnd;
|
---|
710 | }
|
---|
711 |
|
---|
712 | BOOL CWM3UFolder::wpDeleteFromContent(WPObject* Object)
|
---|
713 | {
|
---|
714 | fContentsChanged=TRUE;
|
---|
715 | return CWMediaFolder::wpDeleteFromContent(Object);
|
---|
716 | }
|
---|
717 |
|
---|
718 | void _Optlink saveThreadFunc (void *arg)
|
---|
719 | {
|
---|
720 | HAB hab;
|
---|
721 | HMQ hmq;
|
---|
722 | QMSG qmsg;
|
---|
723 | CWM3UFolder *thisPtr;
|
---|
724 | HWND hwnd;
|
---|
725 | char chrFileName[CCHMAXPATH];
|
---|
726 | ULONG ulSize;
|
---|
727 | M3UTHREADPARMS *parms=(M3UTHREADPARMS*)arg;
|
---|
728 |
|
---|
729 | writeLog("Thread");
|
---|
730 | if(!parms) {
|
---|
731 | writeLog("!parms");
|
---|
732 | return;
|
---|
733 | }
|
---|
734 |
|
---|
735 | thisPtr=(CWM3UFolder*)parms->thisPtr;
|
---|
736 | if(!somIsObj(thisPtr)) {
|
---|
737 | writeLog("!thisPtr");
|
---|
738 | return;
|
---|
739 | }
|
---|
740 |
|
---|
741 | if(!somIsObj(thisPtr->wpObjM3UFile)){
|
---|
742 | writeLog("!thisPtr->wpObjM3UFile");
|
---|
743 | return;
|
---|
744 | }
|
---|
745 |
|
---|
746 | ulSize=sizeof(chrFileName);
|
---|
747 | if(!((WPFileSystem*)thisPtr->wpObjM3UFile)->wpQueryRealName(chrFileName, &ulSize, TRUE)) {
|
---|
748 | writeLog("!chrFileName");
|
---|
749 | return;
|
---|
750 | }
|
---|
751 | writeLog("chrFileName %s", chrFileName);
|
---|
752 | hab=WinInitialize(0);
|
---|
753 | if(hab) {
|
---|
754 | hmq=WinCreateMsgQueue(hab,0);
|
---|
755 | if(hmq) {
|
---|
756 | FILE* fStream;
|
---|
757 |
|
---|
758 | if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), parms->hwndCnr))
|
---|
759 | {
|
---|
760 | /* Container handle is valid */
|
---|
761 | if((fStream=fopen(chrFileName, "w"))!=NULLHANDLE) /* Open the playlist file */
|
---|
762 | {
|
---|
763 | HWND hwndContainer=parms->hwndCnr;
|
---|
764 |
|
---|
765 | for(;;)
|
---|
766 | {
|
---|
767 | PMINIRECORDCORE mrc;
|
---|
768 | WPObject * contentObject;
|
---|
769 | /* Get first container item of our folder */
|
---|
770 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORD, MPFROMSHORT(CMA_FIRST),
|
---|
771 | MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER));
|
---|
772 | if(!mrc || (int)mrc==-1) {
|
---|
773 | writeLog("No mrc");
|
---|
774 | #ifdef _PMPRINTF_
|
---|
775 | Pmpf(("No mrc"));
|
---|
776 | #endif
|
---|
777 | break;
|
---|
778 | }
|
---|
779 |
|
---|
780 | do {
|
---|
781 | contentObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
|
---|
782 | if(somIsObj(contentObject)) {
|
---|
783 | /* Get file system object or NULL */
|
---|
784 | if((contentObject=thisPtr->cwGetFileSystemObject(contentObject))==NULLHANDLE) {
|
---|
785 | /* Try next object */
|
---|
786 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORD, mrc,
|
---|
787 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
788 | continue;
|
---|
789 | }
|
---|
790 | }
|
---|
791 | else {
|
---|
792 | writeLog("No contentobj");
|
---|
793 | #ifdef _PMPRINTF_
|
---|
794 | Pmpf(("No contentobj"));
|
---|
795 | #endif
|
---|
796 | break;/* Error */
|
---|
797 | }
|
---|
798 |
|
---|
799 | /* Get the name of the audio file */
|
---|
800 | ulSize=sizeof(chrFileName);
|
---|
801 | ((WPFileSystem*)contentObject)->wpQueryRealName(chrFileName,&ulSize,TRUE);
|
---|
802 | /* Try next object */
|
---|
803 | writeLog("chrFileName %s", chrFileName);
|
---|
804 | #ifdef _PMPRINTF_
|
---|
805 | Pmpf(("chrFileName %s", chrFileName));
|
---|
806 | #endif
|
---|
807 | fputs(chrFileName,fStream);
|
---|
808 | fputs("\n",fStream);
|
---|
809 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORD, mrc,
|
---|
810 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
811 | }while(mrc && (int)mrc!=-1);
|
---|
812 | break;
|
---|
813 | }/* for() */
|
---|
814 | }/* fopen() */
|
---|
815 | fclose(fStream);
|
---|
816 | }
|
---|
817 | WinDestroyMsgQueue(hmq);
|
---|
818 | }
|
---|
819 | WinTerminate(hab);
|
---|
820 | }
|
---|
821 | /* Mark as saved */
|
---|
822 | thisPtr->fContentsChanged=FALSE;
|
---|
823 | if(!parms->fSaveOnly) {
|
---|
824 | writeLog("Not Saveonly");
|
---|
825 | #ifdef _PMPRINTF_
|
---|
826 | Pmpf(("Not Saveonly "));
|
---|
827 | #endif
|
---|
828 | /* Close and destroy the folder if requested */
|
---|
829 | WinPostMsg(parms->hwndFrame, WM_CLOSE, 0, 0);
|
---|
830 | if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), thisPtr->hwndObject))
|
---|
831 | WinPostMsg(thisPtr->hwndObject, WM_APPTERMINATENOTIFY, 0, 0);
|
---|
832 | }
|
---|
833 | thisPtr->wpFreeMem((PBYTE)parms);
|
---|
834 | }
|
---|
835 |
|
---|
836 | BOOL CWM3UFolder::cwSavePlaylist(char* chrM3UFile, BOOL fClose)
|
---|
837 | {
|
---|
838 | M3UTHREADPARMS* parms;
|
---|
839 | ULONG ulError;
|
---|
840 |
|
---|
841 | if((parms=(M3UTHREADPARMS*)wpAllocMem(sizeof(M3UTHREADPARMS),&ulError))!=NULLHANDLE)
|
---|
842 | {
|
---|
843 | HWND hwnd;
|
---|
844 |
|
---|
845 | memset(parms,0, sizeof(M3UTHREADPARMS));
|
---|
846 | parms->thisPtr=this;
|
---|
847 | if((hwnd=WinQueryWindow(hwndBottom,QW_PARENT))!=NULLHANDLE)
|
---|
848 | {
|
---|
849 | parms->hwndFrame=hwnd;
|
---|
850 | parms->hwndCnr=WinWindowFromID(hwnd, FID_CLIENT);
|
---|
851 | }
|
---|
852 | if(fClose)
|
---|
853 | fClosing=TRUE;
|
---|
854 | else
|
---|
855 | parms->fSaveOnly=TRUE;
|
---|
856 |
|
---|
857 | _beginthread(saveThreadFunc,NULL,8192*16,(void*)parms); //Fehlerbehandlung fehlt
|
---|
858 | }
|
---|
859 | else {
|
---|
860 | /* FIXME: Error handling!*/
|
---|
861 | }
|
---|
862 | return TRUE;
|
---|
863 | }
|
---|
864 |
|
---|
865 | BOOL CWM3UFolder::cwClose(HWND hwndFrame)
|
---|
866 | {
|
---|
867 | SWP swp;
|
---|
868 |
|
---|
869 | if(fClosing)
|
---|
870 | return TRUE;
|
---|
871 |
|
---|
872 | if(fContentsChanged)
|
---|
873 | {
|
---|
874 | char text[200];
|
---|
875 | char title[50];
|
---|
876 | ULONG ulRc;
|
---|
877 | if((ulRc=messageBox( text, IDSTR_M3UCLOSETEXT, sizeof(text),
|
---|
878 | title, IDSTR_CLOSETITLE, sizeof(title),
|
---|
879 | queryResModuleHandle(),
|
---|
880 | HWND_DESKTOP,
|
---|
881 | MB_YESNOCANCEL|MB_MOVEABLE|MB_ICONQUESTION))==MBID_CANCEL)
|
---|
882 | return FALSE;
|
---|
883 | if(ulRc==MBID_YES) {
|
---|
884 | cwSavePlaylist(NULLHANDLE, TRUE);
|
---|
885 | return FALSE;
|
---|
886 | }
|
---|
887 | }
|
---|
888 | fClosing=TRUE;
|
---|
889 |
|
---|
890 | if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), hwndObject)) {
|
---|
891 | WinPostMsg(hwndObject, WM_APPTERMINATENOTIFY, 0, 0);
|
---|
892 | }
|
---|
893 | return TRUE;
|
---|
894 | }
|
---|
895 |
|
---|
896 | ULONG CWM3UFolder::wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect)
|
---|
897 | {
|
---|
898 |
|
---|
899 | return CTXT_HELP|CTXT_SORT|CTXT_SETTINGS|CTXT_REFRESH|CTXT_FIND;
|
---|
900 | #if 0
|
---|
901 | return CWMediaFolder::wpFilterPopupMenu(ulFlags, hwndCnr, fMultiSelect)&
|
---|
902 | ~(CTXT_COPY|CTXT_ICON|CTXT_CHANGETOICON|CTXT_CHANGETOTREE|CTXT_CHANGETODETAILS);
|
---|
903 | #endif
|
---|
904 | }
|
---|
905 |
|
---|
906 | BOOL CWM3UFolder::wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, ULONG ulPosition)
|
---|
907 | {
|
---|
908 | WinSendMsg( hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(0x2ca, TRUE),0);
|
---|
909 | return TRUE;
|
---|
910 | }
|
---|
911 |
|
---|
912 |
|
---|
913 |
|
---|
914 |
|
---|
915 |
|
---|
916 |
|
---|
917 |
|
---|
918 |
|
---|