Move the sources to trunk
[opencv] / filters / ProxyTrans / ProxyTransprop.cpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/
41
42 // This class implements the property page for the ProxyTransform filter
43
44 #pragma warning( disable: 4201 )
45 #include <cvstreams.h>
46 #include <commctrl.h>
47 #include <olectl.h>
48 #include <memory.h>
49 #include "resource.h"
50 #include "iProxyTrans.h"
51 #include "ProxyTrans.h"
52 #include "ProxyTransprop.h"
53 #include "ProxyTransuids.h"
54
55 //
56 // CreateInstance
57 //
58 // This goes in the factory template table to create new filter instances
59 //
60 const signed char MaxLevel = 127;
61 const signed char MinLevel = -128;
62
63 CUnknown * WINAPI ProxyTransformProperties::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
64 {
65     CUnknown *punk = new ProxyTransformProperties(lpunk, phr);
66     if (punk == NULL) {
67     *phr = E_OUTOFMEMORY;
68     }
69     return punk;
70
71 } // CreateInstance
72
73
74 //
75 // Constructor
76 //
77 ProxyTransformProperties::ProxyTransformProperties(LPUNKNOWN pUnk, HRESULT *phr) :
78     CBasePropertyPage(NAME("ProxyTrans Property Page"),pUnk,
79                       IDD_ProxyTransformPROP,
80                       IDS_TITLE),
81     m_pProxyTransform(NULL)
82 {
83     InitCommonControls();
84 } // (Constructor)
85
86
87 //
88 // SetDirty
89 //
90 // Sets m_bDirty and notifies the property page site of the change
91 //
92 void ProxyTransformProperties::SetDirty()
93 {
94     m_bDirty = TRUE;
95     if (m_pPageSite) {
96         m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
97     }
98
99 } // SetDirty
100
101
102 //
103 // OnReceiveMessage
104 //
105 // Virtual method called by base class with Window messages
106 //
107 BOOL ProxyTransformProperties::OnReceiveMessage(HWND hwnd,
108                                                   UINT uMsg,
109                                                   WPARAM wParam,
110                                                   LPARAM lParam)
111 {
112     switch (uMsg)
113     {        
114         case WM_INITDIALOG:
115         {
116         return (LRESULT) 1;
117         }
118         case WM_VSCROLL:
119         {
120         return (LRESULT) 1;
121         }
122
123         case WM_COMMAND:
124         {
125             return (LRESULT) 1;
126         }
127
128         case WM_DESTROY:
129         {
130         return (LRESULT) 1;
131         }
132     }
133     return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);
134
135 } // OnReceiveMessage
136
137
138 //
139 // OnConnect
140 //
141 // Called when the property page connects to a filter
142 //
143 HRESULT ProxyTransformProperties::OnConnect(IUnknown *pUnknown)
144 {
145     ASSERT(m_pProxyTransform == NULL);
146
147     HRESULT hr = pUnknown->QueryInterface(IID_IProxyTransform, (void **) &m_pProxyTransform);
148     if (FAILED(hr)) {
149         return E_NOINTERFACE;
150     }
151
152     ASSERT(m_pProxyTransform);
153
154     return NOERROR;
155
156 } // OnConnect
157
158
159 //
160 // OnDisconnect
161 //
162 // Called when we're disconnected from a filter
163 //
164 HRESULT ProxyTransformProperties::OnDisconnect()
165 {
166     // Release of Interface after setting the parameters
167
168     if (m_pProxyTransform == NULL) {
169         return E_UNEXPECTED;
170     }
171     m_pProxyTransform->Release();
172     m_pProxyTransform = NULL;
173     return NOERROR;
174
175 } // OnDisconnect
176
177
178 //
179 // OnDeactivate
180 //
181 // We are being deactivated
182 //
183 HRESULT ProxyTransformProperties::OnDeactivate(void)
184 {
185     return NOERROR;
186
187 } // OnDeactivate
188
189
190 //
191 // OnApplyChanges
192 //
193 // Changes made should be kept. Change the  variable
194 //
195 HRESULT ProxyTransformProperties::OnApplyChanges()
196 {
197     m_bDirty = FALSE;
198     return(NOERROR);
199
200 } // OnApplyChanges