aboutsummaryrefslogtreecommitdiffstats
path: root/commands/command_event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'commands/command_event.cpp')
-rw-r--r--commands/command_event.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/commands/command_event.cpp b/commands/command_event.cpp
index 5c71aaebd..4e29b452c 100644
--- a/commands/command_event.cpp
+++ b/commands/command_event.cpp
@@ -74,11 +74,24 @@ AddEventDivemodeSwitch::AddEventDivemodeSwitch(struct dive *d, int dcNr, int sec
}
AddEventSetpointChange::AddEventSetpointChange(struct dive *d, int dcNr, int seconds, pressure_t pO2) :
- AddEventBase(d, dcNr, create_event(seconds, SAMPLE_EVENT_PO2, 0, pO2.mbar, QT_TRANSLATE_NOOP("gettextFromC", "SP change")))
+ AddEventBase(d, dcNr, create_event(seconds, SAMPLE_EVENT_PO2, 0, pO2.mbar, QT_TRANSLATE_NOOP("gettextFromC", "SP change"))),
+ divemode(CCR)
{
setText(Command::Base::tr("Add set point change")); // TODO: format pO2 value in bar or psi.
}
+void AddEventSetpointChange::undoit()
+{
+ AddEventBase::undoit();
+ std::swap(get_dive_dc(d, dcNr)->divemode, divemode);
+}
+
+void AddEventSetpointChange::redoit()
+{
+ AddEventBase::redoit();
+ std::swap(get_dive_dc(d, dcNr)->divemode, divemode);
+}
+
RenameEvent::RenameEvent(struct dive *d, int dcNr, struct event *ev, const char *name) : EventBase(d, dcNr),
eventToAdd(clone_event_rename(ev, name)),
eventToRemove(ev)