initial wind when entering TM dialog causes message now

(TODO: try to propagate key into dialog instead)
This commit is contained in:
thrust26 2018-02-05 19:57:41 +01:00
parent 1569ee1c6b
commit 1fa00f2372
5 changed files with 25 additions and 4 deletions

View File

@ -2153,9 +2153,9 @@ void EventHandler::enterTimeMachineMenuMode(uInt32 numWinds, bool unwind)
myOSystem.state().addExtraState("enter Time Machine dialog"); // force new state myOSystem.state().addExtraState("enter Time Machine dialog"); // force new state
if(numWinds) if(numWinds)
myOSystem.state().windStates(numWinds, unwind); // hande winds and display wind message (numWinds != 0) in time machine dialog
myOSystem.timeMachine().setEnterWinds(unwind ? numWinds : -numWinds);
// TODO: display last wind message (numWinds != 0) in time machine dialog
enterMenuMode(EventHandlerState::TIMEMACHINE); enterMenuMode(EventHandlerState::TIMEMACHINE);
} }

View File

@ -47,8 +47,10 @@ void TimeMachine::requestResize()
{ {
myWidth = newWidth; myWidth = newWidth;
Dialog* oldPtr = myBaseDialog; Dialog* oldPtr = myBaseDialog;
Int32 enterWinds = ((TimeMachineDialog*)myBaseDialog)->getEnterWinds();
delete myBaseDialog; delete myBaseDialog;
myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth); myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth);
setEnterWinds(enterWinds);
Dialog* newPtr = myBaseDialog; Dialog* newPtr = myBaseDialog;
// Update the container stack; it may contain a reference to the old pointer // Update the container stack; it may contain a reference to the old pointer
@ -56,3 +58,9 @@ void TimeMachine::requestResize()
myDialogStack.replace(oldPtr, newPtr); myDialogStack.replace(oldPtr, newPtr);
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TimeMachine::setEnterWinds(Int32 numWinds)
{
((TimeMachineDialog*)myBaseDialog)->setEnterWinds(numWinds);
}

View File

@ -39,6 +39,11 @@ class TimeMachine : public DialogContainer
*/ */
void requestResize() override; void requestResize() override;
/**
Set number of winds when entering the dialog.
*/
void setEnterWinds(Int32 numWinds);
private: private:
int myWidth; int myWidth;

View File

@ -37,7 +37,8 @@ using Common::Base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
int width) int width)
: Dialog(osystem, parent) : Dialog(osystem, parent),
_enterWinds(0)
{ {
const int BUTTON_W = 16, BUTTON_H = 14; const int BUTTON_W = 16, BUTTON_H = 14;
@ -224,8 +225,9 @@ void TimeMachineDialog::loadConfig()
surface().applyAttributes(); surface().applyAttributes();
} }
handleWinds();
myMessageWidget->setLabel(""); myMessageWidget->setLabel("");
handleWinds(_enterWinds);
_enterWinds = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -31,6 +31,10 @@ class TimeMachineDialog : public Dialog
TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int width); TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int width);
virtual ~TimeMachineDialog() = default; virtual ~TimeMachineDialog() = default;
/** set/get number of winds when entering the dialog */
void setEnterWinds(Int32 numWinds) { _enterWinds = numWinds; };
Int32 getEnterWinds() { return _enterWinds; };
private: private:
void loadConfig() override; void loadConfig() override;
void handleKeyDown(StellaKey key, StellaMod mod) override; void handleKeyDown(StellaKey key, StellaMod mod) override;
@ -72,6 +76,8 @@ class TimeMachineDialog : public Dialog
StaticTextWidget* myLastIdxWidget; StaticTextWidget* myLastIdxWidget;
StaticTextWidget* myMessageWidget; StaticTextWidget* myMessageWidget;
Int32 _enterWinds;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
TimeMachineDialog() = delete; TimeMachineDialog() = delete;