1 | /*
|
---|
2 | * This file is (C) Chris Wohlgemuth 2002
|
---|
3 | */
|
---|
4 | /*
|
---|
5 | * This program is free software; you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation; either version 2, or (at your option)
|
---|
8 | * any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program; see the file COPYING. If not, write to
|
---|
17 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #define INCL_DOS
|
---|
21 | #define INCL_WIN
|
---|
22 | #define INCL_GPIBITMAPS
|
---|
23 | #include <os2.h>
|
---|
24 |
|
---|
25 | #define INCL_MCIOS2
|
---|
26 | #include <os2me.h>
|
---|
27 | #include "except.h"
|
---|
28 | #include "mediafolderinc.h"
|
---|
29 |
|
---|
30 |
|
---|
31 | #define MAIN_BMP_IDX 0
|
---|
32 | #define CTRLIDX_POSSLIDER 1
|
---|
33 | #define CTRLIDX_POSSLIDERARM 2
|
---|
34 | #define CTRLIDX_VOLSLIDER 3
|
---|
35 | #define CTRLIDX_VOLSLIDERARM 4
|
---|
36 | #define CTRLIDX_VOLSLIDERARMSEL 5
|
---|
37 | #define CTRLIDX_PLAYTIME 6
|
---|
38 | #define CTRLIDX_TOPLEFT 7
|
---|
39 | #define CTRLIDX_TOPRIGHT 8
|
---|
40 | #define CTRLIDX_PLAYBUTTON 9
|
---|
41 | #define CTRLIDX_PLAYBUTTONSEL 10
|
---|
42 | #define CTRLIDX_STOPBUTTON 11
|
---|
43 | #define CTRLIDX_STOPBUTTONSEL 12
|
---|
44 | #define CTRLIDX_PAUSEBUTTON 13
|
---|
45 | #define CTRLIDX_PAUSEBUTTONSEL 14
|
---|
46 | #define CTRLIDX_SKIPBACKBUTTON 15
|
---|
47 | #define CTRLIDX_SKIPBACKBUTTONSEL 16
|
---|
48 | #define CTRLIDX_SKIPFWDBUTTON 17
|
---|
49 | #define CTRLIDX_SKIPFWDBUTTONSEL 18
|
---|
50 | #define CTRLIDX_BOTTOM 19
|
---|
51 | #define CTRLIDX_CHECK 20
|
---|
52 | #define CTRLIDX_UNCHECK 21
|
---|
53 | #define CTRLIDX_CHECKSEL 22
|
---|
54 | #define CTRLIDX_UNCHECKSEL 23
|
---|
55 |
|
---|
56 | #define CTRLIDX_RANDOMCHECK 24
|
---|
57 | #define CTRLIDX_RANDOMUNCHECK 25
|
---|
58 | #define CTRLIDX_RANDOMCHECKSEL 26
|
---|
59 | #define CTRLIDX_RANDOMUNCHECKSEL 27
|
---|
60 |
|
---|
61 | #define NUM_CTRL_IDX 28
|
---|
62 |
|
---|
63 |
|
---|
64 | #define SHOWABOUTDIALOG_COMMAND "SHOWABOUTDIALOG=1"
|
---|
65 | #define SETUP_SHOWABOUTDIALOG "SHOWABOUTDIALOG"
|
---|
66 |
|
---|
67 | /*** Private folder flags: ***/
|
---|
68 |
|
---|
69 | /* Flag indicating from where a method was called */
|
---|
70 | #define MFLDR_CURACTION_ADDFOLDERVIEW3 0x00000001
|
---|
71 | /* Flag telling if folder is in compact view */
|
---|
72 | #define MFLDR_VIEW_COMPACT 0x00000002
|
---|
73 | /* The view is currently changing */
|
---|
74 | #define MFLDR_CHANGING_VIEW 0x00000004
|
---|
75 | /*** End of private folder flags ***/
|
---|
76 |
|
---|
77 | #define IDHLP_MEDIAFOLDERMAIN 100
|
---|
78 |
|
---|
79 |
|
---|
80 | #pragma SOMAsDefault(on)
|
---|
81 | #include <som.hh>
|
---|
82 | #include <somcls.hh>
|
---|
83 | #pragma SOMNoMangling(on)
|
---|
84 | /*#include "progfolder.h"*/
|
---|
85 | #include "progfolder.hh"
|
---|
86 | #include "cwaudio.hh"
|
---|
87 |
|
---|
88 | /* Forward declaration */
|
---|
89 | class CWMediaFolder;
|
---|
90 |
|
---|
91 | #pragma SOMAsDefault(off)
|
---|
92 | #pragma SOMNonDTS(on)
|
---|
93 |
|
---|
94 | typedef struct _MYVIEWITEM
|
---|
95 | {
|
---|
96 | BOOL bIsInUseList;
|
---|
97 | USEITEM useItem;
|
---|
98 | VIEWITEM viewItem;
|
---|
99 | }MYVIEWITEM;
|
---|
100 |
|
---|
101 | typedef struct
|
---|
102 | {
|
---|
103 | INT id;
|
---|
104 | RECTL rclSource;
|
---|
105 | HBITMAP hbmSource;
|
---|
106 | RECTL rclDest;
|
---|
107 | }CONTROLINFO;
|
---|
108 |
|
---|
109 | typedef struct
|
---|
110 | {
|
---|
111 | BITMAPINFOHEADER bmpInfoHdr;
|
---|
112 | HBITMAP hbm;
|
---|
113 | }LOADEDBITMAP;
|
---|
114 |
|
---|
115 |
|
---|
116 | /* The following is used for openThreadFunc(void *arg) when openeing a media folder and
|
---|
117 | for storing information when calling cwPlayAudioFile() etc. from the player panel dialog of the folder. */
|
---|
118 | typedef struct _THREADPARAMS
|
---|
119 | {
|
---|
120 | CWMediaFolder *thisPtr;
|
---|
121 | HWND hwndFrame;
|
---|
122 | }THREADPARAMS;
|
---|
123 |
|
---|
124 | /* This struct is used in the CWInsertTrack method to specify the REXX script
|
---|
125 | to be started */
|
---|
126 | typedef struct _INSERTTRACKPARMS
|
---|
127 | {
|
---|
128 | WPObject* thisPtr;
|
---|
129 | char chrRexxScript[CCHMAXPATH];
|
---|
130 | }INSERTTRACKPARMS;
|
---|
131 |
|
---|
132 | typedef struct _MEDIAFLDRDATA
|
---|
133 | {
|
---|
134 | ULONG ulTotalTime; /* Playtime of all folder tracks in secs */
|
---|
135 | char chrPlayTimeFont[50];/* Fontnamelength is 31 chars. Some space for the pointsize added and some to be save.
|
---|
136 | Yeah, I know I'm lazy... */
|
---|
137 | BOOL bProcessing; /* Set to TRUE if a thread is running. this is checked in the container proc and the wait ptr. is set. */
|
---|
138 | ULONG ulNumTracks;
|
---|
139 | ULONG ulSize;
|
---|
140 | BOOL bOpened;
|
---|
141 | BYTE *pRandomArray; /* This array holds the already random played tracks. When played the index is set to '1'. */
|
---|
142 | int iNumPlayed; /* # of random played tracks */
|
---|
143 | int iNumToPlay;
|
---|
144 | HWND hwndPlayObject;/* Object window which handles the play commands so the WPS is not blocked. */
|
---|
145 | }MEDIAFLDRDATA;
|
---|
146 | typedef MEDIAFLDRDATA* PMEDIAFLDRDATA;
|
---|
147 |
|
---|
148 | typedef struct _DROPTHREADPARAMS
|
---|
149 | {
|
---|
150 | CWMediaFolder *thisPtr;
|
---|
151 | HWND hwndCnr;
|
---|
152 | HWND hwndSource;
|
---|
153 | ULONG ulNumObjects;
|
---|
154 | POINTL ptl;
|
---|
155 | WPObject* wpObject[1];
|
---|
156 | }DROPTHREADPARAMS;
|
---|
157 | typedef DROPTHREADPARAMS* PDROPTHREADPARAMS;
|
---|
158 |
|
---|
159 | typedef struct _MFLDRCTRLDATA
|
---|
160 | {
|
---|
161 | ULONG ulMnemonicPos;
|
---|
162 | BOOL bPreviousCheckState;
|
---|
163 | }MFLDRCTRLDATA;
|
---|
164 |
|
---|
165 | class launchPad;
|
---|
166 |
|
---|
167 | #pragma SOMAsDefault(on)
|
---|
168 |
|
---|
169 | #ifndef somMD_WPFileSystem_wpRefresh
|
---|
170 | typedef BOOL SOMLINK somTP_WPFileSystem_wpRefresh(WPFileSystem *somSelf,
|
---|
171 | ULONG ulView,
|
---|
172 | PVOID pReserved);
|
---|
173 | //#pragma linkage(somTP_WPFileSystem_wpRefresh, system)
|
---|
174 | typedef somTP_WPFileSystem_wpRefresh *somTD_WPFileSystem_wpRefresh;
|
---|
175 | #define somMD_WPFileSystem_wpRefresh "::WPFileSystem::wpRefresh"
|
---|
176 | #define WPFileSystem_wpRefresh(somSelf,ulView,pReserved) \
|
---|
177 | (SOM_Resolve(somSelf, WPFileSystem, wpRefresh) \
|
---|
178 | (somSelf,ulView,pReserved))
|
---|
179 | #ifndef SOMGD_wpRefresh
|
---|
180 | #if (defined(_wpRefresh) || defined(__wpRefresh))
|
---|
181 | #undef _wpRefresh
|
---|
182 | #undef __wpRefresh
|
---|
183 | #define SOMGD_wpRefresh 1
|
---|
184 | #else
|
---|
185 | #define _wpRefresh WPFileSystem_wpRefresh
|
---|
186 | #endif /* _wpRefresh */
|
---|
187 | #endif /* SOMGD_wpRefresh */
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | class M_CWMediaFolder:public M_CWProgFolder
|
---|
191 | {
|
---|
192 | /* The name of of the new class */
|
---|
193 | #pragma SOMClassName(*,"M_CWMediaFolder")
|
---|
194 | /* Required SOM version */
|
---|
195 | #pragma SOMClassVersion(*,1,2)
|
---|
196 | #pragma SOMCallstyle(oidl)
|
---|
197 | public:
|
---|
198 | virtual PSZ wpclsQueryTitle();
|
---|
199 | virtual void wpclsInitData();
|
---|
200 | virtual ULONG wpclsQueryIconData(PICONINFO pIconInfo);
|
---|
201 | virtual ULONG wpclsQueryIconDataN(PICONINFO pIconInfo, ULONG ulIconIndex);
|
---|
202 | virtual void wpclsUnInitData();
|
---|
203 | virtual BOOL wpclsCreateDefaultTemplates(WPObject * wpObject);
|
---|
204 | virtual ULONG wpclsQueryStyle();
|
---|
205 | virtual BOOL wpclsQueryDefaultHelp(PULONG HelpPanelId,PSZ HelpLibrary);
|
---|
206 |
|
---|
207 | #pragma SOMReleaseOrder()
|
---|
208 | #pragma SOMIDLPass(*,"Implementation-End","dllname = mediafld;")
|
---|
209 | };
|
---|
210 |
|
---|
211 | class CWMediaFolder:public CWProgFolder
|
---|
212 | {
|
---|
213 | #pragma SOMClassName(*,"CWMediaFolder")
|
---|
214 | #pragma SOMMetaClass(CWMediaFolder,"M_CWMediaFolder")
|
---|
215 | #pragma SOMClassVersion(CWMediaFolder,1,2)
|
---|
216 | #pragma SOMCallstyle(oidl)
|
---|
217 | private:
|
---|
218 | /*
|
---|
219 | Added with V0.2.8 (07.09.2003)
|
---|
220 |
|
---|
221 | Private flags used by the folder to keep track of current actions.
|
---|
222 |
|
---|
223 | Tells the folder:
|
---|
224 | MFLDR_CURACTION_ADDFOLDERVIEW3: currently processing the wpAddFolderView3Page()
|
---|
225 | MFLDR_VIEW_COMPACT: folder is in compact view
|
---|
226 |
|
---|
227 | */
|
---|
228 | ULONG ulPrivFlags;
|
---|
229 | SWP swpUnshrink;
|
---|
230 | public:
|
---|
231 | /* From M3UFolder*/
|
---|
232 | WPObject* wpObjM3UFile;
|
---|
233 | HWND hwndObject;
|
---|
234 |
|
---|
235 | WPObject* currentObject; /* Currently playing object */
|
---|
236 | PMINIRECORDCORE mrcPlaying;
|
---|
237 | MYVIEWITEM myViewItem;
|
---|
238 |
|
---|
239 | HWND hwndTopMiddle;/* */
|
---|
240 | HWND hwndBottom;
|
---|
241 | HWND hwndMFldrFrame;
|
---|
242 | int iWave;
|
---|
243 | ULONG ulFlags;
|
---|
244 | BOOL bPaused;
|
---|
245 | ULONG ulVolume;
|
---|
246 | ULONG ulStartPosition;
|
---|
247 | ULONG ulTotalLength;/* Total length of track in ms */
|
---|
248 | ULONG ulPos;/* Position in wave/track in secs */
|
---|
249 | //char chrTBFlyFontName[CCHMAXPATH+1];
|
---|
250 | // RGB rgbTBFlyForeground;
|
---|
251 | // RGB rgbTBFlyBackground;
|
---|
252 | // BOOL bTBFlyOverEnabled;
|
---|
253 | // int iTBFlyOverDelay;
|
---|
254 | PFNWP pfnwpFrame;
|
---|
255 | USHORT usLastSelMenuItem;
|
---|
256 | USHORT usWhichDisplay;
|
---|
257 | MEDIAFLDRDATA* mfData;/* Allocated in wpInitData() */
|
---|
258 | launchPad* lPad;
|
---|
259 | #if 0
|
---|
260 | virtual BOOL wpMenuItemHelpSelected(ULONG MenuId);
|
---|
261 | virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect);
|
---|
262 | virtual BOOL cwIsWaveFile(WPObject* wpObject);
|
---|
263 | virtual ULONG cwSetWriteFlags(ULONG ulNewWriteFlags,ULONG ulMask);
|
---|
264 | virtual ULONG cwQueryWriteFlags();
|
---|
265 | #endif
|
---|
266 | virtual BOOL wpSetupOnce(PSZ pSetupString);
|
---|
267 | virtual BOOL wpAddToContent(WPObject* Object);
|
---|
268 | virtual BOOL wpDeleteFromContent(WPObject* Object);
|
---|
269 | virtual ULONG wpAddFolderView1Page(HWND hwndNotebook);
|
---|
270 | virtual ULONG wpAddFolderView2Page(HWND hwndNotebook);
|
---|
271 | virtual ULONG wpAddFolderView3Page(HWND hwndNotebook);
|
---|
272 | virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect);
|
---|
273 | virtual HWND wpOpen(HWND hwndCnr,ULONG ulView,ULONG ulParam);
|
---|
274 | virtual BOOL wpRestoreState(ULONG ulReserved);
|
---|
275 | virtual BOOL wpSaveState();
|
---|
276 | virtual MRESULT wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo);
|
---|
277 | virtual MRESULT wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);
|
---|
278 | virtual BOOL wpAddSettingsPages(HWND hwndNotebook);
|
---|
279 | virtual ULONG wpInsertSettingsPage(HWND hwndNotebook, PPAGEINFO ppageinfo);
|
---|
280 | virtual BOOL wpMenuItemSelected(HWND hwndFrame,ULONG ulMenuId);
|
---|
281 | virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, ULONG ulPosition);
|
---|
282 | virtual BOOL wpSetup(PSZ pSetupString);
|
---|
283 | virtual void wpInitData();
|
---|
284 | virtual void wpUnInitData();
|
---|
285 | virtual BOOL wpRefresh(ULONG ulView, PVOID pReserved);
|
---|
286 | // The following was introduced by CWProgFolder
|
---|
287 | virtual BOOL cwClose(HWND hwndFrame);
|
---|
288 | // These are our new methods
|
---|
289 | virtual ULONG cwPlayAudioFile(HWND hwndFrame, ULONG ulWhich);
|
---|
290 | virtual BOOL cwStopAudioFile(HWND hwndFrame);
|
---|
291 | virtual BOOL cwPauseAudioFile(HWND hwndFrame);
|
---|
292 | virtual BOOL cwAddToolbarOptionPage(HWND hwndNotebook);
|
---|
293 | virtual MMAudio* cwQueryCurrentlyPlayingObject();
|
---|
294 | virtual void cwSetStatusLineText(char * chrText);
|
---|
295 | virtual BOOL cwSeekAudioFile(LONG lPosSec);
|
---|
296 | virtual void cwPlayTimeCallback(HWND hwndFrame, LONG lPosSec);
|
---|
297 | virtual ULONG cwPlayRandomAudioFile(HWND hwndFrame);
|
---|
298 | virtual BOOL cwInsertAllTracks(char* chrM3UFile);
|
---|
299 | virtual ULONG cwQueryMFldrFlags();
|
---|
300 | virtual BOOL cwShrinkFolderToCompact(HWND hwndFrame);
|
---|
301 | virtual BOOL cwUnshrinkFolder(HWND hwndFrame);
|
---|
302 | #pragma SOMReleaseOrder(\
|
---|
303 | "cwPlayAudioFile",\
|
---|
304 | "cwStopAudioFile",\
|
---|
305 | "cwPauseAudioFile",\
|
---|
306 | "cwAddToolbarOptionPage",\
|
---|
307 | "cwQueryCurrentlyPlayingObject",\
|
---|
308 | "cwSetStatusLineText",\
|
---|
309 | "cwSeekAudioFile",\
|
---|
310 | "cwPlayTimeCallback",\
|
---|
311 | "cwPlayRandomAudioFile",\
|
---|
312 | "cwInsertAllTracks",\
|
---|
313 | "cwQueryMFldrFlags", \
|
---|
314 | "cwShrinkFolderToCompact",\
|
---|
315 | "cwUnshrinkFolder")
|
---|
316 |
|
---|
317 | #if 0
|
---|
318 | virtual MRESULT wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);
|
---|
319 | virtual BOOL cwClose();
|
---|
320 | virtual BOOL wpSetupOnce(PSZ pSetupString);
|
---|
321 | virtual BOOL wpSetup(PSZ pSetupString);
|
---|
322 |
|
---|
323 | #pragma SOMReleaseOrder(\
|
---|
324 | "cwIsWaveFile",\
|
---|
325 | "cwSetWriteFlags",\
|
---|
326 | "cwQueryWriteFlags",\
|
---|
327 | "cwEnableGrab",\
|
---|
328 | "cwQueryGrabEnabled",\
|
---|
329 | "cwEnableGrabControls",\
|
---|
330 | "cwEnableSelectControls",\
|
---|
331 | "cwFillTrackList",\
|
---|
332 | "cwSetStatusTime",\
|
---|
333 | "cwForceStatusUpdate",\
|
---|
334 | "cwEnableWrite",\
|
---|
335 | "cwQueryWriteEnabled",\
|
---|
336 | "cwEnableWriteControls",\
|
---|
337 | "cwSetStatusText",\
|
---|
338 | "cwWriteAudioTracks",\
|
---|
339 | "cwIsMp3File",\
|
---|
340 | "cwCreateContentsFile")
|
---|
341 | #endif
|
---|
342 | #pragma SOMIDLPass(CWMediaFolder,"Implementation-End","dllname = mediafld;")
|
---|
343 | };
|
---|
344 |
|
---|
345 | /************/
|
---|
346 | #pragma SOMAsDefault(pop)
|
---|
347 |
|
---|
348 | #pragma SOMNonDTS(pop)
|
---|
349 |
|
---|
350 |
|
---|
351 |
|
---|
352 |
|
---|
353 |
|
---|
354 |
|
---|
355 |
|
---|
356 |
|
---|
357 |
|
---|
358 |
|
---|
359 |
|
---|
360 |
|
---|
361 |
|
---|
362 |
|
---|