// HACK: Committing a button is the same as instantly clicking it. // virtual void LLButton::onCommit() { // WARNING: Sometimes clicking a button destroys the floater or // panel containing it. Therefore we need to call LLUICtrl::onCommit() // LAST, otherwise this becomes deleted memory. if (mMouseDownSignal) (*mMouseDownSignal)(this, LLSD()); if (mMouseUpSignal) (*mMouseUpSignal)(this, LLSD()); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } if (mIsToggle) { toggleState(); } // do this last, as it can result in destroying this button LLUICtrl::onCommit(); }
BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } // We only handle the click if the click both started and ended within us if (hasMouseCapture()) { // Release the mouse gFocusMgr.setMouseCapture( NULL ); // DO THIS AT THE VERY END to allow the button to be destroyed // as a result of being clicked. If mouseup in the widget, // it's been clicked if (mClickedCallback && !handled) { mClickedCallback(); handled = TRUE; } } else { handled = LLTextBase::handleMouseUp(x, y, mask); } return handled; }
BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); if (hasTabStop() && !getIsChrome()) { setFocus(TRUE); } if (mMouseDownCallback) { (*mMouseDownCallback)(mCallbackUserData); } mMouseDownTimer.start(); mMouseDownFrame = (S32) LLFrameTimer::getFrameCount(); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } return TRUE; }
BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // We only handle the click if the click both started and ended within us // HACK: Only do this if there actually is a click callback, so that // overly large text boxes in the older UI won't start eating clicks. if (mClickedCallback && hasMouseCapture()) { handled = TRUE; // Release the mouse gFocusMgr.setMouseCapture( NULL ); if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked. // If mouseup in the widget, it's been clicked if (mClickedCallback) { (*mClickedCallback)( mCallbackUserData ); } } return handled; }
BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) { if (!childrenHandleMouseDown(x, y, mask)) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); if (hasTabStop() && !getIsChrome()) { setFocus(TRUE); } /* * ATTENTION! This call fires another mouse down callback. * If you wish to remove this call emit that signal directly * by calling LLUICtrl::mMouseDownSignal(x, y, mask); */ LLUICtrl::handleMouseDown(x, y, mask); if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD()); mMouseDownTimer.start(); mMouseDownFrame = (S32) LLFrameTimer::getFrameCount(); mMouseHeldDownCount = 0; if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } } return TRUE; }
void Music::changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos) { if (storeCurPos) _storedPos = _musicFile->pos(); stopSoundEffect(); freeMusic(); _musicFile = _vm->_resource->openDataFile(filename); if (seektoStoredPos) _musicFile->seek(_storedPos); Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, 15000, getSoundFlags()); _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, new Audio::LoopingAudioStream(audioStream, 0)); }
BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) { // Always release the mouse gFocusMgr.setMouseCapture( NULL ); /* * ATTENTION! This call fires another mouse up callback. * If you wish to remove this call emit that signal directly * by calling LLUICtrl::mMouseUpSignal(x, y, mask); */ LLUICtrl::handleMouseUp(x, y, mask); LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); // Regardless of where mouseup occurs, handle callback if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD()); resetMouseDownTimer(); // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked. // If mouseup in the widget, it's been clicked if (pointInView(x, y)) { if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } if (mIsToggle) { toggleState(); } LLUICtrl::onCommit(); } } else { childrenHandleMouseUp(x, y, mask); } return TRUE; }
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLTextBase::handleMouseDown(x, y, mask); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } if (!handled && mClickedCallback) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); handled = TRUE; } return handled; }
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // HACK: Only do this if there actually is a click callback, so that // overly large text boxes in the older UI won't start eating clicks. if (mClickedCallback) { handled = TRUE; // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); if (getSoundFlags() & MOUSE_DOWN) { make_ui_sound("UISndClick"); } } return handled; }
BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) { // We only handle the click if the click both started and ended within us if( hasMouseCapture() ) { // Always release the mouse gFocusMgr.setMouseCapture( NULL ); // Regardless of where mouseup occurs, handle callback if (mMouseUpCallback) { (*mMouseUpCallback)(mCallbackUserData); } mMouseDownTimer.stop(); mMouseDownTimer.reset(); // DO THIS AT THE VERY END to allow the button to be destroyed as a result of being clicked. // If mouseup in the widget, it's been clicked if (pointInView(x, y)) { if (getSoundFlags() & MOUSE_UP) { make_ui_sound("UISndClickRelease"); } if (mIsToggle) { toggleState(); } if (mClickedCallback) { (*mClickedCallback)( mCallbackUserData ); } } } return TRUE; }
void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) { stopSoundEffect(); // NOTE: We need to use malloc(), cause this will be freed with free() // by the music code byte *soundData = (byte *)malloc(length); dataFile->read(soundData, length); Audio::SeekableAudioStream *audioStream = Audio::makePCMStream((const byte *)soundData, length, MAX<uint16>(sampleSpeed, 4000), getSoundFlags()); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, new Audio::LoopingAudioStream(audioStream, (loop) ? 0 : 1)); }