// InsertDE.cpp : implementation file // #include "stdafx.h" #include "dicomapp.h" #include "InsertDE.h" ///////////////////////////////////////////////////////////////////////////// // CDicomInsertElementDlg dialog CDicomInsertElementDlg::CDicomInsertElementDlg(CWnd* pParent /*=NULL*/) : CDialog(CDicomInsertElementDlg::IDD, pParent) { //{{AFX_DATA_INIT(CDicomInsertElementDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CDicomInsertElementDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDicomInsertElementDlg) DDX_Control(pDX, IDC_SEQUENCE, m_Sequence); DDX_Control(pDX, IDC_CHILD, m_Child); DDX_Control(pDX, IDC_INFO, m_Info); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDicomInsertElementDlg, CDialog) //{{AFX_MSG_MAP(CDicomInsertElementDlg) ON_NOTIFY(TVN_SELCHANGED, IDC_INFO, OnSelchangedInfo) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDicomInsertElementDlg message handlers BOOL CDicomInsertElementDlg::OnInitDialog() { CDialog::OnInitDialog(); SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon pDICOMTAG pTag; HTREEITEM hItem; CString strText; L_UINT32 nGroup=0xFFFF; HTREEITEM hGroup=NULL; pTag = LDicomTag::GetFirst(); while (pTag != NULL) { if ((pTag->nCode != TAG_DATA_SET_TRAILING_PADDING) && (pTag->nCode != TAG_ITEM_DELIMITATION_ITEM) && (pTag->nCode != TAG_SEQUENCE_DELIMITATION_ITEM)) { if (nGroup != GETGROUP(pTag->nCode)) { nGroup = GETGROUP(pTag->nCode); strText.Format("%04X", nGroup); hGroup = m_Info.InsertItem(strText, TVI_ROOT, TVI_LAST); } strText.Format("%04X:%04X - %s", GETGROUP(pTag->nCode), GETELEMENT(pTag->nCode), pTag->pszName); hItem = m_Info.InsertItem(strText, hGroup, TVI_LAST); m_Info.SetItemData(hItem, (DWORD)pTag); } pTag = LDicomTag::GetNext(pTag); } m_pTag = NULL; if (m_bChild == FALSE) { m_Child.EnableWindow(FALSE); } m_Info.SortChildren(NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDicomInsertElementDlg::OnSelchangedInfo(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; m_pTag = (pDICOMTAG)m_Info.GetItemData(pNMTreeView->itemNew.hItem); if (m_pTag != NULL) { SetDlgItemText(IDC_NAME, m_pTag->pszName); if ((m_pTag->nVR == VR_SQ) || (m_pTag->nCode == TAG_ITEM)) { m_Sequence.EnableWindow(TRUE); } else { m_Sequence.EnableWindow(FALSE); m_Sequence.SetCheck(0); } } else { SetDlgItemText(IDC_NAME, ""); } *pResult = 0; } void CDicomInsertElementDlg::OnOK() { m_bChild = (m_Child.GetCheck() == 0) ? FALSE : TRUE; m_bSequence = (m_Sequence.GetCheck() == 0) ? FALSE : TRUE; CDialog::OnOK(); }