void StatusWindow::UpdateReport() { Report* r = Report::Instance(); const int32 n = r->CountItems(); const bool update = fReportIndex < n; if (update && fReportIndex == 0) { fReportScrollView->SetExplicitMinSize(BSize(600, 400)); fReportScrollView->Show(); } while (fReportIndex < n) { ReportRecord* rr = r->ItemAt(fReportIndex ++); const char* label = NULL; rgb_color color = {0, 0, 0, 255}; switch (rr->Kind()) { case kInfo: label = "Info"; color.green = 255; break; case kWarning: label = "Warning"; color.red = 255; color.green=255; break; case kError: label = "Error"; color.red = 255; break; case kDebug: label = "Debug"; color.blue = 255; break; } int32 cur = fReport->TextLength()-1; fReport->Insert(fReport->TextLength(), label, strlen(label)); int32 end = fReport->TextLength(); fReport->SetFontAndColor(cur, end, NULL, 0, &color); char page[80]; if (rr->Page() > 0) { sprintf(page, " (Page %d)", (int)rr->Page()); int32 len = strlen(page); fReport->Insert(fReport->TextLength(), page, len); } fReport->Insert(fReport->TextLength(), ": ", 2); fReport->Insert(fReport->TextLength(), rr->Desc(), strlen(rr->Desc())); fReport->Insert(fReport->TextLength(), "\n", 1); } if (update) { fReport->ScrollToOffset(fReport->TextLength()); fReport->Invalidate(); } }