]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/testtool/win32/PlatformDialog.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / testtool / win32 / PlatformDialog.cpp
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 // PlatformDialog.cpp : implementation file
26 //
27
28 #include "stdafx.h"
29 #include "eCosTest.h"
30 #include "testtool.h"
31 #include "PlatformDialog.h"
32
33 #ifdef _DEBUG
34 #define new DEBUG_NEW
35 #undef THIS_FILE
36 static char THIS_FILE[] = __FILE__;
37 #endif
38
39 /////////////////////////////////////////////////////////////////////////////
40 // CPlatformDialog dialog
41
42
43 CPlatformDialog::CPlatformDialog(CWnd* pParent /*=NULL*/)
44         : CeCosDialog(CPlatformDialog::IDD, pParent)
45 {
46         //{{AFX_DATA_INIT(CPlatformDialog)
47         m_strPlatform=_T("");
48         m_strPrefix=_T("");
49         m_strGDB=_T("");
50         m_strInferior = _T("");
51         m_strPrompt = _T("");
52         m_bServerSideGdb = FALSE;
53         //}}AFX_DATA_INIT
54 }
55
56
57 void CPlatformDialog::DoDataExchange(CDataExchange* pDX)
58 {
59         CeCosDialog::DoDataExchange(pDX);
60         //{{AFX_DATA_MAP(CPlatformDialog)
61   DDX_Text(pDX, IDC_TT_NEW_PLATFORM, m_strPlatform);
62   DDX_Text(pDX, IDC_TT_NEW_PLATFORM_PREFIX, m_strPrefix);
63   DDX_Text(pDX, IDC_TT_NEW_PLATFORM_GDB, m_strGDB);
64         DDX_Text(pDX, IDC_INFERIOR, m_strInferior);
65         DDX_Text(pDX, IDC_PROMPT, m_strPrompt);
66         DDX_Check(pDX, IDC_SERVER_SIDE_GDB, m_bServerSideGdb);
67         //}}AFX_DATA_MAP
68 }
69
70
71 BEGIN_MESSAGE_MAP(CPlatformDialog, CeCosDialog)
72         //{{AFX_MSG_MAP(CPlatformDialog)
73         ON_CBN_EDITCHANGE(IDC_TT_NEW_PLATFORM_PREFIX, OnChangeNewPlatformPrefix)
74         ON_EN_CHANGE(IDC_TT_NEW_PLATFORM, OnChangeNewPlatform)
75         //}}AFX_MSG_MAP
76 END_MESSAGE_MAP()
77
78 /////////////////////////////////////////////////////////////////////////////
79 // CPlatformDialog message handlers
80
81 BOOL CPlatformDialog::OnInitDialog()
82 {
83   m_strGDB.Replace(_T(";"),_T("\r\n"));
84   CeCosDialog::OnInitDialog();
85
86   SetWindowText(m_strCaption);
87   if(!m_strPlatform.IsEmpty()){
88     SetDlgItemText(IDC_TT_NEW_PLATFORM,m_strPlatform);
89     GetDlgItem(IDC_TT_NEW_PLATFORM)->EnableWindow(false);
90   }
91   CMapStringToPtr map;
92   for(unsigned int i=0;i<CeCosTestPlatform::Count();i++){
93     map.SetAt(CeCosTestPlatform::Get(i)->Prefix(),this);
94   }
95   for(POSITION pos = map.GetStartPosition(); pos != NULL; ){
96     void *p;
97     CString str;
98     map.GetNextAssoc(pos, str, p);
99     ((CComboBox *)GetDlgItem(IDC_TT_NEW_PLATFORM_PREFIX))->AddString(str);
100   }
101
102   GetDlgItem(IDOK)->EnableWindow(!m_strPlatform.IsEmpty() && !m_strPrefix.IsEmpty());
103
104   return true;
105 }
106
107 void CPlatformDialog::OnChangeNewPlatformPrefix() 
108 {
109   UpdateData(true);
110   GetDlgItem(IDOK)->EnableWindow(!m_strPlatform.IsEmpty() && !m_strPrefix.IsEmpty());
111 }
112
113 void CPlatformDialog::OnChangeNewPlatform() 
114 {
115   UpdateData(true);
116   GetDlgItem(IDOK)->EnableWindow(!m_strPlatform.IsEmpty() && !m_strPrefix.IsEmpty());
117 }
118
119 void CPlatformDialog::OnOK() 
120 {
121         UpdateData(TRUE);
122   m_strGDB.Replace(_T("\r\n"),_T(";"));
123         EndDialog(IDOK);
124 }