Apply patch from Karvjorm for #6126 to add console messages from FontDemo.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40086 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ryan Leavengood 2011-01-03 03:51:25 +00:00
parent e62cadc374
commit 494c97f7f9
2 changed files with 61 additions and 3 deletions

View File

@ -272,6 +272,10 @@ ControlView::MessageReceived(BMessage* msg)
BMessage msg(ALIASING_MSG);
msg.AddBool("_aliased", static_cast<bool>(fAliasingCheckBox->Value()));
fMessenger->SendMessage(&msg);
if (static_cast<bool>(fAliasingCheckBox->Value()) == true)
printf("Aliasing: true\n");
else
printf("Aliasing: false\n");
break;
}
@ -280,6 +284,10 @@ ControlView::MessageReceived(BMessage* msg)
BMessage msg(BOUNDING_BOX_MSG);
msg.AddBool("_boundingbox", static_cast<bool>(fBoundingboxesCheckBox->Value()));
fMessenger->SendMessage(&msg);
if (static_cast<bool>(fBoundingboxesCheckBox->Value()))
printf("Bounding: true\n");
else
printf("Bounding: false\n");
break;
}
@ -309,11 +317,13 @@ ControlView::MessageReceived(BMessage* msg)
delete fMessageRunner;
fMessageRunner = new BMessageRunner(this,
new BMessage(CYCLING_FONTS_UPDATE_MSG), 360000*2, -1);
printf("Cycle fonts enabled\n");
} else {
// Delete our MessageRunner and reset the style index
delete fMessageRunner;
fMessageRunner = NULL;
fFontStyleindex = 0;
// Delete our MessageRunner and reset the style index
printf("Cycle fonts disabled\n");
}
break;
}
@ -351,7 +361,7 @@ ControlView::MessageReceived(BMessage* msg)
if (newFontFamilyItem && newstyleitem) {
if (msg->AddString("_style", newstyleitem->Label()) != B_OK
|| msg->AddString("_family", newFontFamilyItem->Label()) != B_OK) {
printf("Failed to add _style or family to the message\n");
printf("Failed to add style or family to the message\n");
return;
}
printf("InstalledStyles(%ld), Font(%s), Style(%s)\n",
@ -461,7 +471,17 @@ ControlView::_UpdateAndSendFamily(const BMessage* message)
font_style style;
if (message->FindString("_family", (const char **)&family) == B_OK) {
printf("Family:%s\n\n", family);
char* name;
type_code typeFound = 0;
int32 countFound = 0;
if (message->GetInfo(B_ANY_TYPE, 0, &name, &typeFound,
&countFound) == B_OK) {
if (typeFound == B_STRING_TYPE) {
BString string;
if (message->FindString(name, 0, &string) == B_OK)
printf("Family: %s\n", string.String());
}
}
BMenuItem* markedItem = fFontFamilyMenu->FindItem(family);
if (!markedItem)
@ -512,6 +532,7 @@ ControlView::_UpdateAndSendStyle(const BMessage* message)
if (styleItem && !styleItem->IsMarked())
styleItem->SetMarked(true);
}
printf("Family: %s, Style: %s\n", family, style);
}
BString string;

View File

@ -290,6 +290,43 @@ FontDemoView::MessageReceived(BMessage* msg)
{
if (msg->FindInt32("_mode", (int32 *)&fDrawingMode) == B_OK) {
Invalidate(/*&fBoxRegion*/);
switch (fDrawingMode) {
case B_OP_COPY:
printf("Drawing mode: B_OP_COPY\n");
break;
case B_OP_OVER:
printf("Drawing mode: B_OP_OVER\n");
break;
case B_OP_ERASE:
printf("Drawing mode: B_OP_ERASE\n");
break;
case B_OP_INVERT:
printf("Drawing mode: B_OP_INVERT\n");
break;
case B_OP_ADD:
printf("Drawing mode: B_OP_ADD\n");
break;
case B_OP_SUBTRACT:
printf("Drawing mode: B_OP_SUBTRACT\n");
break;
case B_OP_BLEND:
printf("Drawing mode: B_OP_BLEND\n");
break;
case B_OP_MIN:
printf("Drawing mode: B_OP_MIN\n");
break;
case B_OP_MAX:
printf("Drawing mode: B_OP_MAX\n");
break;
case B_OP_SELECT:
printf("Drawing mode: B_OP_SELECT\n");
break;
case B_OP_ALPHA:
printf("Drawing mode: B_OP_ALPHA\n");
break;
default:
printf("Drawing mode: %d\n", fDrawingMode);
}
}
break;
}