win95-initial-port-20010430
[openafs.git] / src / WINNT / win9xpanel / CommandSettings.cpp
1 /* Copyright 2000, International Business Machines Corporation and others.
2         All Rights Reserved.
3  
4         This software has been released under the terms of the IBM Public
5         License.  For details, see the LICENSE file in the top-level source
6         directory or online at http://www.openafs.org/dl/license10.html
7 */
8 // CommandSettings.cpp : implementation file
9 //
10
11 #include "stdafx.h"
12 #include "winafsload.h"
13 #include "CommandSettings.h"
14
15 #ifdef _DEBUG
16 #define new DEBUG_NEW
17 #undef THIS_FILE
18 static char THIS_FILE[] = __FILE__;
19 #endif
20
21 /////////////////////////////////////////////////////////////////////////////
22 // CCommandSettings dialog
23
24
25 CCommandSettings::CCommandSettings(CWnd* pParent /*=NULL*/)
26         : CDialog(CCommandSettings::IDD, pParent)
27 {
28         //{{AFX_DATA_INIT(CCommandSettings)
29         m_ConnectOnStart = FALSE;
30         m_LogToFile = FALSE;
31         m_LogToWindow = FALSE;
32         m_UserName = _T("");
33         m_uMaxLoginTime = 0;
34         m_uMaxPowerRestartDelay = 0;
35         //}}AFX_DATA_INIT
36 }
37
38
39 void CCommandSettings::DoDataExchange(CDataExchange* pDX)
40 {
41         CDialog::DoDataExchange(pDX);
42         //{{AFX_DATA_MAP(CCommandSettings)
43         DDX_Control(pDX, IDC_OPTIONLINE, m_cOptionLine);
44         DDX_Control(pDX, IDC_CHECKADVANCED, m_cCheckAdvanceDisplay);
45         DDX_Check(pDX, IDC_CONNECTONSTART, m_ConnectOnStart);
46         DDX_Check(pDX, IDC_LOGTOFILE, m_LogToFile);
47         DDX_Check(pDX, IDC_LOGTOWINDOW, m_LogToWindow);
48         DDX_Text(pDX, IDC_USERNAME, m_UserName);
49         DDX_Text(pDX, IDC_MAXLOGINTIME, m_uMaxLoginTime);
50         DDV_MinMaxUInt(pDX, m_uMaxLoginTime, 1, 300);
51         DDX_Text(pDX, IDC_POWERRESTARTDELAY, m_uMaxPowerRestartDelay);
52         DDV_MinMaxUInt(pDX, m_uMaxPowerRestartDelay, 0, 120);
53         //}}AFX_DATA_MAP
54 }
55
56
57 BEGIN_MESSAGE_MAP(CCommandSettings, CDialog)
58         //{{AFX_MSG_MAP(CCommandSettings)
59         ON_BN_CLICKED(IDH_SETTINGS, OnSettings)
60         ON_BN_CLICKED(IDC_CHECKADVANCED, OnCheckadvanced)
61         //}}AFX_MSG_MAP
62 END_MESSAGE_MAP()
63
64 /////////////////////////////////////////////////////////////////////////////
65 // CCommandSettings message handlers
66
67 void CCommandSettings::OnSettings() 
68 {
69         // TODO: Add your control notification handler code here
70         ::WinHelp(m_hWnd,CWINAFSLOADAPP->m_pszHelpFilePath,HELP_CONTEXT,IDH_SETTINGS);
71         
72 }
73
74 void CCommandSettings::OnCheckadvanced() 
75 {
76         // TODO: Add your control notification handler code here
77         if (m_cCheckAdvanceDisplay.GetCheck()) 
78         {
79                 SetWindowPos(&wndTop,0,0,m_OriginalRect.right-m_OriginalRect.left,m_OriginalRect.bottom-m_OriginalRect.top,SWP_NOMOVE|SWP_NOZORDER);
80         } else {
81                 SetWindowPos(&wndTop,0,0,m_OriginalRect.right-m_OriginalRect.left,m_DialogShrink,SWP_NOMOVE|SWP_NOZORDER);
82         }
83         
84 }
85
86 BOOL CCommandSettings::OnInitDialog() 
87 {
88         CDialog::OnInitDialog();
89         
90         // TODO: Add extra initialization here
91         
92         CRect rect;
93         GetWindowRect(&m_OriginalRect);
94         m_cOptionLine.GetWindowRect(&rect);
95         m_DialogShrink=rect.top-m_OriginalRect.top+5;   //make it above the edit box
96         SetWindowPos(&wndTop,0,0,m_OriginalRect.right-m_OriginalRect.left,m_DialogShrink,SWP_NOMOVE|SWP_NOZORDER);
97         return TRUE;  // return TRUE unless you set the focus to a control
98                       // EXCEPTION: OCX Property Pages should return FALSE
99 }