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 |
|
|
// PlatformsDialog.cpp : implementation file
|
23 |
|
|
//
|
24 |
|
|
|
25 |
|
|
#include "stdafx.h"
|
26 |
|
|
#include "testtool.h"
|
27 |
|
|
#include "PLatformsDialog.h"
|
28 |
|
|
#include "PlatformDialog.h"
|
29 |
|
|
|
30 |
|
|
#ifdef _DEBUG
|
31 |
|
|
#define new DEBUG_NEW
|
32 |
|
|
#undef THIS_FILE
|
33 |
|
|
static char THIS_FILE[] = __FILE__;
|
34 |
|
|
#endif
|
35 |
|
|
|
36 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
37 |
|
|
// CPlatformsDialog dialog
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
CPlatformsDialog::CPlatformsDialog(CWnd* pParent /*=NULL*/)
|
41 |
|
|
: CeCosDialog(CPlatformsDialog::IDD, pParent)
|
42 |
|
|
{
|
43 |
|
|
//{{AFX_DATA_INIT(CPlatformsDialog)
|
44 |
|
|
// NOTE: the ClassWizard will add member initialization here
|
45 |
|
|
//}}AFX_DATA_INIT
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
void CPlatformsDialog::DoDataExchange(CDataExchange* pDX)
|
50 |
|
|
{
|
51 |
|
|
CeCosDialog::DoDataExchange(pDX);
|
52 |
|
|
//{{AFX_DATA_MAP(CPlatformsDialog)
|
53 |
|
|
DDX_Control(pDX, IDC_TT_PLATFORM_LIST, m_List);
|
54 |
|
|
//}}AFX_DATA_MAP
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
BEGIN_MESSAGE_MAP(CPlatformsDialog, CeCosDialog)
|
59 |
|
|
//{{AFX_MSG_MAP(CPlatformsDialog)
|
60 |
|
|
ON_BN_CLICKED(IDC_TT_ADD_PLATFORM, OnAddPlatform)
|
61 |
|
|
ON_BN_CLICKED(IDC_TT_DELETE_PLATFORM, OnDeletePlatform)
|
62 |
|
|
ON_NOTIFY(NM_DBLCLK, IDC_TT_PLATFORM_LIST, OnDblclkPlatformList)
|
63 |
|
|
ON_BN_CLICKED(IDC_TT_MODIFY_PLATFORM, OnModifyPlatform)
|
64 |
|
|
ON_NOTIFY(LVN_KEYDOWN, IDC_TT_PLATFORM_LIST, OnKeydownPlatformList)
|
65 |
|
|
ON_NOTIFY(LVN_ITEMCHANGED, IDC_TT_PLATFORM_LIST, OnItemchangedPlatformList)
|
66 |
|
|
//}}AFX_MSG_MAP
|
67 |
|
|
END_MESSAGE_MAP()
|
68 |
|
|
|
69 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
70 |
|
|
// CPlatformsDialog message handlers
|
71 |
|
|
const LPCTSTR CPlatformsDialog::arpszTypes[]={
|
72 |
|
|
_T("Hardware with breakpoint support"),
|
73 |
|
|
_T("Simulator"),
|
74 |
|
|
_T("Synthetic target"),
|
75 |
|
|
_T("Hardware without breakpoint support"),
|
76 |
|
|
_T("Remote simulator")
|
77 |
|
|
};
|
78 |
|
|
|
79 |
|
|
BOOL CPlatformsDialog::OnInitDialog()
|
80 |
|
|
{
|
81 |
|
|
CeCosDialog::OnInitDialog();
|
82 |
|
|
|
83 |
|
|
ListView_SetExtendedListViewStyle(m_List.GetSafeHwnd(),LVS_EX_FULLROWSELECT);
|
84 |
|
|
|
85 |
|
|
m_List.InsertColumn(0,_T("Target"));
|
86 |
|
|
m_List.InsertColumn(1,_T("Prefix"));
|
87 |
|
|
m_List.InsertColumn(2,_T("Commands"));
|
88 |
|
|
m_List.InsertColumn(3,_T("Inferior"));
|
89 |
|
|
m_List.InsertColumn(4,_T("Prompt"));
|
90 |
|
|
m_List.InsertColumn(5,_T("ServerSideGdb"));
|
91 |
|
|
for(unsigned int i=0;i<CeCosTestPlatform::Count();i++){
|
92 |
|
|
Add(*CeCosTestPlatform::Get(i));
|
93 |
|
|
}
|
94 |
|
|
CRect rect;
|
95 |
|
|
m_List.GetClientRect(rect);
|
96 |
|
|
m_List.SetColumnWidth(0,rect.Width()/6);
|
97 |
|
|
m_List.SetColumnWidth(1,rect.Width()/6);
|
98 |
|
|
m_List.SetColumnWidth(2,rect.Width()/6);
|
99 |
|
|
m_List.SetColumnWidth(3,rect.Width()/6);
|
100 |
|
|
m_List.SetColumnWidth(4,rect.Width()/6);
|
101 |
|
|
m_List.SetColumnWidth(5,rect.Width()/6);
|
102 |
|
|
|
103 |
|
|
bool bSel=(NULL!=m_List.GetFirstSelectedItemPosition());
|
104 |
|
|
GetDlgItem(IDC_TT_MODIFY_PLATFORM)->EnableWindow(bSel);
|
105 |
|
|
GetDlgItem(IDC_TT_DELETE_PLATFORM)->EnableWindow(bSel);
|
106 |
|
|
|
107 |
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
108 |
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
void CPlatformsDialog::OnAddPlatform()
|
112 |
|
|
{
|
113 |
|
|
CPlatformDialog dlg;
|
114 |
|
|
if(IDOK==dlg.DoModal()){
|
115 |
|
|
LVFINDINFO fi;
|
116 |
|
|
fi.flags=LVFI_STRING;
|
117 |
|
|
fi.psz=dlg.m_strPlatform;
|
118 |
|
|
if(-1==m_List.FindItem(&fi)){
|
119 |
|
|
Add(CeCosTestPlatform(dlg.m_strPlatform,dlg.m_strPrefix,dlg.m_strPrompt,dlg.m_strGDB,dlg.m_bServerSideGdb,dlg.m_strInferior));
|
120 |
|
|
} else {
|
121 |
|
|
MessageBox(_T("That platform name is already in use."));
|
122 |
|
|
}
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
void CPlatformsDialog::OnDeletePlatform()
|
127 |
|
|
{
|
128 |
|
|
POSITION pos = m_List.GetFirstSelectedItemPosition();
|
129 |
|
|
if(pos){
|
130 |
|
|
int nIndex= m_List.GetNextSelectedItem(pos);
|
131 |
|
|
|
132 |
|
|
if(IDYES==MessageBox(_T("Are you sure you wish to delete this platform?"),_T("Delete"),MB_YESNO)){
|
133 |
|
|
delete Platform(nIndex);
|
134 |
|
|
m_List.DeleteItem(nIndex);
|
135 |
|
|
m_arTargetInfo.RemoveAt(nIndex);
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
void CPlatformsDialog::Add(const CeCosTestPlatform &ti)
|
141 |
|
|
{
|
142 |
|
|
int i=m_List.GetItemCount();
|
143 |
|
|
m_List.InsertItem(i,ti.Name());
|
144 |
|
|
m_List.SetItemText(i,1,ti.Prefix());
|
145 |
|
|
m_List.SetItemText(i,2,ti.GdbCmds());
|
146 |
|
|
m_List.SetItemText(i,3,ti.Inferior());
|
147 |
|
|
m_List.SetItemText(i,4,ti.Prompt());
|
148 |
|
|
m_List.SetItemText(i,5,ti.ServerSideGdb()?_T("y"):_T("n"));
|
149 |
|
|
m_arTargetInfo.Add(new CeCosTestPlatform(ti));
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
void CPlatformsDialog::OnDblclkPlatformList(NMHDR*, LRESULT* pResult)
|
153 |
|
|
{
|
154 |
|
|
OnModifyPlatform();
|
155 |
|
|
*pResult = 0;
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
void CPlatformsDialog::OnModifyPlatform()
|
159 |
|
|
{
|
160 |
|
|
POSITION pos = m_List.GetFirstSelectedItemPosition();
|
161 |
|
|
if(pos){
|
162 |
|
|
int nIndex= m_List.GetNextSelectedItem(pos);
|
163 |
|
|
CeCosTestPlatform *pti=Platform(nIndex);
|
164 |
|
|
CPlatformDialog dlg;
|
165 |
|
|
dlg.m_strPlatform=pti->Name();
|
166 |
|
|
dlg.m_strPrefix=pti->Prefix();
|
167 |
|
|
dlg.m_strGDB=pti->GdbCmds();
|
168 |
|
|
dlg.m_strCaption=_T("Modify");
|
169 |
|
|
dlg.m_strPrompt=pti->Prompt();
|
170 |
|
|
dlg.m_bServerSideGdb=pti->ServerSideGdb();
|
171 |
|
|
dlg.m_strInferior=pti->Inferior();
|
172 |
|
|
if(IDCANCEL!=dlg.DoModal()){
|
173 |
|
|
*pti=CeCosTestPlatform(dlg.m_strPlatform,dlg.m_strPrefix,dlg.m_strPrompt,dlg.m_strGDB,dlg.m_bServerSideGdb,dlg.m_strInferior);
|
174 |
|
|
m_List.SetItemText(nIndex,1,pti->Prefix());
|
175 |
|
|
m_List.SetItemText(nIndex,2,pti->GdbCmds());
|
176 |
|
|
m_List.SetItemText(nIndex,3,pti->Inferior());
|
177 |
|
|
m_List.SetItemText(nIndex,4,pti->Prompt());
|
178 |
|
|
m_List.SetItemText(nIndex,5,pti->ServerSideGdb()?_T("Y"):_T("N"));
|
179 |
|
|
}
|
180 |
|
|
}
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
void CPlatformsDialog::OnKeydownPlatformList(NMHDR* pNMHDR, LRESULT* pResult)
|
184 |
|
|
{
|
185 |
|
|
LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
|
186 |
|
|
if(VK_DELETE==pLVKeyDow->wVKey){
|
187 |
|
|
OnDeletePlatform();
|
188 |
|
|
}
|
189 |
|
|
*pResult = 0;
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
void CPlatformsDialog::OnItemchangedPlatformList(NMHDR* pNMHDR, LRESULT* pResult)
|
193 |
|
|
{
|
194 |
|
|
//NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
195 |
|
|
bool bSel=(NULL!=m_List.GetFirstSelectedItemPosition());
|
196 |
|
|
GetDlgItem(IDC_TT_MODIFY_PLATFORM)->EnableWindow(bSel);
|
197 |
|
|
GetDlgItem(IDC_TT_DELETE_PLATFORM)->EnableWindow(bSel);
|
198 |
|
|
*pResult = 0;
|
199 |
|
|
}
|