WSF
Signals.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11#ifndef SIGNALS_HPP
12#define SIGNALS_HPP
13
14#include <QObject>
15
16#include "ScriptDebugger.hpp"
17#include "UtCallback.hpp"
18#include "Vi.hpp"
19#include "ViExport.hpp"
20#include "WsfPProxyNode.hpp"
21#include "WsfPProxyPath.hpp"
22
23class QFileInfo;
24class QHelpEvent;
25class QMenu;
26class QMimeData;
27class QString;
28
29namespace wizard
30{
31class Editor;
32class PasteContext;
33class Project;
34class TextSource;
35class WsfEditor;
36class WsfExe;
37
38class VI_EXPORT Signals : public QObject
39{
40 Q_OBJECT
41
42public:
43 explicit Signals(QObject* p)
44 : QObject(p)
45 , gEditMode(Vi::cEDIT_MODE_TEXT)
46 {
47 }
48
49 UtCallbackListN<void(ScriptDebugger*, bool)> DebugSessionActive; /*(aDebugger, aIsActive)*/
50 UtCallbackListN<void()> CurrentDebugLineChanged;
51 UtCallbackListN<void(ScriptDebugger*, bool)> DebugAtBreak;
52 // The selected callstack frame has changed. The callstack frame resets to the top (-1) whenever a new break occurs
53 // ( signal DebugAtBreak ) This signal is only emitted when the user changes the frame.
54 UtCallbackListN<void(ScriptDebugger*, int)> DebugCallStackFrameSwitch;
55 UtCallbackListN<void(ScriptDebugger*)> DebugCallstackUpdated;
56
57 // called by auto-complete to find plug-in suggestions for icons
58signals:
59 void RequestNameSuggestions(const std::string& aNameType, std::vector<std::string>& aNameList);
60 void EpochUpdated(const UtCalendar& aEpoch);
61
62
63 // Called when the editor's context menu is requested
64 void EditorContextMenu(Editor* aEditorPtr, QMenu& aMenu);
65
66 void URL_Process(const QUrl& aUrl);
67
69
70 // Some files are likely to have changed.
72
73 void ProjectDirectoriesChanged(const std::vector<UtPath>& aDirectoryList);
74 void ProjectDirectoryChanged(const UtPath& aDirectory);
76 void ProjectStartupFilesChanged(const std::vector<UtPath>& aMainFiles);
78
79 // Signaled when the application attempts to clean up unused text sources
80 void SourceCleanupEligibility(QSet<TextSource*>&);
81
85 void EditorToolTipEvent(WsfEditor*, QHelpEvent*);
87 void TextModified(TextSource* aSourcePtr);
88
94 void ActionsForFileRequested(const QFileInfo& aFileInfo, QMenu* aMenu);
95 void ActionsForCommandContentsRequested(const std::string& aContent,
96 const std::string& aPath,
97 QMenu* aMenu,
98 QWidget* aParentWidget);
99 void ActionsForNodeRequested(const WsfPProxyNode& aNode, QMenu* aMenu, QWidget* aParentWidget);
100
101 // The active WSF executable has changed
105 // changes in application state may necessitate a change in action state
109 void ActiveEditorChanged(Editor* aEditorPtr);
110
111public:
112 VI_DEPRECATED void emitEpochUpdated(const UtCalendar& aEpoch) { emit EpochUpdated(aEpoch); }
113
114 VI_DEPRECATED void emitEditorContextMenu(Editor* aEditorPtr, QMenu& aMenu)
115 {
116 emit EditorContextMenu(aEditorPtr, aMenu);
117 }
118
119 VI_DEPRECATED void emitURL_Process(const QUrl& aUrl) { emit URL_Process(aUrl); }
120
122
123 VI_DEPRECATED void emitProjectDirectoriesChanged(const std::vector<UtPath>& aDirectoryList)
124 {
125 emit ProjectDirectoriesChanged(aDirectoryList);
126 }
127
128 VI_DEPRECATED void emitProjectDirectoryChanged(const UtPath& aDirectory)
129 {
130 emit ProjectDirectoryChanged(aDirectory);
131 }
132
139 {
140 gEditMode = aEditMode;
141 emit EditModeSwitch(aEditMode);
142 }
143
144 VI_DEPRECATED void emitProjectStartupFilesChanged(const std::vector<UtPath>& aMainFiles)
145 {
146 emit ProjectStartupFilesChanged(aMainFiles);
147 }
148
150 {
151 emit SourceModifiedStateChange(aSourcePtr);
152 }
153
154 VI_DEPRECATED void emitSourceCleanupEligibility(QSet<TextSource*>& aEligibleSources)
155 {
156 emit SourceCleanupEligibility(aEligibleSources);
157 }
158
159 VI_DEPRECATED void emitSourceDeleted(TextSource* aSourcePtr) { emit SourceDeleted(aSourcePtr); }
160
162
163 VI_DEPRECATED void emitEditorToolTipEvent(WsfEditor* aEditorPtr, QHelpEvent* aToolTipEventPtr)
164 {
165 emit EditorToolTipEvent(aEditorPtr, aToolTipEventPtr);
166 }
167
169
170 VI_DEPRECATED void emitActionsForFileRequested(const QFileInfo& aFileInfo, QMenu* aMenu)
171 {
172 emit ActionsForFileRequested(aFileInfo, aMenu);
173 }
174
176 const std::string& aPath,
177 QMenu* aMenu,
178 QWidget* aParentWidget)
179 {
180 emit ActionsForCommandContentsRequested(aContent, aPath, aMenu, aParentWidget);
181 }
182
183 VI_DEPRECATED void emitActionsForNodeRequested(const WsfPProxyNode& aNode, QMenu* aMenu, QWidget* aParentWidget)
184 {
185 emit ActionsForNodeRequested(aNode, aMenu, aParentWidget);
186 }
187
194 {
196 emit WsfExeChanged(aExePtr);
197 }
198
200
202
204
205 VI_DEPRECATED void emitActiveEditorChanged(Editor* aEditorPtr) { emit ActiveEditorChanged(aEditorPtr); }
206
207 UtCallbackListN<void()> CheckFilesForModification;
208 UtCallbackListN<void()> ApplicationActivated;
209 UtCallbackListN<void(Editor*)> EditorClosed;
210 UtCallbackListN<void(Editor*)> EditorSelectionChanged;
211 UtCallbackListN<void(Project&)> ProjectOpen;
212 UtCallbackListN<void(Project&)> ProjectSettingsOpen;
213 UtCallbackListN<void(Project*, bool)> ParseUpdatedDeferred;
214 UtCallbackListN<void(TextSource*, UtTextDocumentRange)> OpenCommandDocumentation;
215 UtCallbackListN<void(QString)> StyleSheetReload;
216 UtCallbackListN<void()> ShuttingDown;
217 UtCallbackListN<void()> ShuttingDown2;
218
219 // PasteQuery and PasteExecute allow for custom paste and drag->drop operations and allows for extension by plugins
220 // PasteQuery(.., .., false) - Invoked before a paste operation is executed. Callee should use
221 // PasteContext::AddAvailableAction()
222 // if the paste may be handled by them.
223 // PasteQuery(.., .., true) - Invoked after PasteQuery if some actions were declared available. Callee should
224 // execute the paste
225 // operation if PasteContext::IsActionChosen() returns true
226 UtCallbackListN<void(const QMimeData*, const PasteContext&, bool)> PasteQuery;
227
228 // The proxy has been invalidated
229 UtCallbackListN<void()> ProxyInvalidate;
230
232 bool InVisualMode() const { return gEditMode == Vi::cEDIT_MODE_VISUAL; }
233
234 void editProxy();
235 void applyProxy();
236 void revertVisualModeChanges();
237 void handleProjectClose();
238
239protected:
240 void switchToEditModeP();
241
243};
244} // namespace wizard
245
247
248#endif
wizard::Signals * wizSignals
Definition Signals.cpp:19
#define VI_DEPRECATED
Definition ViExport.hpp:39
#define VI_EXPORT
Definition ViExport.hpp:38
Definition WsfPProxyNode.hpp:60
Definition Editor.hpp:57
Definition PasteContext.hpp:31
A WSF 'project'. Manages WSF sources files in a WSF project.
Definition Project.hpp:66
Definition ScriptDebugger.hpp:35
Definition ScriptDebugger.hpp:25
Definition Signals.hpp:39
VI_DEPRECATED void emitActionsForCommandContentsRequested(const std::string &aContent, const std::string &aPath, QMenu *aMenu, QWidget *aParentWidget)
Definition Signals.hpp:175
UtCallbackListN< void()> CurrentDebugLineChanged
Definition Signals.hpp:50
UtCallbackListN< void()> ShuttingDown
Definition Signals.hpp:216
VI_DEPRECATED void emitActionsForNodeRequested(const WsfPProxyNode &aNode, QMenu *aMenu, QWidget *aParentWidget)
Definition Signals.hpp:183
UtCallbackListN< void(Editor *)> EditorSelectionChanged
Definition Signals.hpp:210
UtCallbackListN< void(QString)> StyleSheetReload
Definition Signals.hpp:215
void ActiveEditorChanged(Editor *aEditorPtr)
UtCallbackListN< void()> ProxyInvalidate
Definition Signals.hpp:229
UtCallbackListN< void()> ApplicationActivated
Definition Signals.hpp:208
UtCallbackListN< void()> CheckFilesForModification
Definition Signals.hpp:207
VI_DEPRECATED void emitEditorContextMenu(Editor *aEditorPtr, QMenu &aMenu)
Definition Signals.hpp:114
void SourceDeleted(TextSource *)
void ActionsStateChange()
VI_DEPRECATED void emitURL_Process(const QUrl &aUrl)
Definition Signals.hpp:119
void emitWsfExeChanged(WsfExe *aExePtr)
Definition Signals.hpp:193
void EditorContextMenu(Editor *aEditorPtr, QMenu &aMenu)
void ProjectStartupFilesChanged(const std::vector< UtPath > &aMainFiles)
UtCallbackListN< void(const QMimeData *, const PasteContext &, bool)> PasteQuery
Definition Signals.hpp:226
UtCallbackListN< void(ScriptDebugger *, bool)> DebugSessionActive
Definition Signals.hpp:49
void WsfExeChanged(WsfExe *)
VI_DEPRECATED void emitProjectDirectoriesChanged(const std::vector< UtPath > &aDirectoryList)
Definition Signals.hpp:123
void FileCheckRequested()
void BreakpointsChanged()
void VisualModeChanged()
UtCallbackListN< void(Project &)> ProjectOpen
Definition Signals.hpp:211
VI_DEPRECATED void emitParseResultsInvalidate(Project *aProjectPtr)
Definition Signals.hpp:168
UtCallbackListN< void(Project *, bool)> ParseUpdatedDeferred
Definition Signals.hpp:213
void RequestNameSuggestions(const std::string &aNameType, std::vector< std::string > &aNameList)
VI_DEPRECATED void emitSourceDeleted(TextSource *aSourcePtr)
Definition Signals.hpp:159
void TextModified(TextSource *aSourcePtr)
UtCallbackListN< void(ScriptDebugger *, bool)> DebugAtBreak
Definition Signals.hpp:51
UtCallbackListN< void(Project &)> ProjectSettingsOpen
Definition Signals.hpp:212
bool InVisualMode() const
Definition Signals.hpp:232
void SourceModifiedStateChange(TextSource *)
UtCallbackListN< void(Editor *)> EditorClosed
Definition Signals.hpp:209
VI_DEPRECATED void emitEditorToolTipEvent(WsfEditor *aEditorPtr, QHelpEvent *aToolTipEventPtr)
Definition Signals.hpp:163
void URL_Process(const QUrl &aUrl)
void emitEditModeSwitch(Vi::EditMode aEditMode)
Definition Signals.hpp:138
VI_DEPRECATED void emitSourceCleanupEligibility(QSet< TextSource * > &aEligibleSources)
Definition Signals.hpp:154
Signals(QObject *p)
Definition Signals.hpp:43
void SourceCleanupEligibility(QSet< TextSource * > &)
VI_DEPRECATED void emitActionsStateChange()
Definition Signals.hpp:203
void EpochUpdated(const UtCalendar &aEpoch)
void ProjectDirectoryChanged(const UtPath &aDirectory)
UtCallbackListN< void(ScriptDebugger *, int)> DebugCallStackFrameSwitch
Definition Signals.hpp:54
VI_DEPRECATED void emitProjectDirectoryChanged(const UtPath &aDirectory)
Definition Signals.hpp:128
void EditorToolTipEvent(WsfEditor *, QHelpEvent *)
Vi::EditMode gEditMode
Definition Signals.hpp:242
void ParseResultsInvalidate(Project *)
VI_DEPRECATED void emitProjectStartupFilesChanged(const std::vector< UtPath > &aMainFiles)
Definition Signals.hpp:144
VI_DEPRECATED void emitFileCheckRequested()
Definition Signals.hpp:121
Vi::EditMode GetProxyEditMode() const
Definition Signals.hpp:231
void ActionsForCommandContentsRequested(const std::string &aContent, const std::string &aPath, QMenu *aMenu, QWidget *aParentWidget)
void ActionsForNodeRequested(const WsfPProxyNode &aNode, QMenu *aMenu, QWidget *aParentWidget)
void ActionsForFileRequested(const QFileInfo &aFileInfo, QMenu *aMenu)
VI_DEPRECATED void emitVisualModeChanged()
Definition Signals.hpp:199
void ProjectDirectoriesChanged(const std::vector< UtPath > &aDirectoryList)
UtCallbackListN< void(ScriptDebugger *)> DebugCallstackUpdated
Definition Signals.hpp:55
VI_DEPRECATED void emitSourceModifiedStateChange(TextSource *aSourcePtr)
Definition Signals.hpp:149
UtCallbackListN< void()> ShuttingDown2
Definition Signals.hpp:217
void EditModeSwitch(Vi::EditMode aEditMode)
UtCallbackListN< void(TextSource *, UtTextDocumentRange)> OpenCommandDocumentation
Definition Signals.hpp:214
void BreakpointHit(const wizard::ScriptDebugger::Breakpoint *aBreakpoint)
VI_DEPRECATED void emitActionsForFileRequested(const QFileInfo &aFileInfo, QMenu *aMenu)
Definition Signals.hpp:170
VI_DEPRECATED void emitApplyProxy()
Definition Signals.hpp:201
VI_DEPRECATED void emitEpochUpdated(const UtCalendar &aEpoch)
Definition Signals.hpp:112
VI_DEPRECATED void emitActiveEditorChanged(Editor *aEditorPtr)
Definition Signals.hpp:205
VI_DEPRECATED void emitBreakpointsChanged()
Definition Signals.hpp:161
Definition TextSource.hpp:48
Definition WsfEditor.hpp:32
Definition WsfExe.hpp:46
Definition Vi.hpp:16
EditMode
Definition Vi.hpp:18
@ cEDIT_MODE_VISUAL
Definition Vi.hpp:21
Definition Runner.hpp:22
Copyrights Multiple, All Rights Reserved