From c1a96ad26cb7dd8fe275c7d43f52a33e45130a58 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Wed, 3 Mar 2004 01:06:40 +0000 Subject: [PATCH] Made window title just like Be's, removed bits->bits translation code (should never be called, this case should be handled in BaseTranslator.cpp), fixed hardcoding of config view bg color git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6876 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../translators/bmptranslator/BMPMain.cpp | 2 +- .../bmptranslator/BMPTranslator.cpp | 37 +------------------ .../translators/bmptranslator/BMPView.cpp | 2 +- 3 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/add-ons/translators/bmptranslator/BMPMain.cpp b/src/add-ons/translators/bmptranslator/BMPMain.cpp index 9d8170fd41..d4466451d4 100644 --- a/src/add-ons/translators/bmptranslator/BMPMain.cpp +++ b/src/add-ons/translators/bmptranslator/BMPMain.cpp @@ -54,7 +54,7 @@ main() BApplication app("application/x-vnd.obos-bmp-translator"); status_t result; result = LaunchTranslatorWindow(new BMPTranslator, - "BMPTranslator", BRect(0, 0, 225, 175)); + "BMP Settings", BRect(0, 0, 225, 175)); if (result == B_OK) { app.Run(); return 0; diff --git a/src/add-ons/translators/bmptranslator/BMPTranslator.cpp b/src/add-ons/translators/bmptranslator/BMPTranslator.cpp index 813bfac263..3d026c147c 100644 --- a/src/add-ons/translators/bmptranslator/BMPTranslator.cpp +++ b/src/add-ons/translators/bmptranslator/BMPTranslator.cpp @@ -1002,42 +1002,9 @@ BMPTranslator::translate_from_bits(BPositionIO *inSource, uint32 outType, result = identify_bits_header(inSource, NULL, &bitsHeader); if (result != B_OK) return result; - - // Translate B_TRANSLATOR_BITMAP to B_TRANSLATOR_BITMAP, easy enough :) - if (outType == B_TRANSLATOR_BITMAP) { - // write out bitsHeader (only if configured to) - if (bheaderonly || (!bheaderonly && !bdataonly)) { - if (swap_data(B_UINT32_TYPE, &bitsHeader, - sizeof(TranslatorBitmap), B_SWAP_HOST_TO_BENDIAN) != B_OK) - return B_ERROR; - if (outDestination->Write(&bitsHeader, - sizeof(TranslatorBitmap)) != sizeof(TranslatorBitmap)) - return B_ERROR; - } - - // write out the data (only if configured to) - if (bdataonly || (!bheaderonly && !bdataonly)) { - uint8 buf[1024]; - uint32 remaining = B_BENDIAN_TO_HOST_INT32(bitsHeader.dataSize); - ssize_t rd, writ; - rd = inSource->Read(buf, 1024); - while (rd > 0) { - writ = outDestination->Write(buf, rd); - if (writ < 0) - break; - remaining -= static_cast(writ); - rd = inSource->Read(buf, min(1024, remaining)); - } - - if (remaining > 0) - return B_ERROR; - else - return B_OK; - } else - return B_OK; - + // Translate B_TRANSLATOR_BITMAP to B_BMP_FORMAT - } else if (outType == B_BMP_FORMAT) { + if (outType == B_BMP_FORMAT) { // Set up BMP header BMPFileHeader fileHeader; fileHeader.magic = 'MB'; diff --git a/src/add-ons/translators/bmptranslator/BMPView.cpp b/src/add-ons/translators/bmptranslator/BMPView.cpp index 05c5853beb..5791b16a6d 100644 --- a/src/add-ons/translators/bmptranslator/BMPView.cpp +++ b/src/add-ons/translators/bmptranslator/BMPView.cpp @@ -50,7 +50,7 @@ BMPView::BMPView(const BRect &frame, const char *name, { fSettings = settings; - SetViewColor(220,220,220,0); + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } // ---------------------------------------------------------------