OpenASIP
2.0
src
procgen
ProDe
AddRFFromHDBCmd.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 AddRFFromHDBCmd.cc
26
*
27
* Definition of AddRFFromHDBCmd 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 "
AddRFFromHDBCmd.hh
"
36
#include "
ProDeConstants.hh
"
37
#include "
AddRFFromHDBDialog.hh
"
38
#include "
ProDe.hh
"
39
#include "
Model.hh
"
40
#include "
MDFDocument.hh
"
41
42
using
std::string;
43
44
45
/**
46
* The Constructor.
47
*/
48
AddRFFromHDBCmd::AddRFFromHDBCmd
():
49
EditorCommand
(
ProDeConstants
::CMD_NAME_ADD_RF_FROM_HDB) {
50
}
51
52
53
/**
54
* The Destructor.
55
*/
56
AddRFFromHDBCmd::~AddRFFromHDBCmd
() {}
57
58
59
/**
60
* Executes the command.
61
*
62
* @return True, if the command was succesfully executed, false otherwise.
63
*/
64
bool
65
AddRFFromHDBCmd::Do
() {
66
67
assert
(
parentWindow
() != NULL);
68
assert
(
view
() != NULL);
69
70
Model
* model =
dynamic_cast<
MDFDocument
*
>
(
71
view
()->GetDocument())->getModel();
72
73
74
AddRFFromHDBDialog
dialog(
parentWindow
(), model);
75
76
dialog.ShowModal();
77
return
true
;
78
}
79
80
81
/**
82
* Returns id of this command.
83
*/
84
int
85
AddRFFromHDBCmd::id
()
const
{
86
return
ProDeConstants::COMMAND_ADD_RF_FROM_HDB
;
87
}
88
89
90
/**
91
* Creates and returns a new instance of this command.
92
*/
93
AddRFFromHDBCmd
*
94
AddRFFromHDBCmd::create
()
const
{
95
return
new
AddRFFromHDBCmd
();
96
}
97
98
99
100
/**
101
* Returns path to the command's icon file.
102
*/
103
string
104
AddRFFromHDBCmd::icon
()
const
{
105
return
ProDeConstants::CMD_ICON_DEFAULT
;
106
}
107
108
109
/**
110
* Returns short version of the command name.
111
*/
112
string
113
AddRFFromHDBCmd::shortName
()
const
{
114
return
ProDeConstants::CMD_SNAME_ADD_RF_FROM_HDB
;
115
}
116
117
118
/**
119
* Returns true when the command is executable, false when not.
120
*
121
* This command is executable when a document is open.
122
*
123
* @return True, if a document is open.
124
*/
125
bool
126
AddRFFromHDBCmd::isEnabled
() {
127
wxDocManager* manager = wxGetApp().docManager();
128
if
(manager->GetCurrentView() != NULL) {
129
return
true
;
130
}
131
return
false
;
132
}
ProDe.hh
MDFDocument.hh
AddRFFromHDBCmd::Do
virtual bool Do()
Definition:
AddRFFromHDBCmd.cc:65
AddRFFromHDBCmd.hh
assert
#define assert(condition)
Definition:
Application.hh:86
AddRFFromHDBCmd::shortName
virtual std::string shortName() const
Definition:
AddRFFromHDBCmd.cc:113
AddRFFromHDBDialog.hh
AddRFFromHDBCmd::create
virtual AddRFFromHDBCmd * create() const
Definition:
AddRFFromHDBCmd.cc:94
EditorCommand::view
wxView * view() const
Definition:
EditorCommand.cc:76
AddRFFromHDBDialog
Definition:
AddRFFromHDBDialog.hh:64
Model.hh
AddRFFromHDBCmd::icon
virtual std::string icon() const
Definition:
AddRFFromHDBCmd.cc:104
AddRFFromHDBCmd
Definition:
AddRFFromHDBCmd.hh:41
MDFDocument
Definition:
MDFDocument.hh:51
ProDeConstants.hh
ProDeConstants::CMD_ICON_DEFAULT
static const std::string CMD_ICON_DEFAULT
Icon path for default icon of commands.
Definition:
ProDeConstants.hh:286
Model
Definition:
Model.hh:50
AddRFFromHDBCmd::id
virtual int id() const
Definition:
AddRFFromHDBCmd.cc:85
AddRFFromHDBCmd::AddRFFromHDBCmd
AddRFFromHDBCmd()
Definition:
AddRFFromHDBCmd.cc:48
AddRFFromHDBCmd::~AddRFFromHDBCmd
virtual ~AddRFFromHDBCmd()
Definition:
AddRFFromHDBCmd.cc:56
EditorCommand
Definition:
EditorCommand.hh:46
ProDeConstants::CMD_SNAME_ADD_RF_FROM_HDB
static const std::string CMD_SNAME_ADD_RF_FROM_HDB
Short command name for the "Add RF from hdb" command.
Definition:
ProDeConstants.hh:222
ProDeConstants
Definition:
ProDeConstants.hh:43
AddRFFromHDBCmd::isEnabled
virtual bool isEnabled()
Definition:
AddRFFromHDBCmd.cc:126
ProDeConstants::COMMAND_ADD_RF_FROM_HDB
@ COMMAND_ADD_RF_FROM_HDB
Definition:
ProDeConstants.hh:426
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition:
GUICommand.cc:75
Generated by
1.8.17