OpenASIP
2.0
src
procgen
ProDe
PrintPreviewCmd.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 PrintPreviewCmd.cc
26
*
27
* Definition of PrintPreviewCmd 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 "tce_config.h"
35
#include "
PrintPreviewCmd.hh
"
36
#include "
ProDeConstants.hh
"
37
#include "
ProDe.hh
"
38
#include "
ErrorDialog.hh
"
39
40
using
std::string;
41
42
43
/**
44
* The Constructor.
45
*/
46
PrintPreviewCmd::PrintPreviewCmd
():
47
EditorCommand
(
ProDeConstants
::CMD_NAME_PRINT_PREVIEW) {
48
49
}
50
51
52
/**
53
* The Destructor.
54
*/
55
PrintPreviewCmd::~PrintPreviewCmd
() {
56
}
57
58
59
/**
60
* Executes the command.
61
*
62
* If the wxWidgets printing framework was not compiled in the wxWidgets
63
* library, print previeving is not possible. An error message will be
64
* displayed instead of previewing.
65
*
66
* @return Always false. The command is not undoable.
67
*/
68
bool
69
PrintPreviewCmd::Do
() {
70
71
#if WX_PRINTING_DISABLED
72
73
// wxWidgets was compiled without printing framework, display an
74
// error message.
75
76
wxString message =
77
wxString(_T(
"Printing framework is disabled in the wxWidgets\n"
));
78
79
message.Append(_T(
"library. Print previewing is not possible."
));
80
81
ErrorDialog
error(
parentWindow
(), message);
82
error.ShowModal();
83
return
false
;
84
85
#else
86
87
// wxWidgets was compiled with the printing framework.
88
wxCommandEvent
dummy
;
89
wxGetApp().docManager()->OnPreview(
dummy
);
90
return
false
;
91
92
#endif // WX_PRINTING_ENABLED
93
94
}
95
96
97
/**
98
* Return id of this command.
99
*
100
* @return ID for this command to be used in menus and toolbars.
101
*/
102
int
103
PrintPreviewCmd::id
()
const
{
104
return
ProDeConstants::COMMAND_PRINT_PREVIEW
;
105
}
106
107
108
/**
109
* Creates and returns a new instance of this command.
110
*
111
* @return Newly created instance of this command.
112
*/
113
PrintPreviewCmd
*
114
PrintPreviewCmd::create
()
const
{
115
return
new
PrintPreviewCmd
();
116
}
117
118
119
/**
120
* Returns short version of the command name.
121
*
122
* @return Short name of the command to be used in the toolbar.
123
*/
124
string
125
PrintPreviewCmd::shortName
()
const
{
126
return
ProDeConstants::CMD_SNAME_PRINT_PREVIEW
;
127
}
128
129
130
/**
131
* Returns path to the command's icon file.
132
*
133
* @return Full path to the command's icon file.
134
*/
135
string
136
PrintPreviewCmd::icon
()
const
{
137
return
ProDeConstants::CMD_ICON_PRINT_PREVIEW
;
138
}
139
140
141
/**
142
* Returns true when command is executable, false when not.
143
*
144
* This command is executable when a document is open.
145
*
146
* @return True, if the command is executable.
147
*/
148
bool
149
PrintPreviewCmd::isEnabled
() {
150
wxDocManager* manager = wxGetApp().docManager();
151
if
(manager->GetCurrentView() != NULL) {
152
return
true
;
153
}
154
return
false
;
155
}
PrintPreviewCmd::shortName
virtual std::string shortName() const
Definition:
PrintPreviewCmd.cc:125
ProDe.hh
PrintPreviewCmd::~PrintPreviewCmd
virtual ~PrintPreviewCmd()
Definition:
PrintPreviewCmd.cc:55
PrintPreviewCmd::PrintPreviewCmd
PrintPreviewCmd()
Definition:
PrintPreviewCmd.cc:46
ProDeConstants::CMD_ICON_PRINT_PREVIEW
static const std::string CMD_ICON_PRINT_PREVIEW
Icon location for the "Print Preview" command.
Definition:
ProDeConstants.hh:302
PrintPreviewCmd.hh
ProDeConstants::CMD_SNAME_PRINT_PREVIEW
static const std::string CMD_SNAME_PRINT_PREVIEW
Command name for the "Print Preview" command.
Definition:
ProDeConstants.hh:202
ErrorDialog
Definition:
ErrorDialog.hh:42
PrintPreviewCmd::icon
virtual std::string icon() const
Definition:
PrintPreviewCmd.cc:136
ErrorDialog.hh
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
PrintPreviewCmd::isEnabled
virtual bool isEnabled()
Definition:
PrintPreviewCmd.cc:149
ProDeConstants::COMMAND_PRINT_PREVIEW
@ COMMAND_PRINT_PREVIEW
Definition:
ProDeConstants.hh:413
PrintPreviewCmd
Definition:
PrintPreviewCmd.hh:42
PrintPreviewCmd::Do
virtual bool Do()
Definition:
PrintPreviewCmd.cc:69
ProDeConstants.hh
PrintPreviewCmd::id
virtual int id() const
Definition:
PrintPreviewCmd.cc:103
EditorCommand
Definition:
EditorCommand.hh:46
ProDeConstants
Definition:
ProDeConstants.hh:43
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition:
GUICommand.cc:75
PrintPreviewCmd::create
virtual PrintPreviewCmd * create() const
Definition:
PrintPreviewCmd.cc:114
Generated by
1.8.17