1 | /*
|
---|
2 | * This file is (C) Chris Wohlgemuth 2002-2005
|
---|
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 | #pragma SOMAsDefault(on)
|
---|
68 | #include <som.hh>
|
---|
69 | #include <somcls.hh>
|
---|
70 | #pragma SOMNoMangling(on)
|
---|
71 | /*#include "progfolder.h"*/
|
---|
72 | #include "progfolder.hh"
|
---|
73 | #include "cwaudio.hh"
|
---|
74 |
|
---|
75 | /* Forward declaration */
|
---|
76 | class CWMediaFolder;
|
---|
77 |
|
---|
78 | #pragma SOMAsDefault(off)
|
---|
79 | #pragma SOMNonDTS(on)
|
---|
80 |
|
---|
81 | typedef struct _MYVIEWITEM
|
---|
82 | {
|
---|
83 | BOOL bIsInUseList;
|
---|
84 | USEITEM useItem;
|
---|
85 | VIEWITEM viewItem;
|
---|
86 | }MYVIEWITEM;
|
---|
87 |
|
---|
88 | typedef struct
|
---|
89 | {
|
---|
90 | INT id;
|
---|
91 | RECTL rclSource;
|
---|
92 | HBITMAP hbmSource;
|
---|
93 | RECTL rclDest;
|
---|
94 | }CONTROLINFO;
|
---|
95 |
|
---|
96 | typedef struct
|
---|
97 | {
|
---|
98 | BITMAPINFOHEADER bmpInfoHdr;
|
---|
99 | HBITMAP hbm;
|
---|
100 | }LOADEDBITMAP;
|
---|
101 |
|
---|
102 |
|
---|
103 | /* The following is used for openThreadFunc(void *arg) when openeing a media folder and
|
---|
104 | for storing information when calling cwPlayAudioFile() etc. from the player panel dialog of the folder. */
|
---|
105 | typedef struct _THREADPARAMS
|
---|
106 | {
|
---|
107 | CWMediaFolder *thisPtr;
|
---|
108 | HWND hwndFrame;
|
---|
109 | }THREADPARAMS;
|
---|
110 |
|
---|
111 | /* This struct is used in the CWInsertTrack method to specify the REXX script
|
---|
112 | to be started */
|
---|
113 | typedef struct _INSERTTRACKPARMS
|
---|
114 | {
|
---|
115 | WPObject* thisPtr;
|
---|
116 | char chrRexxScript[CCHMAXPATH];
|
---|
117 | }INSERTTRACKPARMS;
|
---|
118 |
|
---|
119 | typedef struct _MEDIAFLDRDATA
|
---|
120 | {
|
---|
121 | ULONG ulTotalTime; /* Playtime of all folder tracks in secs */
|
---|
122 | char chrPlayTimeFont[50];/* Fontnamelength is 31 chars. Some space for the pointsize added and some to be save.
|
---|
123 | Yeah, I know I'm lazy... */
|
---|
124 | BOOL bProcessing; /* Set to TRUE if a thread is running. this is checked in the container proc and the wait ptr. is set. */
|
---|
125 | ULONG ulNumTracks;
|
---|
126 | ULONG ulSize;
|
---|
127 | BOOL bOpened;
|
---|
128 | BYTE *pRandomArray; /* This array holds the already random played tracks. When played the index is set to '1'. */
|
---|
129 | int iNumPlayed; /* # of random played tracks */
|
---|
130 | int iNumToPlay;
|
---|
131 | HWND hwndPlayObject;/* Object window which handles the play commands so the WPS is not blocked. */
|
---|
132 | }MEDIAFLDRDATA;
|
---|
133 | typedef MEDIAFLDRDATA* PMEDIAFLDRDATA;
|
---|
134 |
|
---|
135 | typedef struct _DROPTHREADPARAMS
|
---|
136 | {
|
---|
137 | CWMediaFolder *thisPtr;
|
---|
138 | HWND hwndCnr;
|
---|
139 | HWND hwndSource;
|
---|
140 | ULONG ulNumObjects;
|
---|
141 | POINTL ptl;
|
---|
142 | WPObject* wpObject[1];
|
---|
143 | }DROPTHREADPARAMS;
|
---|
144 | typedef DROPTHREADPARAMS* PDROPTHREADPARAMS;
|
---|
145 |
|
---|
146 | typedef struct _MFLDRCTRLDATA
|
---|
147 | {
|
---|
148 | ULONG ulMnemonicPos;
|
---|
149 | BOOL bPreviousCheckState;
|
---|
150 | }MFLDRCTRLDATA;
|
---|
151 |
|
---|
152 | class launchPad;
|
---|
153 |
|
---|
154 | #pragma SOMAsDefault(on)
|
---|
155 |
|
---|
156 | #ifndef somMD_WPFileSystem_wpRefresh
|
---|
157 | typedef BOOL SOMLINK somTP_WPFileSystem_wpRefresh(WPFileSystem *somSelf,
|
---|
158 | ULONG ulView,
|
---|
159 | PVOID pReserved);
|
---|
160 | //#pragma linkage(somTP_WPFileSystem_wpRefresh, system)
|
---|
161 | typedef somTP_WPFileSystem_wpRefresh *somTD_WPFileSystem_wpRefresh;
|
---|
162 | #define somMD_WPFileSystem_wpRefresh "::WPFileSystem::wpRefresh"
|
---|
163 | #define WPFileSystem_wpRefresh(somSelf,ulView,pReserved) \
|
---|
164 | (SOM_Resolve(somSelf, WPFileSystem, wpRefresh) \
|
---|
165 | (somSelf,ulView,pReserved))
|
---|
166 | #ifndef SOMGD_wpRefresh
|
---|
167 | #if (defined(_wpRefresh) || defined(__wpRefresh))
|
---|
168 | #undef _wpRefresh
|
---|
169 | #undef __wpRefresh
|
---|
170 | #define SOMGD_wpRefresh 1
|
---|
171 | #else
|
---|
172 | #define _wpRefresh WPFileSystem_wpRefresh
|
---|
173 | #endif /* _wpRefresh */
|
---|
174 | #endif /* SOMGD_wpRefresh */
|
---|
175 | #endif
|
---|
176 |
|
---|
177 | class M_CWMediaFolder:public M_CWProgFolder
|
---|
178 | {
|
---|
179 | /* The name of of the new class */
|
---|
180 | #pragma SOMClassName(*,"M_CWMediaFolder")
|
---|
181 | /* Required SOM version */
|
---|
182 | #pragma SOMClassVersion(*,1,2)
|
---|
183 | #pragma SOMCallstyle(oidl)
|
---|
184 | public:
|
---|
185 | virtual PSZ wpclsQueryTitle();
|
---|
186 | virtual void wpclsInitData();
|
---|
187 | virtual ULONG wpclsQueryIconData(PICONINFO pIconInfo);
|
---|
188 | virtual ULONG wpclsQueryIconDataN(PICONINFO pIconInfo, ULONG ulIconIndex);
|
---|
189 | virtual void wpclsUnInitData();
|
---|
190 | virtual BOOL wpclsCreateDefaultTemplates(WPObject * wpObject);
|
---|
191 | virtual ULONG wpclsQueryStyle();
|
---|
192 | virtual BOOL wpclsQueryDefaultHelp(PULONG HelpPanelId,PSZ HelpLibrary);
|
---|
193 |
|
---|
194 | #pragma SOMReleaseOrder()
|
---|
195 | #pragma SOMIDLPass(*,"Implementation-End","dllname = mediafld;")
|
---|
196 | };
|
---|
197 |
|
---|
198 | class CWMediaFolder:public CWProgFolder
|
---|
199 | {
|
---|
200 | #pragma SOMClassName(*,"CWMediaFolder")
|
---|
201 | #pragma SOMMetaClass(CWMediaFolder,"M_CWMediaFolder")
|
---|
202 | #pragma SOMClassVersion(CWMediaFolder,1,2)
|
---|
203 | #pragma SOMCallstyle(oidl)
|
---|
204 | private:
|
---|
205 | /*
|
---|
206 | Added with V0.2.8 (07.09.2003)
|
---|
207 |
|
---|
208 | Private flags used by the folder to keep track of current actions.
|
---|
209 |
|
---|
210 | Tells the folder:
|
---|
211 | MFLDR_CURACTION_ADDFOLDERVIEW3: currently processing the wpAddFolderView3Page()
|
---|
212 | MFLDR_VIEW_COMPACT: folder is in compact view
|
---|
213 |
|
---|
214 | */
|
---|
215 | ULONG ulPrivFlags;
|
---|
216 | SWP swpUnshrink;
|
---|
217 | public:
|
---|
218 | /* From M3UFolder*/
|
---|
219 | WPObject* wpObjM3UFile;
|
---|
220 | HWND hwndObject;
|
---|
221 |
|
---|
222 | WPObject* currentObject; /* Currently playing object */
|
---|
223 | PMINIRECORDCORE mrcPlaying;
|
---|
224 | MYVIEWITEM myViewItem;
|
---|
225 |
|
---|
226 | HWND hwndTopMiddle;/* */
|
---|
227 | HWND hwndBottom;
|
---|
228 | HWND hwndMFldrFrame;
|
---|
229 | int iWave;
|
---|
230 | ULONG ulFlags;
|
---|
231 | BOOL bPaused;
|
---|
232 | ULONG ulVolume;
|
---|
233 | ULONG ulStartPosition;
|
---|
234 | ULONG ulTotalLength;/* Total length of track in ms */
|
---|
235 | ULONG ulPos;/* Position in wave/track in secs */
|
---|
236 | //char chrTBFlyFontName[CCHMAXPATH+1];
|
---|
237 | // RGB rgbTBFlyForeground;
|
---|
238 | // RGB rgbTBFlyBackground;
|
---|
239 | // BOOL bTBFlyOverEnabled;
|
---|
240 | // int iTBFlyOverDelay;
|
---|
241 | PFNWP pfnwpFrame;
|
---|
242 | USHORT usLastSelMenuItem;
|
---|
243 | USHORT usWhichDisplay;
|
---|
244 | MEDIAFLDRDATA* mfData;/* Allocated in wpInitData() */
|
---|
245 | launchPad* lPad;
|
---|
246 | #if 0
|
---|
247 | virtual BOOL wpMenuItemHelpSelected(ULONG MenuId);
|
---|
248 | virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect);
|
---|
249 | virtual BOOL cwIsWaveFile(WPObject* wpObject);
|
---|
250 | virtual ULONG cwSetWriteFlags(ULONG ulNewWriteFlags,ULONG ulMask);
|
---|
251 | virtual ULONG cwQueryWriteFlags();
|
---|
252 | #endif
|
---|
253 | virtual BOOL wpSetupOnce(PSZ pSetupString);
|
---|
254 | virtual BOOL wpAddToContent(WPObject* Object);
|
---|
255 | virtual BOOL wpDeleteFromContent(WPObject* Object);
|
---|
256 | virtual ULONG wpAddFolderView1Page(HWND hwndNotebook);
|
---|
257 | virtual ULONG wpAddFolderView2Page(HWND hwndNotebook);
|
---|
258 | virtual ULONG wpAddFolderView3Page(HWND hwndNotebook);
|
---|
259 | virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr, BOOL fMultiSelect);
|
---|
260 | virtual HWND wpOpen(HWND hwndCnr,ULONG ulView,ULONG ulParam);
|
---|
261 | virtual BOOL wpRestoreState(ULONG ulReserved);
|
---|
262 | virtual BOOL wpSaveState();
|
---|
263 | virtual MRESULT wpDragOver(HWND hwndCnr,PDRAGINFO pDragInfo);
|
---|
264 | virtual MRESULT wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);
|
---|
265 | virtual BOOL wpAddSettingsPages(HWND hwndNotebook);
|
---|
266 | virtual ULONG wpInsertSettingsPage(HWND hwndNotebook, PPAGEINFO ppageinfo);
|
---|
267 | virtual BOOL wpMenuItemSelected(HWND hwndFrame,ULONG ulMenuId);
|
---|
268 | virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr, ULONG ulPosition);
|
---|
269 | virtual BOOL wpSetup(PSZ pSetupString);
|
---|
270 | virtual void wpInitData();
|
---|
271 | virtual void wpUnInitData();
|
---|
272 | virtual BOOL wpRefresh(ULONG ulView, PVOID pReserved);
|
---|
273 | // The following was introduced by CWProgFolder
|
---|
274 | virtual BOOL cwClose(HWND hwndFrame);
|
---|
275 | // These are our new methods
|
---|
276 | virtual ULONG cwPlayAudioFile(HWND hwndFrame, ULONG ulWhich);
|
---|
277 | virtual BOOL cwStopAudioFile(HWND hwndFrame);
|
---|
278 | virtual BOOL cwPauseAudioFile(HWND hwndFrame);
|
---|
279 | virtual BOOL cwAddToolbarOptionPage(HWND hwndNotebook);
|
---|
280 | virtual MMAudio* cwQueryCurrentlyPlayingObject();
|
---|
281 | virtual void cwSetStatusLineText(char * chrText);
|
---|
282 | virtual BOOL cwSeekAudioFile(LONG lPosSec);
|
---|
283 | virtual void cwPlayTimeCallback(HWND hwndFrame, LONG lPosSec);
|
---|
284 | virtual ULONG cwPlayRandomAudioFile(HWND hwndFrame);
|
---|
285 | virtual BOOL cwInsertAllTracks(char* chrM3UFile);
|
---|
286 | virtual ULONG cwQueryMFldrFlags();
|
---|
287 | virtual BOOL cwShrinkFolderToCompact(HWND hwndFrame);
|
---|
288 | virtual BOOL cwUnshrinkFolder(HWND hwndFrame);
|
---|
289 | #pragma SOMReleaseOrder(\
|
---|
290 | "cwPlayAudioFile",\
|
---|
291 | "cwStopAudioFile",\
|
---|
292 | "cwPauseAudioFile",\
|
---|
293 | "cwAddToolbarOptionPage",\
|
---|
294 | "cwQueryCurrentlyPlayingObject",\
|
---|
295 | "cwSetStatusLineText",\
|
---|
296 | "cwSeekAudioFile",\
|
---|
297 | "cwPlayTimeCallback",\
|
---|
298 | "cwPlayRandomAudioFile",\
|
---|
299 | "cwInsertAllTracks",\
|
---|
300 | "cwQueryMFldrFlags", \
|
---|
301 | "cwShrinkFolderToCompact",\
|
---|
302 | "cwUnshrinkFolder")
|
---|
303 |
|
---|
304 | #if 0
|
---|
305 | virtual MRESULT wpDrop(HWND hwndCnr,PDRAGINFO pDragInfo,PDRAGITEM pDragItem);
|
---|
306 | virtual BOOL cwClose();
|
---|
307 | virtual BOOL wpSetupOnce(PSZ pSetupString);
|
---|
308 | virtual BOOL wpSetup(PSZ pSetupString);
|
---|
309 |
|
---|
310 | #pragma SOMReleaseOrder(\
|
---|
311 | "cwIsWaveFile",\
|
---|
312 | "cwSetWriteFlags",\
|
---|
313 | "cwQueryWriteFlags",\
|
---|
314 | "cwEnableGrab",\
|
---|
315 | "cwQueryGrabEnabled",\
|
---|
316 | "cwEnableGrabControls",\
|
---|
317 | "cwEnableSelectControls",\
|
---|
318 | "cwFillTrackList",\
|
---|
319 | "cwSetStatusTime",\
|
---|
320 | "cwForceStatusUpdate",\
|
---|
321 | "cwEnableWrite",\
|
---|
322 | "cwQueryWriteEnabled",\
|
---|
323 | "cwEnableWriteControls",\
|
---|
324 | "cwSetStatusText",\
|
---|
325 | "cwWriteAudioTracks",\
|
---|
326 | "cwIsMp3File",\
|
---|
327 | "cwCreateContentsFile")
|
---|
328 | #endif
|
---|
329 | #pragma SOMIDLPass(CWMediaFolder,"Implementation-End","dllname = mediafld;")
|
---|
330 | };
|
---|
331 |
|
---|
332 | /************/
|
---|
333 | #pragma SOMAsDefault(pop)
|
---|
334 |
|
---|
335 | #pragma SOMNonDTS(pop)
|
---|
336 |
|
---|
337 |
|
---|
338 |
|
---|
339 |
|
---|
340 |
|
---|
341 |
|
---|
342 |
|
---|
343 |
|
---|
344 |
|
---|
345 |
|
---|
346 |
|
---|
347 |
|
---|
348 |
|
---|
349 |
|
---|