comparison host/tools/testtool/win32/RemotePropertiesDialog.cpp @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children 6736c52df507
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 // more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 // RemotePropertiesDialog.cpp : implementation file
26 //
27
28 #include "stdafx.h"
29 #include "RemotePropertiesDialog.h"
30 #include "eCosTestSocket.h"
31
32 #ifdef _DEBUG
33 #define new DEBUG_NEW
34 #undef THIS_FILE
35 static char THIS_FILE[] = __FILE__;
36 #endif
37
38 /////////////////////////////////////////////////////////////////////////////
39 // CRemotePropertiesDialog dialog
40
41
42 CRemotePropertiesDialog::CRemotePropertiesDialog(CWnd* pParent /*=NULL*/)
43 : CeCosDialog(IDD_TT_PROPERTIES3, pParent)
44 {
45 //{{AFX_DATA_INIT(CRemotePropertiesDialog)
46 //}}AFX_DATA_INIT
47 }
48
49
50 void CRemotePropertiesDialog::DoDataExchange(CDataExchange* pDX)
51 {
52 CeCosDialog::DoDataExchange(pDX);
53 if(pDX->m_bSaveAndValidate){
54 m_bFarmed=(TRUE==((CButton *)GetDlgItem(IDC_TT_FARMED))->GetCheck());
55 } else {
56 ((CButton *)GetDlgItem(IDC_TT_FARMED))->SetCheck(m_bFarmed);
57 ((CButton *)GetDlgItem(IDC_TT_EXPLICIT))->SetCheck(!m_bFarmed);
58 }
59 //{{AFX_DATA_MAP(CRemotePropertiesDialog)
60 DDX_Text(pDX, IDC_TT_RESOURCEHOST, m_strResourceHost);
61 DDX_Text(pDX, IDC_TT_RESOURCEPORT, m_nResourcePort);
62 DDX_Text(pDX, IDC_TT_REMOTEHOST, m_strRemoteHost);
63 DDX_Text(pDX, IDC_TT_REMOTEPORT, m_nRemotePort);
64 //}}AFX_DATA_MAP
65 }
66
67
68 BEGIN_MESSAGE_MAP(CRemotePropertiesDialog, CeCosDialog)
69 //{{AFX_MSG_MAP(CRemotePropertiesDialog)
70 ON_BN_CLICKED(IDC_TT_FARMED, OnFarmed)
71 ON_BN_CLICKED(IDC_TT_EXPLICIT, OnExplicit)
72 //}}AFX_MSG_MAP
73 END_MESSAGE_MAP()
74
75 /////////////////////////////////////////////////////////////////////////////
76 // CRemotePropertiesDialog message handlers
77
78 void CRemotePropertiesDialog::OnFarmed()
79 {
80 ((CButton *)GetDlgItem(IDC_TT_EXPLICIT))->SetCheck(FALSE);
81 SetButtons();
82 }
83
84 void CRemotePropertiesDialog::OnExplicit()
85 {
86 ((CButton *)GetDlgItem(IDC_TT_FARMED))->SetCheck(FALSE);
87 SetButtons();
88 }
89
90 void CRemotePropertiesDialog::SetButtons(bool bFromDataExchange)
91 {
92 if(!bFromDataExchange){
93 UpdateData(TRUE);
94 }
95 GetDlgItem(IDC_TT_RESOURCEHOST)->EnableWindow(m_bFarmed);
96 GetDlgItem(IDC_TT_RESOURCEPORT)->EnableWindow(m_bFarmed);
97 GetDlgItem(IDC_TT_REMOTEHOST)->EnableWindow(!m_bFarmed);
98 GetDlgItem(IDC_TT_REMOTEPORT)->EnableWindow(!m_bFarmed);
99 }
100
101 BOOL CRemotePropertiesDialog::OnInitDialog()
102 {
103 CeCosDialog::OnInitDialog();
104
105 SetButtons();
106 return TRUE; // return TRUE unless you set the focus to a control
107 // EXCEPTION: OCX Property Pages should return FALSE
108 }
109
110 void CRemotePropertiesDialog::OnOK()
111 {
112 UpdateData();
113 if(m_bFarmed && !CeCosTestSocket::IsLegalHostPort(CeCosTestSocket::HostPort(m_strResourceHost,m_nResourcePort))){
114 MessageBox(_T("Please provide a valid host/port combination for resource server"));
115 } else if (!m_bFarmed && !CeCosTestSocket::IsLegalHostPort(CeCosTestSocket::HostPort(m_strRemoteHost,m_nRemotePort))){
116 MessageBox(_T("Please provide a valid host/port combination for remote execution"));
117 } else {
118 CeCosDialog::OnOK();
119 }
120
121 }