replaced misc values with respective constants

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22762 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-10-29 19:10:30 +00:00
parent 1fbd9939b9
commit 69e65f2f57
12 changed files with 37 additions and 35 deletions

View File

@ -21,9 +21,10 @@
#include <Screen.h>
#include <ScrollView.h>
#include <String.h>
#include <StringView.h>
#include <TextView.h>
#include <TranslationUtils.h>
#include <StringView.h>
#include <TranslatorFormats.h>
#include <View.h>
#include <Window.h>
@ -118,7 +119,7 @@ AboutView::AboutView(const BRect &rect)
fLastActionTime(system_time()),
fScrollRunner(NULL)
{
fLogo = BTranslationUtils::GetBitmap('PNG ', "haikulogo.png");
fLogo = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "haikulogo.png");
if (fLogo) {
fDrawPoint.x = (225-fLogo->Bounds().Width()) / 2;
fDrawPoint.y = 0;

View File

@ -65,7 +65,7 @@ dummy_label:
}
theRect.Set(0,0,15,15);
if ((picH = rsrcs.FindResource('MICN', "center", &len))) {
if ((picH = rsrcs.FindResource(B_MINI_ICON_TYPE, "center", &len))) {
fCenter = new BBitmap(theRect, B_CMAP8);
fCenter->SetBits(picH, len, 0, B_CMAP8);
free(picH);

View File

@ -25,6 +25,7 @@
#include <TextControl.h>
#include <TextView.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
#include <stdlib.h>
@ -772,7 +773,7 @@ ImageView::ImageView(BRect rect, DataEditor &editor)
fBitmap(NULL),
fScaleSlider(NULL)
{
if (editor.Type() == 'MICN' || editor.Type() == 'ICON'
if (editor.Type() == B_MINI_ICON_TYPE || editor.Type() == B_LARGE_ICON_TYPE
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|| editor.Type() == B_VECTOR_ICON_TYPE
#endif
@ -878,7 +879,7 @@ ImageView::UpdateImage()
return;
}
if (fBitmap != NULL && (fEditor.Type() == 'MICN' || fEditor.Type() == 'ICON')) {
if (fBitmap != NULL && (fEditor.Type() == B_MINI_ICON_TYPE || fEditor.Type() == B_LARGE_ICON_TYPE)) {
// optimize icon update...
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
fEditor.SetViewSize(viewSize);
@ -899,12 +900,12 @@ ImageView::UpdateImage()
fBitmap = NULL;
switch (fEditor.Type()) {
case 'MICN':
case B_MINI_ICON_TYPE:
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
if (fBitmap->InitCheck() == B_OK)
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
break;
case 'ICON':
case B_LARGE_ICON_TYPE:
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
if (fBitmap->InitCheck() == B_OK)
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
@ -921,13 +922,13 @@ ImageView::UpdateImage()
}
break;
#endif
case 'PNG ':
case B_PNG_FORMAT:
{
BMemoryIO stream(data, fEditor.FileSize());
fBitmap = BTranslationUtils::GetBitmap(&stream);
break;
}
case 'MSGG':
case B_MESSAGE_TYPE:
{
BMessage message;
// ToDo: this could be problematic if the data is not large
@ -950,17 +951,17 @@ ImageView::UpdateImage()
char buffer[256];
const char *type = "Unknown Type";
switch (fEditor.Type()) {
case 'MICN':
case 'ICON':
case B_MINI_ICON_TYPE:
case B_LARGE_ICON_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE:
#endif
type = "Icon";
break;
case 'PNG ':
case B_PNG_FORMAT:
type = "PNG Format";
break;
case 'MSGG':
case B_MESSAGE_TYPE:
type = "Flattened Bitmap";
break;
default:
@ -1083,10 +1084,10 @@ GetTypeEditorFor(BRect rect, DataEditor &editor)
case B_OFF_T_TYPE:
case B_POINTER_TYPE:
return new NumberEditor(rect, editor);
case 'MICN':
case 'ICON':
case 'PNG ':
case 'MSGG':
case B_MINI_ICON_TYPE:
case B_LARGE_ICON_TYPE:
case B_PNG_FORMAT:
case B_MESSAGE_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE:
#endif

View File

@ -2140,13 +2140,13 @@ FSGetDeskDir(BDirectory *deskDir, dev_t dev)
size_t size;
const void* data = GetTrackerResources()->
LoadResource('ICON', kResDeskIcon, &size);
LoadResource(B_LARGE_ICON_TYPE, kResDeskIcon, &size);
if (data)
deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
data = GetTrackerResources()->
LoadResource('MICN', kResDeskIcon, &size);
LoadResource(B_MINI_ICON_TYPE, kResDeskIcon, &size);
if (data)
deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
@ -2639,13 +2639,13 @@ FSCreateTrashDirs()
if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) {
size_t size;
const void* data = GetTrackerResources()->
LoadResource('ICON', kResTrashIcon, &size);
LoadResource(B_LARGE_ICON_TYPE, kResTrashIcon, &size);
if (data) {
trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0,
data, size);
}
data = GetTrackerResources()->
LoadResource('MICN', kResTrashIcon, &size);
LoadResource(B_MINI_ICON_TYPE, kResTrashIcon, &size);
if (data) {
trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0,
data, size);

View File

@ -51,9 +51,9 @@ get_type(type_code type)
case B_DOUBLE_TYPE:
return "Double";
case 'MICN':
case B_MINI_ICON_TYPE:
return "Mini Icon";
case 'ICON':
case B_LARGE_ICON_TYPE:
return "Icon";
default:

View File

@ -49,9 +49,9 @@ get_type(type_code type)
case B_DOUBLE_TYPE:
return "Double";
case 'MICN':
case B_MINI_ICON_TYPE:
return "Mini Icon";
case 'ICON':
case B_LARGE_ICON_TYPE:
return "Icon";
default:

View File

@ -1073,7 +1073,7 @@ IconView::ShowIconHeap(bool show)
if (data == NULL) {
// no vector icon or failed to get bitmap
// try bitmap icon
data = resources->LoadResource('ICON', "icon heap", NULL);
data = resources->LoadResource(B_LARGE_ICON_TYPE, "icon heap", NULL);
if (data != NULL) {
fHeapIcon = Icon::AllocateBitmap(B_LARGE_ICON, B_CMAP8);
memcpy(fHeapIcon->Bits(), data, fHeapIcon->BitsLength());

View File

@ -443,7 +443,7 @@ ConfigWindow::MakeHowToView()
BResources *resources = BApplication::AppResources();
if (resources) {
size_t length;
char *buffer = (char *)resources->FindResource('ICON', 101, &length);
char *buffer = (char *)resources->FindResource(B_LARGE_ICON_TYPE, 101, &length);
if (buffer) {
BBitmap *bitmap = new BBitmap(BRect(0, 0, 63, 63), B_CMAP8);
if (bitmap && bitmap->InitCheck() == B_OK) {

View File

@ -130,7 +130,7 @@ BBitmap* MediaAlert::InitIcon()
// Load the raw icon data
size_t size;
const void* rawIcon =
Resources.LoadResource('ICON', iconName, &size);
Resources.LoadResource(B_LARGE_ICON_TYPE, iconName, &size);
if (rawIcon)
{

View File

@ -96,8 +96,8 @@ MouseView::MouseView(BRect rect, const MouseSettings &settings)
fMouseDownBitmap->SetBits(kMouseDownBits, sizeof(kMouseDownBits), 0, kMouseDownColorSpace);
// ToDo: move these images to the resources as well
//fMouseBitmap = BTranslationUtils::GetBitmap('PNG ', "mouse_bmap");
//fMouseDownBitmap = BTranslationUtils::GetBitmap('PNG ', "pressed_mouse_bmap");
//fMouseBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "mouse_bmap");
//fMouseDownBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "pressed_mouse_bmap");
if (fMouseDownBitmap != NULL)
fMouseDownBounds = fMouseDownBitmap->Bounds();

View File

@ -144,7 +144,7 @@ AlertView::InitIcon()
&& resources.SetTo(&file) == B_OK) {
// Load the raw icon data
size_t size;
const void* data = resources.LoadResource('ICON', "warn", &size);
const void* data = resources.LoadResource(B_LARGE_ICON_TYPE, "warn", &size);
if (data) {
// Now build the bitmap
icon = new BBitmap(BRect(0, 0, 31, 31), 0, B_CMAP8);

View File

@ -51,10 +51,10 @@ DeviceWatcher::DeviceWatcher()
size_t size;
const void* bits;
bits = res.LoadResource('ICON', 10, &size);
bits = res.LoadResource(B_LARGE_ICON_TYPE, 10, &size);
largeIcon->SetBits(bits, size, 0, B_CMAP8);
bits = res.LoadResource('MICN', 11, &size);
bits = res.LoadResource(B_MINI_ICON_TYPE, 11, &size);
miniIcon->SetBits(bits, size, 0, B_CMAP8);
}
}
@ -132,10 +132,10 @@ void DeviceWatcher::SetIcons(BMidiEndpoint* endp)
BMessage msg;
msg.AddData(
"be:large_icon", 'ICON', largeIcon->Bits(), largeIcon->BitsLength());
"be:large_icon", B_LARGE_ICON_TYPE, largeIcon->Bits(), largeIcon->BitsLength());
msg.AddData(
"be:mini_icon", 'MICN', miniIcon->Bits(), miniIcon->BitsLength());
"be:mini_icon", B_MINI_ICON_TYPE, miniIcon->Bits(), miniIcon->BitsLength());
endp->SetProperties(&msg);
}