Added hotkey display to tooltips

This commit is contained in:
Thomas Jentzsch 2022-04-02 19:07:28 +02:00
parent 0ef0e35f45
commit 11ff4aca4f
12 changed files with 174 additions and 46 deletions

View File

@ -25,6 +25,8 @@
- Added option to show/hide file extensions.
- Extended context menu and shortcuts.
* Added hotkey display to tooltips.
* Added option to automatically pause emulation when focus is lost.
* Added option to toggle autofire mode.

View File

@ -104,15 +104,18 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
mySettingsGroupEmulation = new RadioButtonGroup();
RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Player settings", mySettingsGroupEmulation, kPlrSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Developer settings", mySettingsGroupEmulation, kDevSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP * 1;
myFrameStatsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Console info overlay");
myFrameStatsWidget->setToolTip(Event::ToggleFrameStats);
wid.push_back(myFrameStatsWidget);
myDetectedInfoWidget = new CheckboxWidget(myTab, font,
@ -239,10 +242,12 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
mySettingsGroupTia = new RadioButtonGroup();
RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Player settings", mySettingsGroupTia, kPlrSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Developer settings", mySettingsGroupTia, kDevSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP * 1;
@ -355,24 +360,27 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
mySettingsGroupVideo = new RadioButtonGroup();
RadioButtonWidget* r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Player settings", mySettingsGroupVideo, kPlrSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, HBORDER, ypos + 1,
"Developer settings", mySettingsGroupVideo, kDevSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP * 1;
// TV jitter effect
myTVJitterWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Jitter/roll effect", kTVJitter);
myTVJitterWidget->setToolTip("Enable to emulate TV loss of sync.");
myTVJitterWidget->setToolTip("Enable to emulate TV loss of sync.", Event::ToggleJitter);
wid.push_back(myTVJitterWidget);
myTVJitterRecWidget = new SliderWidget(myTab, font,
myTVJitterWidget->getRight() + fontWidth * 3, ypos - 1,
"Recovery ", 0, kTVJitterChanged);
myTVJitterRecWidget->setMinValue(1); myTVJitterRecWidget->setMaxValue(20);
myTVJitterRecWidget->setTickmarkIntervals(5);
myTVJitterRecWidget->setToolTip("Define speed of sync recovery.");
myTVJitterRecWidget->setToolTip("Define speed of sync recovery.",
Event::JitterDecrease, Event::JitterIncrease);
wid.push_back(myTVJitterRecWidget);
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRecWidget->getRight() + 4,
@ -383,13 +391,14 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"PAL color-loss");
myColorLossWidget->setToolTip("PAL games with odd scanline count\n"
"will be displayed without color.");
"will be displayed without color.", Event::ToggleColorLoss);
wid.push_back(myColorLossWidget);
ypos += lineHeight + VGAP;
// debug colors
myDebugColorsWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Debug colors (*)");
myDebugColorsWidget->setToolTip(Event::ToggleFixedColors);
wid.push_back(myDebugColorsWidget);
ypos += lineHeight + VGAP + 2;
@ -498,16 +507,19 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
mySettingsGroupTM = new RadioButtonGroup();
RadioButtonWidget* r = new RadioButtonWidget(myTab, font, xpos, ypos + 1,
"Player settings", mySettingsGroupTM, kPlrSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
ypos += lineHeight + VGAP;
r = new RadioButtonWidget(myTab, font, xpos, ypos + 1,
"Developer settings", mySettingsGroupTM, kDevSettings);
r->setToolTip(Event::ToggleDeveloperSet);
wid.push_back(r);
xpos += INDENT;
ypos += lineHeight + VGAP * 1;
myTimeMachineWidget = new CheckboxWidget(myTab, font, xpos, ypos + 1,
"Time Machine", kTimeMachine);
myTimeMachineWidget->setToolTip(Event::ToggleTimeMachine);
wid.push_back(myTimeMachineWidget);
xpos += CheckboxWidget::prefixSize(font);
ypos += lineHeight + VGAP;

View File

@ -91,6 +91,7 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
mySpeed->setMinValue(MIN_SPEED); mySpeed->setMaxValue(MAX_SPEED);
mySpeed->setStepValue(SPEED_STEP);
mySpeed->setTickmarkIntervals(2);
mySpeed->setToolTip(Event::DecreaseSpeed, Event::IncreaseSpeed);
wid.push_back(mySpeed);
ypos += lineHeight + VGAP;
@ -102,6 +103,7 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
myTurbo = new CheckboxWidget(this, _font, xpos, ypos + 1, "Turbo mode");
myTurbo->setToolTip(Event::ToggleTurbo);
wid.push_back(myTurbo);
ypos += lineHeight + VGAP * 3;
@ -155,6 +157,7 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
myAutoSlotWidget = new CheckboxWidget(this, font, xpos, ypos + 1, "Automatically change save state slots");
myAutoSlotWidget->setToolTip("Cycle to next state slot after saving.", Event::ToggleAutoSlot);
wid.push_back(myAutoSlotWidget);
ypos += lineHeight + VGAP;

View File

@ -153,6 +153,7 @@ void GameInfoDialog::addEmulationTab()
VarList::push_back(items, "SECAM60", "SECAM60");
myFormat = new PopUpWidget(myTab, _font, t->getRight(), ypos,
pwidth, lineHeight, items);
myFormat->setToolTip(Event::FormatDecrease, Event::FormatIncrease);
wid.push_back(myFormat);
myFormatDetected = new StaticTextWidget(myTab, ifont, myFormat->getRight() + fontWidth, ypos + 4,
@ -162,6 +163,7 @@ void GameInfoDialog::addEmulationTab()
ypos += lineHeight + VGAP;
myPhosphor = new CheckboxWidget(myTab, _font, HBORDER, ypos + 1,
"Phosphor (enabled for all ROMs)", kPhosphorChanged);
myPhosphor->setToolTip(Event::TogglePhosphor);
wid.push_back(myPhosphor);
ypos += lineHeight + VGAP * 0;
@ -170,6 +172,7 @@ void GameInfoDialog::addEmulationTab()
"Blend ", 0, kPPBlendChanged, 4 * fontWidth, "%");
myPPBlend->setMinValue(0); myPPBlend->setMaxValue(100);
myPPBlend->setTickmarkIntervals(2);
myPPBlend->setToolTip(Event::PhosphorDecrease, Event::PhosphorIncrease);
wid.push_back(myPPBlend);
ypos += lineHeight + VGAP;
@ -180,6 +183,7 @@ void GameInfoDialog::addEmulationTab()
myVCenter->setMinValue(TIAConstants::minVcenter);
myVCenter->setMaxValue(TIAConstants::maxVcenter);
myVCenter->setTickmarkIntervals(4);
myVCenter->setToolTip(Event::VCenterDecrease, Event::VCenterIncrease);
wid.push_back(myVCenter);
ypos += lineHeight + VGAP * 3;
@ -295,6 +299,7 @@ void GameInfoDialog::addControllersTab()
myLeftPort = new PopUpWidget(myTab, _font, myLeftPortLabel->getRight(),
myLeftPortLabel->getTop()-1,
pwidth, lineHeight, items, "", 0, kLeftCChanged);
myLeftPort->setToolTip(Event::PreviousLeftPort, Event::NextLeftPort);
wid.push_back(myLeftPort);
ypos += lineHeight + VGAP;
@ -306,6 +311,7 @@ void GameInfoDialog::addControllersTab()
myRightPort = new PopUpWidget(myTab, _font, myRightPortLabel->getRight(),
myRightPortLabel->getTop()-1,
pwidth, lineHeight, items, "", 0, kRightCChanged);
myRightPort->setToolTip(Event::PreviousRightPort, Event::NextRightPort);
wid.push_back(myRightPort);
ypos += lineHeight + VGAP;
@ -314,6 +320,7 @@ void GameInfoDialog::addControllersTab()
mySwapPorts = new CheckboxWidget(myTab, _font, myLeftPort->getRight() + fontWidth * 4,
myLeftPort->getTop() + 1, "Swap ports");
mySwapPorts->setToolTip(Event::ToggleSwapPorts);
wid.push_back(mySwapPorts);
myQuadTariButton = new ButtonWidget(myTab, _font, myRightPort->getRight() + fontWidth * 4, myRightPort->getTop() - 2,
@ -334,6 +341,7 @@ void GameInfoDialog::addControllersTab()
ypos += lineHeight + VGAP * 4;
mySwapPaddles = new CheckboxWidget(myTab, _font, xpos, ypos, "Swap paddles");
mySwapPaddles->setToolTip(Event::ToggleSwapPaddles);
wid.push_back(mySwapPaddles);
ypos += lineHeight + VGAP;
@ -393,7 +401,8 @@ void GameInfoDialog::addControllersTab()
"Mouse axes range ", 0, 0, fontWidth * 4, "%");
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
myMouseRange->setTickmarkIntervals(4);
myMouseRange->setToolTip("Adjust paddle range emulated by the mouse.");
myMouseRange->setToolTip("Adjust paddle range emulated by the mouse.",
Event::DecreaseMouseAxesRange, Event::IncreaseMouseAxesRange);
wid.push_back(myMouseRange);
// Add items for tab 2

View File

@ -122,7 +122,8 @@ void InputDialog::addDevicePortTab()
myDigitalDeadzone->setMinValue(Controller::MIN_DIGITAL_DEADZONE);
myDigitalDeadzone->setMaxValue(Controller::MAX_DIGITAL_DEADZONE);
myDigitalDeadzone->setTickmarkIntervals(5);
myDigitalDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating digital controllers.");
myDigitalDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating digital controllers.",
Event::DecreaseDeadzone, Event::IncreaseDeadzone);
wid.push_back(myDigitalDeadzone);
// Add analog dead zone
@ -133,7 +134,8 @@ void InputDialog::addDevicePortTab()
myAnalogDeadzone->setMinValue(Controller::MIN_ANALOG_DEADZONE);
myAnalogDeadzone->setMaxValue(Controller::MAX_ANALOG_DEADZONE);
myAnalogDeadzone->setTickmarkIntervals(5);
myAnalogDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating analog controllers.");
myAnalogDeadzone->setToolTip("Adjust dead zone size for analog joysticks when emulating analog controllers.",
Event::DecAnalogDeadzone, Event::IncAnalogDeadzone);
wid.push_back(myAnalogDeadzone);
ypos += lineHeight + VGAP * (3 - 2);
@ -148,6 +150,7 @@ void InputDialog::addDevicePortTab()
myPaddleSpeed->setMinValue(0);
myPaddleSpeed->setMaxValue(Paddles::MAX_ANALOG_SENSE);
myPaddleSpeed->setTickmarkIntervals(3);
myPaddleSpeed->setToolTip(Event::DecAnalogSense, Event::IncAnalogSense);
wid.push_back(myPaddleSpeed);
// Add analog paddle linearity
@ -158,7 +161,8 @@ void InputDialog::addDevicePortTab()
myPaddleLinearity->setMaxValue(Paddles::MAX_ANALOG_LINEARITY);
myPaddleLinearity->setStepValue(5);
myPaddleLinearity->setTickmarkIntervals(3);
myPaddleLinearity->setToolTip("Adjust paddle movement linearity.");
myPaddleLinearity->setToolTip("Adjust paddle movement linearity.",
Event::DecAnalogLinear, Event::IncAnalogLinear);
wid.push_back(myPaddleLinearity);
// Add dejitter (analog paddles)
@ -170,7 +174,8 @@ void InputDialog::addDevicePortTab()
myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterBase->setTickmarkIntervals(5);
myDejitterBase->setToolTip("Adjust paddle input averaging.\n"
"Note: Already implemented in 2600-daptor");
"Note: Already implemented in 2600-daptor",
Event::DecDejtterAveraging, Event::IncDejtterAveraging);
//xpos += myDejitterBase->getWidth() + fontWidth - 4;
wid.push_back(myDejitterBase);
@ -181,7 +186,8 @@ void InputDialog::addDevicePortTab()
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER);
myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterDiff->setTickmarkIntervals(5);
myDejitterDiff->setToolTip("Adjust paddle reaction to fast movements.");
myDejitterDiff->setToolTip("Adjust paddle reaction to fast movements.",
Event::DecDejtterReaction, Event::IncDejtterReaction);
wid.push_back(myDejitterDiff);
// Add paddle speed (digital emulation)
@ -191,34 +197,40 @@ void InputDialog::addDevicePortTab()
lwidth, kDPSpeedChanged, 4 * fontWidth, "%");
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
myDPaddleSpeed->setTickmarkIntervals(4);
myDPaddleSpeed->setToolTip(Event::DecDigitalSense, Event::IncDigitalSense);
wid.push_back(myDPaddleSpeed);
ypos += lineHeight + VGAP * (3 - 2);
myAutoFire = new CheckboxWidget(myTab, _font, HBORDER, ypos + 1, "Autofire", kAutoFireChanged);
myAutoFire->setToolTip(Event::ToggleAutoFire);
wid.push_back(myAutoFire);
myAutoFireRate = new SliderWidget(myTab, _font, HBORDER + lwidth - fontWidth * 5,
ypos - 1, swidth, lineHeight, "Rate ", 0, kAutoFireRate, 5 * fontWidth, "Hz");
myAutoFireRate->setMinValue(0); myAutoFireRate->setMaxValue(30);
myAutoFireRate->setTickmarkIntervals(6);
myAutoFireRate->setToolTip(Event::DecreaseAutoFire, Event::IncreaseAutoFire);
wid.push_back(myAutoFireRate);
// Add 'allow all 4 directions' for joystick
ypos += lineHeight + VGAP * (4 - 2);
myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos,
"Allow all 4 directions on joystick");
myAllowAll4->setToolTip(Event::ToggleFourDirections);
wid.push_back(myAllowAll4);
// Enable/disable modifier key-combos
ypos += lineHeight + VGAP;
myModCombo = new CheckboxWidget(myTab, _font, HBORDER, ypos,
"Use modifier key combos");
myModCombo->setToolTip(Event::ToggleKeyCombos);
wid.push_back(myModCombo);
ypos += lineHeight + VGAP;
// Stelladaptor mappings
mySAPort = new CheckboxWidget(myTab, _font, HBORDER, ypos,
"Swap Stelladaptor ports");
mySAPort->setToolTip(Event::ToggleSAPortOrder);
wid.push_back(mySAPort);
// Add EEPROM erase (part 1/2)
@ -281,6 +293,7 @@ void InputDialog::addMouseTab()
VarList::push_back(items, "Never", "never");
myMouseControl = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight, items,
"Use mouse as a controller ", lwidth, kMouseCtrlChanged);
myMouseControl->setToolTip(Event::PrevMouseAsController, Event::NextMouseAsController);
wid.push_back(myMouseControl);
ypos += lineHeight + VGAP;
@ -294,6 +307,7 @@ void InputDialog::addMouseTab()
lwidth, kMPSpeedChanged, 4 * fontWidth, "%");
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
myMPaddleSpeed->setTickmarkIntervals(4);
myMPaddleSpeed->setToolTip(Event::DecMousePaddleSense, Event::IncMousePaddleSense);
wid.push_back(myMPaddleSpeed);
// Add trackball speed
@ -303,6 +317,7 @@ void InputDialog::addMouseTab()
lwidth, kTBSpeedChanged, 4 * fontWidth, "%");
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
myTrackBallSpeed->setTickmarkIntervals(4);
myTrackBallSpeed->setToolTip(Event::DecMouseTrackballSense, Event::IncMouseTrackballSense);
wid.push_back(myTrackBallSpeed);
// Add driving controller speed
@ -312,7 +327,8 @@ void InputDialog::addMouseTab()
lwidth, kDCSpeedChanged, 4 * fontWidth, "%");
myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20);
myDrivingSpeed->setTickmarkIntervals(4);
myDrivingSpeed->setToolTip("Adjust driving controller sensitivity for digital and mouse input.");
myDrivingSpeed->setToolTip("Adjust driving controller sensitivity for digital and mouse input.",
Event::DecreaseDrivingSense, Event::IncreaseDrivingSense);
wid.push_back(myDrivingSpeed);
// Mouse cursor state
@ -325,6 +341,7 @@ void InputDialog::addMouseTab()
VarList::push_back(items, "+UI, +Emulation", "3");
myCursorState = new PopUpWidget(myTab, _font, HBORDER, ypos, pwidth, lineHeight, items,
"Mouse cursor visibility ", lwidth, kCursorStateChanged);
myCursorState->setToolTip(Event::PreviousCursorVisbility, Event::NextCursorVisbility);
wid.push_back(myCursorState);
#ifndef WINDOWED_SUPPORT
myCursorState->clearFlags(Widget::FLAG_ENABLED);
@ -334,6 +351,7 @@ void InputDialog::addMouseTab()
ypos += lineHeight + VGAP;
myGrabMouse = new CheckboxWidget(myTab, _font, HBORDER, ypos,
"Grab mouse in emulation mode");
myGrabMouse->setToolTip(Event::ToggleGrabMouse);
wid.push_back(myGrabMouse);
#ifndef WINDOWED_SUPPORT
myGrabMouse->clearFlags(Widget::FLAG_ENABLED);

View File

@ -139,6 +139,7 @@ void LauncherDialog::addOptionWidgets(int& ypos)
mySettingsButton = new ButtonWidget(this, _font, xpos, ypos - btnYOfs,
iconWidth, buttonHeight, settingsIcon,
iconGap, " Options" + ELLIPSIS + " ", kOptionsCmd);
mySettingsButton-> setToolTip("(Ctrl+O)");
wid.push_back(mySettingsButton);
const int cwSettings = mySettingsButton->getWidth();
@ -186,14 +187,14 @@ void LauncherDialog::addOptionWidgets(int& ypos)
xpos = myPattern->getRight() + btnGap;
myOnlyRomsButton = new ButtonWidget(this, _font, xpos, ypos - btnYOfs,
buttonWidth, buttonHeight, dummyIcon, kAllfilesCmd);
myOnlyRomsButton->setToolTip("Toggle file type filter");
myOnlyRomsButton->setToolTip("Toggle file type filter (Ctrl+A)");
wid.push_back(myOnlyRomsButton);
// Show the subdirectories button
xpos = myOnlyRomsButton->getRight() + btnGap;
mySubDirsButton = new ButtonWidget(this, _font, xpos, ypos - btnYOfs,
buttonWidth, buttonHeight, dummyIcon, kSubDirsCmd);
mySubDirsButton->setToolTip("Toggle subdirectories");
mySubDirsButton->setToolTip("Toggle subdirectories (Ctrl+D)");
wid.push_back(mySubDirsButton);
// Show the help button
@ -201,7 +202,7 @@ void LauncherDialog::addOptionWidgets(int& ypos)
myHelpButton = new ButtonWidget(this, _font, xpos, ypos - btnYOfs,
buttonWidth, buttonHeight, helpIcon, kHelpCmd);
const string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode);
myHelpButton->setToolTip("Click or press " + key + " for help.");
myHelpButton->setToolTip("Click for help. (" + key + ")");
wid.push_back(myHelpButton);
// Show the files counter
@ -244,7 +245,7 @@ void LauncherDialog::addPathWidgets(int& ypos)
xpos = myNavigationBar->getRight() + BTN_GAP;
myReloadButton = new ButtonWidget(this, _font, xpos, ypos,
buttonWidth, buttonHeight, reloadIcon, kReloadCmd);
myReloadButton->setToolTip("Reload listing");
myReloadButton->setToolTip("Reload listing. (Ctrl+R)");
wid.push_back(myReloadButton);
}
else
@ -793,7 +794,6 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
case KBDK_A:
sendCommand(kAllfilesCmd, 0, 0);
toggleShowAll();
break;
case KBDK_D:

View File

@ -50,25 +50,25 @@ NavigationWidget::NavigationWidget(GuiObject* boss, const GUI::Font& font,
myHomeButton = new ButtonWidget(boss, _font, xpos, ypos,
buttonWidth, buttonHeight, homeIcon, FileListWidget::kHomeDirCmd);
myHomeButton->setToolTip("Go back to initial directory.");
myHomeButton->setToolTip("Go back to initial directory. (Alt+Pos1)");
boss->addFocusWidget(myHomeButton);
xpos = myHomeButton->getRight() + BTN_GAP;
myPrevButton = new ButtonWidget(boss, _font, xpos, ypos,
buttonWidth, buttonHeight, prevIcon, FileListWidget::kPrevDirCmd);
myPrevButton->setToolTip("Go back in directory history.");
myPrevButton->setToolTip("Go back in directory history. (Alt+Left)");
boss->addFocusWidget(myPrevButton);
xpos = myPrevButton->getRight() + BTN_GAP;
myNextButton = new ButtonWidget(boss, _font, xpos, ypos,
buttonWidth, buttonHeight, nextIcon, FileListWidget::kNextDirCmd);
myNextButton->setToolTip("Go forward in directory history.");
myNextButton->setToolTip("Go forward in directory history. (Alt+Right)");
boss->addFocusWidget(myNextButton);
xpos = myNextButton->getRight() + BTN_GAP;
myUpButton = new ButtonWidget(boss, _font, xpos, ypos,
buttonWidth, buttonHeight, upIcon, ListWidget::kParentDirCmd);
myUpButton->setToolTip("Go Up");
myUpButton->setToolTip("Go Up.", Event::UIPrevDir, EventMode::kMenuMode);
boss->addFocusWidget(myUpButton);
xpos = myUpButton->getRight() + BTN_GAP;

View File

@ -20,7 +20,6 @@
#include "EditTextWidget.hxx"
#include "FSNode.hxx"
#include "Font.hxx"
#include "LauncherDialog.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "SnapshotDialog.hxx"

View File

@ -33,8 +33,10 @@ class FBSurface;
class ToolTip
{
private:
public:
static constexpr uInt32 MAX_COLUMNS = 60;
private:
static constexpr uInt32 MAX_ROWS = 5;
public:

View File

@ -129,7 +129,7 @@ void VideoAudioDialog::addDisplayTab()
// TIA interpolation
myTIAInterpolate = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Interpolation ");
myTIAInterpolate->setToolTip("Blur emulated display.");
myTIAInterpolate->setToolTip("Blur emulated display.", Event::ToggleInter);
wid.push_back(myTIAInterpolate);
ypos += lineHeight + VGAP * 4;
@ -137,11 +137,13 @@ void VideoAudioDialog::addDisplayTab()
myTIAZoom = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
"Zoom ", lwidth, 0, fontWidth * 4, "%");
myTIAZoom->setMinValue(200); myTIAZoom->setStepValue(FrameBuffer::ZOOM_STEPS * 100);
myTIAZoom->setToolTip(Event::VidmodeDecrease, Event::VidmodeIncrease);
wid.push_back(myTIAZoom);
ypos += lineHeight + VGAP;
// Fullscreen
myFullscreen = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Fullscreen", kFullScreenChanged);
myFullscreen->setToolTip(Event::ToggleFullScreen);
wid.push_back(myFullscreen);
ypos += lineHeight + VGAP;
@ -154,7 +156,7 @@ void VideoAudioDialog::addDisplayTab()
// Adapt refresh rate
ypos += lineHeight + VGAP;
myRefreshAdapt = new CheckboxWidget(myTab, _font, xpos + INDENT, ypos + 1, "Adapt display refresh rate");
myRefreshAdapt->setToolTip("Select optimal display refresh rate for each ROM.");
myRefreshAdapt->setToolTip("Select optimal display refresh rate for each ROM.", Event::ToggleAdaptRefresh);
wid.push_back(myRefreshAdapt);
#else
myRefreshAdapt = nullptr;
@ -166,12 +168,14 @@ void VideoAudioDialog::addDisplayTab()
"Overscan", lwidth - INDENT, kOverscanChanged, fontWidth * 3, "%");
myTVOverscan->setMinValue(0); myTVOverscan->setMaxValue(10);
myTVOverscan->setTickmarkIntervals(2);
myTVOverscan->setToolTip(Event::OverscanDecrease, Event::OverscanIncrease);
wid.push_back(myTVOverscan);
// Aspect ratio correction
ypos += lineHeight + VGAP * 4;
myCorrectAspect = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Correct aspect ratio (*)");
myCorrectAspect->setToolTip("Uncheck to disable real world aspect ratio correction.");
myCorrectAspect->setToolTip("Uncheck to disable real world aspect ratio correction.",
Event::ToggleCorrectAspectRatio);
wid.push_back(myCorrectAspect);
// Vertical size
@ -181,7 +185,8 @@ void VideoAudioDialog::addDisplayTab()
"V-Size adjust", lwidth, kVSizeChanged, fontWidth * 7, "%", 0, true);
myVSizeAdjust->setMinValue(-5); myVSizeAdjust->setMaxValue(5);
myVSizeAdjust->setTickmarkIntervals(2);
myVSizeAdjust->setToolTip("Adjust vertical size to match emulated TV display.");
myVSizeAdjust->setToolTip("Adjust vertical size to match emulated TV display.",
Event::VSizeAdjustDecrease, Event::VSizeAdjustIncrease);
wid.push_back(myVSizeAdjust);
@ -224,6 +229,7 @@ void VideoAudioDialog::addPaletteTab()
VarList::push_back(items, "Custom", PaletteHandler::SETTING_CUSTOM);
myTIAPalette = new PopUpWidget(myTab, _font, xpos, ypos, pwidth,
lineHeight, items, "Palette ", lwidth, kPaletteChanged);
myTIAPalette->setToolTip(Event::PaletteDecrease, Event::PaletteIncrease);
wid.push_back(myTIAPalette);
ypos += lineHeight + VGAP;
@ -345,6 +351,7 @@ void VideoAudioDialog::addTVEffectsTab()
VarList::push_back(items, "Custom", static_cast<uInt32>(NTSCFilter::Preset::CUSTOM));
myTVMode = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight,
items, "TV mode ", 0, kTVModeChanged);
myTVMode->setToolTip(Event::PreviousVideoMode, Event::NextVideoMode);
wid.push_back(myTVMode);
ypos += lineHeight + VGAP;
@ -379,6 +386,7 @@ void VideoAudioDialog::addTVEffectsTab()
xpos += INDENT;
CREATE_CUSTOM_SLIDERS(ScanIntense, "Intensity", kScanlinesChanged)
myTVScanIntense->setToolTip(Event::ScanlinesDecrease, Event::ScanlinesIncrease);
items.clear();
VarList::push_back(items, "Standard", TIASurface::SETTING_STANDARD);
@ -391,6 +399,7 @@ void VideoAudioDialog::addTVEffectsTab()
pwidth = _w - HBORDER - xpos - fontWidth * 5 - PopUpWidget::dropDownWidth(_font) - 2 * 2;
myTVScanMask = new PopUpWidget(myTab, _font, xpos,
myTVScanIntense->getTop() + 1, pwidth, lineHeight, items, "Mask ");
myTVScanMask->setToolTip(Event::PreviousScanlineMask, Event::NextScanlineMask);
wid.push_back(myTVScanMask);
// Create buttons in 2nd column
@ -437,6 +446,7 @@ void VideoAudioDialog::addAudioTab()
// Enable sound
mySoundEnableCheckbox = new CheckboxWidget(myTab, _font, xpos, ypos,
"Enable sound", kSoundEnableChanged);
mySoundEnableCheckbox->setToolTip(Event::SoundToggle);
wid.push_back(mySoundEnableCheckbox);
ypos += lineHeight + VGAP;
xpos += CheckboxWidget::prefixSize(_font);
@ -446,6 +456,7 @@ void VideoAudioDialog::addAudioTab()
"Volume", lwidth, 0, 4 * fontWidth, "%");
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
myVolumeSlider->setTickmarkIntervals(4);
myVolumeSlider->setToolTip(Event::VolumeDecrease, Event::VolumeIncrease);
wid.push_back(myVolumeSlider);
ypos += lineHeight + VGAP;

View File

@ -25,6 +25,7 @@
#include "FBSurface.hxx"
#include "GuiObject.hxx"
#include "OSystem.hxx"
#include "EventHandler.hxx"
#include "Widget.hxx"
@ -277,11 +278,73 @@ void Widget::setEnabled(bool e)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setToolTip(const string& text)
void Widget::setToolTip(const string& text, Event::Type event1, EventMode mode)
{
setToolTip(text, event1, Event::Type::NoType, mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setToolTip(const string& text, Event::Type event1, Event::Type event2, EventMode mode)
{
assert(text.length() <= ToolTip::MAX_LEN);
_toolTipText = text;
setToolTip(event1, event2, mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setToolTip(Event::Type event1, EventMode mode)
{
setToolTip(event1, Event::Type::NoType, mode);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setToolTip(Event::Type event1, Event::Type event2, EventMode mode)
{
_toolTipEvent1 = event1;
_toolTipEvent2 = event2;
_toolTipMode = mode;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Widget::getToolTip(const Common::Point& pos) const
{
string hotkey = instance().eventHandler().keyHandler().getMappingDesc(_toolTipEvent1, _toolTipMode);
string hotkey2 = instance().eventHandler().keyHandler().getMappingDesc(_toolTipEvent2, _toolTipMode);
if(hotkey2 != EmptyString)
{
// Merge hotkeys if they only differ by "+Shift"
const string mod = "+Shift";
size_t p = BSPF::findIgnoreCase(hotkey, mod);
if(p != string::npos)
{
string testKey = hotkey.substr(0, p) + hotkey.substr(p + string(mod).length());
if(testKey == hotkey2)
hotkey = hotkey.substr(0, p) + "[" + mod + "]" + hotkey.substr(p + string(mod).length());
else
hotkey += ", " + hotkey2;
}
else
hotkey += ", " + hotkey2;
}
if(hotkey == EmptyString)
return _toolTipText;
else if(_toolTipText == EmptyString)
return "(" + hotkey + ")";
else
if(_toolTipText.length() + hotkey.length() + 3 <= ToolTip::MAX_COLUMNS)
return _toolTipText + " (" + hotkey + ")";
else
return _toolTipText + "\n(" + hotkey + ")";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Widget::hasToolTip() const
{
return !_toolTipText.empty() || _toolTipEvent1 != Event::Type::NoType;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -114,8 +114,14 @@ class Widget : public GuiObject
void setBGColorHi(ColorId color) { _bgcolorhi = color; setDirty(); }
void setShadowColor(ColorId color) { _shadowcolor = color; setDirty(); }
void setToolTip(const string& text);
virtual string getToolTip(const Common::Point& pos) const { return _toolTipText; }
void setToolTip(const string& text,
Event::Type event1 = Event::Type::NoType, EventMode = EventMode::kEmulationMode);
void setToolTip(const string& text,
Event::Type event1, Event::Type event2, EventMode = EventMode::kEmulationMode);
void setToolTip(Event::Type event1, EventMode mode = EventMode::kEmulationMode);
void setToolTip(Event::Type event1, Event::Type event2,
EventMode mode = EventMode::kEmulationMode);
virtual string getToolTip(const Common::Point& pos) const;
virtual bool changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const { return false; }
@ -135,7 +141,7 @@ class Widget : public GuiObject
void releaseFocus() override { assert(_boss); _boss->releaseFocus(); }
virtual bool wantsToolTip() const { return hasMouseFocus() && hasToolTip(); }
virtual bool hasToolTip() const { return !_toolTipText.empty(); }
virtual bool hasToolTip() const;
// By default, delegate unhandled commands to the boss
void handleCommand(CommandSender* sender, int cmd, int data, int id) override
@ -145,24 +151,27 @@ class Widget : public GuiObject
bool hasHelp() const override { return !getHelpURL().empty(); }
protected:
GuiObject* _boss{nullptr};
GuiObject* _boss{nullptr};
const GUI::Font& _font;
Widget* _next{nullptr};
uInt32 _id{0};
bool _hasFocus{false};
int _fontWidth{0};
int _lineHeight{0};
ColorId _bgcolor{kWidColor};
ColorId _bgcolorhi{kWidColor};
ColorId _bgcolorlo{kBGColorLo};
ColorId _textcolor{kTextColor};
ColorId _textcolorhi{kTextColorHi};
ColorId _textcolorlo{kBGColorLo};
ColorId _shadowcolor{kShadowColor};
string _toolTipText;
string _helpAnchor;
string _helpURL;
bool _debuggerHelp{false};
Widget* _next{nullptr};
uInt32 _id{0};
bool _hasFocus{false};
int _fontWidth{0};
int _lineHeight{0};
ColorId _bgcolor{kWidColor};
ColorId _bgcolorhi{kWidColor};
ColorId _bgcolorlo{kBGColorLo};
ColorId _textcolor{kTextColor};
ColorId _textcolorhi{kTextColorHi};
ColorId _textcolorlo{kBGColorLo};
ColorId _shadowcolor{kShadowColor};
string _toolTipText;
Event::Type _toolTipEvent1{Event::NoType};
Event::Type _toolTipEvent2{Event::NoType};
EventMode _toolTipMode{EventMode::kEmulationMode};
string _helpAnchor;
string _helpURL;
bool _debuggerHelp{false};
public:
static Widget* findWidgetInChain(Widget* start, int x, int y);