propagate 'repeated' to dialogs

This commit is contained in:
Thomas Jentzsch 2019-08-14 17:25:42 +02:00
parent 950068ba60
commit d731b71afb
15 changed files with 20 additions and 22 deletions

View File

@ -93,7 +93,7 @@ void DebuggerDialog::loadConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod)
void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
if(key == KBDK_GRAVE && !StellaModTest::isShift(mod))
{

View File

@ -75,7 +75,7 @@ class DebuggerDialog : public Dialog
private:
void center() override { positionAt(0); }
void loadConfig() override;
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void doStep();

View File

@ -280,7 +280,7 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod)
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod));
}

View File

@ -86,7 +86,7 @@ class ContextMenu : public Dialog, public CommandSender
void handleMouseMoved(int x, int y) override;
bool handleMouseClicks(int x, int y, MouseButton b) override;
void handleMouseWheel(int x, int y, int direction) override;
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleJoyDown(int stick, int button, bool longPress) override;
void handleJoyAxis(int stick, int axis, int value, int button) override;
bool handleJoyHat(int stick, int hat, JoyHat value, int button) override;

View File

@ -443,7 +443,7 @@ void Dialog::handleText(char text)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
void Dialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
Event::Type e = Event::NoType;
@ -463,7 +463,7 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
// Unless a widget has claimed all responsibility for data, we assume
// that if an event exists for the given data, it should have priority.
if(!handleNavEvent(e) && _focusedWidget)
if(!handleNavEvent(e, repeated) && _focusedWidget)
{
if(_focusedWidget->wantsRaw() || e == Event::NoType)
_focusedWidget->handleKeyDown(key, mod);
@ -653,7 +653,7 @@ bool Dialog::handleJoyHat(int stick, int hat, JoyHat value, int button)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::handleNavEvent(Event::Type e)
bool Dialog::handleNavEvent(Event::Type e, bool repeated)
{
switch(e)
{
@ -692,7 +692,7 @@ bool Dialog::handleNavEvent(Event::Type e)
break;
case Event::UIOK:
if(_okWidget && _okWidget->isEnabled())
if(_okWidget && _okWidget->isEnabled() && !repeated)
{
// Receiving 'OK' is the same as getting the 'Select' event
_okWidget->handleEvent(Event::UISelect);
@ -701,7 +701,7 @@ bool Dialog::handleNavEvent(Event::Type e)
break;
case Event::UICancel:
if(_cancelWidget && _cancelWidget->isEnabled())
if(_cancelWidget && _cancelWidget->isEnabled() && !repeated)
{
// Receiving 'Cancel' is the same as getting the 'Select' event
_cancelWidget->handleEvent(Event::UISelect);

View File

@ -130,7 +130,7 @@ class Dialog : public GuiObject
void releaseFocus() override;
virtual void handleText(char text);
virtual void handleKeyDown(StellaKey key, StellaMod modifiers);
virtual void handleKeyDown(StellaKey key, StellaMod modifiers, bool repeated = false);
virtual void handleKeyUp(StellaKey key, StellaMod modifiers);
virtual void handleMouseDown(int x, int y, MouseButton b, int clickCount);
virtual void handleMouseUp(int x, int y, MouseButton b, int clickCount);
@ -169,7 +169,7 @@ class Dialog : public GuiObject
private:
void buildCurrentFocusList(int tabID = -1);
bool handleNavEvent(Event::Type e);
bool handleNavEvent(Event::Type e, bool repeated = false);
void getTabIdForWidget(Widget* w);
bool cycleTab(int direction);

View File

@ -188,7 +188,7 @@ void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod, bool pressed,
// Send the event to the dialog box on the top of the stack
Dialog* activeDialog = myDialogStack.top();
if(pressed)
activeDialog->handleKeyDown(key, mod);
activeDialog->handleKeyDown(key, mod, repeated);
else
activeDialog->handleKeyUp(key, mod);
}

View File

@ -451,7 +451,7 @@ bool InputDialog::repeatEnabled()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::handleKeyDown(StellaKey key, StellaMod mod)
void InputDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
// Remap key events in remap mode, otherwise pass to parent dialog
if (myEmulEventMapper->remapMode())

View File

@ -47,7 +47,7 @@ class InputDialog : public Dialog
bool repeatEnabled() override;
private:
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleKeyUp(StellaKey key, StellaMod mod) override;
void handleJoyDown(int stick, int button, bool longPress) override;
void handleJoyUp(int stick, int button) override;

View File

@ -428,7 +428,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod)
void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
// Grab the key before passing it to the actual dialog and check for
// Control-R (reload ROM listing)

View File

@ -88,7 +88,7 @@ class LauncherDialog : public Dialog
private:
void center() override { positionAt(0); }
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void handleJoyDown(int stick, int button, bool longPress) override;

View File

@ -136,7 +136,7 @@ void MinUICommandDialog::loadConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MinUICommandDialog::handleKeyDown(StellaKey key, StellaMod mod)
void MinUICommandDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
switch (key)
{

View File

@ -35,7 +35,7 @@ class MinUICommandDialog : public Dialog
protected:
void loadConfig() override;
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void updateSlot(int slot);
void updateWinds();

View File

@ -34,7 +34,6 @@
#include "Base.hxx"
using Common::Base;
const int BUTTON_W = 14, BUTTON_H = 14;
static uInt32 RECORD[BUTTON_H] =
@ -193,7 +192,6 @@ static uInt32 LOAD_ALL[BUTTON_H] =
0b11111111111111,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
int width)
@ -305,7 +303,7 @@ void TimeMachineDialog::loadConfig()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod)
void TimeMachineDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
// The following 'Alt' shortcuts duplicate the shortcuts in EventHandler
// It is best to keep them the same, so changes in EventHandler mean we

View File

@ -37,7 +37,7 @@ class TimeMachineDialog : public Dialog
private:
void loadConfig() override;
void handleKeyDown(StellaKey key, StellaMod mod) override;
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
/** initialize timeline bar */