コード例 #1
0
    //___________________________________________________________________
    void LineEditData::textChanged( void )
    {

        // check whether text change was triggered manually
        // in which case do not start transition
        if( _edited )
        {
            _edited = false;
            return;
        }

        if( transition().data()->isAnimated() )
        { transition().data()->endAnimation(); }

        if( isLocked() )
        {
            // if locked one do not start the new animation, to prevent flicker
            // instead, one hides the transition pixmap, trigger an update, and return.
            // animations are re-locked.
            transition().data()->hide();
            lockAnimations();
            _timer.start( 0, this );
            return;
        }

        if( initializeAnimation() )
        {

            lockAnimations();
            animate();

        } else {

            transition().data()->hide();

        }
    }
コード例 #2
0
void LayerTreeCoordinator::performScheduledLayerFlush()
{
    if (m_isSuspended || m_waitingForUIProcess)
        return;

    // We lock the animations while performing layout, to avoid flickers caused by animations continuing in the UI process while
    // the web process layout wants to cancel them.
    lockAnimations();
    syncDisplayState();

    // We can unlock the animations before flushing if there are no visible changes, for example if there are content updates
    // in a layer with opacity 0.
    bool canUnlockBeforeFlush = !m_isValid || !toCoordinatedGraphicsLayer(m_rootLayer.get())->hasPendingVisibleChanges();
    if (canUnlockBeforeFlush)
        unlockAnimations();

    if (!m_isValid)
        return;

    if (flushPendingLayerChanges())
        didPerformScheduledLayerFlush();
}
コード例 #3
0
ファイル: Animation.cpp プロジェクト: fluffyfreak/TrenchBroom
        wxThread::ExitCode AnimationManager::Entry() {
            m_lastTime = wxGetLocalTimeMillis();
            while (!TestDestroy()) {
                wxLongLong elapsed = wxGetLocalTimeMillis() - m_lastTime;
                Animation::List updateAnimations;
                {
                    wxCriticalSectionLocker lockAnimations(m_animationsLock);
                    if (!m_animations.empty()) {
                        AnimationMap::iterator mapIt = m_animations.begin();
                        while (mapIt != m_animations.end()) {
                            Animation::List& list = mapIt->second;
                            Animation::List::iterator listIt = list.begin();
                            while (listIt != list.end()) {
                                Animation::Ptr animation = *listIt;
                                if (animation->step(elapsed))
                                    listIt = list.erase(listIt);
                                updateAnimations.push_back(animation);
                                if (listIt != list.end())
                                    ++listIt;
                            }

                            if (list.empty())
                                m_animations.erase(mapIt++);
                            else
                                ++mapIt;
                        }
                    }
                }
                m_lastTime += elapsed;

                wxTheApp->QueueEvent(new AnimationEvent(updateAnimations));
                Sleep(20);
            }

            return (wxThread::ExitCode)0;
        }
コード例 #4
0
ファイル: labeldata.cpp プロジェクト: 33akash/MuseScore
//___________________________________________________________________
bool LabelData::eventFilter( QObject* object, QEvent* event ) {

      if ( object != target_.data() ) return TransitionData::eventFilter( object, event );
      switch ( event->type() ) {

            case QEvent::Show:
                  /*
                  at show event, on set the old text to current
                  to avoid animate the "first" paint event.
                  text mnemonic is always removed to avoid triggering the animation when only the
                  latter is changed
                  */
                  text_ = target_.data()->text().remove( '&' );
                  break;

            case QEvent::Paint: {

                  if ( enabled() && target_  ) {

                        // remove showMnemonic from text before comparing
                        QString text( target_.data()->text().remove( '&' ) );
                        if ( text == text_ ) {
                              if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) return true;
                              else break;
                              }

                        // update text and pixmap
                        text_ = text;

                        if ( !(transition() && target_.data()->isVisible() ) ) break;

                        if ( transition().data()->isAnimated() ) {
                              transition().data()->endAnimation();
                              }

                        // check whether animations are locked
                        if ( isLocked() ) {

                              // hide transition widget
                              transition().data()->hide();

                              // restart the lock timer
                              // and abort transition
                              lockAnimations();
                              break;
                              }

                        // restart the lock timer
                        // and prepare transition
                        lockAnimations();
                        initializeAnimation();
                        timer_.start( 0, this );

                        if ( !transition().data()->startPixmap().isNull() && TransitionWidget::paintEnabled() ) {

                              // show the transition widget
                              // and disable this event painting
                              transition().data()->show();
                              transition().data()->raise();
                              return true;

                              }
                        else {

                              // hide transition widget and abort transition
                              transition().data()->hide();
                              break;

                              }

                        }
                  else if ( transition().data()->isAnimated() && TransitionWidget::paintEnabled() ) {

                        // disable painting when transition is running
                        // since label is obscured by transition widget
                        return true;

                        }
                  else break;
                  }

            default:
                  break;
            }

      return TransitionData::eventFilter( object, event );

      }