OpenASIP 2.2
Loading...
Searching...
No Matches
EditAddressSpacesCmd.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 EditAddressSpacesCmd.cc
26 *
27 * Definition of EditAddressSpacesCmd class.
28 *
29 * @author Tommi Rantanen 2004 (tommi.rantanen-no.spam-tut.fi)
30 */
31
32#include <vector>
33#include <wx/docview.h>
34
36#include "ProDeConstants.hh"
38#include "ProDe.hh"
39#include "Model.hh"
40#include "MDFDocument.hh"
41#include "Machine.hh"
42#include "ModelConstants.hh"
43#include "AddressSpace.hh"
44
45using std::string;
46using std::vector;
47
48
49/**
50 * The Constructor.
51 */
55
56
57/**
58 * The Destructor.
59 */
61
62
63/**
64 * Executes the command.
65 *
66 * @return True, if the command was succesfully executed, false otherwise.
67 */
68bool
70
71 assert(parentWindow() != NULL);
72 assert(view() != NULL);
73
74 Model* model = dynamic_cast<MDFDocument*>(
75 view()->GetDocument())->getModel();
76
77 model->pushToStack();
78
80
81 if (dialog.ShowModal() == wxID_OK) {
82 model->notifyObservers();
83 return true;
84 } else {
85 // Cancel button was pressed, address spaces are not modified.
86 model->popFromStack();
87 return false;
88 }
89}
90
91
92/**
93 * Returns id of this command.
94 */
95int
99
100
101/**
102 * Creates and returns a new instance of this command.
103 */
106 return new EditAddressSpacesCmd();
107}
108
109
110
111/**
112 * Returns path to the command's icon file.
113 */
114string
118
119
120/**
121 * Returns short version of the command name.
122 */
123string
127
128
129/**
130 * Returns true when the command is executable, false when not.
131 *
132 * This command is executable when a document is open.
133 *
134 * @return True, if a document is open.
135 */
136bool
138 wxDocManager* manager = wxGetApp().docManager();
139 if (manager->GetCurrentView() != NULL) {
140 return true;
141 }
142 return false;
143}
#define assert(condition)
virtual std::string shortName() const
virtual EditAddressSpacesCmd * create() const
virtual std::string icon() const
wxView * view() const
wxWindow * parentWindow() const
Definition GUICommand.cc:75
Definition Model.hh:50
void pushToStack()
Definition Model.cc:167
void notifyObservers(bool modified=true)
Definition Model.cc:152
void popFromStack(bool modified=false)
Definition Model.cc:195
TTAMachine::Machine * getMachine()
Definition Model.cc:88
static const std::string CMD_ICON_EDIT_ADDRESS_SPACES
Icon location for the "Edit Address Space" command.
static const std::string CMD_SNAME_EDIT_ADDRESS_SPACES
Command name for the "Edit Address Space" command.