OpenASIP
2.2
Loading...
Searching...
No Matches
src
procgen
ProDe
SelectCmd.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 SelectCmd.cc
26
*
27
* Definition of SelectCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
SelectCmd.hh
"
34
#include "
SelectTool.hh
"
35
#include "
MDFView.hh
"
36
#include "
ProDe.hh
"
37
#include "
ProDeConstants.hh
"
38
#include "
MachineCanvas.hh
"
39
40
using
std::string;
41
42
/**
43
* The Constructor.
44
*/
45
SelectCmd::SelectCmd
():
46
EditorCommand
(
ProDeConstants
::CMD_NAME_SELECT) {
47
48
}
49
50
51
/**
52
* The Destructor.
53
*/
54
SelectCmd::~SelectCmd
() {
55
}
56
57
58
/**
59
* Executes the command.
60
*
61
* @return True, if the command was succesfully executed, false otherwise.
62
*/
63
bool
64
SelectCmd::Do
() {
65
MDFView
* mdfView =
dynamic_cast<
MDFView
*
>
(
view
());
66
ChildFrame
* frame =
dynamic_cast<
ChildFrame
*
>
(mdfView->GetFrame());
67
assert
(frame != NULL);
68
mdfView->
clearSelection
();
69
SelectTool
* tool =
new
SelectTool
(frame, mdfView);
70
mdfView->
canvas
()->
setTool
(tool);
71
return
true
;
72
}
73
74
75
/**
76
* Returns id of this command.
77
*
78
* @return ID for this command to be used in menus and toolbars.
79
*/
80
int
81
SelectCmd::id
()
const
{
82
return
ProDeConstants::COMMAND_SELECT
;
83
}
84
85
86
/**
87
* Creates and returns a new instance of this command.
88
*
89
* @return Newly created instance of this command.
90
*/
91
SelectCmd
*
92
SelectCmd::create
()
const
{
93
return
new
SelectCmd
();
94
}
95
96
97
/**
98
* Returns path to the command's icon file.
99
*
100
* @return Full path to the command's icon file.
101
*/
102
string
103
SelectCmd::icon
()
const
{
104
return
ProDeConstants::CMD_ICON_SELECT
;
105
}
106
107
108
/**
109
* Returns true when the command is executable, false when not.
110
*
111
* This command is executable when a document is open.
112
*
113
* @return True, if a document is open.
114
*/
115
bool
116
SelectCmd::isEnabled
() {
117
wxDocManager* manager = wxGetApp().docManager();
118
if
(manager->GetCurrentView() != NULL) {
119
return
true
;
120
}
121
return
false
;
122
}
assert
#define assert(condition)
Definition
Application.hh:86
MDFView.hh
MachineCanvas.hh
ProDeConstants.hh
ProDe.hh
SelectCmd.hh
SelectTool.hh
ChildFrame
Definition
ChildFrame.hh:42
EditorCommand
Definition
EditorCommand.hh:46
EditorCommand::view
wxView * view() const
Definition
EditorCommand.cc:76
MDFView
Definition
MDFView.hh:59
MDFView::canvas
MachineCanvas * canvas() const
Definition
MDFView.cc:229
MDFView::clearSelection
void clearSelection()
Definition
MDFView.cc:182
MachineCanvas::setTool
void setTool(MachineCanvasTool *tool)
Definition
MachineCanvas.cc:305
ProDeConstants
Definition
ProDeConstants.hh:43
ProDeConstants::CMD_ICON_SELECT
static const std::string CMD_ICON_SELECT
Icon location for the "Select" command.
Definition
ProDeConstants.hh:304
ProDeConstants::COMMAND_SELECT
@ COMMAND_SELECT
Definition
ProDeConstants.hh:460
SelectCmd
Definition
SelectCmd.hh:41
SelectCmd::isEnabled
bool isEnabled()
Definition
SelectCmd.cc:116
SelectCmd::id
virtual int id() const
Definition
SelectCmd.cc:81
SelectCmd::~SelectCmd
virtual ~SelectCmd()
Definition
SelectCmd.cc:54
SelectCmd::SelectCmd
SelectCmd()
Definition
SelectCmd.cc:45
SelectCmd::create
virtual SelectCmd * create() const
Definition
SelectCmd.cc:92
SelectCmd::Do
virtual bool Do()
Definition
SelectCmd.cc:64
SelectCmd::icon
virtual std::string icon() const
Definition
SelectCmd.cc:103
SelectTool
Definition
SelectTool.hh:47
Generated by
1.9.8