1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // RemotePropertiesDialog.cpp : implementation file
29 #include "RemotePropertiesDialog.h"
30 #include "eCosSocket.h"
35 static char THIS_FILE[] = __FILE__;
38 /////////////////////////////////////////////////////////////////////////////
39 // CRemotePropertiesDialog dialog
42 CRemotePropertiesDialog::CRemotePropertiesDialog(CWnd* pParent /*=NULL*/)
43 : CeCosDialog(IDD_TT_PROPERTIES3, pParent)
45 //{{AFX_DATA_INIT(CRemotePropertiesDialog)
50 void CRemotePropertiesDialog::DoDataExchange(CDataExchange* pDX)
52 CeCosDialog::DoDataExchange(pDX);
53 if(pDX->m_bSaveAndValidate){
54 m_bFarmed=(TRUE==((CButton *)GetDlgItem(IDC_TT_FARMED))->GetCheck());
56 ((CButton *)GetDlgItem(IDC_TT_FARMED))->SetCheck(m_bFarmed);
57 ((CButton *)GetDlgItem(IDC_TT_EXPLICIT))->SetCheck(!m_bFarmed);
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);
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)
75 /////////////////////////////////////////////////////////////////////////////
76 // CRemotePropertiesDialog message handlers
78 void CRemotePropertiesDialog::OnFarmed()
80 ((CButton *)GetDlgItem(IDC_TT_EXPLICIT))->SetCheck(FALSE);
84 void CRemotePropertiesDialog::OnExplicit()
86 ((CButton *)GetDlgItem(IDC_TT_FARMED))->SetCheck(FALSE);
90 void CRemotePropertiesDialog::SetButtons(bool bFromDataExchange)
92 if(!bFromDataExchange){
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);
101 BOOL CRemotePropertiesDialog::OnInitDialog()
103 CeCosDialog::OnInitDialog();
106 return TRUE; // return TRUE unless you set the focus to a control
107 // EXCEPTION: OCX Property Pages should return FALSE
110 void CRemotePropertiesDialog::OnOK()
113 if(m_bFarmed && !CeCosSocket::IsLegalHostPort(CeCosSocket::HostPort(m_strResourceHost,m_nResourcePort))){
114 MessageBox(_T("Please provide a valid host/port combination for resource server"));
115 } else if (!m_bFarmed && !CeCosSocket::IsLegalHostPort(CeCosSocket::HostPort(m_strRemoteHost,m_nRemotePort))){
116 MessageBox(_T("Please provide a valid host/port combination for remote execution"));