home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / feconvdl.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.5 KB  |  130 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // FE_DialogConvert.cpp : implementation file
  20. //
  21.  
  22. #include "stdafx.h"
  23. #include "resource.h"
  24. #include "feconvdl.h"
  25.  
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // FE_DialogConvert dialog
  34.  
  35.  
  36. FE_DialogConvert::FE_DialogConvert(CWnd* pParent /*=NULL*/)
  37.     : CDialog(FE_DialogConvert::IDD, pParent)
  38. {
  39.     //{{AFX_DATA_INIT(FE_DialogConvert)
  40.     m_imagetypevalue = -1;
  41.     m_outfilevalue = _T("");
  42.     m_inputimagesize = _T("");
  43.     m_inputimagetype = _T("");
  44.     m_qualityvalue = -1;
  45.     //}}AFX_DATA_INIT
  46.     m_Doutputimagetype1=0;
  47.     m_Doutputimagequality1=0;
  48. }
  49.  
  50.  
  51. void FE_DialogConvert::DoDataExchange(CDataExchange* pDX)
  52. {
  53.     CDialog::DoDataExchange(pDX);
  54.     //{{AFX_DATA_MAP(FE_DialogConvert)
  55.     DDX_Radio(pDX, IDC_IMAGETYPE, m_imagetypevalue);
  56.     DDX_Text(pDX, IDC_OUTFILE, m_outfilevalue);
  57.     DDX_Text(pDX, IDC_INPUTIMAGESIZE, m_inputimagesize);
  58.     DDX_Text(pDX, IDC_INPUTIMAGETYPE, m_inputimagetype);
  59.     DDX_Radio(pDX, IDC_QUALITY1, m_qualityvalue);
  60.     //}}AFX_DATA_MAP
  61. }
  62.  
  63.  
  64. BEGIN_MESSAGE_MAP(FE_DialogConvert, CDialog)
  65.     //{{AFX_MSG_MAP(FE_DialogConvert)
  66.     ON_BN_CLICKED(IDC_IMAGETYPE, OnJPEG)
  67.     ON_BN_CLICKED(IDC_IMAGETYPE2, OnPNG)
  68.     //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70.  
  71. /////////////////////////////////////////////////////////////////////////////
  72. // FE_DialogConvert message handlers
  73.  
  74. BOOL FE_DialogConvert::OnInitDialog() 
  75. {
  76.     CDialog::OnInitDialog();
  77.     
  78.     // TODO: Add extra initialization here
  79.     m_outfilevalue=m_Doutfilename1;
  80.     m_imagetypevalue=m_Doutputimagetype1;
  81.     if (m_Doutputimagequality1<=33)
  82.         m_qualityvalue=0;
  83.     else if (m_Doutputimagequality1<=66)
  84.         m_qualityvalue=1;
  85.     else if (m_Doutputimagequality1>66)
  86.         m_qualityvalue=2;
  87.  
  88.     m_inputimagetype=m_Dinputimagetype;
  89.     _ultoa(m_Dinputimagesize,m_inputimagesize.GetBuffer(255),10);
  90.     m_inputimagesize.ReleaseBuffer();
  91.     UpdateData(FALSE);
  92.     return TRUE;  // return TRUE unless you set the focus to a control
  93.                   // EXCEPTION: OCX Property Pages should return FALSE
  94. }
  95.  
  96. void FE_DialogConvert::OnOK() 
  97. {
  98.     // TODO: Add extra validation here
  99.     UpdateData(TRUE);
  100.     m_Doutfilename1=m_outfilevalue;
  101.     m_Doutputimagetype1=m_imagetypevalue;
  102.     switch (m_qualityvalue)
  103.     {
  104.     case 0:m_Doutputimagequality1=25;break;
  105.     case 1:m_Doutputimagequality1=75;break;
  106.     case 2:m_Doutputimagequality1=100;break;
  107.     }
  108.  
  109.     CDialog::OnOK();
  110. }
  111.  
  112. void FE_DialogConvert::OnCancel() 
  113. {
  114.     // TODO: Add extra cleanup here
  115.     
  116.     CDialog::OnCancel();
  117. }
  118.  
  119. void FE_DialogConvert::OnJPEG() 
  120. {
  121.     // TODO: Add your control notification handler code here
  122.     
  123. }
  124.  
  125. void FE_DialogConvert::OnPNG() 
  126. {
  127.     // TODO: Add your control notification handler code here
  128.     
  129. }
  130.