OpenASIP
2.0
src
procgen
HDBEditor
AddFUEntryCmd.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 AddFUEntryCmd.cc
26
*
27
* Implementation of AddFUEntryCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
AddFUEntryCmd.hh
"
34
#include "
WxConversion.hh
"
35
#include "
HDBEditorConstants.hh
"
36
#include "
HDBEditor.hh
"
37
#include "
HDBEditorMainFrame.hh
"
38
#include "
DBTypes.hh
"
39
#include "
HDBManager.hh
"
40
#include "
HDBBrowserWindow.hh
"
41
42
/**
43
* The Constructor.
44
*/
45
AddFUEntryCmd::AddFUEntryCmd
() :
46
GUICommand
(
HDBEditorConstants
::COMMAND_NAME_ADD_FU_ENTRY, NULL) {
47
}
48
49
50
/**
51
* The Destructor.
52
*/
53
AddFUEntryCmd::~AddFUEntryCmd
() {
54
}
55
56
/**
57
* Executes the command.
58
*/
59
bool
60
AddFUEntryCmd::Do
() {
61
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
62
63
if
(manager == NULL) {
64
return
false
;
65
}
66
67
RowID
id
= manager->
addFUEntry
();
68
69
wxGetApp().mainFrame().update();
70
wxGetApp().mainFrame().browser()->selectFUEntry(
id
);
71
72
return
true
;
73
}
74
75
/**
76
* Returns name of the command icon file.
77
*
78
* @return Command icon file name.
79
*/
80
std::string
81
AddFUEntryCmd::icon
()
const
{
82
return
""
;
83
}
84
85
/**
86
* Returns command id.
87
*
88
* @return Command identifier.
89
*/
90
int
91
AddFUEntryCmd::id
()
const
{
92
return
HDBEditorConstants::COMMAND_ADD_FU_ENTRY
;
93
}
94
95
96
/**
97
* Creates a new instance of this command.
98
*
99
* @return Newly created instance of this command.
100
*/
101
AddFUEntryCmd
*
102
AddFUEntryCmd::create
()
const
{
103
return
new
AddFUEntryCmd
();
104
}
105
106
107
/**
108
* Returns true if the command should be enabled in the menu/toolbar.
109
*
110
* @return True if the command is enabled, false if not.
111
*/
112
bool
113
AddFUEntryCmd::isEnabled
() {
114
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
115
116
if
(manager == NULL) {
117
return
false
;
118
}
119
120
return
true
;
121
}
HDBBrowserWindow.hh
AddFUEntryCmd::create
virtual AddFUEntryCmd * create() const
Definition:
AddFUEntryCmd.cc:102
HDBEditor.hh
HDBEditorConstants.hh
RowID
int RowID
Type definition of row ID in relational databases.
Definition:
DBTypes.hh:37
AddFUEntryCmd
Definition:
AddFUEntryCmd.hh:41
DBTypes.hh
GUICommand
Definition:
GUICommand.hh:43
AddFUEntryCmd::Do
virtual bool Do()
Definition:
AddFUEntryCmd.cc:60
AddFUEntryCmd.hh
HDBEditorMainFrame.hh
HDB::HDBManager
Definition:
HDBManager.hh:82
HDB::HDBManager::addFUEntry
RowID addFUEntry() const
Definition:
HDBManager.cc:1014
AddFUEntryCmd::AddFUEntryCmd
AddFUEntryCmd()
Definition:
AddFUEntryCmd.cc:45
AddFUEntryCmd::isEnabled
virtual bool isEnabled()
Definition:
AddFUEntryCmd.cc:113
AddFUEntryCmd::id
virtual int id() const
Definition:
AddFUEntryCmd.cc:91
HDBEditorConstants
Definition:
HDBEditorConstants.hh:42
AddFUEntryCmd::icon
virtual std::string icon() const
Definition:
AddFUEntryCmd.cc:81
HDBEditorConstants::COMMAND_ADD_FU_ENTRY
@ COMMAND_ADD_FU_ENTRY
Definition:
HDBEditorConstants.hh:53
WxConversion.hh
AddFUEntryCmd::~AddFUEntryCmd
virtual ~AddFUEntryCmd()
Definition:
AddFUEntryCmd.cc:53
HDBManager.hh
Generated by
1.8.17