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
This commit is contained in:
parent
ade669abd7
commit
c1a96ad26c
@ -54,7 +54,7 @@ main()
|
|||||||
BApplication app("application/x-vnd.obos-bmp-translator");
|
BApplication app("application/x-vnd.obos-bmp-translator");
|
||||||
status_t result;
|
status_t result;
|
||||||
result = LaunchTranslatorWindow(new BMPTranslator,
|
result = LaunchTranslatorWindow(new BMPTranslator,
|
||||||
"BMPTranslator", BRect(0, 0, 225, 175));
|
"BMP Settings", BRect(0, 0, 225, 175));
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
app.Run();
|
app.Run();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1003,41 +1003,8 @@ BMPTranslator::translate_from_bits(BPositionIO *inSource, uint32 outType,
|
|||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
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<uint32>(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
|
// Translate B_TRANSLATOR_BITMAP to B_BMP_FORMAT
|
||||||
} else if (outType == B_BMP_FORMAT) {
|
if (outType == B_BMP_FORMAT) {
|
||||||
// Set up BMP header
|
// Set up BMP header
|
||||||
BMPFileHeader fileHeader;
|
BMPFileHeader fileHeader;
|
||||||
fileHeader.magic = 'MB';
|
fileHeader.magic = 'MB';
|
||||||
|
@ -50,7 +50,7 @@ BMPView::BMPView(const BRect &frame, const char *name,
|
|||||||
{
|
{
|
||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
|
|
||||||
SetViewColor(220,220,220,0);
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user