-
Notifications
You must be signed in to change notification settings - Fork 0
/
swftParaViewMenuBuilders.cpp
335 lines (287 loc) · 11.8 KB
/
swftParaViewMenuBuilders.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#include "swftParaViewMenuBuilders.h"
#include "swftLoadModelReaction.h"
#include "vtkPVConfig.h"
#include "ui_pqFileMenuBuilder.h"
#include "ui_pqEditMenuBuilder.h"
#include "ui_pqPipelineBrowserContextMenu.h"
#include "pqAboutDialogReaction.h"
#include "pqAnimationTimeToolbar.h"
#include "pqApplicationCore.h"
#include "pqApplicationSettingsReaction.h"
#include "pqAxesToolbar.h"
#include "pqCameraLinkReaction.h"
#include "pqCameraToolbar.h"
#include "pqCameraUndoRedoReaction.h"
#include "pqCatalystConnectReaction.h"
#include "pqCategoryToolbarsBehavior.h"
#include "pqChangePipelineInputReaction.h"
#include "pqColorToolbar.h"
#include "pqCopyReaction.h"
#include "pqCreateCustomFilterReaction.h"
#include "pqDataQueryReaction.h"
#include "pqDeleteReaction.h"
#include "pqExportReaction.h"
#include "pqFiltersMenuReaction.h"
#include "pqHelpReaction.h"
#include "pqIgnoreSourceTimeReaction.h"
#include "pqLoadDataReaction.h"
#include "pqLoadStateReaction.h"
#include "swftMainControlsToolbar.h"
#include "pqManageCustomFiltersReaction.h"
#include "pqManageLinksReaction.h"
#include "pqManagePluginsReaction.h"
#include "pqProxyGroupMenuManager.h"
#include "pqPVApplicationCore.h"
#include "pqPythonShellReaction.h"
#include "pqRecentFilesMenu.h"
#include "pqRepresentationToolbar.h"
#include "pqSaveAnimationGeometryReaction.h"
#include "pqSaveAnimationReaction.h"
#include "pqSaveDataReaction.h"
#include "pqSaveScreenshotReaction.h"
#include "pqSaveStateReaction.h"
#include "pqServerConnectReaction.h"
#include "pqServerDisconnectReaction.h"
#include "pqSetName.h"
#include "pqSourcesMenuReaction.h"
#include "pqTestingReaction.h"
#include "pqTimerLogReaction.h"
#include "pqUndoRedoReaction.h"
#include "pqVCRToolbar.h"
#include "pqViewMenuManager.h"
#include "pqViewSettingsReaction.h"
#ifdef PARAVIEW_ENABLE_PYTHON
#include "pqMacroReaction.h"
#include "pqPythonManager.h"
#include "pqTraceReaction.h"
#endif
#include <QDockWidget>
#include <QKeySequence>
#include <QLayout>
#include <QMainWindow>
#include <QMenu>
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildFileMenu(QMenu& menu)
{
QString objectName = menu.objectName();
Ui::pqFileMenuBuilder ui;
ui.setupUi(&menu);
// since the UI file tends to change the name of the menu.
menu.setObjectName(objectName);
QObject::connect(ui.actionFileExit, SIGNAL(triggered()),
pqApplicationCore::instance(), SLOT(quit()));
// now setup reactions.
new pqLoadStateReaction(ui.actionFileOpen);
new pqRecentFilesMenu(*ui.menuRecentFiles, ui.menuRecentFiles);
new pqLoadStateReaction(ui.actionFileLoadServerState);
new pqSaveStateReaction(ui.actionFileSaveServerState);
new pqServerConnectReaction(ui.actionServerConnect);
new pqServerDisconnectReaction(ui.actionServerDisconnect);
new pqSaveScreenshotReaction(ui.actionFileSaveScreenshot);
new pqSaveAnimationReaction(ui.actionFileSaveAnimation);
new pqSaveAnimationGeometryReaction(ui.actionFileSaveGeometry);
new pqExportReaction(ui.actionExport);
new pqSaveDataReaction(ui.actionFileSaveData);
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildEditMenu(QMenu& menu)
{
QString objectName = menu.objectName();
Ui::pqEditMenuBuilder ui;
ui.setupUi(&menu);
// since the UI file tends to change the name of the menu.
menu.setObjectName(objectName);
new pqUndoRedoReaction(ui.actionEditUndo, true);
new pqUndoRedoReaction(ui.actionEditRedo, false);
new pqCameraUndoRedoReaction(ui.actionEditCameraUndo, true);
new pqCameraUndoRedoReaction(ui.actionEditCameraRedo, false);
new pqChangePipelineInputReaction(ui.actionChangeInput);
new pqIgnoreSourceTimeReaction(ui.actionIgnoreTime);
new pqDeleteReaction(ui.actionDelete);
new pqDeleteReaction(ui.actionDelete_All, true);
new pqCopyReaction(ui.actionCopy);
new pqCopyReaction(ui.actionPaste, true);
new pqApplicationSettingsReaction(ui.actionEditSettings);
new pqViewSettingsReaction(ui.actionEditViewSettings);
new pqDataQueryReaction(ui.actionQuery);
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildSourcesMenu(QMenu& menu,
QMainWindow* mainWindow)
{
pqProxyGroupMenuManager* mgr = new pqProxyGroupMenuManager(&menu, "ParaViewSources");
mgr->addProxyDefinitionUpdateListener("sources");
new pqSourcesMenuReaction(mgr);
pqPVApplicationCore::instance()->registerForQuicklaunch(mgr->widgetActionsHolder());
if (mainWindow)
{
// create toolbars for categories as needed.
new pqCategoryToolbarsBehavior(mgr, mainWindow);
}
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildFiltersMenu(QMenu& menu,
QMainWindow* mainWindow)
{
pqProxyGroupMenuManager* mgr = new pqProxyGroupMenuManager(&menu, "ParaViewFilters");
mgr->addProxyDefinitionUpdateListener("filters");
mgr->setRecentlyUsedMenuSize(10);
new pqFiltersMenuReaction(mgr);
pqPVApplicationCore::instance()->registerForQuicklaunch(mgr->widgetActionsHolder());
if (mainWindow)
{
// create toolbars for categories as needed.
new pqCategoryToolbarsBehavior(mgr, mainWindow);
}
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildToolsMenu(QMenu& menu)
{
new pqCreateCustomFilterReaction(menu.addAction("Create Custom Filter...") <<
pqSetName("actionToolsCreateCustomFilter"));
new pqCameraLinkReaction(menu.addAction("Add Camera Link...") <<
pqSetName("actionToolsAddCameraLink"));
menu.addSeparator();
new pqManageCustomFiltersReaction(menu.addAction("Manage Custom Filters...")
<< pqSetName("actionToolsManageCustomFilters"));
new pqManageLinksReaction(menu.addAction("Manage Links...") <<
pqSetName("actionToolsManageLinks"));
//<addaction name="actionToolsAddCameraLink" />
#ifdef BUILD_SHARED_LIBS
// Add support for importing plugins only if ParaView was built shared.
new pqManagePluginsReaction(menu.addAction("Manage Plugins...") <<
pqSetName("actionManage_Plugins"));
#else
QAction* action2 = menu.addAction("Manage Plugins...");
action2->setEnabled(false);
action2->setToolTip(
"Use BUILD_SHARED:ON while compiling to enable plugin support.");
action2->setStatusTip(action2->toolTip());
#endif
menu.addSeparator(); // --------------------------------------------------
//<addaction name="actionToolsDumpWidgetNames" />
new pqTestingReaction(menu.addAction("Record Test...")
<< pqSetName("actionToolsRecordTest"),
pqTestingReaction::RECORD);
new pqTestingReaction(menu.addAction("Play Test...")
<< pqSetName("actionToolsPlayTest"),
pqTestingReaction::PLAYBACK,Qt::QueuedConnection);
new pqTestingReaction(menu.addAction("Lock View Size")
<< pqSetName("actionTesting_Window_Size"),
pqTestingReaction::LOCK_VIEW_SIZE);
new pqTestingReaction(menu.addAction("Lock View Size Custom...")
<< pqSetName("actionTesting_Window_Size_Custom"),
pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
menu.addSeparator();
new pqTimerLogReaction(menu.addAction("Timer Log")
<< pqSetName("actionToolsTimerLog"));
QAction* action = menu.addAction("&Output Window")
<< pqSetName("actionToolsOutputWindow");
QObject::connect(action, SIGNAL(triggered()),
pqApplicationCore::instance(),
SLOT(showOutputWindow()));
menu.addSeparator(); // --------------------------------------------------
new pqCatalystConnectReaction(menu.addAction("Connect To Catalyst")
<< pqSetName("actionConnectCatalyst"));
menu.addSeparator(); // --------------------------------------------------
new pqPythonShellReaction(menu.addAction("Python Shell")
<< pqSetName("actionToolsPythonShell"));
#ifdef PARAVIEW_ENABLE_PYTHON
menu.addSeparator(); // --------------------------------------------------
new pqTraceReaction( menu.addAction("Start Trace")
<< pqSetName("actionToolsStartTrace"), true);
new pqTraceReaction(menu.addAction("Stop Trace")
<< pqSetName("actionToolsStartTrace"), false);
#endif
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildViewMenu(QMenu& menu, QMainWindow& mainWindow)
{
new pqViewMenuManager(&mainWindow, &menu);
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildPipelineBrowserContextMenu(QWidget& widget)
{
QString objectName = widget.objectName();
Ui::pqPipelineBrowserContextMenu ui;
ui.setupUi(&widget);
// since the UI file tends to change the name of the menu.
widget.setObjectName(objectName);
widget.setContextMenuPolicy(Qt::ActionsContextMenu);
QByteArray signalName=QMetaObject::normalizedSignature("deleteKey()");
if (widget.metaObject()->indexOfSignal(signalName) != -1)
{
// Trigger a delete when the user requests a delete.
QObject::connect(&widget, SIGNAL(deleteKey()),
ui.actionPBDelete, SLOT(trigger()), Qt::QueuedConnection);
}
// And here the reactions come in handy! Just reuse the reaction used for
// File | Open.
new swftLoadModelReaction(ui.actionPBOpen);
new pqChangePipelineInputReaction(ui.actionPBChangeInput);
new pqCreateCustomFilterReaction(ui.actionPBCreateCustomFilter);
new pqIgnoreSourceTimeReaction(ui.actionPBIgnoreTime);
new pqDeleteReaction(ui.actionPBDelete);
new pqCopyReaction(ui.actionPBCopy);
new pqCopyReaction(ui.actionPBPaste, true);
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildMacrosMenu
#ifdef PARAVIEW_ENABLE_PYTHON
(QMenu& menu)
#else
(QMenu& )
#endif
{
#ifdef PARAVIEW_ENABLE_PYTHON
// Give the macros menu to the pqPythonMacroSupervisor
pqPythonManager* manager = pqPVApplicationCore::instance()->pythonManager();
if (manager)
{
new pqMacroReaction(menu.addAction("Add new macro...")
<< pqSetName("actionMacroCreate"));
QMenu *editMenu = menu.addMenu("Edit...");
QMenu *deleteMenu = menu.addMenu("Delete...");
menu.addSeparator();
manager->addWidgetForRunMacros(&menu);
manager->addWidgetForEditMacros(editMenu);
manager->addWidgetForDeleteMacros(deleteMenu);
}
#endif
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildHelpMenu(QMenu& menu)
{
QAction * help = menu.addAction("Help") <<
pqSetName("actionHelp");
help->setShortcut(QKeySequence::HelpContents);
new pqHelpReaction(help);
new pqAboutDialogReaction(
menu.addAction("About...")
<< pqSetName("actionAbout"));
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildToolbars(QMainWindow& mainWindow)
{
QToolBar* mainToolBar = new swftMainControlsToolbar(&mainWindow)
<< pqSetName("MainControlsToolbar");
mainToolBar->layout()->setSpacing(0);
mainWindow.addToolBar(Qt::TopToolBarArea, mainToolBar);
QToolBar* colorToolbar = new pqColorToolbar(&mainWindow)
<< pqSetName("variableToolbar");
colorToolbar->layout()->setSpacing(0);
mainWindow.addToolBar(Qt::TopToolBarArea, colorToolbar);
mainWindow.insertToolBarBreak(colorToolbar);
QToolBar* reprToolbar = new pqRepresentationToolbar(&mainWindow)
<< pqSetName("representationToolbar");
reprToolbar->layout()->setSpacing(0);
mainWindow.addToolBar(Qt::TopToolBarArea, reprToolbar);
QToolBar* vcrToolbar = new pqVCRToolbar(&mainWindow)
<< pqSetName("VCRToolbar");
vcrToolbar->layout()->setSpacing(0);
mainWindow.addToolBar(Qt::TopToolBarArea, vcrToolbar);
QToolBar* timeToolbar = new pqAnimationTimeToolbar(&mainWindow)
<< pqSetName("currentTimeToolbar");
timeToolbar->layout()->setSpacing(0);
mainWindow.addToolBar(Qt::TopToolBarArea, timeToolbar);
}