Ticket #6126: fontdemoDebugMsg.patch

File fontdemoDebugMsg.patch, 3.8 KB (added by Karvjorm, 14 years ago)

An updated Fontdemo debug message fix (added dbg messages for the other buttons too)

  • src/apps/fontdemo/FontDemoView.cpp

     
    290290        {
    291291            if (msg->FindInt32("_mode", (int32 *)&fDrawingMode) == B_OK) {
    292292                Invalidate(/*&fBoxRegion*/);
     293                switch (fDrawingMode) {
     294                    case B_OP_COPY:
     295                        printf("Drawing mode: B_OP_COPY\n");
     296                        break;
     297                    case B_OP_OVER:
     298                        printf("Drawing mode: B_OP_OVER\n");
     299                        break;
     300                    case B_OP_ERASE:
     301                        printf("Drawing mode: B_OP_ERASE\n");
     302                        break;
     303                    case B_OP_INVERT:
     304                        printf("Drawing mode: B_OP_INVERT\n");
     305                        break;
     306                    case B_OP_ADD:
     307                        printf("Drawing mode: B_OP_ADD\n");
     308                        break;
     309                    case B_OP_SUBTRACT:
     310                        printf("Drawing mode: B_OP_SUBTRACT\n");
     311                        break;
     312                    case B_OP_BLEND:
     313                        printf("Drawing mode: B_OP_BLEND\n");
     314                        break;
     315                    case B_OP_MIN:
     316                        printf("Drawing mode: B_OP_MIN\n");
     317                        break;
     318                    case B_OP_MAX:
     319                        printf("Drawing mode: B_OP_MAX\n");
     320                        break;
     321                    case B_OP_SELECT:
     322                        printf("Drawing mode: B_OP_SELECT\n");
     323                        break;
     324                    case B_OP_ALPHA:
     325                        printf("Drawing mode: B_OP_ALPHA\n");
     326                        break;
     327                    default:
     328                        printf("Drawing mode: %d\n", fDrawingMode);
     329                }
    293330            }
    294331            break;
    295332        }
  • src/apps/fontdemo/ControlView.cpp

     
    272272            BMessage msg(ALIASING_MSG);
    273273            msg.AddBool("_aliased", static_cast<bool>(fAliasingCheckBox->Value()));
    274274            fMessenger->SendMessage(&msg);
     275            if (static_cast<bool>(fAliasingCheckBox->Value()) == true)
     276                printf("Aliasing: true\n");
     277            else
     278                printf("Aliasing: false\n");
    275279            break;
    276280        }
    277281
     
    280284            BMessage msg(BOUNDING_BOX_MSG);
    281285            msg.AddBool("_boundingbox", static_cast<bool>(fBoundingboxesCheckBox->Value()));
    282286            fMessenger->SendMessage(&msg);
     287            if (static_cast<bool>(fBoundingboxesCheckBox->Value()))
     288                printf("Bounding: true\n");
     289            else
     290                printf("Bounding: false\n");
    283291            break;
    284292        }
    285293
     
    309317                delete fMessageRunner;
    310318                fMessageRunner = new BMessageRunner(this,
    311319                    new BMessage(CYCLING_FONTS_UPDATE_MSG), 360000*2, -1);
     320                printf("Cycle fonts enabled\n");
    312321            } else {
    313322                delete fMessageRunner;
    314323                fMessageRunner = NULL;
    315324                fFontStyleindex = 0;
    316325                // Delete our MessageRunner and reset the style index
     326                printf("Cycle fonts disabled\n");
    317327            }
    318328            break;
    319329        }
     
    351361                if (newFontFamilyItem && newstyleitem) {
    352362                    if (msg->AddString("_style", newstyleitem->Label()) != B_OK
    353363                        || msg->AddString("_family", newFontFamilyItem->Label()) != B_OK) {
    354                         printf("Failed to add _style or family to the message\n");
     364                        printf("Failed to add style or family to the message\n");
    355365                        return;
    356366                    }
    357367                    printf("InstalledStyles(%ld), Font(%s), Style(%s)\n",
     
    461471    font_style style;
    462472
    463473    if (message->FindString("_family", (const char **)&family) == B_OK) {
    464         printf("Family:%s\n\n", family);
     474        char* _name;
     475        type_code type_found = 0;
     476        int32 countFound = 0;
     477        status_t ret = B_OK;
    465478
     479        ret = message->GetInfo(B_ANY_TYPE,
     480            0,
     481            &_name,
     482            &type_found,
     483            &countFound);
     484        if (ret == B_OK)
     485            if (type_found == B_STRING_TYPE) {
     486                BString str;
     487                status_t ok = B_OK;
     488                ok = message->FindString(_name,
     489                    0,
     490                    &str);
     491                if (ok == B_OK)
     492                    printf("Family: %s\n", str.String());
     493            }
    466494        BMenuItem* markedItem = fFontFamilyMenu->FindItem(family);
    467495        if (!markedItem)
    468496            return;
     
    512540                if (styleItem && !styleItem->IsMarked())
    513541                    styleItem->SetMarked(true);
    514542            }
     543            printf("Family: %s, Style: %s\n", family, style);
    515544        }
    516545
    517546        BString string;