From d38593a821906725c68c851d7222830ee8fcdd35 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 5 Dec 2020 23:25:21 +0100 Subject: [PATCH] fixed and enhanced TimeMachineDialog --- src/gui/TimeMachineDialog.cxx | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index 8e550d2a9..594ed5036 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -255,10 +255,12 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, // Add buttons myToggleWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, STOP.data(), BUTTON_W, BUTTON_H, kToggle); + myToggleWidget->setToolTip("Toogle Time Machine mode."); xpos += buttonWidth + BUTTON_GAP; myExitWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, EXIT.data(), BUTTON_W, BUTTON_H, kExit); + myExitWidget->setToolTip("Exit Time Machine dialog."); xpos += buttonWidth + BUTTON_GAP * 4; myRewindAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, @@ -271,6 +273,7 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, myPlayBackWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, PLAYBACK.data(), BUTTON_W, BUTTON_H, kPlayBack); + myPlayBackWidget->setToolTip("Start playback of Time Machine states."); xpos += buttonWidth + BUTTON_GAP; myUnwind1Widget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, @@ -283,15 +286,21 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, mySaveAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, SAVE_ALL.data(), BUTTON_W, BUTTON_H, kSaveAll); + mySaveAllWidget->setToolTip("Save all Time Machine states."); xpos = mySaveAllWidget->getRight() + BUTTON_GAP; myLoadAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, LOAD_ALL.data(), BUTTON_W, BUTTON_H, kLoadAll); + myLoadAllWidget->setToolTip("Load all Time Machine states."); xpos = myLoadAllWidget->getRight() + BUTTON_GAP * 4; // Add message + int mWidth = (myLastTimeWidget->getLeft() - xpos) / font.getMaxCharWidth(); + const string blanks = " "; + myMessageWidget = new StaticTextWidget(this, font, xpos, ypos_s, - " ", TextAlign::Left, kBGColor); + blanks.substr(0, mWidth), + TextAlign::Left, kBGColor); myMessageWidget->setFlags(Widget::FLAG_CLEARBG | Widget::FLAG_NOBG); myMessageWidget->setTextColor(kColorInfo); } @@ -328,6 +337,10 @@ void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeate switch (event) { + case Event::ExitMode: + handleCommand(nullptr, kExit, 0, 0); + break; + case Event::Rewind1Menu: handleCommand(nullptr, kRewind1, 0, 0); break; @@ -352,13 +365,19 @@ void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeate handleCommand(nullptr, kUnwindAll, 0, 0); break; - case Event::TakeSnapshot: - if (!repeated) - handleCommand(nullptr, kSnapShot, 0, 0); + case Event::LoadAllStates: + if(!repeated) + handleCommand(nullptr, kLoadAll, 0, 0); break; - case Event::ExitMode: - handleCommand(nullptr, kExit, 0, 0); + case Event::SaveAllStates: + if(!repeated) + handleCommand(nullptr, kSaveAll, 0, 0); + break; + + case Event::TakeSnapshot: + if(!repeated) + handleCommand(nullptr, kSnapShot, 0, 0); break; default: