From 838cba2d164ef531c6ccac419772fe2b9fae45ab Mon Sep 17 00:00:00 2001 From: thrust26 Date: Tue, 12 May 2020 15:21:15 +0200 Subject: [PATCH] Moved two more mouse settings to Mouse tab --- src/gui/InputDialog.cxx | 81 +++++++++++++++++++++++------------------ src/gui/InputDialog.hxx | 16 ++++---- 2 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index c3959c742..3cced561b 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -127,10 +127,9 @@ void InputDialog::addDevicePortTab() "Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth); myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29); myDeadzone->setTickmarkIntervals(4); - xpos = HBORDER + myDeadzone->getWidth() + 5; wid.push_back(myDeadzone); - xpos = HBORDER; ypos += lineHeight + VGAP * 2; + xpos = HBORDER; ypos += lineHeight + VGAP * 4; new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:"); xpos += fontWidth * 2; @@ -165,7 +164,7 @@ void InputDialog::addDevicePortTab() wid.push_back(myDejitterDiff); // Add paddle speed (digital emulation) - ypos += lineHeight + VGAP * 3; + ypos += lineHeight + VGAP * 4; myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, "Digital paddle sensitivity", lwidth, kDPSpeedChanged, 4 * fontWidth, "%"); @@ -173,26 +172,8 @@ void InputDialog::addDevicePortTab() myDPaddleSpeed->setTickmarkIntervals(4); wid.push_back(myDPaddleSpeed); - // Add trackball speed - ypos += lineHeight + VGAP; - myTrackBallSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, - "Trackball sensitivity", - lwidth, kTBSpeedChanged, 4 * fontWidth, "%"); - myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20); - myTrackBallSpeed->setTickmarkIntervals(4); - wid.push_back(myTrackBallSpeed); - - // Add driving controller speed - ypos += lineHeight + VGAP; - myDrivingSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, - "Driving contr. sensitivity", - lwidth, kDCSpeedChanged, 4 * fontWidth, "%"); - myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20); - myDrivingSpeed->setTickmarkIntervals(4); - wid.push_back(myDrivingSpeed); - // Add 'allow all 4 directions' for joystick - ypos += lineHeight + VGAP * 3; + ypos += lineHeight + VGAP * 4; myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos, "Allow all 4 directions on joystick"); wid.push_back(myAllowAll4); @@ -231,7 +212,7 @@ void InputDialog::addDevicePortTab() wid.push_back(myEraseEEPROMButton); // Add AtariVox serial port - ypos += lineHeight + VGAP * 2; + ypos += lineHeight + VGAP * 3; lwidth = _font.getStringWidth("AVox serial port "); fwidth = _w - HBORDER * 2 - 2 - lwidth; new StaticTextWidget(myTab, _font, HBORDER, ypos + 2, "AVox serial port "); @@ -252,7 +233,8 @@ void InputDialog::addMouseTab() const int VGAP = fontHeight / 4; const int VBORDER = fontHeight / 2; const int HBORDER = fontWidth * 1.25; - int ypos, lwidth, pwidth, tabID; + const int INDENT = fontWidth * 2; + int xpos = HBORDER, ypos, lwidth, pwidth, tabID; WidgetArray wid; VariantList items; @@ -267,21 +249,43 @@ void InputDialog::addMouseTab() VarList::push_back(items, "Always", "always"); VarList::push_back(items, "Analog devices", "analog"); VarList::push_back(items, "Never", "never"); - myMouseControl = new PopUpWidget(myTab, _font, HBORDER, ypos, pwidth, lineHeight, items, + myMouseControl = new PopUpWidget(myTab, _font, xpos, ypos, pwidth, lineHeight, items, "Use mouse as a controller ", lwidth, kMouseCtrlChanged); wid.push_back(myMouseControl); - // Add paddle speed (mouse emulation) ypos += lineHeight + VGAP; - myMPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, - "Mouse paddle sensitivity ", + myMouseSensitivity = new StaticTextWidget(myTab, _font, xpos, ypos + 1, "Sensitivity:"); + + // Add paddle speed (mouse emulation) + xpos += INDENT; ypos += lineHeight + VGAP; + lwidth -= INDENT; + myMPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, + "Paddle", lwidth, kMPSpeedChanged, 4 * fontWidth, "%"); myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20); myMPaddleSpeed->setTickmarkIntervals(4); wid.push_back(myMPaddleSpeed); + // Add trackball speed + ypos += lineHeight + VGAP; + myTrackBallSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, + "Trackball", + lwidth, kTBSpeedChanged, 4 * fontWidth, "%"); + myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20); + myTrackBallSpeed->setTickmarkIntervals(4); + wid.push_back(myTrackBallSpeed); + + // Add driving controller speed + ypos += lineHeight + VGAP; + myDrivingSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, + "Driving controller", + lwidth, kDCSpeedChanged, 4 * fontWidth, "%"); + myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20); + myDrivingSpeed->setTickmarkIntervals(4); + wid.push_back(myDrivingSpeed); // Mouse cursor state + lwidth += INDENT; ypos += lineHeight + VGAP * 4; items.clear(); VarList::push_back(items, "-UI, -Emulation", "0"); @@ -473,9 +477,6 @@ void InputDialog::setDefaults() myDejitterBase->setValue(0); myDejitterDiff->setValue(0); #endif - myDrivingSpeed->setValue(10); - myTrackBallSpeed->setValue(10); - // AtariVox serial port myAVoxPort->setText(""); @@ -491,15 +492,17 @@ void InputDialog::setDefaults() // Use mouse as a controller myMouseControl->setSelected("analog"); + // Paddle speed (mouse) + myMPaddleSpeed->setValue(10); + myTrackBallSpeed->setValue(10); + myDrivingSpeed->setValue(10); + // Mouse cursor state myCursorState->setSelected("2"); // Grab mouse myGrabMouse->setState(true); - // Paddle speed (mouse) - myMPaddleSpeed->setValue(10); - handleMouseControlState(); handleCursorState(); break; @@ -691,6 +694,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, case kMouseCtrlChanged: handleMouseControlState(); + handleCursorState(); break; case kCursorStateChanged: @@ -725,14 +729,19 @@ void InputDialog::updateDejitterReaction() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputDialog::handleMouseControlState() { - myMPaddleSpeed->setEnabled(myMouseControl->getSelected() != 2); + bool enable = myMouseControl->getSelected() != 2; + + myMouseSensitivity->setEnabled(enable); + myMPaddleSpeed->setEnabled(enable); + myTrackBallSpeed->setEnabled(enable); + myDrivingSpeed->setEnabled(enable); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputDialog::handleCursorState() { int state = myCursorState->getSelected(); - bool enableGrab = state != 1 && state != 3; + bool enableGrab = state != 1 && state != 3 && myMouseControl->getSelected() != 2; myGrabMouse->setEnabled(enableGrab); } diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 54fde4a91..1c8c04367 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -91,9 +91,7 @@ class InputDialog : public Dialog EventMappingWidget* myEmulEventMapper{nullptr}; EventMappingWidget* myMenuEventMapper{nullptr}; - CheckboxWidget* mySAPort{nullptr}; - PopUpWidget* myMouseControl{nullptr}; - PopUpWidget* myCursorState{nullptr}; + CheckboxWidget* mySAPort{nullptr}; EditTextWidget* myAVoxPort{nullptr}; @@ -102,16 +100,20 @@ class InputDialog : public Dialog SliderWidget* myDejitterBase{nullptr}; SliderWidget* myDejitterDiff{nullptr}; SliderWidget* myDPaddleSpeed{nullptr}; - SliderWidget* myMPaddleSpeed{nullptr}; - SliderWidget* myTrackBallSpeed{nullptr}; - SliderWidget* myDrivingSpeed{nullptr}; CheckboxWidget* myAllowAll4{nullptr}; - CheckboxWidget* myGrabMouse{nullptr}; CheckboxWidget* myModCombo{nullptr}; ButtonWidget* myJoyDlgButton{nullptr}; ButtonWidget* myEraseEEPROMButton{nullptr}; + PopUpWidget* myMouseControl{nullptr}; + StaticTextWidget* myMouseSensitivity{nullptr}; + SliderWidget* myMPaddleSpeed{nullptr}; + SliderWidget* myTrackBallSpeed{nullptr}; + SliderWidget* myDrivingSpeed{nullptr}; + PopUpWidget* myCursorState{nullptr}; + CheckboxWidget* myGrabMouse{nullptr}; + // Show the list of joysticks that the eventhandler knows about unique_ptr myJoyDialog;