code style

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20704 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2007-04-15 14:17:02 +00:00
parent 88ec4b1dbe
commit 1cafa90eda
4 changed files with 119 additions and 121 deletions
+3 -4
View File
@@ -23,7 +23,7 @@
#define MENUITEM_ICON_SIZE 16
class MethodMenuItem : public BMenuItem {
public:
public:
MethodMenuItem(int32 cookie, const char *label, const uchar *icon, BMenu *subMenu, BMessenger &messenger);
MethodMenuItem(int32 cookie, const char *label, const uchar *icon);
@@ -36,14 +36,13 @@ public:
const char *Name() { return Label(); };
void SetIcon(const uchar *icon);
const uchar *Icon() { return (uchar *)fIcon.Bits(); };
const uchar *Icon() { return(uchar *)fIcon.Bits(); };
const int32 Cookie() { return fCookie; };
private:
private:
BBitmap fIcon;
int32 fCookie;
BMessenger fMessenger;
};
#endif
+22 -22
View File
@@ -45,17 +45,17 @@ MethodReplicant::MethodReplicant(const char* signature)
fSegments = new BBitmap(BRect(0, 0, kRemoteWidth - 1, kRemoteHeight - 1), kRemoteColorSpace);
fSegments->SetBits(kRemoteBits, kRemoteWidth*kRemoteHeight, 0, kRemoteColorSpace);
// Background Color
SetViewColor(184,184,184);
SetViewColor(184, 184, 184);
//add dragger
BRect rect(Bounds());
rect.left = rect.right-7.0;
rect.top = rect.bottom-7.0;
rect.left = rect.right - 7.0;
rect.top = rect.bottom - 7.0;
BDragger *dragger = new BDragger(rect, this, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
AddChild(dragger);
dragger->SetViewColor(B_TRANSPARENT_32_BIT);
ASSERT(signature!=NULL);
ASSERT(signature != NULL);
fSignature = strdup(signature);
fMenu.SetFont(be_plain_font);
@@ -73,7 +73,7 @@ MethodReplicant::MethodReplicant(BMessage *message)
const char *signature = NULL;
message->FindString("add_on", &signature);
ASSERT(signature!=NULL);
ASSERT(signature != NULL);
fSignature = strdup(signature);
fMenu.SetFont(be_plain_font);
@@ -118,7 +118,7 @@ MethodReplicant::AttachedToWindow()
msg.AddMessenger("address", messenger);
BMessenger inputMessenger(fSignature);
if (inputMessenger.SendMessage(&msg)!=B_OK) {
if (inputMessenger.SendMessage(&msg) != B_OK) {
printf("error when contacting input_server\n");
}
}
@@ -127,13 +127,13 @@ MethodReplicant::AttachedToWindow()
void
MethodReplicant::MessageReceived(BMessage *message)
{
PRINT(("%s what:%c%c%c%c\n", __PRETTY_FUNCTION__, message->what>>24, message->what>>16, message->what>>8, message->what));
PRINT(("%s what:%c%c%c%c\n", __PRETTY_FUNCTION__, message->what >> 24, message->what >> 16, message->what >> 8, message->what));
PRINT_OBJECT(*message);
switch (message->what) {
case B_ABOUT_REQUESTED:
(new BAlert("About Method Replicant", "Method Replicant (Replicant)\n"
" Brought to you by Jérôme DUVAL.\n\n"
"Haiku, 2004","OK"))->Go();
"Haiku, 2004", "OK"))->Go();
break;
case IS_UPDATE_NAME:
UpdateMethodName(message);
@@ -206,7 +206,7 @@ MethodReplicant::UpdateMethod(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
@@ -228,14 +228,14 @@ MethodReplicant::UpdateMethodIcon(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
const uchar *data;
ssize_t numBytes;
if (message->FindData("icon", B_ANY_TYPE, (const void**)&data, &numBytes)!=B_OK) {
if (message->FindData("icon", B_ANY_TYPE, (const void**)&data, &numBytes) != B_OK) {
fprintf(stderr, "can't find icon in message\n");
return;
}
@@ -255,20 +255,20 @@ MethodReplicant::UpdateMethodMenu(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
BMessage msg;
if (message->FindMessage("menu", &msg)!=B_OK) {
if (message->FindMessage("menu", &msg) != B_OK) {
fprintf(stderr, "can't find menu in message\n");
return;
}
PRINT_OBJECT(msg);
BMessenger messenger;
if (message->FindMessenger("target", &messenger)!=B_OK) {
if (message->FindMessenger("target", &messenger) != B_OK) {
fprintf(stderr, "can't find target in message\n");
return;
}
@@ -304,13 +304,13 @@ MethodReplicant::UpdateMethodName(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
const char *name;
if (message->FindString("name", &name)!=B_OK) {
if (message->FindString("name", &name) != B_OK) {
fprintf(stderr, "can't find name in message\n");
return;
}
@@ -328,10 +328,10 @@ MethodReplicant::UpdateMethodName(BMessage *message)
MethodMenuItem *
MethodReplicant::FindItemByCookie(int32 cookie)
{
for (int32 i=0; i<fMenu.CountItems(); i++) {
for (int32 i = 0; i < fMenu.CountItems(); i++) {
MethodMenuItem *item = (MethodMenuItem *)fMenu.ItemAt(i);
PRINT(("cookie : 0x%lx\n", item->Cookie()));
if (item->Cookie()==cookie)
if (item->Cookie() == cookie)
return item;
}
@@ -344,20 +344,20 @@ MethodReplicant::AddMethod(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
const char *name;
if (message->FindString("name", &name)!=B_OK) {
if (message->FindString("name", &name) != B_OK) {
fprintf(stderr, "can't find name in message\n");
return;
}
const uchar *icon;
ssize_t numBytes;
if (message->FindData("icon", B_ANY_TYPE, (const void**)&icon, &numBytes)!=B_OK) {
if (message->FindData("icon", B_ANY_TYPE, (const void**)&icon, &numBytes) != B_OK) {
fprintf(stderr, "can't find icon in message\n");
return;
}
@@ -382,7 +382,7 @@ MethodReplicant::RemoveMethod(BMessage *message)
{
CALLED();
int32 cookie;
if (message->FindInt32("cookie", &cookie)!=B_OK) {
if (message->FindInt32("cookie", &cookie) != B_OK) {
fprintf(stderr, "can't find cookie in message\n");
return;
}
+3 -4
View File
@@ -26,7 +26,7 @@
class _EXPORT MethodReplicant;
class MethodReplicant : public BView {
public:
public:
MethodReplicant(const char* signature);
MethodReplicant(BMessage *);
@@ -43,10 +43,10 @@ public:
virtual void MouseDown(BPoint);
virtual void MouseUp(BPoint);
virtual void Draw(BRect );
virtual void Draw(BRect);
virtual void MessageReceived(BMessage *);
private:
private:
BBitmap *fSegments;
char *fSignature;
BPopUpMenu fMenu;
@@ -61,4 +61,3 @@ private:
};
#endif