home *** CD-ROM | disk | FTP | other *** search
- // the implementation of class CAptChgLineDialog
- // Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
-
- #include "../stdafx.h"
-
- #include "aptline.h"
-
- BEGIN_MESSAGE_MAP(CAptChgLineDialog, CAptCommonDialog)
- END_MESSAGE_MAP()
-
- CEdit& CAptChgLineDialog::ctlWidth()
- {
- return *(CEdit*)GetDlgItem(IDC_WIDTH);
- }
-
- void CAptChgLineDialog::SetAll(const APERTURE& apt)
- {
- SetTextInt(&ctlWidth(), apt.width());
- }
-
- CAptChgLineDialog::CAptChgLineDialog(
- CWnd* pParentWnd ,
- const APT_TABLE& apt_table ,
- const APT_TABLE& apt_table_purged,
- const APERTURE& prev
- )
- : CAptCommonDialog (pParentWnd, IDD_APTCHG_LINE, apt_table, apt_table_purged, prev),
- m_width (1)
- {
- }
-
- BOOL CAptChgLineDialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- ctlWidth().LimitText(5);
-
- m_index = 0;
- RegisterAllItems();
- if(m_apt_table.size() != 0) {
- SetAll(m_apt_table[m_index]);
- ctlExisting().SetCurSel(m_index);
- }
- return TRUE;
- }
-
- void CAptChgLineDialog::OnOK()
- {
- CDialog::OnOK();
- m_aperture.set_all(
- APERTURE::APT_ROUND,
- unit_change_micron2kban(m_width),
- 0,
- 0
- );
- if(!m_apt_table.is_included(m_aperture)) {
- m_apt_table.push_back(m_aperture);
- m_apt_table.sort();
- }
- }
-
- void CAptChgLineDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Text (pDX, IDC_WIDTH, m_width);
- DDV_MinMaxInt(pDX, m_width, 1, 10000);
- DDX_LBIndex (pDX, IDC_EXISTING, m_index);
- }
-
- void CAptChgLineDialog::AddAperture(const APERTURE& apt)
- {
- char str[50];
- sprintf(str, "%d", apt.width());
- ctlExisting().AddString(str);
- }
-