source: branches/v2.9/mediafolder/c/cdfldr/cdfolder.cpp

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

Import sources from cwmm-full.zip dated 2005-03-21

File size: 3.5 KB
Line 
1/*
2 * This file is (C) Chris Wohlgemuth 2002
3 *
4 * It's part of the Media-Folder distribution
5 */
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#define INCL_DOSERRORS
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26#include "mediafolderres.h"
27#include "cdfolder.hh"
28
29extern char chrInstallDir[CCHMAXPATH];
30
31extern HFILE openDrive(char* drive);
32extern void closeDrive(HFILE hfDrive);
33extern int CDQueryAudioCDTracks(HFILE hfDrive);
34LONG extern CDQueryTrackSecs(ULONG numTrack, char * drive);
35extern ULONG launchPMWrapper(PSZ pszTitle, PSZ wrapperExe, PSZ parameters);
36
37BOOL CWCDFolder::cwInsertAllTracks(char* chrCDDrive)
38{
39 HFILE hfDrive;
40 ULONG ulSize;
41 ULONG flWindowAttr;
42 HWND hwndCnr=NULLHANDLE;
43 WPObject *wpObject;
44
45 wpDeleteContents(NULL);
46
47 ulNumTracks=0;
48
49 if(WinIsWindow(WinQueryAnchorBlock(HWND_DESKTOP), hwndFrameCDFldr)) {
50 if((hwndCnr=WinWindowFromID(hwndFrameCDFldr, FID_CLIENT))!=NULLHANDLE) {
51 WinEnableWindowUpdate(hwndCnr, FALSE);
52 }
53 }
54
55 // WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, chrCDDrive, "", 12324, MB_MOVEABLE);
56 if((hfDrive=openDrive(chrCDDrive))!=NULLHANDLE)
57 {
58 char chrFreeDBClient[CCHMAXPATH]={0};
59 ulNumTracks=CDQueryAudioCDTracks(hfDrive);
60 closeDrive(hfDrive);
61 if(ulNumTracks>0) {
62 int a;
63 char chrTarget[CCHMAXPATH];
64 char chrTitle[CCHMAXPATH];
65 char chrSetup[CCHMAXPATH];
66 ulSize=sizeof(chrTarget);
67 wpQueryRealName(chrTarget, &ulSize, TRUE);
68 for(a=ulNumTracks;a>0;a--) {
69 LONG lSecs;
70 lSecs=CDQueryTrackSecs(a, chrCDDrive);
71 sprintf(chrSetup,"CWAUDIOPLAYTIME=%d;CWCDTTRACKNUM=%d;OBJECTID=<CDTRACK_%c_%d>", lSecs, a, chrDrive[0], a);
72 //sprintf(chrSetup,"CWAUDIOPLAYTIME=%d;CWCDTTRACKNUM=%d", lSecs, a);
73 // if(a==1)
74 // WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, chrSetup, "", 12324, MB_MOVEABLE);
75 sprintf(chrTitle,"Track %d",a);
76 WinCreateObject("MMCDTrack", chrTitle, chrSetup, chrTarget, CO_REPLACEIFEXISTS);
77 }
78
79 /* Query FreeDB */
80 if(PrfQueryProfileString(HINI_USERPROFILE, APPKEY_CWMM, KEY_FREEDBCLIENTROOT,"",
81 chrFreeDBClient, sizeof(chrFreeDBClient)))
82 {
83 char chrParams[CCHMAXPATH+20];
84 strcat(chrFreeDBClient, FREEDB_CLIENT_NAME);
85 sprintf(chrParams, "%s \"%s%s\"", chrCDDrive, chrInstallDir, FREEDB_REXXSCRIPT);
86 launchPMWrapper("FreeDB", chrFreeDBClient, chrParams);
87 }
88 }
89 else
90 ulNumTracks=0;
91 }
92 if(hwndCnr) {
93 WinShowWindow(hwndCnr, TRUE);
94 }
95#if 0
96 /* Set emphasis of first track */
97 wpObject=wpQueryContent(NULLHANDLE, (ULONG)QC_LAST);
98 if(somIsObj(wpObject))
99 wpObject->wpCnrSetEmphasis(CRA_SELECTED, TRUE);
100#endif
101 return TRUE;
102}
103
104
105
106
107
108
Note: See TracBrowser for help on using the repository browser.