mirror of https://github.com/stella-emu/stella.git
enhanced UI navigation with a controller
added "Cancel" option to LauncherDialog context menu if opened with a controller updated docs for image navigation in LauncherDialog
This commit is contained in:
parent
129ec5886a
commit
65115cc3a1
|
@ -4068,10 +4068,10 @@
|
|||
|
||||
<p>Stella supports viewing images and ROM properties of the currently
|
||||
selected ROM in the ROM launcher. Image support is automatic, as long as your
|
||||
image directory contains snapshots in the appropriate format. The label
|
||||
(if existing) and the number of matching snapshots are displayed under the
|
||||
current one. The mouse or the ROM Launcher hotkeys can be used to browse
|
||||
multiple images or a ROM.</p>
|
||||
image directory contains any images in the appropriate format. The label (if
|
||||
existing) and the number of matching images are displayed under the
|
||||
current image. The mouse, the ROM Launcher hotkeys or the controller can be
|
||||
used to browse multiple images of a ROM.</p>
|
||||
|
||||
Notes:
|
||||
<li>The images can have PNG or JPG format.</li>
|
||||
|
|
|
@ -160,6 +160,16 @@
|
|||
Button 2 or 6 close the menu without any action.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button 1 + Left</td>
|
||||
<td>-</td>
|
||||
<td>Display previous image</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button 1 + Right</td>
|
||||
<td>-</td>
|
||||
<td>Display next image</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button 2</td>
|
||||
<td>SKILL P2</td>
|
||||
|
|
|
@ -75,6 +75,10 @@ void DialogContainer::updateTime(uInt64 time)
|
|||
// Joystick axis still pressed
|
||||
if(myCurrentAxisDown.stick != -1 && myAxisRepeatTime < myTime)
|
||||
{
|
||||
if(myCurrentButtonDown.stick == myCurrentAxisDown.stick)
|
||||
activeDialog->handleJoyAxis(myCurrentAxisDown.stick, myCurrentAxisDown.axis,
|
||||
myCurrentAxisDown.adir, myCurrentButtonDown.button);
|
||||
else
|
||||
activeDialog->handleJoyAxis(myCurrentAxisDown.stick, myCurrentAxisDown.axis,
|
||||
myCurrentAxisDown.adir);
|
||||
myAxisRepeatTime = myTime + _REPEAT_SUSTAIN_DELAY;
|
||||
|
@ -323,7 +327,10 @@ void DialogContainer::handleJoyBtnEvent(int stick, int button, bool pressed)
|
|||
// Send the event to the dialog box on the top of the stack
|
||||
Dialog* activeDialog = myDialogStack.top();
|
||||
|
||||
if(pressed && myButtonRepeatTime < myTime) // prevent pending repeats after enabling repeat again
|
||||
if(pressed)
|
||||
{
|
||||
if(myButtonRepeatTime < myTime || // prevent pending repeats after enabling repeat again
|
||||
myButtonRepeatTime + _REPEAT_INITIAL_DELAY > myTime) // ignore blocking delays
|
||||
{
|
||||
myCurrentButtonDown.stick = stick;
|
||||
myCurrentButtonDown.button = button;
|
||||
|
@ -332,6 +339,7 @@ void DialogContainer::handleJoyBtnEvent(int stick, int button, bool pressed)
|
|||
|
||||
activeDialog->handleJoyDown(stick, button);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only stop firing events if it's the current button
|
||||
|
@ -356,7 +364,8 @@ void DialogContainer::handleJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, i
|
|||
// Send the event to the dialog box on the top of the stack
|
||||
Dialog* activeDialog = myDialogStack.top();
|
||||
|
||||
// Prevent long button press in button/axis combinations
|
||||
// Prevent button repeats and long button press in button/axis combinations
|
||||
myButtonRepeatTime = myTime + _REPEAT_NONE;
|
||||
myButtonLongPressTime = myTime + _REPEAT_NONE;
|
||||
|
||||
// Only stop firing events if it's the current stick
|
||||
|
@ -386,7 +395,8 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHatDir hdir, int
|
|||
// Send the event to the dialog box on the top of the stack
|
||||
Dialog* activeDialog = myDialogStack.top();
|
||||
|
||||
// Prevent long button press in button/hat combinations
|
||||
// Prevent button repeats and long button press in button/hat combinations
|
||||
myButtonRepeatTime = myTime + _REPEAT_NONE;
|
||||
myButtonLongPressTime = myTime + _REPEAT_NONE;
|
||||
|
||||
// Only stop firing events if it's the current stick
|
||||
|
|
|
@ -952,12 +952,13 @@ Event::Type LauncherDialog::getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir
|
|||
break;
|
||||
|
||||
case Event::UITabPrev:
|
||||
// TODO: check with controller, then update doc (R77 too)
|
||||
myRomImageWidget->changeImage(-1);
|
||||
myEventHandled = true;
|
||||
break;
|
||||
|
||||
case Event::UITabNext:
|
||||
myRomImageWidget->changeImage(1);
|
||||
myEventHandled = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1136,11 +1137,13 @@ void LauncherDialog::openContextMenu(int x, int y)
|
|||
{
|
||||
// Dynamically create context menu for ROM list options
|
||||
|
||||
bool addCancel = false;
|
||||
if(x < 0 || y < 0)
|
||||
{
|
||||
// Long pressed button, determine position from currently selected list item
|
||||
x = myList->getLeft() + myList->getWidth() / 2;
|
||||
y = myList->getTop() + (myList->getSelected() - myList->currentPos() + 1) * _font.getLineHeight();
|
||||
addCancel = true;
|
||||
}
|
||||
|
||||
struct ContextItem {
|
||||
|
@ -1219,6 +1222,8 @@ void LauncherDialog::openContextMenu(int x, int y)
|
|||
// items.push_back(ContextItem("Options" + ELLIPSIS, "Ctrl+O", "options"));
|
||||
//}
|
||||
}
|
||||
if(addCancel)
|
||||
items.push_back(ContextItem("Cancel", "")); // closes the context menu and does nothing
|
||||
|
||||
// Format items for menu
|
||||
VariantList varItems;
|
||||
|
|
Loading…
Reference in New Issue