bool ScrollbarThemeGtk::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect) { if (graphicsContext->paintingDisabled()) return false; // Create the ScrollbarControlPartMask based on the damageRect ScrollbarControlPartMask scrollMask = NoPart; IntRect backButtonStartPaintRect; IntRect backButtonEndPaintRect; IntRect forwardButtonStartPaintRect; IntRect forwardButtonEndPaintRect; if (hasButtons(scrollbar)) { backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true); if (damageRect.intersects(backButtonStartPaintRect)) scrollMask |= BackButtonStartPart; backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true); if (damageRect.intersects(backButtonEndPaintRect)) scrollMask |= BackButtonEndPart; forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true); if (damageRect.intersects(forwardButtonStartPaintRect)) scrollMask |= ForwardButtonStartPart; forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true); if (damageRect.intersects(forwardButtonEndPaintRect)) scrollMask |= ForwardButtonEndPart; } IntRect trackPaintRect = trackRect(scrollbar, true); if (damageRect.intersects(trackPaintRect)) scrollMask |= TrackBGPart; if (m_troughUnderSteppers && (scrollMask & BackButtonStartPart || scrollMask & BackButtonEndPart || scrollMask & ForwardButtonStartPart || scrollMask & ForwardButtonEndPart)) scrollMask |= TrackBGPart; bool thumbPresent = hasThumb(scrollbar); IntRect currentThumbRect; if (thumbPresent) { IntRect track = trackRect(scrollbar, false); currentThumbRect = thumbRect(scrollbar, track); if (damageRect.intersects(currentThumbRect)) scrollMask |= ThumbPart; } ScrollbarControlPartMask allButtons = BackButtonStartPart | BackButtonEndPart | ForwardButtonStartPart | ForwardButtonEndPart; if (scrollMask & TrackBGPart || scrollMask & ThumbPart || scrollMask & allButtons) paintScrollbarBackground(graphicsContext, scrollbar); paintTrackBackground(graphicsContext, scrollbar, trackPaintRect); // Paint the back and forward buttons. if (scrollMask & BackButtonStartPart) paintButton(graphicsContext, scrollbar, backButtonStartPaintRect, BackButtonStartPart); if (scrollMask & BackButtonEndPart) paintButton(graphicsContext, scrollbar, backButtonEndPaintRect, BackButtonEndPart); if (scrollMask & ForwardButtonStartPart) paintButton(graphicsContext, scrollbar, forwardButtonStartPaintRect, ForwardButtonStartPart); if (scrollMask & ForwardButtonEndPart) paintButton(graphicsContext, scrollbar, forwardButtonEndPaintRect, ForwardButtonEndPart); // Paint the thumb. if (scrollMask & ThumbPart) paintThumb(graphicsContext, scrollbar, currentThumbRect); return true; }
bool ScrollbarThemeComposite::paint(Scrollbar* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect) { // Create the ScrollbarControlPartMask based on the damageRect ScrollbarControlPartMask scrollMask = NoPart; IntRect backButtonStartPaintRect; IntRect backButtonEndPaintRect; IntRect forwardButtonStartPaintRect; IntRect forwardButtonEndPaintRect; if (hasButtons(scrollbar)) { backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true); if (damageRect.intersects(backButtonStartPaintRect)) scrollMask |= BackButtonStartPart; backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true); if (damageRect.intersects(backButtonEndPaintRect)) scrollMask |= BackButtonEndPart; forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true); if (damageRect.intersects(forwardButtonStartPaintRect)) scrollMask |= ForwardButtonStartPart; forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true); if (damageRect.intersects(forwardButtonEndPaintRect)) scrollMask |= ForwardButtonEndPart; } IntRect startTrackRect; IntRect thumbRect; IntRect endTrackRect; IntRect trackPaintRect = trackRect(scrollbar, true); if (damageRect.intersects(trackPaintRect)) scrollMask |= TrackBGPart; bool thumbPresent = hasThumb(scrollbar); if (thumbPresent) { IntRect track = trackRect(scrollbar); splitTrack(scrollbar, track, startTrackRect, thumbRect, endTrackRect); if (damageRect.intersects(thumbRect)) scrollMask |= ThumbPart; if (damageRect.intersects(startTrackRect)) scrollMask |= BackTrackPart; if (damageRect.intersects(endTrackRect)) scrollMask |= ForwardTrackPart; } #if PLATFORM(WIN) // FIXME: This API makes the assumption that the custom scrollbar's metrics will match // the theme's metrics. This is not a valid assumption. The ability for a client to paint // custom scrollbars should be removed once scrollbars can be styled via CSS. if (Page* page = pageForScrollView(scrollbar->parent())) { if (page->settings()->shouldPaintCustomScrollbars()) { float proportion = static_cast<float>(scrollbar->visibleSize()) / scrollbar->totalSize(); float value = scrollbar->currentPos() / static_cast<float>(scrollbar->maximum()); ScrollbarControlState s = 0; if (scrollbar->client()->isActive()) s |= ActiveScrollbarState; if (scrollbar->enabled()) s |= EnabledScrollbarState; if (scrollbar->pressedPart() != NoPart) s |= PressedScrollbarState; if (page->chrome()->client()->paintCustomScrollbar(graphicsContext, scrollbar->frameRect(), scrollbar->controlSize(), s, scrollbar->pressedPart(), scrollbar->orientation() == VerticalScrollbar, value, proportion, scrollMask)) return true; } } #endif // Paint the scrollbar background (only used by custom CSS scrollbars). paintScrollbarBackground(graphicsContext, scrollbar); // Paint the back and forward buttons. if (scrollMask & BackButtonStartPart) paintButton(graphicsContext, scrollbar, backButtonStartPaintRect, BackButtonStartPart); if (scrollMask & BackButtonEndPart) paintButton(graphicsContext, scrollbar, backButtonEndPaintRect, BackButtonEndPart); if (scrollMask & ForwardButtonStartPart) paintButton(graphicsContext, scrollbar, forwardButtonStartPaintRect, ForwardButtonStartPart); if (scrollMask & ForwardButtonEndPart) paintButton(graphicsContext, scrollbar, forwardButtonEndPaintRect, ForwardButtonEndPart); if (scrollMask & TrackBGPart) paintTrackBackground(graphicsContext, scrollbar, trackPaintRect); if ((scrollMask & ForwardTrackPart) || (scrollMask & BackTrackPart)) { // Paint the track pieces above and below the thumb. if (scrollMask & BackTrackPart) paintTrackPiece(graphicsContext, scrollbar, startTrackRect, BackTrackPart); if (scrollMask & ForwardTrackPart) paintTrackPiece(graphicsContext, scrollbar, endTrackRect, ForwardTrackPart); paintTickmarks(graphicsContext, scrollbar, trackPaintRect); } // Paint the thumb. if (scrollMask & ThumbPart) paintThumb(graphicsContext, scrollbar, thumbRect); return true; }
bool ScrollbarThemeComposite::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect) { // Create the ScrollbarControlPartMask based on the damageRect ScrollbarControlPartMask scrollMask = NoPart; IntRect backButtonStartPaintRect; IntRect backButtonEndPaintRect; IntRect forwardButtonStartPaintRect; IntRect forwardButtonEndPaintRect; if (hasButtons(scrollbar)) { backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true); if (damageRect.intersects(backButtonStartPaintRect)) scrollMask |= BackButtonStartPart; backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true); if (damageRect.intersects(backButtonEndPaintRect)) scrollMask |= BackButtonEndPart; forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true); if (damageRect.intersects(forwardButtonStartPaintRect)) scrollMask |= ForwardButtonStartPart; forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true); if (damageRect.intersects(forwardButtonEndPaintRect)) scrollMask |= ForwardButtonEndPart; } IntRect startTrackRect; IntRect thumbRect; IntRect endTrackRect; IntRect trackPaintRect = trackRect(scrollbar, true); if (damageRect.intersects(trackPaintRect)) scrollMask |= TrackBGPart; bool thumbPresent = hasThumb(scrollbar); if (thumbPresent) { IntRect track = trackRect(scrollbar); splitTrack(scrollbar, track, startTrackRect, thumbRect, endTrackRect); if (damageRect.intersects(thumbRect)) scrollMask |= ThumbPart; if (damageRect.intersects(startTrackRect)) scrollMask |= BackTrackPart; if (damageRect.intersects(endTrackRect)) scrollMask |= ForwardTrackPart; } // Paint the scrollbar background (only used by custom CSS scrollbars). paintScrollbarBackground(graphicsContext, scrollbar); // Paint the back and forward buttons. if (scrollMask & BackButtonStartPart) paintButton(graphicsContext, scrollbar, backButtonStartPaintRect, BackButtonStartPart); if (scrollMask & BackButtonEndPart) paintButton(graphicsContext, scrollbar, backButtonEndPaintRect, BackButtonEndPart); if (scrollMask & ForwardButtonStartPart) paintButton(graphicsContext, scrollbar, forwardButtonStartPaintRect, ForwardButtonStartPart); if (scrollMask & ForwardButtonEndPart) paintButton(graphicsContext, scrollbar, forwardButtonEndPaintRect, ForwardButtonEndPart); if (scrollMask & TrackBGPart) paintTrackBackground(graphicsContext, scrollbar, trackPaintRect); if ((scrollMask & ForwardTrackPart) || (scrollMask & BackTrackPart)) { // Paint the track pieces above and below the thumb. if (scrollMask & BackTrackPart) paintTrackPiece(graphicsContext, scrollbar, startTrackRect, BackTrackPart); if (scrollMask & ForwardTrackPart) paintTrackPiece(graphicsContext, scrollbar, endTrackRect, ForwardTrackPart); paintTickmarks(graphicsContext, scrollbar, trackPaintRect); } // Paint the thumb. if (scrollMask & ThumbPart) paintThumb(graphicsContext, scrollbar, thumbRect); return true; }
int birdTracker::setup(hemisphere hemi, dataformat df, unsigned int rate) { unsigned int i, u; unsigned char *data; unsigned char ds = 0; char rate_string[7]; switch (df) { case birdTracker::FLOCK_POSITION: ds = 0x30; break; case birdTracker::FLOCK_ANGLES: ds = 0x30; break; case birdTracker::FLOCK_MATRIX: ds = 0x90; break; case birdTracker::FLOCK_POSITIONANGLES: ds = 0x60; break; case birdTracker::FLOCK_POSITIONMATRIX: ds = 0xC0; break; case birdTracker::FLOCK_QUATERNION: ds = 0x40; break; case birdTracker::FLOCK_POSITIONQUATERNION: ds = 0x70; break; default: cerr << "oops birdTracker::Setup" << endl; break; } sprintf(rate_string, "%06d", rate * 1000); // request a system-status packet.setType(birdPacket::MSG_GET_STATUS, 0); packet.setDataSize(0); send(); // wait for the answer if (receive(birdPacket::RSP_GET_STATUS) < 0) return (-1); // change the measurementRate data = (unsigned char *)packet.getData(); for (u = 0; u < 6; u++) data[5 + u] = rate_string[u]; // and send the new setup to the motion-star packet.setType(birdPacket::MSG_SEND_SETUP, 0); send(); // wait for the answer if (receive(birdPacket::RSP_SEND_SETUP) < 0) return (-1); // now continue with the devices for (i = 0; i < numReceivers; i++) { // first we have to get the status of the device // so send a status-request packet.setType(birdPacket::MSG_GET_STATUS, receivers[i].address); packet.setDataSize(0); send(); // wait for the answer if (receive(birdPacket::RSP_GET_STATUS) < 0) return (-1); // now perform the setup data = (unsigned char *)packet.getData(); /* IAO: if (SensorState[Sensor].HasButton==TRUE) { NetDataBuffer.buffer[5]=0x0d; // dc on ac, notc on, ac wide off, sudden off and buttons } else { NetDataBuffer.buffer[5]=0x05; // dc on ac, notc on, ac wide off, sudden off } */ // set dataformat, size and hemisphere if (hasButtons(i)) data[5] = 0x0d; // dc on ac, notc on, ac wide off, sudden off and buttons else data[5] = 0x05; // dc on ac, notc on, ac wide off, sudden off data[6] = ((unsigned char)df) | ds; data[7] = 0x01; //reportrate data[10] = (unsigned char)hemi; data[11] = (unsigned char)receivers[i].address; #ifdef BYTESWAP // get range and scale unsigned short Lsb, Msb; short int Word; Msb = data[8]; Lsb = data[9]; Word = ((Msb << 8) & 0x0F00) | (Lsb); receivers[i].range = Word; /// SPECIAL IAO HACK!!!!!!! receivers[i + 1].range = Word; receivers[i + 2].range = Word; #else // get range and scale receivers[i].range = (*(signed short int *)(data + 8)) & 0x0FFF; /// SPECIAL IAO HACK!!!!!!! receivers[i + 1].range = (*(signed short int *)(data + 8)) & 0x0FFF; receivers[i + 2].range = (*(signed short int *)(data + 8)) & 0x0FFF; #endif // send a setup-message packet.setType(birdPacket::MSG_SEND_SETUP, receivers[i].address); send(); // wait for the answer if (receive(birdPacket::RSP_SEND_SETUP) < 0) return (-1); // on to the next device } // done return (0); }