OpenASIP
2.0
src
procgen
ProDe
SaveDocumentAsCmd.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 SaveDocumentAsCmd.cc
26
*
27
* Definition of SaveDocumentAsCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30
*/
31
32
#include <wx/docview.h>
33
34
#include "
SaveDocumentAsCmd.hh
"
35
#include "
ProDeConstants.hh
"
36
#include "
ProDe.hh
"
37
38
using
std::string;
39
40
/**
41
* The Constructor.
42
*/
43
SaveDocumentAsCmd::SaveDocumentAsCmd
():
44
EditorCommand
(
ProDeConstants
::CMD_NAME_SAVEAS_DOC) {
45
46
}
47
48
49
/**
50
* The Destructor.
51
*/
52
SaveDocumentAsCmd::~SaveDocumentAsCmd
() {}
53
54
55
/**
56
* Executes the command.
57
*
58
* @return Always false. Returning true here would cause problems with the
59
* wxCommandProcessor, and the command is never undoable so it's
60
* safe to return false even if the command was succesfully executed.
61
*/
62
bool
63
SaveDocumentAsCmd::Do
() {
64
wxCommandEvent
dummy
(wxID_SAVEAS, 0);
65
wxGetApp().docManager()->OnFileSaveAs(
dummy
);
66
return
false
;
67
}
68
69
70
/**
71
* Returns id of this command.
72
*
73
* @return ID for this command to be used in menus and toolbars.
74
*/
75
int
76
SaveDocumentAsCmd::id
()
const
{
77
return
ProDeConstants::COMMAND_SAVEAS_DOC
;
78
}
79
80
81
/**
82
* Creates and returns a new instance of this command.
83
*
84
* @return Newly created instance of this command.
85
*/
86
SaveDocumentAsCmd
*
87
SaveDocumentAsCmd::create
()
const
{
88
return
new
SaveDocumentAsCmd
();
89
}
90
91
92
/**
93
* Returns short version of the command name.
94
*
95
* @return Short name of the command to be used in the toolbar.
96
*/
97
string
98
SaveDocumentAsCmd::shortName
()
const
{
99
return
ProDeConstants::CMD_SNAME_SAVEAS_DOC
;
100
}
101
102
/**
103
* Returns path to the command's icon file.
104
*
105
* @return Full path to the command's icon file.
106
*/
107
string
108
SaveDocumentAsCmd::icon
()
const
{
109
return
ProDeConstants::CMD_ICON_SAVEAS_DOC
;
110
}
111
112
113
/**
114
* Returns true when the command is executable, false when not.
115
*
116
* This command is executable when a document is open.
117
*
118
* @return True, if a document is open.
119
*/
120
bool
121
SaveDocumentAsCmd::isEnabled
() {
122
wxDocManager* manager = wxGetApp().docManager();
123
if
(manager->GetCurrentView() != NULL) {
124
return
true
;
125
}
126
return
false
;
127
}
SaveDocumentAsCmd::create
virtual SaveDocumentAsCmd * create() const
Definition:
SaveDocumentAsCmd.cc:87
ProDe.hh
SaveDocumentAsCmd
Definition:
SaveDocumentAsCmd.hh:41
SaveDocumentAsCmd::SaveDocumentAsCmd
SaveDocumentAsCmd()
Definition:
SaveDocumentAsCmd.cc:43
SaveDocumentAsCmd::icon
virtual std::string icon() const
Definition:
SaveDocumentAsCmd.cc:108
ProDeConstants::CMD_SNAME_SAVEAS_DOC
static const std::string CMD_SNAME_SAVEAS_DOC
Command name for the "Save Document As" command.
Definition:
ProDeConstants.hh:196
SaveDocumentAsCmd::id
virtual int id() const
Definition:
SaveDocumentAsCmd.cc:76
ProDeConstants::CMD_ICON_SAVEAS_DOC
static const std::string CMD_ICON_SAVEAS_DOC
Icon location for the "Save Document As" command.
Definition:
ProDeConstants.hh:294
SaveDocumentAsCmd::shortName
virtual std::string shortName() const
Definition:
SaveDocumentAsCmd.cc:98
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
ProDeConstants::COMMAND_SAVEAS_DOC
@ COMMAND_SAVEAS_DOC
Definition:
ProDeConstants.hh:411
SaveDocumentAsCmd::isEnabled
virtual bool isEnabled()
Definition:
SaveDocumentAsCmd.cc:121
SaveDocumentAsCmd::Do
virtual bool Do()
Definition:
SaveDocumentAsCmd.cc:63
ProDeConstants.hh
SaveDocumentAsCmd::~SaveDocumentAsCmd
virtual ~SaveDocumentAsCmd()
Definition:
SaveDocumentAsCmd.cc:52
EditorCommand
Definition:
EditorCommand.hh:46
ProDeConstants
Definition:
ProDeConstants.hh:43
SaveDocumentAsCmd.hh
Generated by
1.8.17