home *** CD-ROM | disk | FTP | other *** search
/ PC Elektro 3 / PC-Elektro-3-cd1.bin / KBan 2.0 / KBANSRC.LZH / SRC / PROG / VIEW / APTLINE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-23  |  1.6 KB  |  76 lines

  1. // the implementation of class CAptChgLineDialog
  2. // Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
  3.  
  4. #include "../stdafx.h"
  5.  
  6. #include "aptline.h"
  7.  
  8. BEGIN_MESSAGE_MAP(CAptChgLineDialog, CAptCommonDialog)
  9. END_MESSAGE_MAP()
  10.  
  11. CEdit& CAptChgLineDialog::ctlWidth()
  12. {
  13.   return *(CEdit*)GetDlgItem(IDC_WIDTH);
  14. }
  15.  
  16. void CAptChgLineDialog::SetAll(const APERTURE& apt)
  17. {
  18.   SetTextInt(&ctlWidth(), apt.width());
  19. }
  20.  
  21. CAptChgLineDialog::CAptChgLineDialog(
  22.   CWnd*            pParentWnd      ,
  23.   const APT_TABLE& apt_table       ,
  24.   const APT_TABLE& apt_table_purged,
  25.   const APERTURE&  prev
  26. )
  27.   : CAptCommonDialog  (pParentWnd, IDD_APTCHG_LINE, apt_table, apt_table_purged, prev),
  28.     m_width           (1)
  29. {
  30. }
  31.  
  32. BOOL CAptChgLineDialog::OnInitDialog()
  33. {
  34.   CDialog::OnInitDialog();
  35.  
  36.   ctlWidth().LimitText(5);
  37.  
  38.   m_index = 0;
  39.   RegisterAllItems();
  40.   if(m_apt_table.size() != 0) {
  41.     SetAll(m_apt_table[m_index]);
  42.     ctlExisting().SetCurSel(m_index);
  43.   }
  44.   return TRUE;
  45. }
  46.  
  47. void CAptChgLineDialog::OnOK()
  48. {
  49.   CDialog::OnOK();
  50.   m_aperture.set_all(
  51.     APERTURE::APT_ROUND,
  52.     unit_change_micron2kban(m_width),
  53.     0,
  54.     0
  55.   );
  56.   if(!m_apt_table.is_included(m_aperture)) {
  57.     m_apt_table.push_back(m_aperture);
  58.     m_apt_table.sort();
  59.   }
  60. }
  61.  
  62. void CAptChgLineDialog::DoDataExchange(CDataExchange* pDX)
  63. {
  64.   CDialog::DoDataExchange(pDX);
  65.   DDX_Text     (pDX, IDC_WIDTH, m_width);
  66.   DDV_MinMaxInt(pDX, m_width, 1, 10000);
  67.   DDX_LBIndex  (pDX, IDC_EXISTING, m_index);
  68. }
  69.  
  70. void CAptChgLineDialog::AddAperture(const APERTURE& apt)
  71. {
  72.   char str[50];
  73.   sprintf(str, "%d", apt.width());
  74.   ctlExisting().AddString(str);
  75. }
  76.