bool Slider::pointerPressed(MAPoint2d p, int id) { int sliderPos = getSliderPos(); if(mMoveToPoint || !mGripImage) { double newValue; if(mOrientation == HORIZONTAL) { newValue = mMinValue + (((double)(p.x-(mPaddedBounds.x+(mSliderGripWidth>>1)))) * (mMaxValue-mMinValue)) / (double)(mPaddedBounds.width-mSliderGripWidth); }
void PanelPreviewSound::update() { uint64 t = SoundMan.getChannelDurationPlayed(_sound); Common::UString played = formatTime(t); Common::UString total = formatTime(_duration); Common::UString percent = formatPercent(_duration, t); _textPosition->SetLabelMarkup(Common::UString::format("<tt>%s</tt>", played.c_str())); _textPercent->SetLabelMarkup(Common::UString::format("<tt>%s</tt>", percent.c_str())); _textDuration->SetLabelMarkup(Common::UString::format("<tt>%s</tt>", total.c_str())); _sliderPosition->SetValue(getSliderPos(_duration, t)); bool isPlaying = SoundMan.isPlaying(_sound); bool isPaused = SoundMan.isPaused(_sound); setButtons(!isPlaying || isPaused, isPlaying && !isPaused, isPlaying); }
/** * FUNCTION CalculateExposureAndFlash * * @brief Calculates the Exposure and flash based on Slider Position. * * @version 1.0 * * @author David Libby * @date 9/29/2015 1:35:50 PM * * @param exposurePos * @param flashPos */ void AutoCamera::CalculateExposureAndFlash(int &exposurePos, int &flashPos) { int scrollPos=getSliderPos(); int whole=scrollPos/m_flashASize; int remainder=scrollPos%m_flashASize; exposurePos= whole + 0; //if(remainder>0) // exposurePos = remainder + 1; if(whole==0) exposurePos=0; if(exposurePos>(int)m_CameraSpeedMap_uS.size()-1) exposurePos=m_CameraSpeedMap_uS.size()-1; flashPos= remainder+m_CtxFlashA.min; }