OpenASIP  2.0
RedoCmd.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 RedoCmd.cc
26  *
27  * Definition of RedoCmd class.
28  *
29  * @author Veli-Pekka Jääskeläinen (vjaaskel-no.spam-cs.tut.fi)
30  */
31 
32 #include <wx/docview.h>
33 #include "RedoCmd.hh"
34 #include "ProDe.hh"
35 #include "ProDeConstants.hh"
36 #include "MDFDocument.hh"
37 
38 
39 using std::string;
40 
41 /**
42  * The Constructor.
43  */
45  EditorCommand(ProDeConstants::CMD_NAME_REDO) {
46 
47 }
48 
49 
50 /**
51  * The Destructor.
52  */
54 
55 
56 /**
57  * Executes the command.
58  *
59  * @return Always false.
60  */
61 bool
63  dynamic_cast<MDFDocument*>(view()->GetDocument())->getModel()->redo();
64  return false;
65 }
66 
67 
68 /**
69  * Returns id of this command.
70  *
71  * @return ID for this command to be used in menus and toolbars.
72  */
73 int
74 RedoCmd::id() const {
76 }
77 
78 
79 /**
80  * Creates and returns a new instance of this command.
81  *
82  * @return Newly created instance of this command.
83  */
84 RedoCmd*
85 RedoCmd::create() const {
86  return new RedoCmd();
87 }
88 
89 
90 
91 /**
92  * Returns path to the command's icon file.
93  *
94  * @return Full path to the command's icon file.
95  */
96 string
97 RedoCmd::icon() const {
99 }
100 
101 
102 /**
103  * Returns true when the command is executable, false when not.
104  *
105  * This command is executable when the model has an undone modification
106  * cached.
107  *
108  * @return True, if the model's redo cache is not empty.
109  */
110 bool
112 
113  wxDocManager* manager = wxGetApp().docManager();
114 
115  wxView* view = manager->GetCurrentView();
116  if (view == NULL) {
117  return false;
118  }
119 
120  Model* model =
121  dynamic_cast<MDFDocument*>(view->GetDocument())->getModel();
122 
123  if (model != NULL && model->canRedo()) {
124  return true;
125  }
126  return false;
127 }
128 
RedoCmd::Do
virtual bool Do()
Definition: RedoCmd.cc:62
ProDe.hh
RedoCmd::id
virtual int id() const
Definition: RedoCmd.cc:74
MDFDocument.hh
RedoCmd
Definition: RedoCmd.hh:41
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
Model::canRedo
bool canRedo()
Definition: Model.cc:228
ProDeConstants::COMMAND_REDO
@ COMMAND_REDO
Definition: ProDeConstants.hh:434
RedoCmd::create
virtual RedoCmd * create() const
Definition: RedoCmd.cc:85
RedoCmd::RedoCmd
RedoCmd()
Definition: RedoCmd.cc:44
RedoCmd::isEnabled
virtual bool isEnabled()
Definition: RedoCmd.cc:111
MDFDocument
Definition: MDFDocument.hh:51
ProDeConstants.hh
RedoCmd::~RedoCmd
virtual ~RedoCmd()
Definition: RedoCmd.cc:53
RedoCmd::icon
virtual std::string icon() const
Definition: RedoCmd.cc:97
Model
Definition: Model.hh:50
EditorCommand
Definition: EditorCommand.hh:46
ProDeConstants::CMD_ICON_REDO
static const std::string CMD_ICON_REDO
Icon location for the "Redo" command.
Definition: ProDeConstants.hh:308
ProDeConstants
Definition: ProDeConstants.hh:43
RedoCmd.hh