// EditDlg.cpp : implementation file // #include "stdafx.h" // #include "dicom.h" // #include "EditDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CEditValDlg dialog CEditValDlg::CEditValDlg(CWnd* pParent /*=NULL*/) : CDialog(CEditValDlg::IDD, pParent) { //{{AFX_DATA_INIT(CEditValDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CEditValDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CEditValDlg) DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Control(pDX, IDC_EDIT1, m_Text1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CEditValDlg, CDialog) //{{AFX_MSG_MAP(CEditValDlg) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CEditValDlg message handlers void CEditValDlg::OnButton2() { int x; if(m_List1.GetCount() > 0) { x = m_List1.GetCurSel(); m_List1.DeleteString(x); //remove selected item if(x > 0) m_List1.SetCurSel(x-1); else m_List1.SetCurSel(0); } } void CEditValDlg::OnButton1() { CString csText; int x; m_Text1.GetWindowText(csText); if(csText.GetLength() > 0) { x = m_List1.InsertString(m_List1.GetCurSel(), csText); m_List1.SetCurSel(x); } else AfxMessageBox("Input a value first!"); } void CEditValDlg::Init(void) { long x; CString csText; short nVR; for(x=0; xGetStringValueCount(); x++) { BSTR bstr=m_pLEADDicomDS->GetStringValues(x); csText = bstr; SysFreeString(bstr); m_List1.AddString(csText); } m_List1.SetCurSel(0); x = m_List1.GetCurSel(); if(x != -1) { m_List1.GetText(x, csText); m_Text1.SetWindowText(csText); } CString strText; IDicomVRItemPtr pCurrentVR=NULL; BOOL bMulti=FALSE; IDicomDSElementPtr pCurrentElement=NULL; strText = "Value Representation: "; pCurrentElement = m_pLEADDicomDS->GetCurrentElement(); if(pCurrentElement != NULL) { nVR = pCurrentElement->GetVR(); m_pLEADDicomDS->FindVR(nVR); pCurrentVR = m_pLEADDicomDS->GetCurrentVR(); if(pCurrentVR) { CString cs=(LPCSTR)pCurrentVR->GetName();; strText += cs; if ((pCurrentVR->GetRestrict() & DICOM_VR_BINARY) || (pCurrentVR->GetRestrict() & DICOM_VR_STRING)) bMulti = TRUE; } else { nVR = VR_UN; bMulti = TRUE; } } else PostMessage(WM_CLOSE, 0, 0); SetDlgItemText(IDC_LABEL1, strText); switch (nVR) { case VR_OB: case VR_UN: strText = "Hexadecimal"; break; case VR_SS: case VR_US: case VR_OW: case VR_SL: case VR_IS: case VR_UL: strText = "Integer"; break; case VR_AT: strText = "Group:Element\r\n(Group and Element should be hexadecimal words)"; break; case VR_FD: case VR_FL: case VR_DS: strText = "Float"; break; case VR_CS: case VR_SH: case VR_LO: case VR_AE: case VR_LT: case VR_ST: case VR_UI: case VR_UT: case VR_PN: if (bMulti != FALSE) strText = "String"; else strText = "Text"; break; case VR_AS: strText = "Number Reference\r\n(Reference = 'days' or 'weeks' or 'months' or 'years')"; break; case VR_DA: strText = "MM/DD/YYYY\r\n(MM=Month, DD=Day, YYYY=Year)"; break; case VR_DT: strText = "CC MM/DD/YYYY HH:MM:SS.FFFFFF&OOOO\r\n(CC=Century, MM=Month, DD=Day, YYYY=Year)\r\n(HH=Hours, MM=Minutes, SS=Seconds, FFFFFF=Fractional Second, OOOO=Offset from Coordinated Universal Time)"; break; case VR_TM: strText = "HH:MM:SS.FFFF\r\n(HH=Hours, MM=Minutes, SS=Seconds, FFFFFF=Fractional Second)"; break; default: strText = ""; break; } SetDlgItemText(IDC_LABEL2, strText); if (bMulti == FALSE) { ::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_BUTTON1), FALSE); ::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_BUTTON2), FALSE); ::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_BUTTON3), FALSE); } } BOOL CEditValDlg::OnInitDialog() { CDialog::OnInitDialog(); Init(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CEditValDlg::OnOK() { long x; CString csText; m_lCount = m_List1.GetCount(); for(x=0; x 0) { x = m_List1.InsertString(m_List1.GetCurSel()+1, csText); m_List1.SetCurSel(x); } else AfxMessageBox("Input a value first!"); } void CEditValDlg::OnButton4() { CString csText; int x = m_List1.GetCurSel(); m_Text1.GetWindowText(csText); if(csText.GetLength() > 0) { m_List1.DeleteString(x); //remove selected item m_List1.InsertString(x, csText); m_List1.SetCurSel(x); } else AfxMessageBox("Input a value first!"); } void CEditValDlg::OnSelchangeList1() { CString csText; int x = m_List1.GetCurSel(); m_List1.GetText(x, csText); m_Text1.SetWindowText(csText); }