mirror of https://github.com/stella-emu/stella.git
propagate 'repeated' to dialogs
This commit is contained in:
parent
950068ba60
commit
d731b71afb
|
@ -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))
|
if(key == KBDK_GRAVE && !StellaModTest::isShift(mod))
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ class DebuggerDialog : public Dialog
|
||||||
private:
|
private:
|
||||||
void center() override { positionAt(0); }
|
void center() override { positionAt(0); }
|
||||||
void loadConfig() override;
|
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 handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
|
||||||
void doStep();
|
void doStep();
|
||||||
|
|
|
@ -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));
|
handleEvent(instance().eventHandler().eventForKey(kMenuMode, key, mod));
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ContextMenu : public Dialog, public CommandSender
|
||||||
void handleMouseMoved(int x, int y) override;
|
void handleMouseMoved(int x, int y) override;
|
||||||
bool handleMouseClicks(int x, int y, MouseButton b) override;
|
bool handleMouseClicks(int x, int y, MouseButton b) override;
|
||||||
void handleMouseWheel(int x, int y, int direction) 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 handleJoyDown(int stick, int button, bool longPress) override;
|
||||||
void handleJoyAxis(int stick, int axis, int value, int button) override;
|
void handleJoyAxis(int stick, int axis, int value, int button) override;
|
||||||
bool handleJoyHat(int stick, int hat, JoyHat value, int button) override;
|
bool handleJoyHat(int stick, int hat, JoyHat value, int button) override;
|
||||||
|
|
|
@ -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;
|
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
|
// Unless a widget has claimed all responsibility for data, we assume
|
||||||
// that if an event exists for the given data, it should have priority.
|
// 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)
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
_focusedWidget->handleKeyDown(key, mod);
|
_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)
|
switch(e)
|
||||||
{
|
{
|
||||||
|
@ -692,7 +692,7 @@ bool Dialog::handleNavEvent(Event::Type e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::UIOK:
|
case Event::UIOK:
|
||||||
if(_okWidget && _okWidget->isEnabled())
|
if(_okWidget && _okWidget->isEnabled() && !repeated)
|
||||||
{
|
{
|
||||||
// Receiving 'OK' is the same as getting the 'Select' event
|
// Receiving 'OK' is the same as getting the 'Select' event
|
||||||
_okWidget->handleEvent(Event::UISelect);
|
_okWidget->handleEvent(Event::UISelect);
|
||||||
|
@ -701,7 +701,7 @@ bool Dialog::handleNavEvent(Event::Type e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::UICancel:
|
case Event::UICancel:
|
||||||
if(_cancelWidget && _cancelWidget->isEnabled())
|
if(_cancelWidget && _cancelWidget->isEnabled() && !repeated)
|
||||||
{
|
{
|
||||||
// Receiving 'Cancel' is the same as getting the 'Select' event
|
// Receiving 'Cancel' is the same as getting the 'Select' event
|
||||||
_cancelWidget->handleEvent(Event::UISelect);
|
_cancelWidget->handleEvent(Event::UISelect);
|
||||||
|
|
|
@ -130,7 +130,7 @@ class Dialog : public GuiObject
|
||||||
void releaseFocus() override;
|
void releaseFocus() override;
|
||||||
|
|
||||||
virtual void handleText(char text);
|
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 handleKeyUp(StellaKey key, StellaMod modifiers);
|
||||||
virtual void handleMouseDown(int x, int y, MouseButton b, int clickCount);
|
virtual void handleMouseDown(int x, int y, MouseButton b, int clickCount);
|
||||||
virtual void handleMouseUp(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:
|
private:
|
||||||
void buildCurrentFocusList(int tabID = -1);
|
void buildCurrentFocusList(int tabID = -1);
|
||||||
bool handleNavEvent(Event::Type e);
|
bool handleNavEvent(Event::Type e, bool repeated = false);
|
||||||
void getTabIdForWidget(Widget* w);
|
void getTabIdForWidget(Widget* w);
|
||||||
bool cycleTab(int direction);
|
bool cycleTab(int direction);
|
||||||
|
|
||||||
|
|
|
@ -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
|
// Send the event to the dialog box on the top of the stack
|
||||||
Dialog* activeDialog = myDialogStack.top();
|
Dialog* activeDialog = myDialogStack.top();
|
||||||
if(pressed)
|
if(pressed)
|
||||||
activeDialog->handleKeyDown(key, mod);
|
activeDialog->handleKeyDown(key, mod, repeated);
|
||||||
else
|
else
|
||||||
activeDialog->handleKeyUp(key, mod);
|
activeDialog->handleKeyUp(key, mod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// Remap key events in remap mode, otherwise pass to parent dialog
|
||||||
if (myEmulEventMapper->remapMode())
|
if (myEmulEventMapper->remapMode())
|
||||||
|
|
|
@ -47,7 +47,7 @@ class InputDialog : public Dialog
|
||||||
bool repeatEnabled() override;
|
bool repeatEnabled() override;
|
||||||
|
|
||||||
private:
|
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 handleKeyUp(StellaKey key, StellaMod mod) override;
|
||||||
void handleJoyDown(int stick, int button, bool longPress) override;
|
void handleJoyDown(int stick, int button, bool longPress) override;
|
||||||
void handleJoyUp(int stick, int button) override;
|
void handleJoyUp(int stick, int button) override;
|
||||||
|
|
|
@ -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
|
// Grab the key before passing it to the actual dialog and check for
|
||||||
// Control-R (reload ROM listing)
|
// Control-R (reload ROM listing)
|
||||||
|
|
|
@ -88,7 +88,7 @@ class LauncherDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void center() override { positionAt(0); }
|
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 handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void handleJoyDown(int stick, int button, bool longPress) override;
|
void handleJoyDown(int stick, int button, bool longPress) override;
|
||||||
|
|
|
@ -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)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ class MinUICommandDialog : public Dialog
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void loadConfig() override;
|
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 handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void updateSlot(int slot);
|
void updateSlot(int slot);
|
||||||
void updateWinds();
|
void updateWinds();
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "Base.hxx"
|
#include "Base.hxx"
|
||||||
using Common::Base;
|
using Common::Base;
|
||||||
|
|
||||||
|
|
||||||
const int BUTTON_W = 14, BUTTON_H = 14;
|
const int BUTTON_W = 14, BUTTON_H = 14;
|
||||||
|
|
||||||
static uInt32 RECORD[BUTTON_H] =
|
static uInt32 RECORD[BUTTON_H] =
|
||||||
|
@ -193,7 +192,6 @@ static uInt32 LOAD_ALL[BUTTON_H] =
|
||||||
0b11111111111111,
|
0b11111111111111,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
|
TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
int width)
|
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
|
// The following 'Alt' shortcuts duplicate the shortcuts in EventHandler
|
||||||
// It is best to keep them the same, so changes in EventHandler mean we
|
// It is best to keep them the same, so changes in EventHandler mean we
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TimeMachineDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfig() override;
|
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 handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
|
||||||
/** initialize timeline bar */
|
/** initialize timeline bar */
|
||||||
|
|
Loading…
Reference in New Issue