OpenASIP 2.2
Loading...
Searching...
No Matches
ProximFindCmd.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2017 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 ProximFindCmd.cc
26 *
27 * Implementation of ProximFindCmd class.
28 *
29 * @author Alex Hirvonen 2017 (alex.hirvonen-no.spam-gmail.com)
30 * @note rating: red
31 */
32
33#include "ProximFindCmd.hh"
34#include "ProximConstants.hh"
35#include "FindWindow.hh"
37#include "ProximToolbox.hh"
38#include "ErrorDialog.hh"
39#include "ProximMainFrame.hh"
40
41
43 GUICommand(ProximConstants::COMMAND_NAME_FIND, NULL) {
44}
45
46
49
50
51/**
52 * Executes the command.
53 */
54bool
56
58
59 if (simulation->isSimulationInitialized() ||
60 simulation->isSimulationRunning() ||
61 simulation->isSimulationStopped()) {
62
63 FindWindow* findWindow = dynamic_cast<FindWindow*>(
65 FindWindowById(ProximConstants::ID_FIND_WINDOW));
66
67 if (findWindow == NULL) {
68 findWindow = new FindWindow(ProximToolbox::mainFrame(),
70
72 findWindow, _T("Find pattern in disassembly"), false,
73 wxSize(300, 160));
74 findWindow->GetParent()->Center();
75
76 findWindow->GetParent()->SetSize(300, 160);
77 }
78 } else {
79 ErrorDialog error(parentWindow(), _T("Simulation not initialized."));
80 error.ShowModal();
81 }
82
83 return true;
84}
85
86
87/**
88 * Returns full path to the command icon file.
89 *
90 * @return Full path to the command icon file.
91 */
92std::string
94 return "find.png";
95}
96
97
98/**
99 * Returns ID of this command.
100 */
101int
105
106
107/**
108 * Creates and returns a new instance of this command.
109 *
110 * @return Newly created instance of this command.
111 */
114 return new ProximFindCmd();
115}
116
117
118/**
119 * Returns true if the command is enabled, false otherwise.
120 *
121 * @return Always true.
122 */
123bool
125 return true;
126}
wxWindow * parentWindow() const
Definition GUICommand.cc:75
virtual bool Do()
virtual ProximFindCmd * create() const
virtual ~ProximFindCmd()
virtual bool isEnabled()
virtual int id() const
virtual std::string icon() const
static void addFramedWindow(wxWindow *window, const wxString &title, bool stayOnTop=false, const wxSize &minSize=wxSize(100, 100))
static ProximMainFrame * mainFrame()
static TracedSimulatorFrontend * frontend()
bool isSimulationInitialized() const
bool isSimulationStopped() const
bool isSimulationRunning() const