home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 8090 / ModelEdit.7z / ImportStringKeysDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-08  |  2.0 KB  |  96 lines

  1. // ImportStringKeysDlg.cpp : implementation file
  2. //
  3.  
  4. #include "precompile.h"
  5. #include "modeledit.h"
  6. #include "ImportStringKeysDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CImportStringKeysDlg dialog
  16.  
  17.  
  18. CImportStringKeysDlg::CImportStringKeysDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CImportStringKeysDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CImportStringKeysDlg)
  22.     //}}AFX_DATA_INIT
  23. }
  24.  
  25.  
  26. void CImportStringKeysDlg::DoDataExchange(CDataExchange* pDX)
  27. {
  28.     CDialog::DoDataExchange(pDX);
  29.     //{{AFX_DATA_MAP(CImportStringKeysDlg)
  30.     //}}AFX_DATA_MAP
  31. }
  32.  
  33.  
  34. BEGIN_MESSAGE_MAP(CImportStringKeysDlg, CDialog)
  35.     //{{AFX_MSG_MAP(CImportStringKeysDlg)
  36.     ON_WM_CLOSE()
  37.     ON_WM_DESTROY()
  38.     //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CImportStringKeysDlg message handlers
  43.  
  44. void CImportStringKeysDlg::AddMsg(const char *sMsg, BYTE r, BYTE g, BYTE b)
  45. {        
  46.     CEdit *pCtrl = (CEdit *)GetDlgItem(IDC_PROGRESS);
  47.     if (!pCtrl) return;
  48.  
  49.     // set to bottom of text
  50.     pCtrl->SetSel(-1,-1);
  51.  
  52.     // set the color of the text to output
  53.     CHARFORMAT cf;
  54.     cf.dwMask = CFM_COLOR;
  55.     cf.dwEffects = 0;
  56.     cf.crTextColor = (b << 16) | (g << 8) | r;
  57. //    pCtrl->SetSelectionCharFormat(cf);
  58.  
  59.     // insert text
  60.     pCtrl->ReplaceSel(sMsg);
  61.  
  62.     // move current view to new next
  63.     int nMinPos;
  64.     int nMaxPos;
  65.     pCtrl->GetScrollRange( SB_VERT, &nMinPos, &nMaxPos );
  66.     pCtrl->SetScrollPos( SB_VERT, nMaxPos, TRUE );
  67. }
  68.  
  69. BOOL CImportStringKeysDlg::DestroyWindow() 
  70. {
  71.     return CDialog::DestroyWindow();
  72. }
  73.  
  74. void CImportStringKeysDlg::OnClose() 
  75. {
  76.     CDialog::OnClose();
  77. }
  78.  
  79. void CImportStringKeysDlg::OnDestroy() 
  80. {
  81.     CDialog::OnDestroy();
  82. }
  83.  
  84. void CImportStringKeysDlg::OnOK() 
  85. {
  86.     Clear();
  87.  
  88.     ShowWindow(SW_HIDE);
  89. }
  90.  
  91. void CImportStringKeysDlg::Clear()
  92. {
  93.     CEdit *pCtrl = (CEdit *)GetDlgItem(IDC_PROGRESS);
  94.     pCtrl->SetWindowText("");
  95. }
  96.