OpenASIP 2.2
Loading...
Searching...
No Matches
OSEdUserManualCmd.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 OSEdUserManualCmd.cc
26 *
27 * Definition of OSEdUserManualCmd class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <boost/format.hpp>
34
35#include "OSEdUserManualCmd.hh"
36#include "OSEdConstants.hh"
37#include "Environment.hh"
38#include "FileSystem.hh"
39#include "HelpBrowser.hh"
40#include "OSEdTextGenerator.hh"
41#include "WxConversion.hh"
42
43using std::string;
44using boost::format;
45
46/**
47 * Constructor.
48 */
50 GUICommand(OSEdConstants::CMD_NAME_USER_MANUAL, NULL) {
51}
52
53/**
54 * Destructor.
55 */
58
59/**
60 * Returns the id of the command.
61 *
62 * @return The id of the command.
63 */
64int
68
69/**
70 * Creates new command.
71 *
72 * @return New command.
73 */
76 return new OSEdUserManualCmd();
77}
78
79/**
80 * Executes the command.
81 *
82 * @return True if execution is successful.
83 */
84bool
86
87 string manualFile = userManual();
88
91
92 HelpBrowser* browser = new HelpBrowser(
93 WxConversion::toWxString(fmt.str()),
94 WxConversion::toWxString(manualFile), wxDefaultPosition,
95 wxSize(800, 600));
96
97 browser->Show(true);
98 return true;
99}
100
101/**
102 * Returns true if command is enabled.
103 *
104 * Command is enabled when user manual exists.
105 *
106 * @return True if command is enabled.
107 */
108bool
110 string manualFile = userManual();
111 return FileSystem::fileExists(manualFile);
112}
113
114/**
115 * Returns the icon path.
116 *
117 * @return Empty string (icons not used).
118 */
119string
121 return "";
122}
123
124/**
125 * Returns the user manual location.
126 *
127 * @return User manual location.
128 */
129std::string
static std::string manDirPath(const std::string &prog)
static const std::string DIRECTORY_SEPARATOR
static bool fileExists(const std::string fileName)
@ CMD_USER_MANUAL
User manual command id.
static const std::string USER_MANUAL_NAME
Name of the user manual.
static OSEdTextGenerator & instance()
@ TXT_USER_MANUAL_TITLE
User manual dialog title.
virtual std::string icon() const
virtual bool isEnabled()
virtual int id() const
std::string userManual() const
virtual GUICommand * create() const
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)