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.
This commit is contained in:
John Scipione
2013-06-28 22:59:17 -04:00
parent dd84193fa4
commit 1e6e124cb4
2 changed files with 283 additions and 261 deletions
+127 -112
View File
@@ -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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _VIEW_H #ifndef _VIEW_H
@@ -196,22 +196,22 @@ public:
BView* Parent() const; BView* Parent() const;
BRect Bounds() const; BRect Bounds() const;
BRect Frame() const; BRect Frame() const;
void ConvertToScreen(BPoint* pt) const; void ConvertToScreen(BPoint* point) const;
BPoint ConvertToScreen(BPoint pt) const; BPoint ConvertToScreen(BPoint point) const;
void ConvertFromScreen(BPoint* pt) const; void ConvertFromScreen(BPoint* point) const;
BPoint ConvertFromScreen(BPoint pt) const; BPoint ConvertFromScreen(BPoint point) const;
void ConvertToScreen(BRect* r) const; void ConvertToScreen(BRect* rect) const;
BRect ConvertToScreen(BRect r) const; BRect ConvertToScreen(BRect rect) const;
void ConvertFromScreen(BRect* r) const; void ConvertFromScreen(BRect* rect) const;
BRect ConvertFromScreen(BRect r) const; BRect ConvertFromScreen(BRect rect) const;
void ConvertToParent(BPoint* pt) const; void ConvertToParent(BPoint* point) const;
BPoint ConvertToParent(BPoint pt) const; BPoint ConvertToParent(BPoint point) const;
void ConvertFromParent(BPoint* pt) const; void ConvertFromParent(BPoint* point) const;
BPoint ConvertFromParent(BPoint pt) const; BPoint ConvertFromParent(BPoint point) const;
void ConvertToParent(BRect* r) const; void ConvertToParent(BRect* rect) const;
BRect ConvertToParent(BRect r) const; BRect ConvertToParent(BRect rect) const;
void ConvertFromParent(BRect* r) const; void ConvertFromParent(BRect* rect) const;
BRect ConvertFromParent(BRect r) const; BRect ConvertFromParent(BRect rect) const;
BPoint LeftTop() const; BPoint LeftTop() const;
void GetClippingRegion(BRegion* region) const; void GetClippingRegion(BRegion* region) const;
@@ -235,9 +235,9 @@ public:
void SetViewCursor(const BCursor* cursor, void SetViewCursor(const BCursor* cursor,
bool sync = true); bool sync = true);
virtual void SetViewColor(rgb_color c); virtual void SetViewColor(rgb_color color);
void SetViewColor(uchar r, uchar g, uchar b, void SetViewColor(uchar red, uchar green, uchar blue,
uchar a = 255); uchar alpha = 255);
rgb_color ViewColor() const; rgb_color ViewColor() const;
void SetViewBitmap(const BBitmap* bitmap, void SetViewBitmap(const BBitmap* bitmap,
@@ -264,14 +264,14 @@ public:
uint32 options = 0); uint32 options = 0);
void ClearViewOverlay(); void ClearViewOverlay();
virtual void SetHighColor(rgb_color a_color); virtual void SetHighColor(rgb_color color);
void SetHighColor(uchar r, uchar g, uchar b, void SetHighColor(uchar red, uchar green, uchar blue,
uchar a = 255); uchar alpha = 255);
rgb_color HighColor() const; rgb_color HighColor() const;
virtual void SetLowColor(rgb_color a_color); virtual void SetLowColor(rgb_color color);
void SetLowColor(uchar r, uchar g, uchar b, void SetLowColor(uchar red, uchar green, uchar blue,
uchar a = 255); uchar alpha = 255);
rgb_color LowColor() const; rgb_color LowColor() const;
void SetLineMode(cap_mode lineCap, void SetLineMode(cap_mode lineCap,
@@ -292,110 +292,125 @@ public:
void MovePenTo(float x, float y); void MovePenTo(float x, float y);
void MovePenBy(float x, float y); void MovePenBy(float x, float y);
BPoint PenLocation() const; BPoint PenLocation() const;
void StrokeLine(BPoint toPt, void StrokeLine(BPoint toPoint,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void StrokeLine(BPoint a, BPoint b, void StrokeLine(BPoint start, BPoint end,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void BeginLineArray(int32 count); 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 EndLineArray();
void StrokePolygon(const BPolygon* polygon, void StrokePolygon(const BPolygon* polygon,
bool closed = true, bool closed = true,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray, void StrokePolygon(const BPoint* pointArray,
int32 numPts, bool closed = true, int32 numPoints, bool closed = true,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void StrokePolygon(const BPoint* ptArray, void StrokePolygon(const BPoint* pointArray,
int32 numPts, BRect bounds, int32 numPoints, BRect bounds,
bool closed = true, bool closed = true,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon, void FillPolygon(const BPolygon* polygon,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillPolygon(const BPoint* ptArray, void FillPolygon(const BPoint* pointArray,
int32 numPts, pattern p = B_SOLID_HIGH); int32 numPoints,
void FillPolygon(const BPoint* ptArray, ::pattern pattern = B_SOLID_HIGH);
int32 numPts, BRect bounds, void FillPolygon(const BPoint* pointArray,
pattern p = B_SOLID_HIGH); int32 numPoints, BRect bounds,
::pattern pattern = B_SOLID_HIGH);
void FillPolygon(const BPolygon* polygon, void FillPolygon(const BPolygon* polygon,
const BGradient& gradient); const BGradient& gradient);
void FillPolygon(const BPoint* ptArray, void FillPolygon(const BPoint* pointArray,
int32 numPts, const BGradient& gradient); int32 numPoints, const BGradient& gradient);
void FillPolygon(const BPoint* ptArray, void FillPolygon(const BPoint* pointArray,
int32 numPts, BRect bounds, int32 numPoints, BRect bounds,
const BGradient& gradient); const BGradient& gradient);
void StrokeTriangle(BPoint pt1, BPoint pt2, void StrokeTriangle(BPoint point1, BPoint point2,
BPoint pt3, BRect bounds, BPoint point3, BRect bounds,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void StrokeTriangle(BPoint pt1, BPoint pt2, void StrokeTriangle(BPoint point1, BPoint point2,
BPoint pt3, pattern p = B_SOLID_HIGH); BPoint point3,
void FillTriangle(BPoint pt1, BPoint pt2, ::pattern pattern = B_SOLID_HIGH);
BPoint pt3, pattern p = B_SOLID_HIGH); void FillTriangle(BPoint point1, BPoint point2,
void FillTriangle(BPoint pt1, BPoint pt2, BPoint point3,
BPoint pt3, BRect bounds, ::pattern pattern = B_SOLID_HIGH);
pattern p = B_SOLID_HIGH); void FillTriangle(BPoint point1, BPoint point2,
void FillTriangle(BPoint pt1, BPoint pt2, BPoint point3, BRect bounds,
BPoint pt3, const BGradient& gradient); ::pattern pattern = B_SOLID_HIGH);
void FillTriangle(BPoint pt1, BPoint pt2, void FillTriangle(BPoint point1, BPoint point2,
BPoint pt3, BRect bounds, BPoint point3, const BGradient& gradient);
void FillTriangle(BPoint point1, BPoint point2,
BPoint point3, BRect bounds,
const BGradient& gradient); const BGradient& gradient);
void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); void StrokeRect(BRect rect,
void FillRect(BRect r, pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillRect(BRect r, const BGradient& gradient); void FillRect(BRect rect,
void FillRegion(BRegion* region, ::pattern pattern = B_SOLID_HIGH);
pattern p = B_SOLID_HIGH); void FillRect(BRect rect, const BGradient& gradient);
void FillRegion(BRegion* region, void FillRegion(BRegion* rectegion,
::pattern pattern = B_SOLID_HIGH);
void FillRegion(BRegion* rectegion,
const BGradient& gradient); const BGradient& gradient);
void InvertRect(BRect r); void InvertRect(BRect rect);
void StrokeRoundRect(BRect r, float xRadius, void StrokeRoundRect(BRect rect, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); float yRadius,
void FillRoundRect(BRect r, float xRadius, ::pattern pattern = B_SOLID_HIGH);
float yRadius, pattern p = B_SOLID_HIGH); void FillRoundRect(BRect rect, float xRadius,
void FillRoundRect(BRect r, float xRadius, float yRadius,
::pattern pattern = B_SOLID_HIGH);
void FillRoundRect(BRect rect, float xRadius,
float yRadius, const BGradient& gradient); float yRadius, const BGradient& gradient);
void StrokeEllipse(BPoint center, float xRadius, void StrokeEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); float yRadius,
void StrokeEllipse(BRect r, ::pattern pattern = B_SOLID_HIGH);
pattern p = B_SOLID_HIGH); void StrokeEllipse(BRect rect,
::pattern pattern = B_SOLID_HIGH);
void FillEllipse(BPoint center, float xRadius, void FillEllipse(BPoint center, float xRadius,
float yRadius, pattern p = B_SOLID_HIGH); float yRadius,
void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillEllipse(BRect rect,
::pattern pattern = B_SOLID_HIGH);
void FillEllipse(BPoint center, float xRadius, void FillEllipse(BPoint center, float xRadius,
float yRadius, const BGradient& gradient); float yRadius, const BGradient& gradient);
void FillEllipse(BRect r, void FillEllipse(BRect rect,
const BGradient& gradient); const BGradient& gradient);
void StrokeArc(BPoint center, float xRadius, void StrokeArc(BPoint center, float xRadius,
float yRadius, float startAngle, float yRadius, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH); float arcAngle,
void StrokeArc(BRect r, float startAngle, ::pattern pattern = B_SOLID_HIGH);
float arcAngle, pattern p = B_SOLID_HIGH); void StrokeArc(BRect rect, float startAngle,
float arcAngle,
::pattern pattern = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, void FillArc(BPoint center, float xRadius,
float yRadius, float startAngle, float yRadius, float startAngle,
float arcAngle, pattern p = B_SOLID_HIGH); float arcAngle,
void FillArc(BRect r, float startAngle, ::pattern pattern = B_SOLID_HIGH);
float arcAngle, pattern p = B_SOLID_HIGH); void FillArc(BRect rect, float startAngle,
float arcAngle,
::pattern pattern = B_SOLID_HIGH);
void FillArc(BPoint center, float xRadius, void FillArc(BPoint center, float xRadius,
float yRadius, float startAngle, float yRadius, float startAngle,
float arcAngle, const BGradient& gradient); float arcAngle, const BGradient& gradient);
void FillArc(BRect r, float startAngle, void FillArc(BRect rect, float startAngle,
float arcAngle, const BGradient& gradient); float arcAngle, const BGradient& gradient);
void StrokeBezier(BPoint* controlPoints, void StrokeBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillBezier(BPoint* controlPoints, void FillBezier(BPoint* controlPoints,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillBezier(BPoint* controlPoints, void FillBezier(BPoint* controlPoints,
const BGradient& gradient); const BGradient& gradient);
void StrokeShape(BShape* shape, void StrokeShape(BShape* shape,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillShape(BShape* shape, void FillShape(BShape* shape,
pattern p = B_SOLID_HIGH); ::pattern pattern = B_SOLID_HIGH);
void FillShape(BShape* shape, void FillShape(BShape* shape,
const BGradient& gradient); const BGradient& gradient);
@@ -442,7 +457,7 @@ public:
const BPoint* locations, const BPoint* locations,
int32 locationCount); int32 locationCount);
virtual void SetFont(const BFont* font, virtual void SetFont(const BFont* font,
uint32 mask = B_FONT_ALL); uint32 mask = B_FONT_ALL);
void GetFont(BFont* font) const; void GetFont(BFont* font) const;
@@ -508,22 +523,22 @@ public:
void Flush() const; void Flush() const;
void Sync() const; void Sync() const;
virtual void GetPreferredSize(float* width, float* height); virtual void GetPreferredSize(float* _width, float* _height);
virtual void ResizeToPreferred(); virtual void ResizeToPreferred();
BScrollBar* ScrollBar(orientation posture) const; BScrollBar* ScrollBar(orientation posture) const;
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, BMessage* specifier, int32 form,
const char* property); const char* property);
virtual status_t GetSupportedSuites(BMessage* data); virtual status_t GetSupportedSuites(BMessage* data);
bool IsPrinting() const; bool IsPrinting() const;
void SetScale(float scale) const; void SetScale(float scale) const;
float Scale() const; float Scale() const;
// new for Haiku // 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); virtual void DrawAfterChildren(BRect r);
@@ -581,7 +596,7 @@ public:
void HideToolTip(); void HideToolTip();
protected: protected:
virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); virtual bool GetToolTipAt(BPoint point, BToolTip** _tip);
virtual void LayoutChanged(); virtual void LayoutChanged();
@@ -720,37 +735,37 @@ BView::ScrollTo(float x, float y)
inline void 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; rgb_color color;
color.red = r; color.red = red;
color.green = g; color.green = green;
color.blue = b; color.blue = blue;
color.alpha = a; color.alpha = alpha;
SetViewColor(color); SetViewColor(color);
} }
inline void 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; rgb_color color;
color.red = r; color.red = red;
color.green = g; color.green = green;
color.blue = b; color.blue = blue;
color.alpha = a; color.alpha = alpha;
SetHighColor(color); SetHighColor(color);
} }
inline void 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; rgb_color color;
color.red = r; color.red = red;
color.green = g; color.green = green;
color.blue = b; color.blue = blue;
color.alpha = a; color.alpha = alpha;
SetLowColor(color); SetLowColor(color);
} }
+156 -149
View File
@@ -1,12 +1,12 @@
/* /*
* Copyright 2001-2012, Haiku. * Copyright 2001-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Adrian Oanca <[email protected]> * Stephan Aßmus, [email protected]
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
* Stephan Aßmus <[email protected]> * Adrian Oanca, [email protected]
* Ingo Weinhold <[email protected]> * Ingo Weinhold. [email protected]
*/ */
@@ -834,11 +834,11 @@ BView::ConvertFromParent(BRect rect) const
void void
BView::_ConvertToScreen(BPoint* pt, bool checkLock) const BView::_ConvertToScreen(BPoint* point, bool checkLock) const
{ {
if (!fParent) { if (!fParent) {
if (fOwner) if (fOwner)
fOwner->ConvertToScreen(pt); fOwner->ConvertToScreen(point);
return; return;
} }
@@ -846,33 +846,33 @@ BView::_ConvertToScreen(BPoint* pt, bool checkLock) const
if (checkLock) if (checkLock)
_CheckOwnerLock(); _CheckOwnerLock();
_ConvertToParent(pt, false); _ConvertToParent(point, false);
fParent->_ConvertToScreen(pt, false); fParent->_ConvertToScreen(point, false);
} }
void void
BView::ConvertToScreen(BPoint* pt) const BView::ConvertToScreen(BPoint* point) const
{ {
_ConvertToScreen(pt, true); _ConvertToScreen(point, true);
} }
BPoint BPoint
BView::ConvertToScreen(BPoint pt) const BView::ConvertToScreen(BPoint point) const
{ {
ConvertToScreen(&pt); ConvertToScreen(&point);
return pt; return point;
} }
void void
BView::_ConvertFromScreen(BPoint* pt, bool checkLock) const BView::_ConvertFromScreen(BPoint* point, bool checkLock) const
{ {
if (!fParent) { if (!fParent) {
if (fOwner) if (fOwner)
fOwner->ConvertFromScreen(pt); fOwner->ConvertFromScreen(point);
return; return;
} }
@@ -880,24 +880,24 @@ BView::_ConvertFromScreen(BPoint* pt, bool checkLock) const
if (checkLock) if (checkLock)
_CheckOwnerLock(); _CheckOwnerLock();
_ConvertFromParent(pt, false); _ConvertFromParent(point, false);
fParent->_ConvertFromScreen(pt, false); fParent->_ConvertFromScreen(point, false);
} }
void void
BView::ConvertFromScreen(BPoint* pt) const BView::ConvertFromScreen(BPoint* point) const
{ {
_ConvertFromScreen(pt, true); _ConvertFromScreen(point, true);
} }
BPoint 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) const BGradient& gradient)
{ {
FillEllipse(BRect(center.x - xRadius, center.y - yRadius, 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 void
BView::StrokePolygon(const BPolygon* polygon, bool closed, ::pattern pattern) BView::StrokePolygon(const BPolygon* polygon, bool closed, ::pattern pattern)
{ {
if (!polygon) if (polygon == NULL)
return; return;
StrokePolygon(polygon->fPoints, polygon->fCount, polygon->Frame(), closed, StrokePolygon(polygon->fPoints, polygon->fCount, polygon->Frame(), closed,
@@ -2939,10 +2939,10 @@ BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, bool closed,
void void
BView::StrokePolygon(const BPoint* ptArray, int32 numPoints, BRect bounds, BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, BRect bounds,
bool closed, ::pattern pattern) bool closed, ::pattern pattern)
{ {
if (!ptArray if (pointArray == NULL
|| numPoints <= 1 || numPoints <= 1
|| fOwner == NULL) || fOwner == NULL)
return; return;
@@ -2950,7 +2950,7 @@ BView::StrokePolygon(const BPoint* ptArray, int32 numPoints, BRect bounds,
_CheckLockAndSwitchCurrent(); _CheckLockAndSwitchCurrent();
_UpdatePattern(pattern); _UpdatePattern(pattern);
BPolygon polygon(ptArray, numPoints); BPolygon polygon(pointArray, numPoints);
polygon.MapTo(polygon.Frame(), bounds); polygon.MapTo(polygon.Frame(), bounds);
if (fOwner->fLink->StartMessage(AS_STROKE_POLYGON, if (fOwner->fLink->StartMessage(AS_STROKE_POLYGON,
@@ -3021,50 +3021,50 @@ BView::FillPolygon(const BPolygon* polygon, const BGradient& gradient)
void 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; return;
BPolygon polygon(ptArray, numPts); BPolygon polygon(pointArray, numPoints);
FillPolygon(&polygon, pattern); FillPolygon(&polygon, pattern);
} }
void void
BView::FillPolygon(const BPoint* ptArray, int32 numPts, BView::FillPolygon(const BPoint* pointArray, int32 numPoints,
const BGradient& gradient) const BGradient& gradient)
{ {
if (!ptArray) if (pointArray == NULL)
return; return;
BPolygon polygon(ptArray, numPts); BPolygon polygon(pointArray, numPoints);
FillPolygon(&polygon, gradient); FillPolygon(&polygon, gradient);
} }
void void
BView::FillPolygon(const BPoint* ptArray, int32 numPts, BRect bounds, BView::FillPolygon(const BPoint* pointArray, int32 numPoints, BRect bounds,
pattern p) ::pattern pattern)
{ {
if (!ptArray) if (pointArray == NULL)
return; return;
BPolygon polygon(ptArray, numPts); BPolygon polygon(pointArray, numPoints);
polygon.MapTo(polygon.Frame(), bounds); polygon.MapTo(polygon.Frame(), bounds);
FillPolygon(&polygon, p); FillPolygon(&polygon, pattern);
} }
void void
BView::FillPolygon(const BPoint* ptArray, int32 numPts, BRect bounds, BView::FillPolygon(const BPoint* pointArray, int32 numPoints, BRect bounds,
const BGradient& gradient) const BGradient& gradient)
{ {
if (!ptArray) if (pointArray == NULL)
return; return;
BPolygon polygon(ptArray, numPts); BPolygon polygon(pointArray, numPoints);
polygon.MapTo(polygon.Frame(), bounds); polygon.MapTo(polygon.Frame(), bounds);
FillPolygon(&polygon, gradient); FillPolygon(&polygon, gradient);
@@ -3221,7 +3221,7 @@ BView::FillRegion(BRegion* region, const BGradient& gradient)
void void
BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds, BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, BRect bounds,
::pattern pattern) ::pattern pattern)
{ {
if (fOwner == NULL) if (fOwner == NULL)
@@ -3232,9 +3232,9 @@ BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds,
_UpdatePattern(pattern); _UpdatePattern(pattern);
fOwner->fLink->StartMessage(AS_STROKE_TRIANGLE); fOwner->fLink->StartMessage(AS_STROKE_TRIANGLE);
fOwner->fLink->Attach<BPoint>(pt1); fOwner->fLink->Attach<BPoint>(point1);
fOwner->fLink->Attach<BPoint>(pt2); fOwner->fLink->Attach<BPoint>(point2);
fOwner->fLink->Attach<BPoint>(pt3); fOwner->fLink->Attach<BPoint>(point3);
fOwner->fLink->Attach<BRect>(bounds); fOwner->fLink->Attach<BRect>(bounds);
_FlushIfNotInTransaction(); _FlushIfNotInTransaction();
@@ -3242,125 +3242,127 @@ BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BRect bounds,
void void
BView::StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, pattern p) BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3,
::pattern pattern)
{ {
if (fOwner) { if (fOwner) {
// we construct the smallest rectangle that contains the 3 points // we construct the smallest rectangle that contains the 3 points
// for the 1st point // for the 1st point
BRect bounds(pt1, pt1); BRect bounds(point1, point1);
// for the 2nd point // for the 2nd point
if (pt2.x < bounds.left) if (point2.x < bounds.left)
bounds.left = pt2.x; bounds.left = point2.x;
if (pt2.y < bounds.top) if (point2.y < bounds.top)
bounds.top = pt2.y; bounds.top = point2.y;
if (pt2.x > bounds.right) if (point2.x > bounds.right)
bounds.right = pt2.x; bounds.right = point2.x;
if (pt2.y > bounds.bottom) if (point2.y > bounds.bottom)
bounds.bottom = pt2.y; bounds.bottom = point2.y;
// for the 3rd point // for the 3rd point
if (pt3.x < bounds.left) if (point3.x < bounds.left)
bounds.left = pt3.x; bounds.left = point3.x;
if (pt3.y < bounds.top) if (point3.y < bounds.top)
bounds.top = pt3.y; bounds.top = point3.y;
if (pt3.x > bounds.right) if (point3.x > bounds.right)
bounds.right = pt3.x; bounds.right = point3.x;
if (pt3.y > bounds.bottom) if (point3.y > bounds.bottom)
bounds.bottom = pt3.y; bounds.bottom = point3.y;
StrokeTriangle(pt1, pt2, pt3, bounds, p); StrokeTriangle(point1, point2, point3, bounds, pattern);
} }
} }
void void
BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, pattern p) BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3,
::pattern pattern)
{ {
if (fOwner) { if (fOwner) {
// we construct the smallest rectangle that contains the 3 points // we construct the smallest rectangle that contains the 3 points
// for the 1st point // for the 1st point
BRect bounds(pt1, pt1); BRect bounds(point1, point1);
// for the 2nd point // for the 2nd point
if (pt2.x < bounds.left) if (point2.x < bounds.left)
bounds.left = pt2.x; bounds.left = point2.x;
if (pt2.y < bounds.top) if (point2.y < bounds.top)
bounds.top = pt2.y; bounds.top = point2.y;
if (pt2.x > bounds.right) if (point2.x > bounds.right)
bounds.right = pt2.x; bounds.right = point2.x;
if (pt2.y > bounds.bottom) if (point2.y > bounds.bottom)
bounds.bottom = pt2.y; bounds.bottom = point2.y;
// for the 3rd point // for the 3rd point
if (pt3.x < bounds.left) if (point3.x < bounds.left)
bounds.left = pt3.x; bounds.left = point3.x;
if (pt3.y < bounds.top) if (point3.y < bounds.top)
bounds.top = pt3.y; bounds.top = point3.y;
if (pt3.x > bounds.right) if (point3.x > bounds.right)
bounds.right = pt3.x; bounds.right = point3.x;
if (pt3.y > bounds.bottom) if (point3.y > bounds.bottom)
bounds.bottom = pt3.y; bounds.bottom = point3.y;
FillTriangle(pt1, pt2, pt3, bounds, p); FillTriangle(point1, point2, point3, bounds, pattern);
} }
} }
void void
BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3,
const BGradient& gradient) const BGradient& gradient)
{ {
if (fOwner) { if (fOwner) {
// we construct the smallest rectangle that contains the 3 points // we construct the smallest rectangle that contains the 3 points
// for the 1st point // for the 1st point
BRect bounds(pt1, pt1); BRect bounds(point1, point1);
// for the 2nd point // for the 2nd point
if (pt2.x < bounds.left) if (point2.x < bounds.left)
bounds.left = pt2.x; bounds.left = point2.x;
if (pt2.y < bounds.top) if (point2.y < bounds.top)
bounds.top = pt2.y; bounds.top = point2.y;
if (pt2.x > bounds.right) if (point2.x > bounds.right)
bounds.right = pt2.x; bounds.right = point2.x;
if (pt2.y > bounds.bottom) if (point2.y > bounds.bottom)
bounds.bottom = pt2.y; bounds.bottom = point2.y;
// for the 3rd point // for the 3rd point
if (pt3.x < bounds.left) if (point3.x < bounds.left)
bounds.left = pt3.x; bounds.left = point3.x;
if (pt3.y < bounds.top) if (point3.y < bounds.top)
bounds.top = pt3.y; bounds.top = point3.y;
if (pt3.x > bounds.right) if (point3.x > bounds.right)
bounds.right = pt3.x; bounds.right = point3.x;
if (pt3.y > bounds.bottom) if (point3.y > bounds.bottom)
bounds.bottom = pt3.y; bounds.bottom = point3.y;
FillTriangle(pt1, pt2, pt3, bounds, gradient); FillTriangle(point1, point2, point3, bounds, gradient);
} }
} }
void void
BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3,
BRect bounds, ::pattern pattern) BRect bounds, ::pattern pattern)
{ {
if (fOwner == NULL) if (fOwner == NULL)
@@ -3370,9 +3372,9 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
_UpdatePattern(pattern); _UpdatePattern(pattern);
fOwner->fLink->StartMessage(AS_FILL_TRIANGLE); fOwner->fLink->StartMessage(AS_FILL_TRIANGLE);
fOwner->fLink->Attach<BPoint>(pt1); fOwner->fLink->Attach<BPoint>(point1);
fOwner->fLink->Attach<BPoint>(pt2); fOwner->fLink->Attach<BPoint>(point2);
fOwner->fLink->Attach<BPoint>(pt3); fOwner->fLink->Attach<BPoint>(point3);
fOwner->fLink->Attach<BRect>(bounds); fOwner->fLink->Attach<BRect>(bounds);
_FlushIfNotInTransaction(); _FlushIfNotInTransaction();
@@ -3380,17 +3382,17 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
void void
BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, BRect bounds,
BRect bounds, const BGradient& gradient) const BGradient& gradient)
{ {
if (fOwner == NULL) if (fOwner == NULL)
return; return;
_CheckLockAndSwitchCurrent(); _CheckLockAndSwitchCurrent();
fOwner->fLink->StartMessage(AS_FILL_TRIANGLE_GRADIENT); fOwner->fLink->StartMessage(AS_FILL_TRIANGLE_GRADIENT);
fOwner->fLink->Attach<BPoint>(pt1); fOwner->fLink->Attach<BPoint>(point1);
fOwner->fLink->Attach<BPoint>(pt2); fOwner->fLink->Attach<BPoint>(point2);
fOwner->fLink->Attach<BPoint>(pt3); fOwner->fLink->Attach<BPoint>(point3);
fOwner->fLink->Attach<BRect>(bounds); fOwner->fLink->Attach<BRect>(bounds);
fOwner->fLink->AttachGradient(gradient); fOwner->fLink->AttachGradient(gradient);
@@ -3399,14 +3401,14 @@ BView::FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
void void
BView::StrokeLine(BPoint toPt, pattern p) BView::StrokeLine(BPoint toPoint, ::pattern pattern)
{ {
StrokeLine(PenLocation(), toPt, p); StrokeLine(PenLocation(), toPoint, pattern);
} }
void void
BView::StrokeLine(BPoint pt0, BPoint pt1, ::pattern pattern) BView::StrokeLine(BPoint start, BPoint end, ::pattern pattern)
{ {
if (fOwner == NULL) if (fOwner == NULL)
return; return;
@@ -3415,8 +3417,8 @@ BView::StrokeLine(BPoint pt0, BPoint pt1, ::pattern pattern)
_UpdatePattern(pattern); _UpdatePattern(pattern);
ViewStrokeLineInfo info; ViewStrokeLineInfo info;
info.startPoint = pt0; info.startPoint = start;
info.endPoint = pt1; info.endPoint = end;
fOwner->fLink->StartMessage(AS_STROKE_LINE); fOwner->fLink->StartMessage(AS_STROKE_LINE);
fOwner->fLink->Attach<ViewStrokeLineInfo>(info); fOwner->fLink->Attach<ViewStrokeLineInfo>(info);
@@ -3531,7 +3533,7 @@ BView::BeginLineArray(int32 count)
void void
BView::AddLine(BPoint pt0, BPoint pt1, rgb_color col) BView::AddLine(BPoint start, BPoint end, rgb_color color)
{ {
if (fOwner == NULL) if (fOwner == NULL)
return; return;
@@ -3543,9 +3545,9 @@ BView::AddLine(BPoint pt0, BPoint pt1, rgb_color col)
const uint32 &arrayCount = fCommArray->count; const uint32 &arrayCount = fCommArray->count;
if (arrayCount < fCommArray->maxCount) { if (arrayCount < fCommArray->maxCount) {
fCommArray->array[arrayCount].startPoint = pt0; fCommArray->array[arrayCount].startPoint = start;
fCommArray->array[arrayCount].endPoint = pt1; fCommArray->array[arrayCount].endPoint = end;
fCommArray->array[arrayCount].color = col; fCommArray->array[arrayCount].color = color;
fCommArray->count++; fCommArray->count++;
} }
@@ -3977,6 +3979,7 @@ BView::RemoveChild(BView* child)
return child->RemoveSelf(); return child->RemoveSelf();
} }
int32 int32
BView::CountChildren() const BView::CountChildren() const
{ {
@@ -4205,18 +4208,19 @@ BView::GetSupportedSuites(BMessage* data)
BHandler* BHandler*
BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, BView::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
int32 what, const char* property) int32 what, const char* property)
{ {
if (msg->what == B_WINDOW_MOVE_BY if (message->what == B_WINDOW_MOVE_BY
|| msg->what == B_WINDOW_MOVE_TO) || message->what == B_WINDOW_MOVE_TO) {
return this; return this;
}
BPropertyInfo propertyInfo(sViewPropInfo); BPropertyInfo propertyInfo(sViewPropInfo);
status_t err = B_BAD_SCRIPT_SYNTAX; status_t err = B_BAD_SCRIPT_SYNTAX;
BMessage replyMsg(B_REPLY); BMessage replyMsg(B_REPLY);
switch (propertyInfo.FindMatch(msg, index, specifier, what, property)) { switch (propertyInfo.FindMatch(message, index, specifier, what, property)) {
case 0: case 0:
case 1: case 1:
case 3: case 3:
@@ -4224,7 +4228,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
case 2: case 2:
if (fShelf) { if (fShelf) {
msg->PopSpecifier(); message->PopSpecifier();
return fShelf; return fShelf;
} }
@@ -4269,7 +4273,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
} }
if (child != NULL) { if (child != NULL) {
msg->PopSpecifier(); message->PopSpecifier();
return child; return child;
} }
@@ -4282,7 +4286,7 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
} }
default: default:
return BHandler::ResolveSpecifier(msg, index, specifier, what, return BHandler::ResolveSpecifier(message, index, specifier, what,
property); property);
} }
@@ -4296,16 +4300,16 @@ BView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier,
} }
replyMsg.AddInt32("error", err); replyMsg.AddInt32("error", err);
msg->SendReply(&replyMsg); message->SendReply(&replyMsg);
return NULL; return NULL;
} }
void void
BView::MessageReceived(BMessage* msg) BView::MessageReceived(BMessage* message)
{ {
if (!msg->HasSpecifiers()) { if (!message->HasSpecifiers()) {
switch (msg->what) { switch (message->what) {
case B_VIEW_RESIZED: case B_VIEW_RESIZED:
// By the time the message arrives, the bounds may have // By the time the message arrives, the bounds may have
// changed already, that's why we don't use the values // changed already, that's why we don't use the values
@@ -4320,14 +4324,14 @@ BView::MessageReceived(BMessage* msg)
case B_MOUSE_IDLE: case B_MOUSE_IDLE:
{ {
BPoint where; BPoint where;
if (msg->FindPoint("be:view_where", &where) != B_OK) if (message->FindPoint("be:view_where", &where) != B_OK)
break; break;
BToolTip* tip; BToolTip* tip;
if (GetToolTipAt(where, &tip)) if (GetToolTipAt(where, &tip))
ShowToolTip(tip); ShowToolTip(tip);
else else
BHandler::MessageReceived(msg); BHandler::MessageReceived(message);
break; break;
} }
@@ -4337,15 +4341,15 @@ BView::MessageReceived(BMessage* msg)
BScrollBar* vertical = ScrollBar(B_VERTICAL); BScrollBar* vertical = ScrollBar(B_VERTICAL);
if (horizontal == NULL && vertical == NULL) { if (horizontal == NULL && vertical == NULL) {
// Pass the message to the next handler // Pass the message to the next handler
BHandler::MessageReceived(msg); BHandler::MessageReceived(message);
break; break;
} }
float deltaX = 0.0f, deltaY = 0.0f; float deltaX = 0.0f, deltaY = 0.0f;
if (horizontal != NULL) if (horizontal != NULL)
msg->FindFloat("be:wheel_delta_x", &deltaX); message->FindFloat("be:wheel_delta_x", &deltaX);
if (vertical != NULL) if (vertical != NULL)
msg->FindFloat("be:wheel_delta_y", &deltaY); message->FindFloat("be:wheel_delta_y", &deltaY);
if (deltaX == 0.0f && deltaY == 0.0f) if (deltaX == 0.0f && deltaY == 0.0f)
break; break;
@@ -4361,7 +4365,7 @@ BView::MessageReceived(BMessage* msg)
} }
default: default:
BHandler::MessageReceived(msg); BHandler::MessageReceived(message);
break; break;
} }
@@ -4377,17 +4381,20 @@ BView::MessageReceived(BMessage* msg)
int32 what; int32 what;
const char* property; const char* property;
if (msg->GetCurrentSpecifier(&index, &specifier, &what, &property) != B_OK) if (message->GetCurrentSpecifier(&index, &specifier, &what, &property)
return BHandler::MessageReceived(msg); != B_OK) {
return BHandler::MessageReceived(message);
}
BPropertyInfo propertyInfo(sViewPropInfo); BPropertyInfo propertyInfo(sViewPropInfo);
switch (propertyInfo.FindMatch(msg, index, &specifier, what, property)) { switch (propertyInfo.FindMatch(message, index, &specifier, what,
property)) {
case 0: case 0:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
err = replyMsg.AddRect("result", Frame()); err = replyMsg.AddRect("result", Frame());
} else if (msg->what == B_SET_PROPERTY) { } else if (message->what == B_SET_PROPERTY) {
BRect newFrame; BRect newFrame;
err = msg->FindRect("data", &newFrame); err = message->FindRect("data", &newFrame);
if (err == B_OK) { if (err == B_OK) {
MoveTo(newFrame.LeftTop()); MoveTo(newFrame.LeftTop());
ResizeTo(newFrame.Width(), newFrame.Height()); ResizeTo(newFrame.Width(), newFrame.Height());
@@ -4395,11 +4402,11 @@ BView::MessageReceived(BMessage* msg)
} }
break; break;
case 1: case 1:
if (msg->what == B_GET_PROPERTY) { if (message->what == B_GET_PROPERTY) {
err = replyMsg.AddBool("result", IsHidden()); err = replyMsg.AddBool("result", IsHidden());
} else if (msg->what == B_SET_PROPERTY) { } else if (message->what == B_SET_PROPERTY) {
bool newHiddenState; bool newHiddenState;
err = msg->FindBool("data", &newHiddenState); err = message->FindBool("data", &newHiddenState);
if (err == B_OK) { if (err == B_OK) {
if (newHiddenState == true) if (newHiddenState == true)
Hide(); Hide();
@@ -4412,7 +4419,7 @@ BView::MessageReceived(BMessage* msg)
err = replyMsg.AddInt32("result", CountChildren()); err = replyMsg.AddInt32("result", CountChildren());
break; break;
default: default:
return BHandler::MessageReceived(msg); return BHandler::MessageReceived(message);
} }
if (err != B_OK) { if (err != B_OK) {
@@ -4426,7 +4433,7 @@ BView::MessageReceived(BMessage* msg)
replyMsg.AddInt32("error", err); replyMsg.AddInt32("error", err);
} }
msg->SendReply(&replyMsg); message->SendReply(&replyMsg);
} }