* Style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31579 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+37
-30
@@ -9,6 +9,7 @@
|
|||||||
* Ingo Weinhold <[email protected]>
|
* Ingo Weinhold <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -345,7 +346,8 @@ struct BView::LayoutData {
|
|||||||
|
|
||||||
|
|
||||||
BView::BView(const char* name, uint32 flags, BLayout* layout)
|
BView::BView(const char* name, uint32 flags, BLayout* layout)
|
||||||
: BHandler(name)
|
:
|
||||||
|
BHandler(name)
|
||||||
{
|
{
|
||||||
_InitData(BRect(0, 0, 0, 0), name, B_FOLLOW_NONE,
|
_InitData(BRect(0, 0, 0, 0), name, B_FOLLOW_NONE,
|
||||||
flags | B_SUPPORTS_LAYOUT);
|
flags | B_SUPPORTS_LAYOUT);
|
||||||
@@ -354,14 +356,16 @@ BView::BView(const char* name, uint32 flags, BLayout* layout)
|
|||||||
|
|
||||||
|
|
||||||
BView::BView(BRect frame, const char* name, uint32 resizingMode, uint32 flags)
|
BView::BView(BRect frame, const char* name, uint32 resizingMode, uint32 flags)
|
||||||
: BHandler(name)
|
:
|
||||||
|
BHandler(name)
|
||||||
{
|
{
|
||||||
_InitData(frame, name, resizingMode, flags);
|
_InitData(frame, name, resizingMode, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView::BView(BMessage* archive)
|
BView::BView(BMessage* archive)
|
||||||
: BHandler(archive)
|
:
|
||||||
|
BHandler(archive)
|
||||||
{
|
{
|
||||||
BRect frame;
|
BRect frame;
|
||||||
archive->FindRect("_frame", &frame);
|
archive->FindRect("_frame", &frame);
|
||||||
@@ -2296,9 +2300,9 @@ BView::GetStringWidths(char *stringArray[],int32 lengthArray[],
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::TruncateString(BString *in_out, uint32 mode, float width) const
|
BView::TruncateString(BString* string, uint32 mode, float width) const
|
||||||
{
|
{
|
||||||
fState->font.TruncateString(in_out, mode, width);
|
fState->font.TruncateString(string, mode, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2310,8 +2314,7 @@ BView::ClipToPicture(BPicture *picture, BPoint where, bool sync)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::ClipToInversePicture(BPicture *picture,
|
BView::ClipToInversePicture(BPicture* picture, BPoint where, bool sync)
|
||||||
BPoint where, bool sync)
|
|
||||||
{
|
{
|
||||||
_ClipToPicture(picture, where, true, sync);
|
_ClipToPicture(picture, where, true, sync);
|
||||||
}
|
}
|
||||||
@@ -2868,8 +2871,8 @@ BView::FillPolygon(const BPolygon *polygon, const BGradient& gradient)
|
|||||||
_CheckLockAndSwitchCurrent();
|
_CheckLockAndSwitchCurrent();
|
||||||
|
|
||||||
if (fOwner->fLink->StartMessage(AS_FILL_POLYGON_GRADIENT,
|
if (fOwner->fLink->StartMessage(AS_FILL_POLYGON_GRADIENT,
|
||||||
polygon->fCount * sizeof(BPoint)
|
polygon->fCount * sizeof(BPoint) + sizeof(BRect) + sizeof(int32))
|
||||||
+ sizeof(BRect) + sizeof(int32)) == B_OK) {
|
== B_OK) {
|
||||||
fOwner->fLink->Attach<BRect>(polygon->Frame());
|
fOwner->fLink->Attach<BRect>(polygon->Frame());
|
||||||
fOwner->fLink->Attach<int32>(polygon->fCount);
|
fOwner->fLink->Attach<int32>(polygon->fCount);
|
||||||
fOwner->fLink->Attach(polygon->fPoints,
|
fOwner->fLink->Attach(polygon->fPoints,
|
||||||
@@ -3754,10 +3757,10 @@ BView::InvertRect(BRect rect)
|
|||||||
void
|
void
|
||||||
BView::AddChild(BView* child, BView* before)
|
BView::AddChild(BView* child, BView* before)
|
||||||
{
|
{
|
||||||
STRACE(("BView(%s)::AddChild(child='%s' before='%s')\n",
|
STRACE(("BView(%s)::AddChild(child '%s', before '%s')\n",
|
||||||
this->Name() ? this->Name(): "NULL",
|
this->Name(),
|
||||||
child && child->Name() ? child->Name(): "NULL",
|
child != NULL && child->Name() ? child->Name() : "NULL",
|
||||||
before && before->Name() ? before->Name(): "NULL"));
|
before != NULL && before->Name() ? before->Name() : "NULL"));
|
||||||
|
|
||||||
if (!_AddChild(child, before))
|
if (!_AddChild(child, before))
|
||||||
return;
|
return;
|
||||||
@@ -3889,7 +3892,7 @@ BView::RemoveSelf()
|
|||||||
bool
|
bool
|
||||||
BView::_RemoveSelf()
|
BView::_RemoveSelf()
|
||||||
{
|
{
|
||||||
STRACE(("BView(%s)::RemoveSelf()...\n", Name()));
|
STRACE(("BView(%s)::RemoveSelf()\n", Name()));
|
||||||
|
|
||||||
// Remove this child from its parent
|
// Remove this child from its parent
|
||||||
|
|
||||||
@@ -4081,7 +4084,8 @@ BView::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
{
|
{
|
||||||
if (!fFirstChild) {
|
if (!fFirstChild) {
|
||||||
err = B_NAME_NOT_FOUND;
|
err = B_NAME_NOT_FOUND;
|
||||||
replyMsg.AddString("message", "This window doesn't have children.");
|
replyMsg.AddString("message", "This window doesn't have "
|
||||||
|
"children.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BView* child = NULL;
|
BView* child = NULL;
|
||||||
@@ -4602,7 +4606,8 @@ BView::_Layout(bool force, BLayoutContext* context)
|
|||||||
{
|
{
|
||||||
//printf("%p->BView::_Layout(%d, %p)\n", this, force, context);
|
//printf("%p->BView::_Layout(%d, %p)\n", this, force, context);
|
||||||
//printf(" fNeedsRelayout: %d, fLayoutValid: %d, fLayoutInProgress: %d\n",
|
//printf(" fNeedsRelayout: %d, fLayoutValid: %d, fLayoutInProgress: %d\n",
|
||||||
//fLayoutData->fNeedsRelayout, fLayoutData->fLayoutValid, fLayoutData->fLayoutInProgress);
|
//fLayoutData->fNeedsRelayout, fLayoutData->fLayoutValid,
|
||||||
|
//fLayoutData->fLayoutInProgress);
|
||||||
if (fLayoutData->fNeedsRelayout || !fLayoutData->fLayoutValid || force) {
|
if (fLayoutData->fNeedsRelayout || !fLayoutData->fLayoutValid || force) {
|
||||||
fLayoutData->fLayoutValid = false;
|
fLayoutData->fLayoutValid = false;
|
||||||
|
|
||||||
@@ -4750,16 +4755,15 @@ BView::_SetOwner(BWindow *newOwner)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::_ClipToPicture(BPicture *picture, BPoint where,
|
BView::_ClipToPicture(BPicture* picture, BPoint where, bool invert, bool sync)
|
||||||
bool invert, bool sync)
|
|
||||||
{
|
{
|
||||||
if (!picture)
|
if (!picture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// TODO: Move the implementation to the server!!!
|
// TODO: Move the implementation to the server!!!
|
||||||
// This implementation is pretty slow, since just creating an offscreen bitmap
|
// This implementation is pretty slow, since just creating an offscreen
|
||||||
// takes a lot of time. That's the main reason why it should be moved
|
// bitmap takes a lot of time. That's the main reason why it should be moved
|
||||||
// to the server.
|
// to the server.
|
||||||
|
|
||||||
// Here the idea is to get rid of the padding bytes in the bitmap,
|
// Here the idea is to get rid of the padding bytes in the bitmap,
|
||||||
@@ -4767,8 +4771,10 @@ BView::_ClipToPicture(BPicture *picture, BPoint where,
|
|||||||
// TODO: Maybe it's not so nice as it assumes BBitmaps to be aligned
|
// TODO: Maybe it's not so nice as it assumes BBitmaps to be aligned
|
||||||
// to a 4 byte boundary.
|
// to a 4 byte boundary.
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
if ((bounds.IntegerWidth() + 1) % 32)
|
if ((bounds.IntegerWidth() + 1) % 32) {
|
||||||
bounds.right = bounds.left + ((bounds.IntegerWidth() + 1) / 32 + 1) * 32 - 1;
|
bounds.right = bounds.left + ((bounds.IntegerWidth() + 1) / 32 + 1)
|
||||||
|
* 32 - 1;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: I used a RGBA32 bitmap because drawing on a GRAY8 doesn't work.
|
// TODO: I used a RGBA32 bitmap because drawing on a GRAY8 doesn't work.
|
||||||
BBitmap* bitmap = new(std::nothrow) BBitmap(bounds, B_RGBA32, true);
|
BBitmap* bitmap = new(std::nothrow) BBitmap(bounds, B_RGBA32, true);
|
||||||
@@ -5200,10 +5206,11 @@ BView::_DrawAfterChildren(BRect updateRect)
|
|||||||
void
|
void
|
||||||
BView::_Pulse()
|
BView::_Pulse()
|
||||||
{
|
{
|
||||||
if (Flags() & B_PULSE_NEEDED)
|
if ((Flags() & B_PULSE_NEEDED) != 0)
|
||||||
Pulse();
|
Pulse();
|
||||||
|
|
||||||
for (BView *child = fFirstChild; child != NULL; child = child->fNextSibling) {
|
for (BView* child = fFirstChild; child != NULL;
|
||||||
|
child = child->fNextSibling) {
|
||||||
child->_Pulse();
|
child->_Pulse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5231,7 +5238,8 @@ BView::_UpdateStateForRemove()
|
|||||||
|
|
||||||
// update children as well
|
// update children as well
|
||||||
|
|
||||||
for (BView *child = fFirstChild; child != NULL; child = child->fNextSibling) {
|
for (BView* child = fFirstChild; child != NULL;
|
||||||
|
child = child->fNextSibling) {
|
||||||
if (child->fOwner)
|
if (child->fOwner)
|
||||||
child->_UpdateStateForRemove();
|
child->_UpdateStateForRemove();
|
||||||
}
|
}
|
||||||
@@ -5312,7 +5320,7 @@ BView::_SetViewBitmap(const BBitmap* bitmap, BRect srcRect, BRect dstRect,
|
|||||||
bool
|
bool
|
||||||
BView::_CheckOwnerLockAndSwitchCurrent() const
|
BView::_CheckOwnerLockAndSwitchCurrent() const
|
||||||
{
|
{
|
||||||
STRACE(("BView(%s)::_CheckOwnerLockAndSwitchCurrent()...", Name()));
|
STRACE(("BView(%s)::_CheckOwnerLockAndSwitchCurrent()\n", Name()));
|
||||||
|
|
||||||
if (fOwner == NULL) {
|
if (fOwner == NULL) {
|
||||||
debugger("View method requires owner and doesn't have one.");
|
debugger("View method requires owner and doesn't have one.");
|
||||||
@@ -5341,7 +5349,7 @@ BView::_CheckOwnerLock() const
|
|||||||
void
|
void
|
||||||
BView::_CheckLockAndSwitchCurrent() const
|
BView::_CheckLockAndSwitchCurrent() const
|
||||||
{
|
{
|
||||||
STRACE(("BView(%s)::_CheckLockAndSwitchCurrent()...", Name() ? Name(): "NULL"));
|
STRACE(("BView(%s)::_CheckLockAndSwitchCurrent()\n", Name()));
|
||||||
|
|
||||||
if (!fOwner)
|
if (!fOwner)
|
||||||
return;
|
return;
|
||||||
@@ -5371,8 +5379,6 @@ BView::_SwitchServerCurrentView() const
|
|||||||
fOwner->fLink->Attach<int32>(serverToken);
|
fOwner->fLink->Attach<int32>(serverToken);
|
||||||
|
|
||||||
fOwner->fLastViewToken = serverToken;
|
fOwner->fLastViewToken = serverToken;
|
||||||
} else {
|
|
||||||
STRACE(("quiet2\n"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5486,7 +5492,8 @@ void BView::_ReservedView16(){}
|
|||||||
|
|
||||||
|
|
||||||
BView::BView(const BView& other)
|
BView::BView(const BView& other)
|
||||||
: BHandler()
|
:
|
||||||
|
BHandler()
|
||||||
{
|
{
|
||||||
// this is private and not functional, but exported
|
// this is private and not functional, but exported
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user