##// END OF EJS Templates
Adds read compatibility for local AMDA server...
Adds read compatibility for local AMDA server The local AMDA server uses another regex than the default server to read the units in x. We manage the compatibility by adding in the parser the possibility of testing several regexes to read a property

File last commit:

r1083:f354146de80e
r1121:98220c931c83
Show More
VisualizationActionManager.cpp
109 lines | 4.8 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationActionManager.cpp
New class to manage actions in the visualization
r1078 #include "Visualization/VisualizationActionManager.h"
Action "Remove Selected Zones"
r1079 #include "Visualization/VisualizationGraphWidget.h"
#include "Visualization/VisualizationSelectionZoneItem.h"
New class to manage actions in the visualization
r1078
#include <Actions/ActionsGuiController.h>
#include <SqpApplication.h>
VisualizationActionManager::VisualizationActionManager() {}
void VisualizationActionManager::installSelectionZoneActions()
{
auto &actionController = sqpApp->actionsGuiController();
Add a lambda in SeletionZoneAction to enable or disable the action
r1080
Add action to remove the selected zone with the "del" buttons
r1082 auto removeZonesAction
= actionController.addSectionZoneAction("Remove Selected Zone(s)", [](auto zones) {
for (auto selectionZone : zones) {
if (auto graph = selectionZone->parentGraphWidget()) {
graph->removeSelectionZone(selectionZone);
}
}
});
removeZonesAction->setDisplayedShortcut(QKeySequence::Delete);
Add a lambda in SeletionZoneAction to enable or disable the action
r1080
Alignment actions for zone selections
r1081 auto alignEnableFuntion = [](auto items) { return items.count() > 1; };
Add a lambda in SeletionZoneAction to enable or disable the action
r1080
Alignment actions for zone selections
r1081 // Vertical alignment actions
Put the align actions in sub menus
r1083 auto alignLeftAction = actionController.addSectionZoneAction(
QStringList{"Align Vertically"}, "Left", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesVerticallyOnLeft(zones, false);
});
Add a lambda in SeletionZoneAction to enable or disable the action
r1080 alignLeftAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1083 auto alignLeftBorderAction = actionController.addSectionZoneAction(
QStringList{"Align Vertically"}, "Left Borders", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesVerticallyOnLeft(zones, true);
});
Alignment actions for zone selections
r1081 alignLeftBorderAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1083 auto alignRightAction = actionController.addSectionZoneAction(
QStringList{"Align Vertically"}, "Right", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesVerticallyOnRight(zones, false);
});
Add a lambda in SeletionZoneAction to enable or disable the action
r1080 alignRightAction->setEnableFunction(alignEnableFuntion);
Alignment actions for zone selections
r1081
Put the align actions in sub menus
r1083 auto alignRightBorderAction = actionController.addSectionZoneAction(
QStringList{"Align Vertically"}, "Right Borders", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesVerticallyOnRight(zones, true);
});
Alignment actions for zone selections
r1081 alignRightBorderAction->setEnableFunction(alignEnableFuntion);
auto alignLeftAndRightAction = actionController.addSectionZoneAction(
Put the align actions in sub menus
r1083 QStringList{"Align Vertically"}, "Left and Right", [](auto zones) {
Alignment actions for zone selections
r1081 Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesVerticallyOnLeft(zones, false);
ref->alignZonesVerticallyOnRight(zones, true);
});
alignLeftAndRightAction->setEnableFunction(alignEnableFuntion);
// Temporal alignment actions
Put the align actions in sub menus
r1083 auto alignLeftTemporallyAction = actionController.addSectionZoneAction(
QStringList{"Align Temporally"}, "Left", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesTemporallyOnLeft(zones, false);
});
Alignment actions for zone selections
r1081 alignLeftTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1083 auto alignLeftBorderTemporallyAction = actionController.addSectionZoneAction(
QStringList{"Align Temporally"}, "Left Borders", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesTemporallyOnLeft(zones, true);
});
Alignment actions for zone selections
r1081 alignLeftBorderTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1083 auto alignRightTemporallyAction = actionController.addSectionZoneAction(
QStringList{"Align Temporally"}, "Right", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesTemporallyOnRight(zones, false);
});
Alignment actions for zone selections
r1081 alignRightTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1083 auto alignRightBorderTemporallyAction = actionController.addSectionZoneAction(
QStringList{"Align Temporally"}, "Right Borders", [](auto zones) {
Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesTemporallyOnRight(zones, true);
});
Alignment actions for zone selections
r1081 alignRightBorderTemporallyAction->setEnableFunction(alignEnableFuntion);
auto alignLeftAndRightTemporallyAction = actionController.addSectionZoneAction(
Put the align actions in sub menus
r1083 QStringList{"Align Temporally"}, "Left and Right", [](auto zones) {
Alignment actions for zone selections
r1081 Q_ASSERT(zones.count() > 1);
auto ref = zones.takeFirst();
ref->alignZonesTemporallyOnLeft(zones, false);
ref->alignZonesTemporallyOnRight(zones, true);
});
alignLeftAndRightTemporallyAction->setEnableFunction(alignEnableFuntion);
New class to manage actions in the visualization
r1078 }