void TVideoCaptureToolbar::Draw(BRect updateRect) { // Setup environment rgb_color saveColor = HighColor(); // Fill background SetHighColor(kBlueGrey); FillRect(Bounds()); // Frame it BPoint endPt; SetHighColor(kWhite); MovePenTo(Bounds().left, Bounds().top+1); endPt.Set( Bounds().right, Bounds().top+1 ); StrokeLine(endPt); SetHighColor(kMediumGrey); MovePenTo(Bounds().left, Bounds().bottom-1); endPt.Set( Bounds().right, Bounds().bottom-1 ); StrokeLine(endPt); SetHighColor(kBlack); MovePenTo(Bounds().left, Bounds().top); endPt.Set( Bounds().right, Bounds().top ); StrokeLine(endPt); MovePenTo(Bounds().left, Bounds().bottom); endPt.Set( Bounds().right, Bounds().bottom ); StrokeLine(endPt); // Restore Environment SetHighColor(saveColor); }
void BComboBox::AttachedToWindow() { Window()->AddFilter(fWinMovedFilter); if (Parent()) { SetViewColor(Parent()->ViewColor()); SetLowColor(ViewColor()); } bool enabled = IsEnabled(); rgb_color mc = HighColor(); rgb_color base; BFont textFont; // mc used to be base in this line if (mc.red == 255 && mc.green == 255 && mc.blue == 255) base = ViewColor(); else base = LowColor(); fText->GetFontAndColor(0, &textFont); mc = enabled ? mc : disable_color(base); fText->SetFontAndColor(&textFont, B_FONT_ALL, &mc); if (!enabled) base = tint_color(base, B_DISABLED_MARK_TINT); else base.red = base.green = base.blue = 255; fText->SetLowColor(base); fText->SetViewColor(base); fText->MakeEditable(enabled); }
void BTextControl::AttachedToWindow() { BControl::AttachedToWindow(); bool enabled = IsEnabled(); rgb_color textColor; rgb_color color = HighColor(); BFont font; fText->GetFontAndColor(0, &font, &color); if (enabled) textColor = color; else textColor = tint_color(color, B_LIGHTEN_2_TINT); fText->SetFontAndColor(&font, B_FONT_ALL, &textColor); if (enabled) { color.red = 255; color.green = 255; color.blue = 255; } else color = tint_color(color, B_LIGHTEN_2_TINT); fText->SetViewColor(color); fText->SetLowColor(color); fText->MakeEditable(enabled); }
void TextDiffView::Draw(BRect updateRect) { rgb_color oldHighColor = HighColor(); float oldPenSize = PenSize(); BRect bounds = Bounds(); float leftWidth = floor((bounds.Width() + 1 - B_H_SCROLL_BAR_HEIGHT - PANE_SPLITTER_WIDTH) / 2); if (updateRect.left <= leftWidth + 1) { SetPenSize(0); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT)); StrokeLine(BPoint(leftWidth, updateRect.top), BPoint(leftWidth, updateRect.bottom), B_SOLID_HIGH); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_1_TINT)); StrokeLine(BPoint(leftWidth + 1, updateRect.top), BPoint(leftWidth + 1, updateRect.bottom), B_SOLID_HIGH); } if (updateRect.right >= leftWidth + PANE_SPLITTER_WIDTH - 2) { SetPenSize(0); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT)); StrokeLine(BPoint(leftWidth + PANE_SPLITTER_WIDTH - 2, updateRect.top), BPoint(leftWidth + PANE_SPLITTER_WIDTH - 2, updateRect.bottom), B_SOLID_HIGH); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT)); StrokeLine(BPoint(leftWidth + PANE_SPLITTER_WIDTH - 1, updateRect.top), BPoint(leftWidth + PANE_SPLITTER_WIDTH - 1, updateRect.bottom), B_SOLID_HIGH); } SetPenSize(oldPenSize); SetHighColor(oldHighColor); }
void ValControlSegment::Draw(BRect updateRect) { if (fUnderlineStyle == NO_UNDERLINE) return; // +++++ move to layout function float fY = parent()->baselineOffset() + 1; rgb_color white = {255,255,255,255}; rgb_color blue = {0,0,255,255}; rgb_color gray = {140,140,140,255}; rgb_color old = HighColor(); SetLowColor(white); if(parent()->IsEnabled() && parent()->IsFocus()) SetHighColor(blue); else SetHighColor(gray); if (fXUnderlineRight <= fXUnderlineLeft) sizeUnderline(&fXUnderlineLeft, &fXUnderlineRight); // PRINT(( // "### ValControlSegment::Draw(): underline spans %.1f, %.1f\n", // fXUnderlineLeft, fXUnderlineRight)); // StrokeLine(BPoint(fXUnderlineLeft, fY), BPoint(fXUnderlineRight, fY), (fUnderlineStyle == DOTTED_UNDERLINE) ? B_MIXED_COLORS : B_SOLID_HIGH); SetHighColor(old); }
void RenderView::Draw(BRect updateRect) { static int count = 0; BRect frame = Frame(); // Erase previous drawing (this is the lazy and slow way) FillRect(frame, B_SOLID_LOW); frame.InsetBy(50, 50); StrokeEllipse(frame); if (fInHoverArea) FillRect(fHoverRect); else StrokeRect(fHoverRect); MovePenTo(25, 25); rgb_color color = HighColor(); char str[100]; sprintf(str, "Hello from RenderBoy! Count is %d, high color is RGB(%d, %d, %d)", count, color.red, color.green, color.blue); DrawString(str); // Change the color for next Draw call color.red += 3; color.green += 3; color.blue += 3; SetHighColor(color); count++; }
void MovieLooperUI::PositionIndicator::DrawKnob(float x) { BRect rect(x-2.0, 1.0, x+2.0, Bounds().bottom-1.0); rgb_color highColor = HighColor(); SetHighColor(knobColor); FillRect(rect); SetHighColor(highColor); }
void TActionCue::Draw(BRect updateRect) { // Save colors rgb_color saveColor = HighColor(); // Restore color SetHighColor(saveColor); TCueView::Draw(updateRect); }
void ConfigHeadLine::Draw(BRect updateRect) { rgb_color highcolor = HighColor(); SetHighColor(ViewColor()); FillRect(Bounds()); SetHighColor(highcolor); DrawString(fText.String(), BPoint(17, Bounds().Height() - 5)); BView::Draw(updateRect); }
void TMIDICue::Draw(BRect updateRect) { // Save colors rgb_color saveColor = HighColor(); // Restore color SetHighColor(saveColor); // Pass up to parent TCueView::Draw(updateRect); }
void BRadioButton::_Redraw() { BRect b(Bounds()); // fill background with ViewColor() rgb_color highColor = HighColor(); SetHighColor(ViewColor()); FillRect(b); // restore previous HighColor() SetHighColor(highColor); Draw(b); Flush(); }
void ProjectStatus::Draw(BRect updateRect) { BRect bounds(Bounds()); rgb_color highColor = HighColor(); SetHighColor(tint_color(ViewColor(), B_DARKEN_2_TINT)); StrokeLine(bounds.LeftTop(), bounds.RightTop()); SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); MovePenTo(3, fBaseline); char s[32]; DrawString(fMsg); }
/*------------------------------------------------------------------------------*\ ( ) - \*------------------------------------------------------------------------------*/ void BmToolbar::Draw( BRect updateRect) { BRect bounds = Bounds(); SetHighColor( tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_1_TINT)); StrokeLine(BPoint(bounds.left, bounds.bottom - 1), BPoint(bounds.left, bounds.top)); StrokeLine(BPoint(bounds.left + 1, bounds.top), BPoint(bounds.right, bounds.top)); SetHighColor( tint_color(HighColor(), B_DARKEN_1_TINT)); StrokeLine(BPoint(bounds.right, bounds.top + 1), BPoint(bounds.right, bounds.bottom - 1)); StrokeLine(BPoint(bounds.left, bounds.bottom), BPoint(bounds.right, bounds.bottom)); }
void TStageMovieCue::Draw(BRect updateRect) { if ( (m_Bitmap) && IsCueHidden() == true &&!IsHidden() ) { rgb_color saveColor = HighColor(); // Draw bitmap DrawBitmap(m_Offscreen, B_ORIGIN); // Data selection and resizing rect DrawSelectionRect(); SetHighColor(saveColor); } }
void Stringview1::Clear() { rgb_color lc=LowColor(); rgb_color hc=HighColor(); SetHighColor(190,190,190,255); FillRect(Bounds(),B_SOLID_HIGH); hasIcon=false; text->SetTo(""); typetext->SetTo(""); SetLowColor(lc); SetHighColor(hc); }
void Stringview1::SetText(const char *utext) { rgb_color lc=LowColor(); rgb_color hc=HighColor(); SetHighColor(190,190,190,255); FillRect(BRect(0,0,StringWidth(text->String())+8,Bounds().Height()),B_SOLID_HIGH); SetHighColor(0,0,0,255); SetLowColor(255,255,255,255); text->SetTo(utext); DrawString(text->String(), BPoint(3,12)); SetLowColor(lc); SetHighColor(hc); }
void Stringview1::Draw(BRect updateRect) { rgb_color lc=LowColor(); rgb_color hc=HighColor(); // if (hasIcon) DrawBitmap(bmp,BRect(600,0,615,15)); SetHighColor(0,0,0,255); SetLowColor(255,255,255,255); SetFontSize(10.0); DrawString(text->String(), BPoint(3,12)); DrawString(typetext->String(), BPoint(Bounds().Width()-20-StringWidth(typetext->String()),12)); SetLowColor(lc); SetHighColor(hc); // BView::Draw(updateRect); // be_app->PostMessage('HL01'); }
void MovieLooperUI::ClipListView::Draw(BRect update) { // add a highlight if needed if (drawHighlight) { // inherited version first BListView::Draw(update); // then the highlight rgb_color highColor = HighColor(); SetHighColor(highlightColor); StrokeRect(Bounds()); SetHighColor(highColor); } else { // the "non-highlight" (takes care of erasing) StrokeRect(Bounds(), B_SOLID_LOW); // inherited version last BListView::Draw(update); } }
void TStageMovieCue::DrawSelectionRect() { rgb_color saveColor; saveColor = HighColor(); SetHighColor(kRed); // Draw main selection rect //BRect frame = Bounds(); //frame.InsetBy(kBorder/2, kBorder/2); //StrokeRect(frame); // Draw resizing handles // // Fill them first... SetHighColor(kWhite); FillRect(m_TopLeftResize); FillRect(m_TopMiddleResize); FillRect(m_TopRightResize); FillRect(m_RightMiddleResize); FillRect(m_BottomRightResize); FillRect(m_BottomMiddleResize); FillRect(m_BottomLeftResize); FillRect(m_LeftMiddleResize); // Now stroke... SetHighColor(kBlack); StrokeRect(m_TopLeftResize); StrokeRect(m_TopMiddleResize); StrokeRect(m_TopRightResize); StrokeRect(m_RightMiddleResize); StrokeRect(m_BottomRightResize); StrokeRect(m_BottomMiddleResize); StrokeRect(m_BottomLeftResize); StrokeRect(m_LeftMiddleResize); }
void BComboBox::SetEnabled(bool enabled) { if (enabled == IsEnabled()) return; if (Window()) { fText->MakeEditable(enabled); rgb_color mc = HighColor(); rgb_color base = ViewColor(); mc = (enabled) ? mc : disable_color(base); BFont textFont; fText->GetFontAndColor(0, &textFont); fText->SetFontAndColor(&textFont, B_FONT_ALL, &mc); if (!enabled) base = tint_color(base, B_DISABLED_MARK_TINT); else base.red = base.green = base.blue = 255; fText->SetLowColor(base); fText->SetViewColor(base); fText->Invalidate(); Window()->UpdateIfNeeded(); } fSkipSetFlags = true; BControl::SetEnabled(enabled); fSkipSetFlags = false; //+ // Want the sub_view to be the navigable one. We always want to be able //+ // to navigate to that view, even if disabled since Copy still works. //+ fText->SetFlags(fText->Flags() | B_NAVIGABLE); //+ SetFlags(Flags() & ~B_NAVIGABLE); }
void ColorSwatch::Draw (BRect) { PushState(); SetDrawingMode (B_OP_COPY); rgb_color high (HighColor()); BRect colorPad (Bounds()); SetHighColor (ValueAsColor()); FillRect (colorPad); rgb_color light (ShiftColor (ValueAsColor(), 0.4)); rgb_color dark (ShiftColor (ValueAsColor(), 1.2)); BeginLineArray (10); AddLine ( colorPad.LeftTop(), colorPad.RightTop() - BPoint (1, 0), light); AddLine ( colorPad.LeftTop(), colorPad.LeftBottom() - BPoint (0, 1), light); AddLine ( colorPad.RightTop() + BPoint (0, 1), colorPad.RightBottom(), dark); AddLine ( colorPad.RightBottom(), colorPad.LeftBottom() + BPoint (1, 0), dark); light = ShiftColor (ViewColor(), 0.1); dark = ShiftColor (ViewColor(), 1.4); colorPad.InsetBy (-1, -1); BPoint hless (-1, 0); BPoint hmore (1, 0); BPoint vless (0, -1); BPoint vmore (0, 1); if (IsFocus() && Window()->IsActive()) { light = general_info.mark_color; dark = general_info.mark_color; hless = hmore = vless = vmore = BPoint (0, 0); } else { // A little blue residue clean up AddLine ( colorPad.RightTop(), colorPad.RightTop(), ViewColor()); AddLine ( colorPad.LeftBottom(), colorPad.LeftBottom(), ViewColor()); } AddLine ( colorPad.LeftTop(), colorPad.RightTop() + hless, dark); AddLine ( colorPad.LeftTop(), colorPad.LeftBottom() + vless, dark); AddLine ( colorPad.RightTop() + vmore, colorPad.RightBottom(), light); AddLine ( colorPad.RightBottom(), colorPad.LeftBottom() + hmore, light); EndLineArray(); PopState(); }
void BComboBox::Draw(BRect /*updateRect*/) { BRect bounds = Bounds(); font_height fInfo; rgb_color high = HighColor(); rgb_color base = ViewColor(); bool focused; bool enabled; rgb_color white = {255, 255, 255, 255}; rgb_color black = { 0, 0, 0, 255 }; enabled = IsEnabled(); focused = fText->IsFocus() && Window()->IsActive(); BRect fr = fText->Frame(); fr.InsetBy(-3, -3); fr.bottom -= 1; if (enabled) SetHighColor(tint_color(base, B_DARKEN_1_TINT)); else SetHighColor(base); StrokeLine(fr.LeftBottom(), fr.LeftTop()); StrokeLine(fr.RightTop()); if (enabled) SetHighColor(white); else SetHighColor(tint_color(base, B_LIGHTEN_2_TINT)); StrokeLine(fr.LeftBottom()+BPoint(1,0), fr.RightBottom()); StrokeLine(fr.RightTop()+BPoint(0,1)); fr.InsetBy(1,1); if (focused) { // draw UI indication for 'active' SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR)); StrokeRect(fr); } else { if (enabled) SetHighColor(tint_color(base, B_DARKEN_4_TINT)); else SetHighColor(tint_color(base, B_DARKEN_2_TINT)); StrokeLine(fr.LeftBottom(), fr.LeftTop()); StrokeLine(fr.RightTop()); SetHighColor(base); StrokeLine(fr.LeftBottom()+BPoint(1,0), fr.RightBottom()); StrokeLine(fr.RightTop()+BPoint(0,1)); } fr.InsetBy(1,1); if (!enabled) SetHighColor(tint_color(base, B_DISABLED_MARK_TINT)); else SetHighColor(white); StrokeRect(fr); SetHighColor(high); bounds.right = bounds.left + fDivider; if ((Label()) && (fDivider > 0.0)) { BPoint loc; GetFontHeight(&fInfo); switch (fLabelAlign) { default: case B_ALIGN_LEFT: loc.x = bounds.left + TV_MARGIN; break; case B_ALIGN_CENTER: { float width = StringWidth(Label()); float center = (bounds.right - bounds.left) / 2; loc.x = center - (width/2); break; } case B_ALIGN_RIGHT: { float width = StringWidth(Label()); loc.x = bounds.right - width - TV_MARGIN; break; } } uint32 rmode = ResizingMode(); if ((rmode & _rule_(0xf, 0, 0xf, 0)) == _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)) loc.y = fr.bottom - 2; else loc.y = bounds.bottom - (2 + ceil(fInfo.descent)); MovePenTo(loc); SetHighColor(black); DrawString(Label()); SetHighColor(high); } }
void QGraph::DrawCurve(int nIndex, QPainter &painter) { painter.save(); static double scaley; static int i, ptside; static QPoint From, To, Min, Max; static QRect rViewRect; ptside = 2; CCurve* pCurve = GetCurve(nIndex); scaley = m_scaley; QBrush FillBrush(m_BkColor); painter.setBrush(FillBrush); QPen CurvePen(pCurve->GetColor()); CurvePen.setStyle(GetStyle(pCurve->GetStyle())); CurvePen.setWidth((int)pCurve->GetWidth()); painter.setPen(CurvePen); Min.setX(int(xmin/m_scalex) +m_ptoffset.x()); Min.setY(int(ymin/scaley) +m_ptoffset.y()); Max.setX(int(xmax/m_scalex) +m_ptoffset.x()); Max.setY(int(ymax/scaley) +m_ptoffset.y()); rViewRect.setTopLeft(Min); rViewRect.setBottomRight(Max); if(pCurve->n>=1) { From.setX(int(pCurve->x[0]/m_scalex+m_ptoffset.x())); From.setY(int(pCurve->y[0]/scaley +m_ptoffset.y())); if(pCurve->IsVisible()) { for (i=1; i<pCurve->n;i++) { To.setX(int(pCurve->x[i]/m_scalex+m_ptoffset.x())); To.setY(int(pCurve->y[i]/scaley +m_ptoffset.y())); painter.drawLine(From, To); From = To; } } if(pCurve->PointsVisible()) { for (i=0; i<pCurve->n;i++) { if(pCurve->GetSelected() !=i) painter.drawRect(int(pCurve->x[i]/m_scalex+m_ptoffset.x())-ptside, int(pCurve->y[i]/ scaley+m_ptoffset.y())-ptside, 2*ptside,2*ptside); } } } if(m_bHighlightPoint) { int point = pCurve->GetSelected(); if(point>=0) { //highlight QColor HighColor(0,40, 150); CurvePen.setWidth((int)pCurve->GetWidth()); CurvePen.setColor(HighColor); painter.setPen(CurvePen); To.setX(int(pCurve->x[point]/m_scalex+m_ptoffset.x())); To.setY(int(pCurve->y[point]/scaley +m_ptoffset.y())); painter.drawRect(To.x()-ptside-1,To.y()-ptside-1, 2*(ptside+1),2*(ptside+1)); } } painter.restore(); }
void BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, const BColumnTitle *pressedColumn, void (*trackRectBlitter)(BView *, BRect), BRect passThru) { BRect bounds(Bounds()); BView *view; if (useOffscreen) { ASSERT(sOffscreen); BRect frame(bounds); frame.right += frame.left; // this is kind of messy way of avoiding being clipped by the ammount the // title is scrolled to the left // ToDo: fix this view = sOffscreen->BeginUsing(frame); view->SetOrigin(-bounds.left, 0); view->SetLowColor(LowColor()); view->SetHighColor(HighColor()); BFont font(be_plain_font); font.SetSize(9); view->SetFont(&font); } else view = this; if (be_control_look != NULL) { rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); view->SetHighColor(tint_color(base, B_DARKEN_2_TINT)); view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); bounds.bottom--; be_control_look->DrawButtonBackground(view, bounds, bounds, base, 0, BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER); } else { // fill background with light gray background if (!updateOnly) view->FillRect(bounds, B_SOLID_LOW); view->BeginLineArray(4); view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor); view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor); // draw lighter gray and white inset lines bounds.InsetBy(0, 1); view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor); view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor); view->EndLineArray(); } int32 count = fTitleList.CountItems(); float minx = bounds.right; float maxx = bounds.left; for (int32 index = 0; index < count; index++) { BColumnTitle *title = fTitleList.ItemAt(index); title->Draw(view, title == pressedColumn); BRect titleBounds(title->Bounds()); if (titleBounds.left < minx) minx = titleBounds.left; if (titleBounds.right > maxx) maxx = titleBounds.right; } if (be_control_look != NULL) { bounds = Bounds(); minx--; view->SetHighColor(sLightShadowColor); view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1)); } else { // first and last shades before and after first column maxx++; minx--; view->BeginLineArray(2); view->AddLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom), sShadowColor); view->AddLine(BPoint(maxx, bounds.top), BPoint(maxx, bounds.bottom), sShineColor); view->EndLineArray(); } #if !(APP_SERVER_CLEARS_BACKGROUND) FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW); FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1), B_SOLID_LOW); #endif if (useOffscreen) { if (trackRectBlitter) (trackRectBlitter)(view, passThru); view->Sync(); DrawBitmap(sOffscreen->Bitmap()); sOffscreen->DoneUsing(); } else if (trackRectBlitter) (trackRectBlitter)(view, passThru); }
void MemoryView::Draw(BRect rect) { rect = Bounds(); float divider = (fTargetAddressSize + 1) * fCharWidth; StrokeLine(BPoint(divider, rect.top), BPoint(divider, rect.bottom)); if (fTargetBlock == NULL) return; uint32 hexBlockSize = _GetHexDigitsPerBlock() + 1; uint32 blockByteSize = hexBlockSize / 2; if (fHexMode != HexModeNone && fTextMode != TextModeNone) { divider += (fHexBlocksPerLine * hexBlockSize + 1) * fCharWidth; StrokeLine(BPoint(divider, rect.top), BPoint(divider, rect.bottom)); } char buffer[32]; char textbuffer[512]; int32 startLine = int32(rect.top / fLineHeight); const char* currentAddress = (const char*)(fTargetBlock->Data() + fHexBlocksPerLine * blockByteSize * startLine); const char* maxAddress = (const char*)(fTargetBlock->Data() + fTargetBlock->Size()); const char* targetAddress = (const char *)fTargetBlock->Data() + fTargetAddress - fTargetBlock->BaseAddress(); BPoint drawPoint(1.0, (startLine + 1) * fLineHeight); int32 currentBlocksPerLine = fHexBlocksPerLine; int32 currentCharsPerLine = fTextCharsPerLine; rgb_color addressColor = tint_color(HighColor(), B_LIGHTEN_1_TINT); rgb_color dataColor = HighColor(); font_height fh; GetFontHeight(&fh); target_addr_t lineAddress = fTargetBlock->BaseAddress() + startLine * currentCharsPerLine; for (; currentAddress < maxAddress && drawPoint.y < rect.bottom + fLineHeight; drawPoint.y += fLineHeight) { drawPoint.x = 1.0; snprintf(buffer, sizeof(buffer), "%0*" B_PRIx64, (int)fTargetAddressSize, lineAddress); PushState(); SetHighColor(tint_color(HighColor(), B_LIGHTEN_1_TINT)); DrawString(buffer, drawPoint); drawPoint.x += fCharWidth * (fTargetAddressSize + 2); PopState(); if (fHexMode != HexModeNone) { if (currentAddress + (currentBlocksPerLine * blockByteSize) > maxAddress) { currentCharsPerLine = maxAddress - currentAddress; currentBlocksPerLine = currentCharsPerLine / blockByteSize; } for (int32 j = 0; j < currentBlocksPerLine; j++) { const char* blockAddress = currentAddress + (j * blockByteSize); _GetNextHexBlock(buffer, sizeof(buffer), blockAddress); if (targetAddress >= blockAddress && targetAddress < blockAddress + blockByteSize) { PushState(); SetHighColor(make_color(216,0,0)); DrawString(buffer, drawPoint); PopState(); } else DrawString(buffer, drawPoint); drawPoint.x += fCharWidth * hexBlockSize; } if (currentBlocksPerLine < fHexBlocksPerLine) drawPoint.x += fCharWidth * hexBlockSize * (fHexBlocksPerLine - currentBlocksPerLine); } if (fTextMode != TextModeNone) { drawPoint.x += fCharWidth; for (int32 j = 0; j < currentCharsPerLine; j++) { // filter non-printable characters textbuffer[j] = currentAddress[j] > 32 ? currentAddress[j] : '.'; } textbuffer[fTextCharsPerLine] = '\0'; DrawString(textbuffer, drawPoint); if (targetAddress >= currentAddress && targetAddress < currentAddress + currentCharsPerLine) { PushState(); SetHighColor(B_TRANSPARENT_COLOR); SetDrawingMode(B_OP_INVERT); uint32 blockAddress = uint32(targetAddress - currentAddress); if (fHexMode != HexModeNone) blockAddress &= ~(blockByteSize - 1); float startX = drawPoint.x + fCharWidth * blockAddress; float endX = startX; if (fHexMode != HexModeNone) endX += fCharWidth * ((hexBlockSize - 1) / 2); else endX += fCharWidth; FillRect(BRect(startX, drawPoint.y - fh.ascent, endX, drawPoint.y + fh.descent)); PopState(); } } if (currentBlocksPerLine > 0) { currentAddress += currentBlocksPerLine * blockByteSize; lineAddress += currentBlocksPerLine * blockByteSize; } else { currentAddress += fTextCharsPerLine; lineAddress += fTextCharsPerLine; } } if (fSelectionStart != fSelectionEnd) { PushState(); BRegion selectionRegion; _GetSelectionRegion(selectionRegion); SetDrawingMode(B_OP_INVERT); FillRegion(&selectionRegion, B_SOLID_HIGH); PopState(); } }
void BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly, const BColumnTitle* pressedColumn, void (*trackRectBlitter)(BView*, BRect), BRect passThru) { BRect bounds(Bounds()); BView* view; if (useOffscreen) { ASSERT(sOffscreen); BRect frame(bounds); frame.right += frame.left; // ToDo: this is kind of messy way of avoiding being clipped // by the amount the title is scrolled to the left view = sOffscreen->BeginUsing(frame); view->SetOrigin(-bounds.left, 0); view->SetLowColor(LowColor()); view->SetHighColor(HighColor()); BFont font; GetFont(&font); view->SetFont(&font); } else view = this; view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT); view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); bounds.bottom--; rgb_color baseColor = ui_color(B_PANEL_BACKGROUND_COLOR); be_control_look->DrawButtonBackground(view, bounds, bounds, baseColor, 0, BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER); int32 count = fTitleList.CountItems(); float minx = bounds.right; float maxx = bounds.left; for (int32 index = 0; index < count; index++) { BColumnTitle* title = fTitleList.ItemAt(index); title->Draw(view, title == pressedColumn); BRect titleBounds(title->Bounds()); if (titleBounds.left < minx) minx = titleBounds.left; if (titleBounds.right > maxx) maxx = titleBounds.right; } bounds = Bounds(); minx--; view->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_1_TINT); view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1)); #if !(APP_SERVER_CLEARS_BACKGROUND) FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW); FillRect(BRect(maxx + 1, bounds.top + 1, bounds.right, bounds.bottom - 1), B_SOLID_LOW); #endif if (useOffscreen) { if (trackRectBlitter) (trackRectBlitter)(view, passThru); view->Sync(); DrawBitmap(sOffscreen->Bitmap()); sOffscreen->DoneUsing(); } else if (trackRectBlitter) (trackRectBlitter)(view, passThru); }