home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / wsetup.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-11-12  |  2.9 KB  |  88 lines

  1. /******************************************************************/
  2. /*                                                                */
  3. /*                      TurboCAD for Windows                      */
  4. /*                   Copyright (c) 1993 - 2001                    */
  5. /*             International Microcomputer Software, Inc.         */
  6. /*                            (IMSI)                              */
  7. /*                      All rights reserved.                      */
  8. /*                                                                */
  9. /******************************************************************/
  10.  
  11. // WSetup.cpp : implementation file
  12. //
  13.  
  14. #include "stdafx.h"
  15. #include "JPEG.h"
  16. #include "WSetup.h"
  17.  
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CJPEGWriteSetup dialog
  26.  
  27. // This is a trivial example of a settings UI dialog.  We store the width and height
  28. // of the desired JPEG image in two data members, that we access in our automation object.
  29.  
  30. const int nDefaultHeight = 600;
  31. const int nDefaultWidth = 600;
  32.  
  33. CJPEGWriteSetup::CJPEGWriteSetup(CWnd* pParent /*=NULL*/)
  34.     : CDialog(CJPEGWriteSetup::IDD, pParent)
  35. {
  36.     //{{AFX_DATA_INIT(CJPEGWriteSetup)
  37.     m_nHeight = nDefaultHeight;
  38.     m_nWidth = nDefaultWidth;
  39.     //}}AFX_DATA_INIT
  40. }
  41.  
  42.  
  43. void CJPEGWriteSetup::DoDataExchange(CDataExchange* pDX)
  44. {
  45.     CDialog::DoDataExchange(pDX);
  46.     //{{AFX_DATA_MAP(CJPEGWriteSetup)
  47.     DDX_Text(pDX, IDC_JPEG_HEIGHT, m_nHeight);
  48.     DDV_MinMaxUInt(pDX, m_nHeight, 1, 1024);
  49.     DDX_Text(pDX, IDC_JPEG_WIDTH, m_nWidth);
  50.     DDV_MinMaxUInt(pDX, m_nWidth, 1, 1024);
  51.     //}}AFX_DATA_MAP
  52. }
  53.  
  54.  
  55. BEGIN_MESSAGE_MAP(CJPEGWriteSetup, CDialog)
  56.     //{{AFX_MSG_MAP(CJPEGWriteSetup)
  57.         // NOTE: the ClassWizard will add message map macros here
  58.     //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60.  
  61. static const TCHAR szJPEGFilter[] = _T("JPEG_Filter");
  62. static const TCHAR szWidth[] = _T("Height");
  63. static const TCHAR szHeight[] = _T("Width");
  64.  
  65. // Retrieve settings from the specified INI file.
  66. // We use a (hopefully) unique section name to store our data.
  67.  
  68. void CJPEGWriteSetup::FromProfile(LPCTSTR szProfile)
  69. {
  70.     m_nWidth = ::GetPrivateProfileInt(szJPEGFilter, szWidth, nDefaultWidth, szProfile);
  71.     m_nHeight = ::GetPrivateProfileInt(szJPEGFilter, szHeight, nDefaultHeight, szProfile);
  72. }
  73.  
  74. // Save settings to the specified INI file.
  75. // We use a (hopefully) unique section name to store our data.
  76.  
  77. void CJPEGWriteSetup::ToProfile(LPCTSTR szProfile)
  78. {
  79.     TCHAR szBuf[32];
  80.     _itot(m_nWidth, szBuf, 10);
  81.     ::WritePrivateProfileString(szJPEGFilter, szWidth, szBuf, szProfile);
  82.     _itot(m_nHeight, szBuf, 10);
  83.     ::WritePrivateProfileString(szJPEGFilter, szHeight, szBuf, szProfile);
  84. }
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CJPEGWriteSetup message handlers
  88.