OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [testtool/] [win32/] [RemotePropertiesDialog.cpp] - Blame information for rev 787

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.