// LUTDlg.cpp : implementation file // #include "stdafx.h" #include "cldprn32.h" #include "LUTDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPresentationLUTDlg dialog CPresentationLUTDlg::CPresentationLUTDlg(CWnd* pParent /*=NULL*/) : CDialog(CPresentationLUTDlg::IDD, pParent) { //{{AFX_DATA_INIT(CPresentationLUTDlg) //}}AFX_DATA_INIT } void CPresentationLUTDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPresentationLUTDlg) DDX_Control(pDX, IDC_COMBO_PRESENTATIONLUTSHAPE, m_PresentationLUTShapeCombo); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPresentationLUTDlg, CDialog) //{{AFX_MSG_MAP(CPresentationLUTDlg) ON_BN_CLICKED(IDC_RADIO_PRESENTATIONLUTSHAPE, OnRadioPresentationLUTShape) ON_BN_CLICKED(IDC_RADIO_LOADFROMFILE, OnRadioLoadFromFile) ON_EN_CHANGE(IDC_EDIT_PRESENTATIONLUTFILE, OnChangeEditPresentationLUTFile) ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse) ON_BN_CLICKED(IDC_BUTTON_CREATE, OnButtonCreate) //}}AFX_MSG_MAP END_MESSAGE_MAP() void CPresentationLUTDlg::UpdateControlsState() { BOOL bPresentationLUTShapeSelected = IsDlgButtonChecked(IDC_RADIO_PRESENTATIONLUTSHAPE); GetDlgItem(IDC_COMBO_PRESENTATIONLUTSHAPE)->EnableWindow(bPresentationLUTShapeSelected); GetDlgItem(IDC_EDIT_PRESENTATIONLUTFILE)->EnableWindow(!bPresentationLUTShapeSelected); GetDlgItem(IDC_BUTTON_BROWSE)->EnableWindow(!bPresentationLUTShapeSelected); if (bPresentationLUTShapeSelected) { GetDlgItem(IDC_BUTTON_CREATE)->EnableWindow(TRUE); } else { OnChangeEditPresentationLUTFile(); } } ///////////////////////////////////////////////////////////////////////////// // CPresentationLUTDlg message handlers BOOL CPresentationLUTDlg::OnInitDialog() { CDialog::OnInitDialog(); // Initialize the controls CheckDlgButton(IDC_RADIO_PRESENTATIONLUTSHAPE, BST_CHECKED); m_PresentationLUTShapeCombo.AddString(TEXT("IDENTITY")); m_PresentationLUTShapeCombo.AddString(TEXT("LIN OD")); m_PresentationLUTShapeCombo.SetCurSel(0); UpdateControlsState(); return TRUE; } void CPresentationLUTDlg::OnButtonBrowse() { CFileDialog FileDialog(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, TEXT("All Files (*.*)|*.*||"), this); if (FileDialog.DoModal() != IDOK) { return; } SetDlgItemText(IDC_EDIT_PRESENTATIONLUTFILE, FileDialog.GetPathName()); } void CPresentationLUTDlg::OnButtonCreate() { m_bPresentationLUTShapeSelected = IsDlgButtonChecked(IDC_RADIO_PRESENTATIONLUTSHAPE); m_PresentationLUTShapeCombo.GetWindowText(m_sPresentationLUTShape); GetDlgItemText(IDC_EDIT_PRESENTATIONLUTFILE, m_sPresentationLUTFilename); CDialog::OnOK(); } void CPresentationLUTDlg::OnRadioPresentationLUTShape() { UpdateControlsState(); } void CPresentationLUTDlg::OnRadioLoadFromFile() { UpdateControlsState(); } void CPresentationLUTDlg::OnChangeEditPresentationLUTFile() { CString sFilename; GetDlgItemText(IDC_EDIT_PRESENTATIONLUTFILE, sFilename); sFilename.TrimLeft(); GetDlgItem(IDC_BUTTON_CREATE)->EnableWindow(sFilename.GetLength()); }