aboutsummaryrefslogtreecommitdiff
path: root/Src/burnlib/uiBurnPlaylist.h
blob: 3e26435568176e434db4113d7d6070da70e3ca3b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#pragma once

#include "./main.h"
#include <commctrl.h>

#include "./playlist.h"

#define WM_BURNER				((WM_USER) + 0x400)

#define WM_BURNGETSTATUS			((WM_BURNER) + 0x001)  
#define WM_BURNGETITEMSTATUS		((WM_BURNER) + 0x002)  
#define WM_BURNUPDATEOWNER		((WM_BURNER) + 0x003)   // wParam = 0; lParam = ownerWnd
#define WM_BURNCONFIGCHANGED		((WM_BURNER) + 0x004)   // wParam = changed item; lParam = new value

#define WM_BURNNOTIFY			((WM_BURNER) + 0x100)   // wParam = Notify code, lParam notify  data

// Notification types
#define BURN_READY				0xFFF  // lParam = hwnd
#define BURN_DESTROYED			0x001
#define BURN_WORKING				0x002  
#define BURN_FINISHED			0x003
#define BURN_STATECHANGED		0x004
#define BURN_CONFIGCHANGED		0x005


#define BURN_ITEMSTATECHANGED	0x010
#define BURN_ITEMDECODEPROGRESS	0x011
#define BURN_ITEMBURNPROGRESS	0x012

// status types
#define BURNSTATUS_DRIVE		0x0000
#define BURNSTATUS_ELAPSED		0x0001
#define BURNSTATUS_ESTIMATED		0x0002
#define BURNSTATUS_PROGRESS		0x0003
#define BURNSTATUS_STATE		0x0004
#define BURNSTATUS_ERROR		0x0005


#define BURNPLAYLISTUI_SUCCESS			0x0000
#define BURNPLAYLISTUI_PRIMOSDKNOTSET	0x0105


//stages
#define PLSTAGE_READY		0x00
#define PLSTAGE_LICENSED	0x01
#define PLSTAGE_DECODED		0x02
#define PLSTAGE_BURNED		0x03

// config items
#define BURNCFG_AUTOCLOSE		0x01
#define BURNCFG_AUTOEJECT		0x02
#define BURNCFG_ADDTODB			0x03
#define BURNCFG_HIDEVIEW			0x04

class BurnPlaylistUI
{
public:
	BURNLIB_API BurnPlaylistUI(void);
	BURNLIB_API ~BurnPlaylistUI(void);

public:
	BURNLIB_API DWORD Burn(obj_primo *primoSDK, DWORD drive, DWORD maxspeed, DWORD burnFlags,
							BurnerPlaylist *playlist, const wchar_t* tempPath, HWND ownerWnd);

	
protected:
	static DWORD CALLBACK OnLicensingPlaylist(void *sender, void *userparam, DWORD notifyCode, DWORD errorCode, ULONG_PTR param);
	static DWORD CALLBACK OnDecodePlaylist(void *sender, void *userparam, DWORD notifyCode, DWORD errorCode, ULONG_PTR param);
	static DWORD CALLBACK OnBurnPlaylist(void *sender, void *userparam, DWORD notifyCode, DWORD errorCode, ULONG_PTR param);
	static LRESULT CALLBACK WndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
	void OnLicense(void);
	void OnDecode(void);
	void OnBurn(void);
	void OnInitDialog(HWND hwndDlg);
	void OnCancel(void);
	void OnDestroy(void);
	void SetExtendedView(BOOL extView);
	void SetColumns(void);
	void FillList(void);
	void SetProgress(int position);
	void UpdateTime(BOOL recalcEstimates);
	void ReportError(unsigned int stringCode, BOOL allowContinue);
	void ReportError(const wchar_t *errorString, BOOL allowContinue);
	DWORD DrawList(NMLVCUSTOMDRAW* cd);
	HBITMAP CreateStripBmp(HDC compDC);
	void SetReadyClose(BOOL ready);
	void UpdateItemStatus(int index);
	void SetItemStatusText(int index, unsigned int stringCode, BOOL redraw);
	void SetCurrentOperation(unsigned int stringCode);
	int MessageBox(unsigned int messageCode, unsigned int captionCode, unsigned int uType);
protected:

	struct aproxtime
	{
		DWORD license;
		DWORD convert;
		DWORD transition;
		DWORD chkdisc;
		DWORD init;
		DWORD leadin;
		DWORD burn;
		DWORD leadout;
		DWORD finish;
	};

protected:
	HWND				hwnd;
	HWND				ownerWnd;
	DWORD			drive;
	DWORD			maxspeed;
	DWORD			burnFlags;
	BOOL			extendedView;
	DWORD			errCode;
	obj_primo			*primoSDK;
	BurnerPlaylist	*playlist;
	unsigned int	startedTime;
	unsigned int	estimatedTime;
	wchar_t			*tmpfilename;	
	HANDLE			hTmpFile;
	int				currentPercent;
	DWORD			prevRefresh;
	HBITMAP			stripBmp;
	BOOL			cancelOp;
	HANDLE			workDone;
	aproxtime		estimated;
	BOOL			readyClose;
	DWORD			controlTime;
	DWORD			realSpeed;
	DWORD			stage;
	DWORD			count; // count of items to process (actual)
	DWORD			processed; // count of actually processed items

};