skyrope-mit-merge-hell-20040226
[openafs.git] / src / WINNT / client_exp / partition_info_dlg.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
13 }
14
15 #include "stdafx.h"
16 #include "afs_shl_ext.h"
17 #include "partition_info_dlg.h"
18
19 #ifdef _DEBUG
20 #define new DEBUG_NEW
21 #undef THIS_FILE
22 static char THIS_FILE[] = __FILE__;
23 #endif
24
25 /////////////////////////////////////////////////////////////////////////////
26 // CPartitionInfoDlg dialog
27
28
29 CPartitionInfoDlg::CPartitionInfoDlg(CWnd* pParent /*=NULL*/)
30         : CDialog()
31 {
32         InitModalIndirect (TaLocale_GetDialogResource (CPartitionInfoDlg::IDD), pParent);
33
34         //{{AFX_DATA_INIT(CPartitionInfoDlg)
35                 // NOTE: the ClassWizard will add member initialization here
36         //}}AFX_DATA_INIT
37         m_nSize = 0;
38         m_nFree = 0;
39 }
40
41 void CPartitionInfoDlg::DoDataExchange(CDataExchange* pDX)
42 {
43         CDialog::DoDataExchange(pDX);
44         //{{AFX_DATA_MAP(CPartitionInfoDlg)
45         DDX_Control(pDX, IDC_TOTAL_SIZE, m_Size);
46         DDX_Control(pDX, IDC_PERCENT_USED, m_PercentUsed);
47         DDX_Control(pDX, IDC_BLOCKS_FREE, m_Free);
48         //}}AFX_DATA_MAP
49 }
50
51 BEGIN_MESSAGE_MAP(CPartitionInfoDlg, CDialog)
52         //{{AFX_MSG_MAP(CPartitionInfoDlg)
53         ON_BN_CLICKED(IDHELP, OnHelp)
54         //}}AFX_MSG_MAP
55 END_MESSAGE_MAP()
56
57 /////////////////////////////////////////////////////////////////////////////
58 // CPartitionInfoDlg message handlers
59
60 BOOL CPartitionInfoDlg::OnInitDialog() 
61 {
62     double percentUsed;     // because partition sizes are big
63
64         CDialog::OnInitDialog();
65         
66         ASSERT(m_nSize != 0);
67
68         CString strSize;
69         strSize.Format("%ld", m_nSize);
70         
71         CString strFree;
72         strFree.Format("%ld", m_nFree);
73         
74         CString strPerUsed;
75         strPerUsed.Format("%d", ((m_nSize - m_nFree) * 100) / m_nSize);
76
77         m_Size.SetWindowText(strSize);
78         m_Free.SetWindowText(strFree);
79     percentUsed = ( double(m_nSize - m_nFree) * 100.0l ) / double(m_nSize);
80     strPerUsed.Format("%2.2lf", percentUsed );
81
82         return TRUE;  // return TRUE unless you set the focus to a control
83                       // EXCEPTION: OCX Property Pages should return FALSE
84 }
85
86 void CPartitionInfoDlg::OnHelp() 
87 {
88         ShowHelp(m_hWnd, PARTITION_INFO_HELP_ID);
89 }
90