OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [testtool/] [win32/] [PlatformsDialog.cpp] - Blame information for rev 174

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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