OpenASIP 2.2
Loading...
Searching...
No Matches
AddBreakpointDialog.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 AddBreakpointDialog.cc
26 *
27 * Implementation of AddBreakpointDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34#include <wx/statline.h>
36#include "ProximToolbox.hh"
37#include "Exception.hh"
38#include "ProximLineReader.hh"
39#include "Conversion.hh"
40#include "WxConversion.hh"
41#include "ErrorDialog.hh"
42#include "ProximConstants.hh"
43#include "Proxim.hh"
44
45BEGIN_EVENT_TABLE(AddBreakpointDialog, wxDialog)
48
49/**
50 * The Constructor.
51 *
52 * @paran parent Parent window of the dialog.
53 * @param id Identifier of the window.
54 */
55AddBreakpointDialog::AddBreakpointDialog(wxWindow* parent, wxWindowID id) :
56 wxDialog(parent, id, _T("Add Breakpoint"), wxDefaultPosition) {
57
58 createContents(this, true, true);
59}
60
61/**
62 * The Destructor.
63 */
66
67
68/**
69 * Event handler for the OK-button.
70 *
71 * Adds a breakpoint at the address defined in the address field.
72 */
73void
74AddBreakpointDialog::onOK(wxCommandEvent&) {
75
76 wxString addressString =
77 dynamic_cast<wxTextCtrl*>(FindWindow(ID_ADDRESS))->GetValue();
78
79 unsigned address = 0;
80 try {
81 address =
83 } catch (NumberFormatException& e) {
84 wxString message = _T("Invalid address");
85 ErrorDialog errorDialog(this, message);
86 errorDialog.ShowModal();
87 return;
88 }
89 std::string command = ProximConstants::SCL_SET_BREAKPOINT + " " +
90 Conversion::toString(address);
92 EndModal(wxID_OK);
93}
94
95/**
96 * Creates the dialog widgets.
97 */
98wxSizer*
100 wxWindow *parent, bool call_fit, bool set_sizer) {
101
102 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
103
104 wxStaticText *item1 = new wxStaticText( parent, ID_LABEL_NEW_BP, wxT("Set Breakpoint at"), wxDefaultPosition, wxDefaultSize, 0 );
105 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
106
107 wxTextCtrl *item2 = new wxTextCtrl( parent, ID_ADDRESS, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
108 item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
109
110 wxStaticLine *item3 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
111 item0->Add( item3, 0, wxGROW|wxALL, 5 );
112
113 wxGridSizer *item4 = new wxGridSizer( 2, 0, 0 );
114
115 wxButton *item5 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
116 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
117
118 wxButton *item6 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
119 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
120
121 item0->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
122
123 if (set_sizer)
124 {
125 parent->SetSizer( item0 );
126 if (call_fit)
127 item0->SetSizeHints( parent );
128 }
129
130 return item0;
131}
END_EVENT_TABLE() using namespace IDF
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
void onOK(wxCommandEvent &event)
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
static std::string toString(const T &source)
static unsigned int toUnsignedInt(const T &source)
static const std::string SCL_SET_BREAKPOINT
Command for setting breakpoints in the simulator control language.
void input(std::string command)
static ProximLineReader & lineReader()
static std::string toString(const wxString &source)