From b6cb1734eae3a741ea61613fe430482ff915c6e0 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 2 Apr 2019 16:10:30 +0200 Subject: [PATCH] a litte code cleanup --- src/gui/StellaSettingsDialog.cxx | 31 +++++++------------------------ src/gui/StellaSettingsDialog.hxx | 5 +---- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index 08ec1ca59..019993992 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -192,15 +192,12 @@ void StellaSettingsDialog::loadConfig() myTVMode->setSelected( settings.getString("tv.filter"), "0"); - // TV scanline intensity and interpolation + // TV scanline intensity myTVScanIntense->setValue(valueToLevel(settings.getInt("tv.scanlines"))); handleTVModeChange(); - // TV phosphor mode - //myTVPhosphor->setState(settings.getString("tv.phosphor") == "always"); // TV phosphor blend myTVPhosLevel->setValue(valueToLevel(settings.getInt("tv.phosblend"))); - handlePhosphorChange(); // Controllers Properties props; @@ -232,15 +229,15 @@ void StellaSettingsDialog::saveConfig() myTVMode->getSelectedTag().toString()); // TV phosphor mode - //instance().settings().setValue("tv.phosphor", - // myTVPhosphor->getState() ? "always" : "byrom"); instance().settings().setValue("tv.phosphor", myTVPhosLevel->getValue() > 0 ? "always" : "byrom"); // TV phosphor blend - instance().settings().setValue("tv.phosblend", levelToValue(myTVPhosLevel->getValue())); + instance().settings().setValue("tv.phosblend", + levelToValue(myTVPhosLevel->getValue())); // TV scanline intensity and interpolation - instance().settings().setValue("tv.scanlines", levelToValue(myTVScanIntense->getValue())); + instance().settings().setValue("tv.scanlines", + levelToValue(myTVScanIntense->getValue())); // Controller properties myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString()); @@ -268,15 +265,12 @@ void StellaSettingsDialog::setDefaults() // TV effects myTVMode->setSelected("0", "0"); - // TV scanline intensity myTVScanIntense->setValue(4); // = 26% - // TV phosphor blend myTVPhosLevel->setValue(6); // = 45% handleTVModeChange(); - handlePhosphorChange(); // Load the default game properties Properties defaultProperties; @@ -303,14 +297,9 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd, break; case kTVModeChanged: - case kScanlinesChanged: handleTVModeChange(); break; - case kPhosphorChanged: - handlePhosphorChange(); - break; - default: Dialog::handleCommand(sender, cmd, data, 0); break; @@ -411,19 +400,13 @@ void StellaSettingsDialog::handleTVModeChange() myTVScanIntense->setEnabled(scanenable); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void StellaSettingsDialog::handlePhosphorChange() -{ - //myTVPhosLevel->setEnabled(myTVPhosphor->getState()); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int StellaSettingsDialog::levelToValue(int level) { const int NUM_LEVELS = 11; uInt8 values[NUM_LEVELS] = { 0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95 }; - - return values[level]; + + return values[std::min(level, NUM_LEVELS - 1)]; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/StellaSettingsDialog.hxx b/src/gui/StellaSettingsDialog.hxx index 0859f165c..92f2f85cb 100644 --- a/src/gui/StellaSettingsDialog.hxx +++ b/src/gui/StellaSettingsDialog.hxx @@ -44,7 +44,6 @@ class StellaSettingsDialog : public Dialog void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleTVModeChange(); - void handlePhosphorChange(); // load the properties for the controller settings void loadControllerProperties(const Properties& props); @@ -78,9 +77,7 @@ class StellaSettingsDialog : public Dialog StaticTextWidget* myRightPortDetected; enum { - kTVModeChanged = 'VDtv', - kScanlinesChanged = 'VDsc', - kPhosphorChanged = 'VDph', + kTVModeChanged = 'SStv', }; // Game properties for currently loaded ROM