//
//  Copyright (c) 2000  ELECARD.  All Rights Reserved.
//
//
// aboutprp.cpp - About LAME Encoder
//

#include <windows.h>
#include <streams.h>
#include <olectl.h>
#include <olectlid.h>
#include <commctrl.h>
#include "iaudioprops.h"
#include "aboutprp.h"
#include "mpegac.h"
#include "resource.h"
#include "Reg.h"


// -------------------------------------------------------------------------
// CMAEAbout
// -------------------------------------------------------------------------


CHAR lpszText[] = "This library is free software; you can redistribute it \r\n" 						
						"and/or modify it under the terms of the GNU \r\n" 
						"Library General Public License\r\n" 
						"as published by the Free Software Foundation;\r\n" 
					    "either version 2 of the License,\r\n" 
						"or (at your option) any later version.\r\n" 
						"\r\n"
						"This library is distributed in the hope that it will be useful,\r\n" 
						"but WITHOUT ANY WARRANTY;\r\n" 
						"without even the implied warranty of MERCHANTABILITY or \r\n"  
						"FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r\n"
						"Library General Public License for more details.\r\n"					
						"\r\n"
						"You should have received a copy of the GNU\r\n"
						"Library General Public License\r\n"
						"along with this library; if not, write to the\r\n"
						"Free Software Foundation,\r\n"
						"Inc., 59 Temple Place - Suite 330,\r\n"
						"Boston, MA 02111-1307, USA.\r\n";
/*
This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
*/
//
// CreateInstance
//
CUnknown * WINAPI CMAEAbout::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr)
{
    CUnknown *punk = new CMAEAbout(lpunk, phr);
    if (punk == NULL) {
        *phr = E_OUTOFMEMORY;
    }

    return punk;
}


//
// Constructor
//
// Creaete a Property page object for the MPEG options
CMAEAbout::CMAEAbout(LPUNKNOWN lpunk, HRESULT *phr)
    : CBasePropertyPage(NAME("About LAME Ain't MP3 Encoder"), lpunk,
        IDD_ABOUT,IDS_ABOUT)
    , m_fWindowInActive(TRUE)
{
    ASSERT(phr);

//    InitCommonControls();
}

//
// OnConnect
//
// Give us the filter to communicate with

HRESULT CMAEAbout::OnConnect(IUnknown *pUnknown)
{
    return NOERROR;
}


//
// OnDisconnect
//
// Release the interface

HRESULT CMAEAbout::OnDisconnect()
{
    // Release the interface

    return NOERROR;
}


//
// OnActivate
//
// Called on dialog creation

HRESULT CMAEAbout::OnActivate(void)
{

	// Add text to the window. 
	m_fWindowInActive = FALSE;
    SendDlgItemMessage(m_hwnd, IDC_EDIT_TEXT,  WM_SETTEXT, 0, (LPARAM) lpszText); 
//    m_fWindowInActive = FALSE;
    return NOERROR;
}

//
// OnDeactivate
//
// Called on dialog destruction

HRESULT CMAEAbout::OnDeactivate(void)
{
    m_fWindowInActive = TRUE;
    return NOERROR;
}


//
// OnApplyChanges
//
// User pressed the Apply button, remember the current settings

HRESULT CMAEAbout::OnApplyChanges(void)
{
    return NOERROR;
}


//
// OnReceiveMessages
//
// Handles the messages for our property window

BOOL CMAEAbout::OnReceiveMessage( HWND hwnd
                                , UINT uMsg
                                , WPARAM wParam
                                , LPARAM lParam)
{

    if(m_fWindowInActive)
        return FALSE;

    switch (uMsg) {
    case WM_DESTROY:
        return TRUE;

    default:
        return FALSE;

    }
    return TRUE;
}

//
// SetDirty
//
// notifies the property page site of changes

void CMAEAbout::SetDirty()
{
    m_bDirty = TRUE;
    if (m_pPageSite)
        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
}

