OpenASIP 2.2
Loading...
Searching...
No Matches
CallExplorerPluginCmd.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 CallExplorerPluginCmd.cc
26 *
27 * Definition of CallExplorerPluginCmd class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <wx/docview.h>
34
35#include "ProDe.hh"
37#include "CallExplorerPlugin.hh"
38#include "ProDeConstants.hh"
39#include "MDFDocument.hh"
40
41using std::string;
42
43/**
44 * The Constructor.
45 */
50
51
52/**
53 * The Destructor.
54 */
56
57
58/**
59 * Executes the command.
60 *
61 * @return True, if the command was succesfully executed, false otherwise.
62 */
63bool
65
66 TTAMachine::Machine* machine = dynamic_cast<MDFDocument*>(
67 view()->GetDocument())->getModel()->getMachine();
68
69 Model* model = dynamic_cast<MDFDocument*>(
70 view()->GetDocument())->getModel();
71
72 model->pushToStack();
73
75
76 if (dialog.ShowModal() == wxID_OK) {
77 model->notifyObservers();
78 return true;
79 } else {
80 model->popFromStack();
81 return false;
82 }
83
84 return true;
85}
86
87
88/**
89 * Returns id of this command.
90 */
91int
95
96
97/**
98 * Creates and returns a new instance of this command.
99 */
104
105
106
107/**
108 * Returns path to the command's icon file.
109 */
110string
114
115
116/**
117 * Returns short version of the command name.
118 */
119string
123
124
125/**
126 * Returns true when the command is executable, false when not.
127 *
128 * This command is executable when a document is open.
129 *
130 * @return True, if a document is open.
131 */
132bool
134 wxDocManager* manager = wxGetApp().docManager();
135 if (manager->GetCurrentView() != NULL) {
136 return true;
137 }
138 return false;
139}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual std::string shortName() const
virtual std::string icon() const
virtual CallExplorerPluginCmd * create() 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
static const std::string CMD_ICON_EXPLORER_PLUGIN
Icon location for the "Explorer plugin" command.
static const std::string CMD_SNAME_EXPLORER_PLUGIN
Command name for the "Call Explorer Plugin" command.