Changed the CreateDC driver entry point to use an HDC instead of a DC
[wine] / dlls / dmcompos / composer.c
1 /* IDirectMusicComposer
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
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 of the License, or
8  * (at your option) 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 Library 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; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmcompos_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
23
24 /* IDirectMusicComposerImpl IUnknown part: */
25 HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface (LPDIRECTMUSICCOMPOSER iface, REFIID riid, LPVOID *ppobj) {
26         ICOM_THIS(IDirectMusicComposerImpl,iface);
27         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
28
29         if (IsEqualIID (riid, &IID_IUnknown) || 
30             IsEqualIID (riid, &IID_IDirectMusicComposer)) {
31                 IDirectMusicComposerImpl_AddRef(iface);
32                 *ppobj = This;
33                 return S_OK;
34         }
35         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
36         return E_NOINTERFACE;
37 }
38
39 ULONG WINAPI IDirectMusicComposerImpl_AddRef (LPDIRECTMUSICCOMPOSER iface) {
40         ICOM_THIS(IDirectMusicComposerImpl,iface);
41         TRACE("(%p): AddRef from %ld\n", This, This->ref);
42         return ++(This->ref);
43 }
44
45 ULONG WINAPI IDirectMusicComposerImpl_Release (LPDIRECTMUSICCOMPOSER iface) {
46         ICOM_THIS(IDirectMusicComposerImpl,iface);
47         ULONG ref = --This->ref;
48         TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
49         if (ref == 0) {
50                 HeapFree(GetProcessHeap(), 0, This);
51         }
52         return ref;
53 }
54
55 /* IDirectMusicComposerImpl IDirectMusicComposer part: */
56 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromTemplate (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, IDirectMusicSegment* pTemplate, WORD wActivity, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment) {
57         ICOM_THIS(IDirectMusicComposerImpl,iface);
58         FIXME("(%p, %p, %p, %d, %p, %p): stub\n", This, pStyle, pTemplate, wActivity, pChordMap, ppSegment);
59         return S_OK;
60 }
61
62 HRESULT WINAPI IDirectMusicComposerImpl_ComposeSegmentFromShape (LPDIRECTMUSICCOMPOSER iface, IDirectMusicStyle* pStyle, WORD wNumMeasures, WORD wShape, WORD wActivity, BOOL fIntro, BOOL fEnd, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppSegment) {
63         ICOM_THIS(IDirectMusicComposerImpl,iface);
64         FIXME("(%p, %p, %d, %d, %d, %d, %d, %p, %p): stub\n", This, pStyle, wNumMeasures, wShape, wActivity, fIntro, fEnd, pChordMap, ppSegment);
65         return S_OK;
66 }
67
68 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pFromSeg, IDirectMusicSegment* pToSeg, MUSIC_TIME mtTime, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg) {
69         ICOM_THIS(IDirectMusicComposerImpl,iface);
70         FIXME("(%p, %p, %p, %ld, %d, %ld, %p, %p): stub\n", This, pFromSeg, pToSeg, mtTime, wCommand, dwFlags, pChordMap, ppTransSeg);
71         return S_OK;
72 }
73
74 HRESULT WINAPI IDirectMusicComposerImpl_AutoTransition (LPDIRECTMUSICCOMPOSER iface, IDirectMusicPerformance* pPerformance, IDirectMusicSegment* pToSeg, WORD wCommand, DWORD dwFlags, IDirectMusicChordMap* pChordMap, IDirectMusicSegment** ppTransSeg, IDirectMusicSegmentState** ppToSegState, IDirectMusicSegmentState** ppTransSegState) {
75         ICOM_THIS(IDirectMusicComposerImpl,iface);
76         FIXME("(%p, %p, %d, %ld, %p, %p, %p, %p): stub\n", This, pPerformance, wCommand, dwFlags, pChordMap, ppTransSeg, ppToSegState, ppTransSegState);
77         return S_OK;
78 }
79
80 HRESULT WINAPI IDirectMusicComposerImpl_ComposeTemplateFromShape (LPDIRECTMUSICCOMPOSER iface, WORD wNumMeasures, WORD wShape, BOOL fIntro, BOOL fEnd, WORD wEndLength, IDirectMusicSegment** ppTemplate) {
81         ICOM_THIS(IDirectMusicComposerImpl,iface);
82         FIXME("(%p, %d, %d, %d, %d, %d, %p): stub\n", This, wNumMeasures, wShape, fIntro, fEnd, wEndLength, ppTemplate);
83         return S_OK;
84 }
85
86 HRESULT WINAPI IDirectMusicComposerImpl_ChangeChordMap (LPDIRECTMUSICCOMPOSER iface, IDirectMusicSegment* pSegment, BOOL fTrackScale, IDirectMusicChordMap* pChordMap) {
87         ICOM_THIS(IDirectMusicComposerImpl,iface);
88         FIXME("(%p, %p, %d, %p): stub\n", This, pSegment, fTrackScale, pChordMap);
89         return S_OK;
90 }
91
92 ICOM_VTABLE(IDirectMusicComposer) DirectMusicComposer_Vtbl = {
93     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
94         IDirectMusicComposerImpl_QueryInterface,
95         IDirectMusicComposerImpl_AddRef,
96         IDirectMusicComposerImpl_Release,
97         IDirectMusicComposerImpl_ComposeSegmentFromTemplate,
98         IDirectMusicComposerImpl_ComposeSegmentFromShape,
99         IDirectMusicComposerImpl_ComposeTransition,
100         IDirectMusicComposerImpl_AutoTransition,
101         IDirectMusicComposerImpl_ComposeTemplateFromShape,
102         IDirectMusicComposerImpl_ChangeChordMap
103 };
104
105 /* for ClassFactory */
106 HRESULT WINAPI DMUSIC_CreateDirectMusicComposerImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
107         IDirectMusicComposerImpl* obj;
108         
109         obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicComposerImpl));
110         if (NULL == obj) {
111                 *ppobj = (LPDIRECTMUSICCOMPOSER) NULL;
112                 return E_OUTOFMEMORY;
113         }
114         obj->lpVtbl = &DirectMusicComposer_Vtbl;
115         obj->ref = 0; /* will be inited by QueryInterface */
116         
117         return IDirectMusicComposerImpl_QueryInterface ((LPDIRECTMUSICCOMPOSER)obj, lpcGUID, ppobj);    
118 }