www.pudn.com > isee_code01231.zip > ContrastDlg.cpp


/******************************************************************** 
 
	ContrastDlg.cpp - ISee图像浏览器—图像处理模块类ContrastDlg实现 
	代码文件 
 
    版权所有(C) VCHelp-coPathway-ISee workgroup 2000 all member's 
 
    这一程序是自由软件,你可以遵照自由软件基金会出版的GNU 通用许可证 
	条款来修改和重新发布这一程序。或者用许可证的第二版,或者(根据你 
	的选择)用任何更新的版本。 
 
    发布这一程序的目的是希望它有用,但没有任何担保。甚至没有适合特定 
	目地的隐含的担保。更详细的情况请参阅GNU通用许可证。 
 
    你应该已经和程序一起收到一份GNU通用许可证(GPL)的副本。如果还没有, 
	写信给: 
    The Free Software Foundation, Inc.,  675  Mass Ave,  Cambridge, 
    MA02139,  USA 
 
	如果你在使用本软件时有什么问题或建议,用以下地址可以与我们取得联 
	系: 
		http://isee.126.com 
		http://www.vchelp.net 
	或: 
		iseesoft@china.com 
 
	作者:马翔 
   e-mail:hugesoft@yeah.net 
 
   功能实现:界面对话模框 
 
	文件版本: 
		Build 000123 
		Date  2000-12-3 
 
********************************************************************/ 
// ContrastDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "flt_mass.h" 
#include "ContrastDlg.h" 
#include "DrawPreView.h" 
#include "draw.h" 
#include "Contrast.h" 
#include "AdjustContrast.h" 
#include "System.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
#define	DELAYTIME	300 
///////////////////////////////////////////////////////////////////////////// 
// CContrastDlg dialog 
 
CContrastDlg::CContrastDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CContrastDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CContrastDlg) 
	m_strBright = _T("100"); 
	m_strContrast = _T("100"); 
	//}}AFX_DATA_INIT 
} 
 
 
void CContrastDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CContrastDlg) 
	DDX_Control(pDX, IDC_EDIT_CONTRAST, m_cContrast); 
	DDX_Control(pDX, IDC_EDIT_BRIGHT, m_cBright); 
	DDX_Text(pDX, IDC_EDIT_BRIGHT, m_strBright); 
	DDV_MaxChars(pDX, m_strBright, 3); 
	DDX_Text(pDX, IDC_EDIT_CONTRAST, m_strContrast); 
	DDV_MaxChars(pDX, m_strContrast, 3); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CContrastDlg, CDialog) 
	//{{AFX_MSG_MAP(CContrastDlg) 
	ON_EN_CHANGE(IDC_EDIT_BRIGHT, OnChangeEditBright) 
	ON_EN_CHANGE(IDC_EDIT_CONTRAST, OnChangeEditContrast) 
	ON_WM_DRAWITEM() 
	ON_WM_MOUSEMOVE() 
	ON_WM_TIMER() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CContrastDlg message handlers 
 
 
BOOL CContrastDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	m_nBright=m_nContrast=100; 
  
	CreatMemImage(lpProcInfo); 
 
	m_wndBrightBar.SubclassDlgItem(IDC_LINETRACKBRIGHT, this); 
	m_wndBrightBar.InitControl(IDC_EDIT_BRIGHT,RGB(0,0,0),0, 100,200); 
	m_wndContrastBar.SubclassDlgItem(IDC_LINETRACKCONTRAST, this); 
	m_wndContrastBar.InitControl (IDC_EDIT_CONTRAST,RGB(0,0,0),0,100,200); 
 
	InitDraw(); 
	m_wndLogo.SubclassDlgItem (IDC_LOGO_CONTRAST,this); 
	m_wndLogo.SetLogoFont ("SIMSUN"); 
	m_wndLogo.SetLogoText ("iSee特效滤镜"); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CContrastDlg::OnChangeEditContrast()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	m_nContrast=atoi(m_strContrast); 
	m_nContrast=atoi(m_strContrast); 
 
	if(m_nContrast>200) 
	{ 
		m_nContrast=200; 
	} 
	if(m_nBright>200) 
	{ 
		m_nBright=200; 
	} 
 
	m_wndContrastBar.SetPos (m_nContrast); 
//	if(GetFocus()==GetDlgItem(IDC_EDIT_CONTRAST)) 
	{ 
		KillTimer(1); 
		SetTimer(1,DELAYTIME,NULL); 
	} 
 
	UpdateData(FALSE); 
} 
 
void CContrastDlg::OnChangeEditBright()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	m_nBright=atoi(m_strBright);	 
	m_nContrast=atoi(m_strContrast); 
 
	if(m_nContrast>200) 
	{ 
		m_nContrast=200; 
	} 
	if(m_nBright>200) 
	{ 
		m_nBright=200; 
	} 
	m_wndBrightBar.SetPos (m_nBright); 
 
//	if(GetFocus()==GetDlgItem(IDC_EDIT_BRIGHT)) 
	{ 
		KillTimer(1); 
		SetTimer(1,DELAYTIME,NULL); 
	} 
	UpdateData(FALSE); 
} 
 
void CContrastDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	KillTimer(1); 
	BeginWaitCursor (); 
	ClearPreView(); 
	if(m_nContrast>200) 
	{ 
		m_nContrast=200; 
	} 
	if(m_nBright>200) 
	{ 
		m_nBright=200; 
	} 
 
	CDialog::OnOK();	 
	_fnCOM_AdjustContrast(lpProcInfo,m_nBright-100,m_nContrast-100); 
	EndWaitCursor (); 
} 
 
void CContrastDlg::OnCancel()  
{ 
	// TODO: Add extra cleanup here 
	KillTimer(1); 
	ClearPreView(); 
	Del(lpProcInfo->_pdbdata ); 
 
	CDialog::OnCancel(); 
} 
 
void CContrastDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)  
{ 
	// TODO: Add your message handler code here and/or call default 
	_fnCOM_DrawResizePrView(nIDCtl,lpDrawItemStruct);//(LPDRAWITEMSTRUCT)lpProcInfo); 
 
	CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct); 
} 
 
void CContrastDlg::OnMouseMove(UINT nFlags, CPoint point)  
{ 
	// TODO: Add your message handler code here and/or call default 
	if(nFlags==MK_LBUTTON) 
	{ 
	} 
	CDialog::OnMouseMove(nFlags, point); 
} 
 
void CContrastDlg::OnTimer(UINT nIDEvent)  
{ 
	// TODO: Add your message handler code here and/or call default		 
	_fnCOM_AdjustContrastPreView(m_nBright-100,m_nContrast-100); 
	 
	GetDlgItem (IDC_PRVIEW_CONTRAST)->InvalidateRect (NULL,TRUE); 
	GetDlgItem (IDC_PRVIEW_CONTRAST)->UpdateWindow(); 
	switch(nIDEvent) 
	{ 
	case 1: 
		KillTimer(1); 
		break; 
	} 
	CDialog::OnTimer(nIDEvent); 
}