##// END OF EJS Templates
Add fix for default repository init
Add fix for default repository init

File last commit:

r1191:4c27015bd9c6
r1317:686305865878
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
r1113 #include "Visualization/VisualizationActionManager.h"
Action "Remove Selected Zones"
r1114 #include "Visualization/VisualizationGraphWidget.h"
#include "Visualization/VisualizationSelectionZoneItem.h"
New class to manage actions in the visualization
r1113
#include <Actions/ActionsGuiController.h>
#include <SqpApplication.h>
Add Catalogue methods
r1191 VisualizationActionManager::VisualizationActionManager()
{
}
New class to manage actions in the visualization
r1113
void VisualizationActionManager::installSelectionZoneActions()
{
auto &actionController = sqpApp->actionsGuiController();
Add a lambda in SeletionZoneAction to enable or disable the action
r1115
Add action to remove the selected zone with the "del" buttons
r1117 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
r1115
Alignment actions for zone selections
r1116 auto alignEnableFuntion = [](auto items) { return items.count() > 1; };
Add a lambda in SeletionZoneAction to enable or disable the action
r1115
Alignment actions for zone selections
r1116 // Vertical alignment actions
Put the align actions in sub menus
r1118 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
r1115 alignLeftAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1118 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
r1116 alignLeftBorderAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1118 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
r1115 alignRightAction->setEnableFunction(alignEnableFuntion);
Alignment actions for zone selections
r1116
Put the align actions in sub menus
r1118 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
r1116 alignRightBorderAction->setEnableFunction(alignEnableFuntion);
auto alignLeftAndRightAction = actionController.addSectionZoneAction(
Put the align actions in sub menus
r1118 QStringList{"Align Vertically"}, "Left and Right", [](auto zones) {
Alignment actions for zone selections
r1116 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
r1118 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
r1116 alignLeftTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1118 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
r1116 alignLeftBorderTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1118 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
r1116 alignRightTemporallyAction->setEnableFunction(alignEnableFuntion);
Put the align actions in sub menus
r1118 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
r1116 alignRightBorderTemporallyAction->setEnableFunction(alignEnableFuntion);
auto alignLeftAndRightTemporallyAction = actionController.addSectionZoneAction(
Put the align actions in sub menus
r1118 QStringList{"Align Temporally"}, "Left and Right", [](auto zones) {
Alignment actions for zone selections
r1116 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
r1113 }