OpenASIP 2.2
Loading...
Searching...
No Matches
SimulationInfoDialog.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file SimulationInfoDialog.cc
26 *
27 * Definition of SimulationInfoDialog class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <boost/format.hpp>
34#include <string>
35
37#include "WidgetTools.hh"
38#include "GUITextGenerator.hh"
39#include "OSEdTextGenerator.hh"
41#include "OperationContext.hh"
42#include "WxConversion.hh"
43#include "DialogPosition.hh"
44#include "OSEdConstants.hh"
45
46using boost::format;
47using std::string;
48
49/**
50 * Constructor.
51 *
52 * @param parent Parent window.
53 * @param context Operation context.
54 */
56 wxWindow* parent,
57 OperationContext* context) :
58 wxDialog(parent, -1, _T(""),
59 DialogPosition::getPosition(DialogPosition::DIALOG_SIMULATION_INFO),
60 wxSize(400, 150), wxRESIZE_BORDER), context_(context) {
61
62 createContents(this, false, true);
63
64 parent_ = dynamic_cast<SimulateDialog*>(parent);
65
66 infoList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_LISTCTRL));
67 infoList_->InsertColumn(0, _T(""), wxLIST_FORMAT_LEFT,
69 infoList_->InsertColumn(1, _T(""), wxLIST_FORMAT_LEFT,
71
73
74 format fmt = texts.text(OSEdTextGenerator::TXT_LABEL_PC);
75 infoList_->InsertItem(0, WxConversion::toWxString(fmt.str()));
76
78 infoList_->InsertItem(1, WxConversion::toWxString(fmt.str()));
79
81 infoList_->InsertItem(2, WxConversion::toWxString(fmt.str()));
82
84 infoList_->InsertItem(3, WxConversion::toWxString(fmt.str()));
85
86 setTexts();
87}
88
89/**
90 * Sets the texts for the widgets.
91 */
92void
94
96
97 // title
98 format fmt =
100 SetTitle(WxConversion::toWxString(fmt.str()));
101
102}
103
104
105/**
106 * Destructor.
107 */
109 int x, y;
110 GetPosition(&x, &y);
111 wxPoint point(x, y);
113}
114
115/**
116 * Transfer data to dialog.
117 *
118 * @return True if transfer is successful.
119 */
120bool
122 updateList();
123 return wxWindow::TransferDataToWindow();
124}
125
126/**
127 * Updates the list of information.
128 */
129void
131#if 0
133 infoList_->SetItem(0, 1, WxConversion::toWxString(0));
134 } else {
135 SimValue& value = context_->programCounter();
136 string valueString = parent_->formattedValue(&value);
137 infoList_->SetItem(0, 1, WxConversion::toWxString(valueString));
138 }
139#endif
140 infoList_->SetItem(
142
143#if 0
145 infoList_->SetItem(1, 1, WxConversion::toWxString(0));
146 } else {
147 SimValue& value = context_->returnAddress();
148 string valueString = parent_->formattedValue(&value);
149 infoList_->SetItem(1, 1, WxConversion::toWxString(valueString));
150 }
151#endif
152 infoList_->SetItem(
153 1, 1,
155}
156
157/**
158 * Updates the list which contains information about simulation.
159 *
160 * This method is called when trigger button is pushed in parent dialog
161 * (SimulateDialog).
162 *
163 * @param id The id of the event.
164 */
165void
167 switch (id) {
169 updateList();
170 break;
173 context_->returnAddress() = 0;
174 updateList();
175 break;
176 default:
177 break;
178 }
179}
180
181/**
182 * Creates the contents of the dialog.
183 *
184 * NOTE! This function was generated by wxDesigner.
185 *
186 * @param parent Parent window.
187 * @param call_fit If true fits the contenst inside the dialog.
188 * @param set_sizer If true sets the main sizer as dialog contents.
189 * @return The created sizer.
190 */
191wxSizer*
193 wxWindow* parent,
194 bool call_fit,
195 bool set_sizer ) {
196
197 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
198
199 wxListCtrl *item1 = new wxListCtrl( parent, ID_LISTCTRL, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER );
200 item0->Add( item1, 1, wxGROW|wxALL, 5 );
201
202 if (set_sizer)
203 {
204 parent->SetSizer( item0 );
205 if (call_fit)
206 item0->SetSizeHints( parent );
207 }
208
209 return item0;
210}
static void setPosition(Dialogs dialog, wxPoint point)
@ DIALOG_SIMULATION_INFO
Simulation info dialog.
static SimValue & instance()
Definition SimValue.cc:1642
static const int DEFAULT_COLUMN_WIDTH
Default column width.
@ EVENT_REGISTER
Event when register value might change.
@ EVENT_RESET
Event when operation is reseted.
static OSEdTextGenerator & instance()
@ TXT_LABEL_SYS_CALL_NUMBER
Sys call number label.
@ TXT_LABEL_RA
Return address label.
@ TXT_LABEL_PC
Program counter label.
@ TXT_LABEL_SYS_CALL_HANDLER
Sys call handler label.
@ TXT_SIMULATION_INFO_DIALOG_TITLE
Simulation info dialog title.
SimValue & returnAddress()
InstructionAddress & programCounter()
UIntWord uIntWordValue() const
Definition SimValue.cc:972
std::string formattedValue(SimValue *value)
OperationContext * context_
Operation context for retrieving simulation data.
SimulationInfoDialog(wxWindow *parent, OperationContext *context)
wxListCtrl * infoList_
List for showing simulation statistics.
virtual void handleEvent(OSEdInformer::EventId id)
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
SimulateDialog * parent_
Parent window.
virtual bool TransferDataToWindow()
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)