##// END OF EJS Templates
Implements "Variable creation" operation (2)
Implements "Variable creation" operation (2)

File last commit:

r1159:4c27015bd9c6
r1177:94f6e8c9cecc
Show More
VisualizationActionManager.cpp
111 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>
Add Catalogue methods
r1159 VisualizationActionManager::VisualizationActionManager()
{
}
New class to manage actions in the visualization
r1078
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 }