home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
- //
- //contprop.cpp
- //
-
- #include <windows.h>
- #include <windowsx.h>
- #include <streams.h>
- #include <commctrl.h>
- #include <olectl.h>
- #include <memory.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <tchar.h>
-
- #include "resource.h"
- #include "EZuids.h"
- #include "iEZ.h"
- #include "EZrgb24.h"
- #include "EZprop.h"
-
- // *
- // * CEZrgb24Properties
- // *
-
-
- //
- // CreateInstance
- //
- // The only allowed way to create Bouncing ball's!
- CUnknown *CEZrgb24Properties::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr) {
-
- CUnknown *punk = new CEZrgb24Properties(lpunk, phr);
- if (punk == NULL) {
- *phr = E_OUTOFMEMORY;
- }
-
- return punk;
- }
-
-
- //
- // CEZrgb24Properties::Constructor
- //
- CEZrgb24Properties::CEZrgb24Properties(LPUNKNOWN pUnk, HRESULT *phr)
- : CBasePropertyPage(NAME("EZrgb24 Property Page"),pUnk,phr,
- IDD_EZrgb24PROP, IDS_TITLE)
- , m_pIPEffect(NULL)
- , m_bIsInitialized(FALSE)
- {
- }
-
- // Handles the messages for our property window
-
- BOOL CEZrgb24Properties::OnReceiveMessage(HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
- {
- switch (uMsg)
- {
-
- case WM_COMMAND:
- {
- if (m_bIsInitialized)
- {
- m_bDirty = TRUE;
- if (m_pPageSite)
- {
- m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
- }
- }
- return (LRESULT) 1;
- }
-
- }
- return CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);
- }
-
-
- HRESULT CEZrgb24Properties::OnConnect(IUnknown *pUnknown)
- {
-
- ASSERT(m_pIPEffect == NULL);
-
- HRESULT hr = pUnknown->QueryInterface(IID_IIPEffect, (void **) &m_pIPEffect);
- if (FAILED(hr))
- {
- return E_NOINTERFACE;
- }
-
- ASSERT(m_pIPEffect);
-
- // Get the initial image FX property
- m_pIPEffect->get_IPEffect(&m_effect, &m_start, &m_length);
- m_bIsInitialized = FALSE ;
- return NOERROR;
- }
-
- HRESULT CEZrgb24Properties::OnDisconnect()
- {
- // Release of Interface after setting the appropriate old effect value
-
- if (m_pIPEffect == NULL)
- {
- return E_UNEXPECTED;
- }
-
- m_pIPEffect->Release();
- m_pIPEffect = NULL;
- return NOERROR;
- }
-
-
- // We are being activated
-
- HRESULT CEZrgb24Properties::OnActivate()
- {
- TCHAR sz[60];
-
- _stprintf(sz, TEXT("%f"), m_length);
- Edit_SetText(GetDlgItem(m_Dlg, IDC_LENGTH), sz);
- _stprintf(sz, TEXT("%f"), m_start);
- Edit_SetText(GetDlgItem(m_Dlg, IDC_START), sz);
-
- CheckRadioButton(m_Dlg, IDC_EMBOSS, IDC_NONE, m_effect);
- m_bIsInitialized = TRUE;
- return NOERROR;
- }
-
- // We are being deactivated
-
- HRESULT CEZrgb24Properties::OnDeactivate(void)
- {
- ASSERT(m_pIPEffect);
- m_pIPEffect->get_IPEffect(&m_effect, &m_start, &m_length);
- return NOERROR;
- }
-
-
- //
- // Apply
- //
- // Changes made should be kept.
- //
-
- // Apply any changes so far made
-
- HRESULT CEZrgb24Properties::OnApplyChanges()
- {
-
- ASSERT(m_pIPEffect);
-
- TCHAR sz[STR_MAX_LENGTH];
- REFTIME tmp1, tmp2 ;
-
-
- // Get the start and effect times
-
- Edit_GetText(GetDlgItem(m_Dlg, IDC_LENGTH), sz, STR_MAX_LENGTH);
- tmp2 = COARefTime(atof(sz));
-
- Edit_GetText(GetDlgItem(m_Dlg, IDC_START), sz, STR_MAX_LENGTH);
- tmp1 = COARefTime(atof(sz));
-
- // validate.
- if (tmp1 >= 0 && tmp2 >= 0)
- {
- m_start = tmp1 ;
- m_length = tmp2 ;
- }
-
- for (int i = IDC_EMBOSS; i <= IDC_NONE; i++)
- if (IsDlgButtonChecked(m_Dlg, i))
- {
- m_pIPEffect->put_IPEffect(i, m_start, m_length);
- m_effect = i ;
- }
- return(NOERROR);
-
- }
-