void aRect::render() { int32_t color = getColor(); if(isShowing()) //bOutline ? drawEmptyRect( getGUI_RECT(), color, color ) : drawRect( getGUI_RECT(), color ); bOutline ? drawEmptyRect(getGlobalGUI_RECT(), color, color) : drawRect(getGlobalGUI_RECT(), color); }
bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc, bool grabFocus) { if (doc == nullptr) return false; if (doc->hasFileBeenModifiedExternally()) doc->reloadFromFile(); if (doc == getCurrentDocument() && contentView != nullptr) { if (grabFocus) contentView->grabKeyboardFocus(); return true; } recentDocumentList.newDocumentOpened (doc); bool opened = setEditorComponent (doc->createEditor(), doc); if (opened && grabFocus && isShowing()) contentView->grabKeyboardFocus(); return opened; }
void ActivePilotListItem::update() { if ( !isShowing() ) // do nothing until active return; if ( showingPromotion )// if in promotion area, do that... { s_pilotPromotionArea->update(); PilotReviewScreen::s_curPromotion = s_pilotPromotionArea; if ( s_pilotPromotionArea->isDone() ) { promotionShown = true; PilotReviewScreen::s_curPromotion = NULL; showingPromotion = false; } } else if ( !showingPromotion && !promotionShown && pilot->promotePilot() ) { if ( currentTime > flashTime() + .5f ) // wait five seconds before bringing in the doors { s_pilotPromotionArea->setPilot( pilot, pilotIcon ); showingPromotion = true; promotionShown = false; showGUIWindow( true ); } } else if ( !pilot->promotePilot() ) { promotionShown = true; showingPromotion = false; } PilotListItem::update(); }
void WebBrowserComponent::checkWindowAssociation() { if (isShowing()) { if (browser->browser == nullptr && getPeer() != nullptr) { browser->createBrowser(); reloadLastURL(); } else { if (blankPageShown) goBack(); } } else { if (browser != nullptr && unloadPageWhenBrowserIsHidden && ! blankPageShown) { // when the component becomes invisible, some stuff like flash // carries on playing audio, so we need to force it onto a blank // page to avoid this.. blankPageShown = true; browser->goToURL ("about:blank", 0, 0); } } }
void OpenGLComponent::paint (Graphics&) { ComponentPeer* const peer = getPeer(); if (useThread) { if (peer != nullptr && isShowing()) { #if ! JUCE_LINUX updateContext(); #endif if (! threadStarted) { threadStarted = true; startRenderThread(); } } } else { updateContext(); if (! renderAndSwapBuffers()) return; } if (peer != nullptr) { const Point<int> topLeft (getScreenPosition() - peer->getScreenPosition()); peer->addMaskedRegion (topLeft.getX(), topLeft.getY(), getWidth(), getHeight()); } }
void ResizableWindow::updateLastPosIfShowing() { if (isShowing()) { updateLastPosIfNotFullScreen(); updatePeerConstrainer(); } }
bool Button::isShortcutPressed() const { if (isShowing() && ! isCurrentlyBlockedByAnotherModalComponent()) for (int i = shortcuts.size(); --i >= 0;) if (shortcuts.getReference(i).isCurrentlyDown()) return true; return false; }
void TopLevelWindow::visibilityChanged() { if (isShowing() && (getPeer()->getStyleFlags() & (ComponentPeer::windowIsTemporary | ComponentPeer::windowIgnoresKeyPresses)) == 0) { toFront (true); } }
bool Button::isShortcutPressed() const { if (isShowing() && ! isCurrentlyBlockedByAnotherModalComponent()) for (auto& s : shortcuts) if (s.isCurrentlyDown()) return true; return false; }
void aAnimButton::update( const aAnimation& animData ) { if ( !isShowing() ) return; long color = animData.getColor(); if ( animateBmp ) setColor( color, 0 ); if ( animateText ) data.textColors[state] = color; long xPos = animData.getXDelta(); long yPos = animData.getYDelta(); move( xPos, yPos ); if ( bAnimateChildren ) { for ( int i = 0; i < numberOfChildren(); i++ ) pChildren[i]->setColor( color ); } float fXcaleX = animData.getScaleX(); float fScaleY = animData.getScaleX(); if ( fXcaleX != 1.0 && fScaleY != 1.0 ) { float oldWidth = width(); float oldHeight = height(); float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fXcaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( width() * scaleX, height() * scaleY ); aButton::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aButton::render(); }
void aButton::update() { if ( !isShowing() ) return; long mouseX = userInput->getMouseX(); long mouseY = userInput->getMouseY(); if ( pointInside( mouseX, mouseY ) ) { long mouseDragX = userInput->getMouseDragX(); long mouseDragY = userInput->getMouseDragY(); if ( messageOnRelease && userInput->leftMouseReleased() && pointInside( mouseDragX, mouseDragY ) ) { press( false ); if ( getParent() ) getParent()->handleMessage( aMSG_LEFTMOUSEDOWN, data.ID ); if ( state != DISABLED && state != HIDDEN ) sndSystem->playDigitalSample( clickSFX ); else sndSystem->playDigitalSample( disabledSFX ); } if (userInput->isLeftClick()) { press( true ); if ( getParent() && !messageOnRelease && pointInside(userInput->getMouseDragX(), userInput->getMouseDragY() ) ) getParent()->handleMessage( aMSG_LEFTMOUSEDOWN, data.ID ); if ( state != DISABLED ) sndSystem->playDigitalSample( clickSFX ); else sndSystem->playDigitalSample( disabledSFX ); } else if ( userInput->getMouseLeftHeld() > holdTime && !messageOnRelease && pointInside(userInput->getMouseDragX(), userInput->getMouseDragY()) ) handleMessage( aMSG_LEFTMOUSEHELD, data.ID ); else { if ( state != HIGHLIGHT && state != DISABLED && state != HIDDEN ) sndSystem->playDigitalSample( highlightSFX ); state = HIGHLIGHT; makeUVs( location, state, data ); } } else if ( state == PRESSED && messageOnRelease ) state = ENABLED; aObject::update(); }
void aObject::update() { int32_t x = userInput->getMouseX(); int32_t y = userInput->getMouseY(); if (pointInside(x, y) && helpID && isShowing()) { helpTextID = helpID; } // call update for the children for (size_t i = 0; i < nNumberOfChildren; i++) pChildren[i]->update(); }
void mcScrollButton::render() { if ( isShowing() && state != DISABLED ) { setColor( regularColor ); aButton::render(); GUI_RECT rect = { globalX(), globalY(), globalRight()-1, globalBottom()-1 }; drawEmptyRect( rect, lightEdge, darkEdge ); } }
void LitSphereWidget::paintGL() { if( !isShowing() ) return; glLineWidth( 1.5 ); float useTheta = inTheta; if( doubleTheta ) useTheta *= 2.0; incidentVector[0] = sin(useTheta) * cos(inPhi); incidentVector[1] = sin(useTheta) * sin(inPhi); incidentVector[2] = cos(useTheta); glPushAttrib(GL_ALL_ATTRIB_BITS); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, width(), height()); float fWidth = float(width()); float fHeight = float(height()); if( width() > height() ) { float aspect = fWidth / fHeight; glOrtho( -aspect * sphereMargin, aspect * sphereMargin, -sphereMargin, sphereMargin, NEAR_PLANE, FAR_PLANE ); } else { float invAspect = fHeight / fWidth; glOrtho( -sphereMargin, sphereMargin, -invAspect * sphereMargin, invAspect * sphereMargin, NEAR_PLANE, FAR_PLANE ); } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( 0, 0, 2.75, 0, 0, 0, 0, 1, 0 ); if( brdfs.size() ) drawSphere( 1.0, 100, 100 ); glPopAttrib(); }
//--------------------------------------------------------------------------- void CFunction::Format(CExportContext& ctx, const SFString& fmtIn, void *data) const { if (!isShowing()) return; SFString fmt = (fmtIn.IsEmpty() ? defaultFormat() : fmtIn); //.Substitute("\n","\t"); if (handleCustomFormat(ctx, fmt, data)) return; CFunctionNotify dn(this); while (!fmt.IsEmpty()) ctx << getNextChunk(fmt, nextFunctionChunk, &dn); }
void aAnimObject::render( ) { if ( !isShowing() ) return; long color = animInfo.getColor(); float xNewOffset = animInfo.getXDelta()+.5f; float yNewOffset = animInfo.getYDelta()+.5f; move( xNewOffset, yNewOffset ); setColor( color ); float fScaleX = animInfo.getScaleX(); float fScaleY = animInfo.getScaleY(); if ( fScaleX != 1.0 || fScaleY != 1.0 ) { float oldWidth = width()+.5f; float oldHeight = height()+.5f;; float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fScaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( fScaleX * width(), fScaleY * height() ); aObject::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aObject::render(); move( -xNewOffset, -yNewOffset ); }
//------------------------------------------------------------------------------------------------- void LogisticsScreen::render() { if(!isShowing()) return; int32_t i; for(i = 0; i < rectCount; i++) { if(!rects[i].bOutline && ((rects[i].getColor() & 0xff000000) == 0xff000000)) rects[i].render(); } for(i = 0; i < staticCount; i++) statics[i].render(); for(i = 0; i < rectCount; i++) { if(rects[i].bOutline) rects[i].render(); } // transparencies after statics for(i = 0; i < rectCount; i++) { if((rects[i].getColor() & 0xff000000) != 0xff000000) rects[i].render(); } for(i = 0; i < buttonCount; i++) buttons[i].render(); for(i = 0; i < textCount; i++) { textObjects[i].render(); } for(i = 0; i < editCount; i++) edits[i].render(); for(i = 0; i < animObjectsCount; i++) animObjects[i].render(); if(fadeOutTime) { fadeTime += frameLength; int32_t color = interpolateColor(0, fadeOutMaxColor, fadeTime / fadeOutTime); RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight }; drawRect(rect, color); } else if(fadeInTime && fadeInTime > fadeTime) { fadeTime += frameLength; int32_t color = interpolateColor(fadeOutMaxColor, 0, fadeTime / fadeInTime); RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight }; drawRect(rect, color); } }
//============================================================================== void VstPluginExternalEditor::visibilityChanged () { if (isShowing()) { #if defined(LINUX) if (handle) XMapRaised (display, handle); #endif } else { #if defined(LINUX) if (handle) XUnmapWindow (display, handle); #endif } }
void IBLWidget::paintGL() { if(!isShowing()) return; glcontext->makeCurrent(this); glf->glClearColor( 0, 0, 0, 0 ); glf->glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); recreateFBO(); envRotMatrix = glm::rotate(glm::mat4(1.f), envPhi, glm::vec3(0, 1, 0)); envRotMatrix = glm::rotate(envRotMatrix, envTheta, glm::vec3(0, 1, 0)); envRotMatrixInverse = glm::inverse(envRotMatrix); if( numSampleGroupsRendered < stepSize ) { fbo->bind(); glf->glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); renderObject(); fbo->unbind(); /////////////////////////////////////// compResult(); // another sample group rendered! numSampleGroupsRendered++; if( renderWithIBL ) { if( numSampleGroupsRendered < stepSize ) startTimer(); else { printf( "done!\n" ); stopTimer(); } } /////////////////////////////////////// } // now draw the final result drawResult(); glcontext->swapBuffers(this); }
static void warp_to_pc( int lnum) /* line number to warp to */ { char lbuf[256]; /* build line comand here */ if (lnum > 0) { if (State & INSERT) add_to_input_buf((char_u *) "\033", 1); if (isShowing(lnum)) sprintf(lbuf, "%dG", lnum); else sprintf(lbuf, "%dz.", lnum); add_to_input_buf((char_u *) lbuf, strlen(lbuf)); } }
void aTextListItem::render() { if ( !isShowing() ) return; float y = location[2].y - location[0].y; float tmpHeight = font.height(); if ( y > tmpHeight && font.height( text, width() ) <= tmpHeight && !bForceToTop ) { y = (location[2].y + location[0].y)/2.f - tmpHeight/2.f; } else y = location[0].y + tmpHeight/4.f; font.render( text, location[0].x, y, location[2].x - location[0].x, location[2].y - location[0].y, location[0].argb, 0, alignment ); }
void HippoToolTip::deactivate() { TOOLINFO ti; if (!isShowing()) return; // hippoDebugLogW(L"Deactivating tooltip"); getTrackingToolInfo(&ti); if (!SendMessage(window_, TTM_TRACKACTIVATE, (WPARAM)FALSE, (LPARAM)&ti)) { hippoDebugLogW(L"Failed to send TTM_TRACKACTIVATE to deactivate"); return; } markShowing(false); }
void BubbleMessageComponent::init (const int numMillisecondsBeforeRemoving, const bool removeWhenMouseClicked, const bool deleteSelfAfterUse) { setAlpha (1.0f); setVisible (true); deleteAfterUse = deleteSelfAfterUse; expiryTime = numMillisecondsBeforeRemoving > 0 ? (Time::getMillisecondCounter() + (uint32) numMillisecondsBeforeRemoving) : 0; mouseClickCounter = Desktop::getInstance().getMouseButtonClickCounter(); if (! (removeWhenMouseClicked && isShowing())) mouseClickCounter += 0xfffff; startTimer (77); repaint(); }
void PlotCartesianWidget::paintGL() { if( !isShowing() || !isExposed()) return; glcontext->makeCurrent(this); glf->glClearColor(1,1,1,1); glf->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glf->glDisable(GL_DEPTH_TEST); float currentFWidth = float(width()*devicePixelRatio()); float currentFHeight = float(height()*devicePixelRatio()); if(currentFWidth != fWidth || currentFHeight != fHeight) { fWidth = currentFWidth; fHeight = currentFHeight; mAspect = fWidth / fHeight; updateInputDataLineVAO(); updateProjectionMatrix(); } glf->glViewport(0, 0, fWidth, fHeight); glf->glEnable(GL_MULTISAMPLE); drawAxis(); drawLabels(); glf->glBindVertexArray(dataLineVAO); for( int i = 0; i < (int)brdfs.size(); i++ ) { DGLShader* shader = updateShader( brdfs[i] ); glf->glDrawArrays(GL_LINE_STRIP_ADJACENCY, 0, dataLineNPoints); shader->disable(); } glf->glBindVertexArray(0); glf->glDisable(GL_BLEND); glf->glEnable(GL_DEPTH_TEST); glcontext->swapBuffers(this); }
void LitSphereWidget::paintGL() { if( !isShowing() || !isExposed()) return; glcontext->makeCurrent(this); float useTheta = inTheta; if( doubleTheta ) useTheta *= 2.0; incidentVector[0] = sin(useTheta) * cos(inPhi); incidentVector[1] = sin(useTheta) * sin(inPhi); incidentVector[2] = cos(useTheta); glf->glClearColor( 0.25, 0.25, 0.25, 1 ); glf->glEnable(GL_DEPTH_TEST); glf->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); float fWidth = float(width()*devicePixelRatio()); float fHeight = float(height()*devicePixelRatio()); glf->glViewport(0, 0, fWidth, fHeight); if( width() > height() ) { float aspect = fWidth / fHeight; projectionMatrix = glm::ortho( -aspect * sphereMargin, aspect * sphereMargin, -sphereMargin, sphereMargin, NEAR_PLANE, FAR_PLANE ); } else { float invAspect = fHeight / fWidth; projectionMatrix = glm::ortho( -sphereMargin, sphereMargin, -invAspect * sphereMargin, invAspect * sphereMargin, NEAR_PLANE, FAR_PLANE ); } modelViewMatrix = glm::lookAt( glm::vec3(0, 0, 2.75), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0)); if( brdfs.size() ) drawSphere( 1.0, 100, 100 ); glcontext->swapBuffers(this); }
void WebBrowserComponent::checkWindowAssociation() { if (isShowing()) { if (blankPageShown) goBack(); } else { if (unloadPageWhenBrowserIsHidden && ! blankPageShown) { // when the component becomes invisible, some stuff like flash // carries on playing audio, so we need to force it onto a blank // page to avoid this, (and send it back when it's made visible again). blankPageShown = true; browser->goToURL ("about:blank", 0, 0); } } }
void aAnimButton::render() { if ( !isShowing() ) return; if ( disabledData.isAnimating() ) { update( disabledData ); } else if ( pressedData.isAnimating() ) { update( pressedData ); } else if ( highlightData.isAnimating() ) { update( highlightData ); } else { update( normalData ); } }
void ResizableWindow::updateLastPos() { if (isShowing() && ! (isFullScreen() || isMinimised())) lastNonFullScreenPos = getBounds(); }
void Plot3DWidget::paintGL() { if( !isShowing() ) return; float planeSize = 3.0; float planeHeight = -0.01; float vectorLength = 5.0; incidentVector[0] = sin(inTheta) * cos(inPhi); incidentVector[1] = sin(inTheta) * sin(inPhi); incidentVector[2] = cos(inTheta); glDisable( GL_LIGHTING ); glDisable( GL_COLOR_MATERIAL ); glLineWidth( 2.0 ); glPushAttrib(GL_ALL_ATTRIB_BITS); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // try and set some better viewing planes based on zoom factor... this only kinda works float nearPlane = std::min<float>( lookZoom*0.1, 0.5 ); float farPlane = std::min<float>( lookZoom*10.0, 100.0 ); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, width(), height()); gluPerspective(FOV_Y, float(width()) / float(height()), nearPlane, farPlane); float lookVec[3]; lookVec[0] = sin(lookTheta) * cos(lookPhi); lookVec[1] = sin(lookTheta) * sin(lookPhi); lookVec[2] = cos(lookTheta); lookVec[0] *= lookZoom; lookVec[1] *= lookZoom; lookVec[2] *= lookZoom; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( lookVec[0], lookVec[1], lookVec[2], 0, 0, 0, 0, 0, 1 ); // draw the hemipshere for( int i = 0; i < (int)brdfs.size(); i++ ) DrawBRDFHemisphere( brdfs[i] ); // draw the incident vector glColor3f( 0, 1, 1 ); glBegin( GL_LINES ); glVertex3f( 0, 0, 0 ); glVertex3f( vectorLength*incidentVector[0], vectorLength*incidentVector[1], vectorLength*incidentVector[2] ); glEnd(); // draw the surface normal glColor3f( 0, 0, 1 ); glBegin( GL_LINES ); glVertex3f( 0, 0, 0 ); glVertex3f( 0, 0, vectorLength ); glEnd(); // draw the reflection vector glColor3f( 1, 0, 1 ); glBegin( GL_LINES ); glVertex3f( 0, 0, 0 ); glVertex3f( -vectorLength*incidentVector[0], -vectorLength*incidentVector[1], vectorLength*incidentVector[2] ); glEnd(); // draw the U and V lines glColor3f( 1, 0, 0 ); glBegin( GL_LINES ); glVertex3f( 0, 0, 0 ); glVertex3f( planeSize, 0, 0 ); glEnd(); glColor3f( 0, 1, 0 ); glBegin( GL_LINES ); glVertex3f( 0, 0, 0 ); glVertex3f( 0, planeSize, 0 ); glEnd(); // draw the unit circle float ucInc = 6.28318531 / 60.0f; float ucAngle = 0.0; glColor3f( 0.8, 0.8, 0 ); glBegin( GL_LINE_LOOP ); for( int i = 0; i < 60; i++ ) { glVertex3f( cos(ucAngle), sin(ucAngle), 0.0 ); ucAngle += ucInc; } glEnd(); // draw the plane glColor3f(0.5, 0.5, 0.5); glBegin(GL_QUADS); glNormal3f(0.0, 0.0, 1.0); glVertex3f(-planeSize, -planeSize, planeHeight); glNormal3f(0.0, 0.0, 1.0); glVertex3f(planeSize, -planeSize, planeHeight); glNormal3f(0.0, 1.0, 0.0); glVertex3f(planeSize, planeSize, planeHeight); glNormal3f(0.0, 1.0, 0.0); glVertex3f(-planeSize, planeSize, planeHeight); glEnd(); glPopAttrib(); }
void LogisticsScreen::render(int32_t xOffset, int32_t yOffset) { if(!isShowing()) return; int32_t i; for(i = 0; i < rectCount; i++) { if(!rects[i].bOutline && ((rects[i].getColor() & 0xff000000) == 0xff000000)) { rects[i].move(xOffset, yOffset); rects[i].render(); rects[i].move(-xOffset, -yOffset); } } for(i = 0; i < staticCount; i++) { statics[i].move(xOffset, yOffset); statics[i].render(); statics[i].move(-xOffset, -yOffset); } for(i = 0; i < rectCount; i++) { if(rects[i].bOutline) { rects[i].move(xOffset, yOffset); rects[i].render(); rects[i].move(-xOffset, -yOffset); } } // transparencies after statics for(i = 0; i < rectCount; i++) { if((rects[i].getColor() & 0xff000000) != 0xff000000) { rects[i].move(xOffset, yOffset); rects[i].render(); rects[i].move(-xOffset, -yOffset); } } for(i = 0; i < buttonCount; i++) { buttons[i].move(xOffset, yOffset); buttons[i].render(); buttons[i].move(-xOffset, -yOffset); } for(i = 0; i < textCount; i++) { textObjects[i].move(xOffset, yOffset); textObjects[i].render(); textObjects[i].move(-xOffset, -yOffset); } for(i = 0; i < editCount; i++) { edits[i].move(xOffset, yOffset); edits[i].render(); edits[i].move(-xOffset, -yOffset); } for(i = 0; i < animObjectsCount; i++) { animObjects[i].move(xOffset, yOffset); animObjects[i].render(); animObjects[i].move(-xOffset, -yOffset); } if(fadeOutTime) { fadeTime += frameLength; int32_t color = interpolateColor(0, 0xff000000, fadeTime / fadeOutTime); RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight }; drawRect(rect, color); } else if(fadeInTime && fadeInTime > fadeTime) { fadeTime += frameLength; int32_t color = interpolateColor(0xff000000, 0, fadeTime / fadeInTime); RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight }; drawRect(rect, color); } }