Esempio n. 1
0
void AbstractNavigation::loadView(const glm::mat4 & new_viewmatrix, const float fovy, bool save_history)
{
    m_old_rotation = glm::quat_cast(m_viewmatrix);
    m_new_rotation = glm::quat_cast(new_viewmatrix);

    m_old_pos = glm::column(m_viewmatrix, 3).xyz();
    m_new_pos = glm::column(new_viewmatrix, 3).xyz();

    m_old_fovy = m_fovy;

    if(save_history)
    {
        // this path: when a preset was selected in gui or a view was undone/redone.
        m_new_fovy = m_fovy;
        onNavigated();
    }
    else
    {
        // a user interaction / navigation event
        m_new_fovy = fovy;
    }

    m_animation_progress = 0;
    m_animation_active = true;

    if(!isTimerRunning())
    {
        startTimer();
    }
}
Esempio n. 2
0
    void paint (Graphics&)
    {
        ComponentPeer* const peer = owner.getPeer();

        if (peer != nullptr)
            peer->addMaskedRegion (owner.getScreenBounds() - peer->getScreenPosition());

        if (owner.isUsingDedicatedThread())
        {
            if (peer != nullptr && owner.isShowing())
            {
               #if ! JUCE_LINUX
                owner.updateContext();
               #endif

                owner.startRenderThread();
            }
        }
        else
        {
            owner.updateContext();

           #if JUCE_ANDROID
            triggerAndroidOpenGLRepaint (owner.getCurrentContext());
           #else
            if (isTimerRunning())
                timerCallback();
           #endif
        }
    }
Esempio n. 3
0
void MTCSender::pause()
{
    if (isTimerRunning())
        stopTimer();
    else
        startTimer(1000 / 25 / 4);
}
    void paint (Graphics&)
    {
        ComponentPeer* const peer = owner.getPeer();

        if (peer != nullptr)
            peer->addMaskedRegion (owner.getScreenBounds() - peer->getScreenPosition());

        if (owner.isUsingDedicatedThread())
        {
            if (peer != nullptr && owner.isShowing())
            {
               #if ! JUCE_LINUX
                owner.updateContext();
               #endif

                if (! owner.threadStarted)
                {
                    owner.threadStarted = true;
                    owner.startRenderThread();
                }
            }
        }
        else
        {
            owner.updateContext();

            if (isTimerRunning())
                timerCallback();
        }
    }
void VideoComponent::resized()
{
    Rectangle<int> r = getLocalBounds();

    if (isVideoOpen() && ! r.isEmpty())
    {
        Rectangle<int> nativeSize = getVideoNativeSize();

        if (nativeSize.isEmpty())
        {
            // if we've just opened the file and are still waiting for it to
            // figure out the size, start our timer..
            if (! isTimerRunning())
                startTimer (50);
        }
        else
        {
            r = RectanglePlacement (RectanglePlacement::centred).appliedTo (nativeSize, r);
            stopTimer();
        }
    }
    else
    {
        stopTimer();
    }

    pimpl->setBounds (r);
}
bool ThreadWithProgressWindow::runThread (const int priority)
{
    launchThread (priority);

    while (isTimerRunning())
        MessageManager::getInstance()->runDispatchLoopUntil (5);

    return ! wasCancelledByUser;
}
Esempio n. 7
0
void StatusBar::displayParameter(const Parameter *parameter) {
    parameterNameLabel.setText(parameter->getName());
    parameterValueLabel.setText(parameter->getDisplayText());

    labelOpacity = 1.0f;
    clearTimeout = kClearTimeoutInMs / kAnimationFrameRate;
    if (!isTimerRunning()) {
        startTimer(kAnimationTimerRateInMs);
    }
}
Esempio n. 8
0
//======================================================================
void HeaderComponent::buildPing()
{
    if (! isTimerRunning())
    {
        isBuilding = true;
        runAppButton->setEnabled (false);
        runAppButton->setTooltip ("Building...");

        startTimer (50);
    }
}
Esempio n. 9
0
void TextBuffer::stopMatching()
{
  if (matchpos != -1)
    {
      setPoint(matchpos);  
      setColour(TextEditor::caretColourId, Colours::black);
      matchpos=-1;
      if (isTimerRunning())
	stopTimer();
    }
}
Esempio n. 10
0
    void setFrequencyMillis (int millis)
    {
        const bool wasRunning = isTimerRunning();

        if (wasRunning)
            stopTimer();

        milliseconds = millis;

        if (wasRunning && milliseconds > 0)
            startTimer (milliseconds);
    }
Esempio n. 11
0
    void addImageToCache (const Image& image, const int64 hashCode)
    {
        if (image.isValid())
        {
            if (! isTimerRunning())
                startTimer (2000);

            Item* const item = new Item();
            item->hashCode = hashCode;
            item->image = image;
            item->lastUseTime = Time::getApproximateMillisecondCounter();

            const ScopedLock sl (lock);
            images.add (item);
        }
    }
VstPluginExternalEditor::~VstPluginExternalEditor ()
{
    DBG ("VstPluginExternalEditor::~VstPluginExternalEditor");

    if (isTimerRunning())
        stopTimer();

#if defined(LINUX)
#elif defined(_WIN32)
#endif

    if (plugin)
        plugin->closeEditor ();

#ifdef JUCE_MAC    
    setGuiWindow(0);
#endif // JUCE_MAC    
}
void JUCESplashScreen::paint (Graphics& g)
{
    auto r = getLocalBounds().toFloat();
    Point<float> bottomRight (0.9f * r.getWidth(),
                              0.9f * r.getHeight());

    ColourGradient cg (Colour (0x00000000), Line<float> (0.0f, r.getHeight(), r.getWidth(), 0.0f)
                                              .findNearestPointTo (bottomRight),
                       Colour (0xff000000), bottomRight, false);
    cg.addColour (0.25f, Colour (0x10000000));
    cg.addColour (0.50f, Colour (0x30000000));
    cg.addColour (0.75f, Colour (0x70000000));
    g.setFillType (cg);
    g.fillAll();

    content->drawWithin (g, getLogoArea (r), RectanglePlacement::centred, 1.0f);

    if (splashDisplayTime == 0)
        splashDisplayTime = Time::getMillisecondCounter();

    if (! isTimerRunning())
        startTimer (millisecondsToDisplaySplash);
}
Esempio n. 14
0
int main(void)
{
    DDRB    |= 1;           /* make the LED pin an output */
    DDRB    &= 0xFD;        /* make the switch pin an input */
    PORTB   &= 0xFD;        /* make it tri-stated */

    /* set up the timer */
    BYTE timerHits = 0;
    while (1) {
        
        if ((PINB & 0x02) > 0) { /* if the button is pressed */
            /* if the timer is running, keep going */
            if (isTimerRunning()) {
                continue;
            }
            /* if the timer isn't running, start it */
            else {
                enableTimerInterrupt();
                startTimer(255, CLOCK_SCALE_1024);
                sei();
                timerHits = 0;
            }
        }
        /* if the button is not pressed, stop and clear timer */
        else
        {
            cli();
            stopTimer();
            disableTimerInterrupt();
            timerHits = 0;
            clearTimerTripped();
        }
               
    }
    
    return 0;               /* never reached */
}
LashManager::~LashManager()
{
    if (client && isTimerRunning ())
        stopTimer ();
}
 void trigger()
 {
     if (! isTimerRunning())
         startTimer (100);
 }
Esempio n. 17
0
 unsigned getNumPendingNodes() const
 {
     const unsigned ret = pending_nodes_.getSize();
     UAVCAN_ASSERT((ret > 0) ? isTimerRunning() : true);
     return ret;
 }