hrev45799 adds 1 changeset to branch 'master' old head: dd84193fa4d42d9adf458c51ac673f56e9a1dd55 new head: 1e6e124cb40d6907cd2daa0c1d45ac2a646e08f6 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=1e6e124+%5Edd84193 ---------------------------------------------------------------------------- 1e6e124: BView: Style fixes only, no functional change intended Motivated by inconsistancies found while documenting BView. Update copyright year, alphabetize Variable names normalized: * pt => point * r => rect * p => pattern * c => color * msg => message * a, b and pt0, pt1 => start, end * r, g, b, a => red, green, blue, alpha A couple of white spaces fixes. A couple of !pointer => pointer == NULL fixes. GetPreferredSize params => _width and _height to indicate out params. [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev45799 Commit: 1e6e124cb40d6907cd2daa0c1d45ac2a646e08f6 URL: http://cgit.haiku-os.org/haiku/commit/?id=1e6e124 Author: John Scipione <jscipione@xxxxxxxxx> Date: Sat Jun 29 02:59:17 2013 UTC ---------------------------------------------------------------------------- 2 files changed, 284 insertions(+), 262 deletions(-) headers/os/interface/View.h | 241 ++++++++++++++++--------------- src/kits/interface/View.cpp | 305 ++++++++++++++++++++-------------------- ---------------------------------------------------------------------------- diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index bac388e..39e1e6a 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2012, Haiku, Inc. All rights reserved. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _VIEW_H @@ -196,22 +196,22 @@ public: BView* Parent() const; BRect Bounds() const; BRect Frame() const; - void ConvertToScreen(BPoint* pt) const; - BPoint ConvertToScreen(BPoint pt) const; - void ConvertFromScreen(BPoint* pt) const; - BPoint ConvertFromScreen(BPoint pt) const; - void ConvertToScreen(BRect* r) const; - BRect ConvertToScreen(BRect r) const; - void ConvertFromScreen(BRect* r) const; - BRect ConvertFromScreen(BRect r) const; - void ConvertToParent(BPoint* pt) const; - BPoint ConvertToParent(BPoint pt) const; - void ConvertFromParent(BPoint* pt) const; - BPoint ConvertFromParent(BPoint pt) const; - void ConvertToParent(BRect* r) const; - BRect ConvertToParent(BRect r) const; - void ConvertFromParent(BRect* r) const; - BRect ConvertFromParent(BRect r) const; + void ConvertToScreen(BPoint* point) const; + BPoint ConvertToScreen(BPoint point) const; + void ConvertFromScreen(BPoint* point) const; + BPoint ConvertFromScreen(BPoint point) const; + void ConvertToScreen(BRect* rect) const; + BRect ConvertToScreen(BRect rect) const; + void ConvertFromScreen(BRect* rect) const; + BRect ConvertFromScreen(BRect rect) const; + void ConvertToParent(BPoint* point) const; + BPoint ConvertToParent(BPoint point) const; + void ConvertFromParent(BPoint* point) const; + BPoint ConvertFromParent(BPoint point) const; + void ConvertToParent(BRect* rect) const; + BRect ConvertToParent(BRect rect) const; + void ConvertFromParent(BRect* rect) const; + BRect ConvertFromParent(BRect rect) const; BPoint LeftTop() const; void GetClippingRegion(BRegion* region) const; @@ -235,9 +235,9 @@ public: void SetViewCursor(const BCursor* cursor, bool sync = true); - virtual void SetViewColor(rgb_color c); - void SetViewColor(uchar r, uchar g, uchar b, - uchar a = 255); + virtual void SetViewColor(rgb_color color); + void SetViewColor(uchar red, uchar green, uchar blue, + uchar alpha = 255); rgb_color ViewColor() const; void SetViewBitmap(const BBitmap* bitmap, @@ -264,14 +264,14 @@ public: uint32 options = 0); void ClearViewOverlay(); - virtual void SetHighColor(rgb_color a_color); - void SetHighColor(uchar r, uchar g, uchar b, - uchar a = 255); + virtual void SetHighColor(rgb_color color); + void SetHighColor(uchar red, uchar green, uchar blue, + uchar alpha = 255); rgb_color HighColor() const; - virtual void SetLowColor(rgb_color a_color); - void SetLowColor(uchar r, uchar g, uchar b, - uchar a = 255); + virtual void SetLowColor(rgb_color color); + void SetLowColor(uchar red, uchar green, uchar blue, + uchar alpha = 255); rgb_color LowColor() const; void SetLineMode(cap_mode lineCap, @@ -292,110 +292,125 @@ public: void MovePenTo(float x, float y); void MovePenBy(float x, float y); BPoint PenLocation() const; - void StrokeLine(BPoint toPt, - pattern p = B_SOLID_HIGH); - void StrokeLine(BPoint a, BPoint b, - pattern p = B_SOLID_HIGH); + void StrokeLine(BPoint toPoint, + ::pattern pattern = B_SOLID_HIGH); + void StrokeLine(BPoint start, BPoint end, + ::pattern pattern = B_SOLID_HIGH); void BeginLineArray(int32 count); - void AddLine(BPoint a, BPoint b, rgb_color color); + void AddLine(BPoint start, BPoint end, + rgb_color color); void EndLineArray(); void StrokePolygon(const BPolygon* polygon, bool closed = true, - pattern p = B_SOLID_HIGH); - void StrokePolygon(const BPoint* ptArray, - int32 numPts, bool closed = true, - pattern p = B_SOLID_HIGH); - void StrokePolygon(const BPoint* ptArray, - int32 numPts, BRect bounds, + ::pattern pattern = B_SOLID_HIGH); + void StrokePolygon(const BPoint* pointArray, + int32 numPoints, bool closed = true, + ::pattern pattern = B_SOLID_HIGH); + void StrokePolygon(const BPoint* pointArray, + int32 numPoints, BRect bounds, bool closed = true, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); void FillPolygon(const BPolygon* polygon, - pattern p = B_SOLID_HIGH); - void FillPolygon(const BPoint* ptArray, - int32 numPts, pattern p = B_SOLID_HIGH); - void FillPolygon(const BPoint* ptArray, - int32 numPts, BRect bounds, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); + void FillPolygon(const BPoint* pointArray, + int32 numPoints, + ::pattern pattern = B_SOLID_HIGH); + void FillPolygon(const BPoint* pointArray, + int32 numPoints, BRect bounds, + ::pattern pattern = B_SOLID_HIGH); void FillPolygon(const BPolygon* polygon, const BGradient& gradient); - void FillPolygon(const BPoint* ptArray, - int32 numPts, const BGradient& gradient); - void FillPolygon(const BPoint* ptArray, - int32 numPts, BRect bounds, + void FillPolygon(const BPoint* pointArray, + int32 numPoints, const BGradient& gradient); + void FillPolygon(const BPoint* pointArray, + int32 numPoints, BRect bounds, const BGradient& gradient); - void StrokeTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, BRect bounds, - pattern p = B_SOLID_HIGH); - void StrokeTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, BRect bounds, - pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, const BGradient& gradient); - void FillTriangle(BPoint pt1, BPoint pt2, - BPoint pt3, BRect bounds, + void StrokeTriangle(BPoint point1, BPoint point2, + BPoint point3, BRect bounds, + ::pattern pattern = B_SOLID_HIGH); + void StrokeTriangle(BPoint point1, BPoint point2, + BPoint point3, + ::pattern pattern = B_SOLID_HIGH); + void FillTriangle(BPoint point1, BPoint point2, + BPoint point3, + ::pattern pattern = B_SOLID_HIGH); + void FillTriangle(BPoint point1, BPoint point2, + BPoint point3, BRect bounds, + ::pattern pattern = B_SOLID_HIGH); + void FillTriangle(BPoint point1, BPoint point2, + BPoint point3, const BGradient& gradient); + void FillTriangle(BPoint point1, BPoint point2, + BPoint point3, BRect bounds, const BGradient& gradient); - void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); - void FillRect(BRect r, pattern p = B_SOLID_HIGH); - void FillRect(BRect r, const BGradient& gradient); - void FillRegion(BRegion* region, - pattern p = B_SOLID_HIGH); - void FillRegion(BRegion* region, + void StrokeRect(BRect rect, + ::pattern pattern = B_SOLID_HIGH); + void FillRect(BRect rect, + ::pattern pattern = B_SOLID_HIGH); + void FillRect(BRect rect, const BGradient& gradient); + void FillRegion(BRegion* rectegion, + ::pattern pattern = B_SOLID_HIGH); + void FillRegion(BRegion* rectegion, const BGradient& gradient); - void InvertRect(BRect r); - - void StrokeRoundRect(BRect r, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void FillRoundRect(BRect r, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void FillRoundRect(BRect r, float xRadius, + void InvertRect(BRect rect); + + void StrokeRoundRect(BRect rect, float xRadius, + float yRadius, + ::pattern pattern = B_SOLID_HIGH); + void FillRoundRect(BRect rect, float xRadius, + float yRadius, + ::pattern pattern = B_SOLID_HIGH); + void FillRoundRect(BRect rect, float xRadius, float yRadius, const BGradient& gradient); void StrokeEllipse(BPoint center, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void StrokeEllipse(BRect r, - pattern p = B_SOLID_HIGH); + float yRadius, + ::pattern pattern = B_SOLID_HIGH); + void StrokeEllipse(BRect rect, + ::pattern pattern = B_SOLID_HIGH); void FillEllipse(BPoint center, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); + float yRadius, + ::pattern pattern = B_SOLID_HIGH); + void FillEllipse(BRect rect, + ::pattern pattern = B_SOLID_HIGH); void FillEllipse(BPoint center, float xRadius, float yRadius, const BGradient& gradient); - void FillEllipse(BRect r, + void FillEllipse(BRect rect, const BGradient& gradient); void StrokeArc(BPoint center, float xRadius, float yRadius, float startAngle, - float arcAngle, pattern p = B_SOLID_HIGH); - void StrokeArc(BRect r, float startAngle, - float arcAngle, pattern p = B_SOLID_HIGH); + float arcAngle, + ::pattern pattern = B_SOLID_HIGH); + void StrokeArc(BRect rect, float startAngle, + float arcAngle, + ::pattern pattern = B_SOLID_HIGH); void FillArc(BPoint center, float xRadius, float yRadius, float startAngle, - float arcAngle, pattern p = B_SOLID_HIGH); - void FillArc(BRect r, float startAngle, - float arcAngle, pattern p = B_SOLID_HIGH); + float arcAngle, + ::pattern pattern = B_SOLID_HIGH); + void FillArc(BRect rect, float startAngle, + float arcAngle, + ::pattern pattern = B_SOLID_HIGH); void FillArc(BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, const BGradient& gradient); - void FillArc(BRect r, float startAngle, + void FillArc(BRect rect, float startAngle, float arcAngle, const BGradient& gradient); void StrokeBezier(BPoint* controlPoints, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); void FillBezier(BPoint* controlPoints, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); void FillBezier(BPoint* controlPoints, const BGradient& gradient); void StrokeShape(BShape* shape, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); void FillShape(BShape* shape, - pattern p = B_SOLID_HIGH); + ::pattern pattern = B_SOLID_HIGH); void FillShape(BShape* shape, const BGradient& gradient); @@ -442,7 +457,7 @@ public: const BPoint* locations, int32 locationCount); - virtual void SetFont(const BFont* font, + virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); void GetFont(BFont* font) const; @@ -508,22 +523,22 @@ public: void Flush() const; void Sync() const; - virtual void GetPreferredSize(float* width, float* height); + virtual void GetPreferredSize(float* _width, float* _height); virtual void ResizeToPreferred(); BScrollBar* ScrollBar(orientation posture) const; - virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 form, const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual status_t GetSupportedSuites(BMessage* data); bool IsPrinting() const; void SetScale(float scale) const; float Scale() const; // new for Haiku - virtual status_t Perform(perform_code code, void* data); + virtual status_t Perform(perform_code code, void* data); virtual void DrawAfterChildren(BRect r); @@ -581,7 +596,7 @@ public: void HideToolTip(); protected: - virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); + virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); virtual void LayoutChanged(); @@ -720,37 +735,37 @@ BView::ScrollTo(float x, float y) inline void -BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) +BView::SetViewColor(uchar red, uchar green, uchar blue, uchar alpha) { rgb_color color; - color.red = r; - color.green = g; - color.blue = b; - color.alpha = a; + color.red = red; + color.green = green; + color.blue = blue; + color.alpha = alpha; SetViewColor(color); } inline void -BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) +BView::SetHighColor(uchar red, uchar green, uchar blue, uchar alpha) { rgb_color color; - color.red = r; - color.green = g; - color.blue = b; - color.alpha = a; + color.red = red; + color.green = green; + color.blue = blue; + color.alpha = alpha; SetHighColor(color); } inline void -BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) +BView::SetLowColor(uchar red, uchar green, uchar blue, uchar alpha) { rgb_color color; - color.red = r; - color.green = g; - color.blue = b; - color.alpha = a; + color.red = red; + color.green = green; + color.blue = blue; + color.alpha = alpha; SetLowColor(color); } diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index d1bc743..12fb0ae 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -1,12 +1,12 @@ /* - * Copyright 2001-2012, Haiku. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * Adrian Oanca <adioanca@xxxxxxxxxxxxx> + * Stephan Aßmus, superstippi@xxxxxx * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx - * Stephan Aßmus <superstippi@xxxxxx> - * Ingo Weinhold <ingo_weinhold@xxxxxx> + * Adrian Oanca, adioanca@xxxxxxxxxxxxx + * Ingo Weinhold. ingo_weinhold@xxxxxx */ @@ -834,11 +834,11 @@ BView::ConvertFromParent(BRect rect) const void -BView::_ConvertToScreen(BPoint* pt, bool checkLock) const +BView::_ConvertToScreen(BPoint* point, bool checkLock) const { if (!fParent) { if (fOwner) - fOwner->ConvertToScreen(pt); + fOwner->ConvertToScreen(point); return; } @@ -846,33 +846,33 @@ BView::_ConvertToScreen(BPoint* pt, bool checkLock) const if (checkLock) _CheckOwnerLock(); - _ConvertToParent(pt, false); - fParent->_ConvertToScreen(pt, false); + _ConvertToParent(point, false); + fParent->_ConvertToScreen(point, false); } void -BView::ConvertToScreen(BPoint* pt) const +BView::ConvertToScreen(BPoint* point) const { - _ConvertToScreen(pt, true); + _ConvertToScreen(point, true); } BPoint -BView::ConvertToScreen(BPoint pt) const +BView::ConvertToScreen(BPoint point) const { - ConvertToScreen(&pt); + ConvertToScreen(&point); - return pt; + return point; } void -BView::_ConvertFromScreen(BPoint* pt, bool checkLock) const +BView::_ConvertFromScreen(BPoint* point, bool checkLock) const { if (!fParent) { if (fOwner) - fOwner->ConvertFromScreen(pt); + fOwner->ConvertFromScreen(point); return; } @@ -880,24 +880,24 @@ BView::_ConvertFromScreen(BPoint* pt, bool checkLock) const if (checkLock) _CheckOwnerLock(); - _ConvertFromParent(pt, false); - fParent->_ConvertFromScreen(pt, false); + _ConvertFromParent(point, false); + fParent->_ConvertFromScreen(point, false); } void -BView::ConvertFromScreen(BPoint* pt) const +BView::ConvertFromScreen(BPoint* point) const { - _ConvertFromScreen(pt, true); + _ConvertFromScreen(point, true); } BPoint -BView::ConvertFromScreen(BPoint pt) const +BView::ConvertFromScreen(BPoint point) const { - ConvertFromScreen(&pt); + ConvertFromScreen(&point); - return pt; + return point; } @@ -2739,7 +2739,7 @@ BView::FillEllipse(BPoint center, float xRadius, float yRadius, const BGradient& gradient) { FillEllipse(BRect(center.x - xRadius, center.y - yRadius, - center.x + xRadius, center.y + yRadius), gradient); + center.x + xRadius, center.y + yRadius), gradient); } @@ -2919,7 +2919,7 @@ BView::FillBezier(BPoint* controlPoints, const BGradient& gradient) void BView::StrokePolygon(const BPolygon* polygon, bool closed, ::pattern pattern) { - if (!polygon) + if (polygon == NULL) return; StrokePolygon(polygon->fPoints, polygon->fCount, polygon->Frame(), closed, @@ -2939,10 +2939,10 @@ BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, bool closed, void -BView::StrokePolygon(const BPoint* ptArray, int32 numPoints, BRect bounds, +BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, BRect bounds, bool closed, ::pattern pattern) { - if (!ptArray + if (pointArray == NULL || numPoints <= 1 || fOwner == NULL) return; @@ -2950,7 +2950,7 @@ BView::StrokePolygon(const BPoint* ptArray, int32 numPoints, BRect bounds, _CheckLockAndSwitchCurrent(); _UpdatePattern(pattern); - BPolygon polygon(ptArray, numPoints); + BPolygon polygon(pointArray, numPoints); polygon.MapTo(polygon.Frame(), bounds); if (fOwner->fLink->StartMessage(AS_STROKE_POLYGON, @@ -3021,50 +3021,50 @@ BView::FillPolygon(const BPolygon* polygon, const BGradient& gradient) void -BView::FillPolygon(const BPoint* ptArray, int32 numPts, ::pattern pattern) +BView::FillPolygon(const BPoint* pointArray, int32 numPoints, ::pattern pattern) { - if (!ptArray) + if (pointArray == NULL) return; - BPolygon polygon(ptArray, numPts); + BPolygon polygon(pointArray, numPoints); FillPolygon(&polygon, pattern); } void -BView::FillPolygon(const BPoint* ptArray, int32 numPts, +BView::FillPolygon(const BPoint* pointArray, int32 numPoints, const BGradient& gradient) { - if (!ptArray) + if (pointArray == NULL) return; - BPolygon polygon(ptArray, numPts); + BPolygon polygon(pointArray, numPoints); FillPolygon(&polygon, gradient); } void -BView::FillPolygon(const BPoint* ptArray, int32 numPts, BRect bounds, - pattern p) +BView::FillPolygon(const BPoint* pointArray, int32 numPoints, BRect bounds, + ::pattern pattern) { - if (!ptArray) + if (pointArray == NULL) return; - BPolygon polygon(ptArray, numPts); + BPolygon polygon(pointArray, numPoints); polygon.MapTo(polygon.Frame(), bounds); - FillPolygon(&polygon, p); + FillPolygon(&polygon, pattern); } void -BView::FillPolygon(const BPoint* ptArray, int32 numPts, BRect bounds, +BView::FillPolygon(const BPoint* pointArray, int32 numPoints, BRect bounds, const BGradient& gradient) { - if (!ptArray) + if (pointArray == NULL) return; - BPolygon polygon(ptArray, numPts); + BPolygon polygon(pointArray, numPoints); polygon.MapTo(polygon.Frame(), bounds); FillPolygon(&polygon, gradient); @@ -3221,7 +3221,7 @@ BView::FillRegion(BRegion* region, const BGradient& gradient) void -BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds, +BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern) { if (fOwner == NULL) @@ -3232,9 +3232,9 @@ BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds, _UpdatePattern(pattern); fOwner->fLink->StartMessage(AS_STROKE_TRIANGLE); - fOwner->fLink->Attach<BPoint>(pt1); - fOwner->fLink->Attach<BPoint>(pt2); - fOwner->fLink->Attach<BPoint>(pt3); + fOwner->fLink->Attach<BPoint>(point1); + fOwner->fLink->Attach<BPoint>(point2); + fOwner->fLink->Attach<BPoint>(point3); fOwner->fLink->Attach<BRect>(bounds); _FlushIfNotInTransaction(); @@ -3242,125 +3242,127 @@ BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds, void -BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, pattern p) +BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, + ::pattern pattern) { if (fOwner) { // we construct the smallest rectangle that contains the 3 points // for the 1st point - BRect bounds(pt1, pt1); + BRect bounds(point1, point1); // for the 2nd point - if (pt2.x < bounds.left) - bounds.left = pt2.x; + if (point2.x < bounds.left) + bounds.left = point2.x; - if (pt2.y < bounds.top) - bounds.top = pt2.y; + if (point2.y < bounds.top) + bounds.top = point2.y; - if (pt2.x > bounds.right) - bounds.right = pt2.x; + if (point2.x > bounds.right) + bounds.right = point2.x; - if (pt2.y > bounds.bottom) - bounds.bottom = pt2.y; + if (point2.y > bounds.bottom) + bounds.bottom = point2.y; // for the 3rd point - if (pt3.x < bounds.left) - bounds.left = pt3.x; + if (point3.x < bounds.left) + bounds.left = point3.x; - if (pt3.y < bounds.top) - bounds.top = pt3.y; + if (point3.y < bounds.top) + bounds.top = point3.y; - if (pt3.x > bounds.right) - bounds.right = pt3.x; + if (point3.x > bounds.right) + bounds.right = point3.x; - if (pt3.y > bounds.bottom) - bounds.bottom = pt3.y; + if (point3.y > bounds.bottom) + bounds.bottom = point3.y; - StrokeTriangle(pt1, pt2, pt3, bounds, p); + StrokeTriangle(point1, point2, point3, bounds, pattern); } } void -BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, pattern p) +BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, + ::pattern pattern) { if (fOwner) { // we construct the smallest rectangle that contains the 3 points // for the 1st point - BRect bounds(pt1, pt1); + BRect bounds(point1, point1); // for the 2nd point - if (pt2.x < bounds.left) - bounds.left = pt2.x; + if (point2.x < bounds.left) + bounds.left = point2.x; - if (pt2.y < bounds.top) - bounds.top = pt2.y; + if (point2.y < bounds.top) + bounds.top = point2.y; - if (pt2.x > bounds.right) - bounds.right = pt2.x; + if (point2.x > bounds.right) + bounds.right = point2.x; - if (pt2.y > bounds.bottom) - bounds.bottom = pt2.y; + if (point2.y > bounds.bottom) + bounds.bottom = point2.y; // for the 3rd point - if (pt3.x < bounds.left) - bounds.left = pt3.x; + if (point3.x < bounds.left) + bounds.left = point3.x; - if (pt3.y < bounds.top) - bounds.top = pt3.y; + if (point3.y < bounds.top) + bounds.top = point3.y; - if (pt3.x > bounds.right) - bounds.right = pt3.x; + if (point3.x > bounds.right) + bounds.right = point3.x; - if (pt3.y > bounds.bottom) - bounds.bottom = pt3.y; + if (point3.y > bounds.bottom) + bounds.bottom = point3.y; - FillTriangle(pt1, pt2, pt3, bounds, p); + FillTriangle(point1, point2, point3, bounds, pattern); } } void -BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, +BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, const BGradient& gradient) { if (fOwner) { // we construct the smallest rectangle that contains the 3 points // for the 1st point - BRect bounds(pt1, pt1); + BRect bounds(point1, point1); // for the 2nd point - if (pt2.x < bounds.left) - bounds.left = pt2.x; + if (point2.x < bounds.left) + bounds.left = point2.x; - if (pt2.y < bounds.top) - bounds.top = pt2.y; + if (point2.y < bounds.top) + bounds.top = point2.y; - if (pt2.x > bounds.right) - bounds.right = pt2.x; + if (point2.x > bounds.right) + bounds.right = point2.x; - if (pt2.y > bounds.bottom) - bounds.bottom = pt2.y; + if (point2.y > bounds.bottom) + bounds.bottom = point2.y; // for the 3rd point - if (pt3.x < bounds.left) - bounds.left = pt3.x; + if (point3.x < bounds.left) + bounds.left = point3.x; - if (pt3.y < bounds.top) - bounds.top = pt3.y; + if (point3.y < bounds.top) + bounds.top = point3.y; - if (pt3.x > bounds.right) - bounds.right = pt3.x; + if (point3.x > bounds.right) + bounds.right = point3.x; - if (pt3.y > bounds.bottom) - bounds.bottom = pt3.y; + if (point3.y > bounds.bottom) + bounds.bottom = point3.y; - FillTriangle(pt1, pt2, pt3, bounds, gradient); + FillTriangle(point1, point2, point3, bounds, gradient); } } void -BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, +BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern) { if (fOwner == NULL) @@ -3370,9 +3372,9 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, _UpdatePattern(pattern); fOwner->fLink->StartMessage(AS_FILL_TRIANGLE); - fOwner->fLink->Attach<BPoint>(pt1); - fOwner->fLink->Attach<BPoint>(pt2); - fOwner->fLink->Attach<BPoint>(pt3); + fOwner->fLink->Attach<BPoint>(point1); + fOwner->fLink->Attach<BPoint>(point2); + fOwner->fLink->Attach<BPoint>(point3); fOwner->fLink->Attach<BRect>(bounds); _FlushIfNotInTransaction(); @@ -3380,17 +3382,17 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, void -BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - BRect bounds, const BGradient& gradient) +BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, BRect bounds, + const BGradient& gradient) { if (fOwner == NULL) return; _CheckLockAndSwitchCurrent(); fOwner->fLink->StartMessage(AS_FILL_TRIANGLE_GRADIENT); - fOwner->fLink->Attach<BPoint>(pt1); - fOwner->fLink->Attach<BPoint>(pt2); - fOwner->fLink->Attach<BPoint>(pt3); + fOwner->fLink->Attach<BPoint>(point1); + fOwner->fLink->Attach<BPoint>(point2); + fOwner->fLink->Attach<BPoint>(point3); fOwner->fLink->Attach<BRect>(bounds); fOwner->fLink->AttachGradient(gradient); @@ -3399,14 +3401,14 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, void -BView::StrokeLine(BPoint toPt, pattern p) +BView::StrokeLine(BPoint toPoint, ::pattern pattern) { - StrokeLine(PenLocation(), toPt, p); + StrokeLine(PenLocation(), toPoint, pattern); } void -BView::StrokeLine(BPoint pt0, BPoint pt1, ::pattern pattern) +BView::StrokeLine(BPoint start, BPoint end, ::pattern pattern) { if (fOwner == NULL) return; @@ -3415,8 +3417,8 @@ BView::StrokeLine(BPoint pt0, BPoint pt1, ::pattern pattern) _UpdatePattern(pattern); ViewStrokeLineInfo info; - info.startPoint = pt0; - info.endPoint = pt1; + info.startPoint = start; + info.endPoint = end; fOwner->fLink->StartMessage(AS_STROKE_LINE); fOwner->fLink->Attach<ViewStrokeLineInfo>(info); @@ -3531,7 +3533,7 @@ BView::BeginLineArray(int32 count) void -BView::AddLine(BPoint pt0, BPoint pt1, rgb_color col) +BView::AddLine(BPoint start, BPoint end, rgb_color color) { if (fOwner == NULL) return; @@ -3543,9 +3545,9 @@ BView::AddLine(BPoint pt0, BPoint pt1, rgb_color col) const uint32 &arrayCount = fCommArray->count; if (arrayCount < fCommArray->maxCount) { - fCommArray->array[arrayCount].startPoint = pt0; - fCommArray->array[arrayCount].endPoint = pt1; - fCommArray->array[arrayCount].color = col; + fCommArray->array[arrayCount].startPoint = start; + fCommArray->array[arrayCount].endPoint = end; + fCommArray->array[arrayCount].color = color; fCommArray->count++; } @@ -3977,6 +3979,7 @@ BView::RemoveChild(BView* child) return child->RemoveSelf(); } + int32 BView::CountChildren() const { @@ -4205,18 +4208,19 @@ BView::GetSupportedSuites(BMessage* data) BHandler* -BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, - int32 what, const char* property) +BView::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, + int32 what, const char* property) { - if (msg->what == B_WINDOW_MOVE_BY - || msg->what == B_WINDOW_MOVE_TO) + if (message->what == B_WINDOW_MOVE_BY + || message->what == B_WINDOW_MOVE_TO) { return this; + } BPropertyInfo propertyInfo(sViewPropInfo); status_t err = B_BAD_SCRIPT_SYNTAX; BMessage replyMsg(B_REPLY); - switch (propertyInfo.FindMatch(msg, index, specifier, what, property)) { + switch (propertyInfo.FindMatch(message, index, specifier, what, property)) { case 0: case 1: case 3: @@ -4224,7 +4228,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, case 2: if (fShelf) { - msg->PopSpecifier(); + message->PopSpecifier(); return fShelf; } @@ -4269,7 +4273,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, } if (child != NULL) { - msg->PopSpecifier(); + message->PopSpecifier(); return child; } @@ -4282,7 +4286,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, } default: - return BHandler::ResolveSpecifier(msg, index, specifier, what, + return BHandler::ResolveSpecifier(message, index, specifier, what, property); } @@ -4296,16 +4300,16 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, } replyMsg.AddInt32("error", err); - msg->SendReply(&replyMsg); + message->SendReply(&replyMsg); return NULL; } void -BView::MessageReceived(BMessage* msg) +BView::MessageReceived(BMessage* message) { - if (!msg->HasSpecifiers()) { - switch (msg->what) { + if (!message->HasSpecifiers()) { + switch (message->what) { case B_VIEW_RESIZED: // By the time the message arrives, the bounds may have // changed already, that's why we don't use the values @@ -4320,14 +4324,14 @@ BView::MessageReceived(BMessage* msg) case B_MOUSE_IDLE: { BPoint where; - if (msg->FindPoint("be:view_where", &where) != B_OK) + if (message->FindPoint("be:view_where", &where) != B_OK) break; BToolTip* tip; if (GetToolTipAt(where, &tip)) ShowToolTip(tip); else - BHandler::MessageReceived(msg); + BHandler::MessageReceived(message); break; } @@ -4337,15 +4341,15 @@ BView::MessageReceived(BMessage* msg) BScrollBar* vertical = ScrollBar(B_VERTICAL); if (horizontal == NULL && vertical == NULL) { // Pass the message to the next handler - BHandler::MessageReceived(msg); + BHandler::MessageReceived(message); break; } float deltaX = 0.0f, deltaY = 0.0f; if (horizontal != NULL) - msg->FindFloat("be:wheel_delta_x", &deltaX); + message->FindFloat("be:wheel_delta_x", &deltaX); if (vertical != NULL) - msg->FindFloat("be:wheel_delta_y", &deltaY); + message->FindFloat("be:wheel_delta_y", &deltaY); if (deltaX == 0.0f && deltaY == 0.0f) break; @@ -4361,7 +4365,7 @@ BView::MessageReceived(BMessage* msg) } default: - BHandler::MessageReceived(msg); + BHandler::MessageReceived(message); break; } @@ -4377,17 +4381,20 @@ BView::MessageReceived(BMessage* msg) int32 what; const char* property; - if (msg->GetCurrentSpecifier(&index, &specifier, &what, &property) != B_OK) - return BHandler::MessageReceived(msg); + if (message->GetCurrentSpecifier(&index, &specifier, &what, &property) + != B_OK) { + return BHandler::MessageReceived(message); + } BPropertyInfo propertyInfo(sViewPropInfo); - switch (propertyInfo.FindMatch(msg, index, &specifier, what, property)) { + switch (propertyInfo.FindMatch(message, index, &specifier, what, + property)) { case 0: - if (msg->what == B_GET_PROPERTY) { + if (message->what == B_GET_PROPERTY) { err = replyMsg.AddRect("result", Frame()); - } else if (msg->what == B_SET_PROPERTY) { + } else if (message->what == B_SET_PROPERTY) { BRect newFrame; - err = msg->FindRect("data", &newFrame); + err = message->FindRect("data", &newFrame); if (err == B_OK) { MoveTo(newFrame.LeftTop()); ResizeTo(newFrame.Width(), newFrame.Height()); @@ -4395,11 +4402,11 @@ BView::MessageReceived(BMessage* msg) } break; case 1: - if (msg->what == B_GET_PROPERTY) { + if (message->what == B_GET_PROPERTY) { err = replyMsg.AddBool("result", IsHidden()); - } else if (msg->what == B_SET_PROPERTY) { + } else if (message->what == B_SET_PROPERTY) { bool newHiddenState; - err = msg->FindBool("data", &newHiddenState); + err = message->FindBool("data", &newHiddenState); if (err == B_OK) { if (newHiddenState == true) Hide(); @@ -4412,7 +4419,7 @@ BView::MessageReceived(BMessage* msg) err = replyMsg.AddInt32("result", CountChildren()); break; default: - return BHandler::MessageReceived(msg); + return BHandler::MessageReceived(message); } if (err != B_OK) { @@ -4426,7 +4433,7 @@ BView::MessageReceived(BMessage* msg) replyMsg.AddInt32("error", err); } - msg->SendReply(&replyMsg); + message->SendReply(&replyMsg); }