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
+3 -2
View File
@@ -21,9 +21,10 @@
#include <Screen.h> #include <Screen.h>
#include <ScrollView.h> #include <ScrollView.h>
#include <String.h> #include <String.h>
#include <StringView.h>
#include <TextView.h> #include <TextView.h>
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include <StringView.h> #include <TranslatorFormats.h>
#include <View.h> #include <View.h>
#include <Window.h> #include <Window.h>
@@ -118,7 +119,7 @@ AboutView::AboutView(const BRect &rect)
fLastActionTime(system_time()), fLastActionTime(system_time()),
fScrollRunner(NULL) fScrollRunner(NULL)
{ {
fLogo = BTranslationUtils::GetBitmap('PNG ', "haikulogo.png"); fLogo = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "haikulogo.png");
if (fLogo) { if (fLogo) {
fDrawPoint.x = (225-fLogo->Bounds().Width()) / 2; fDrawPoint.x = (225-fLogo->Bounds().Width()) / 2;
fDrawPoint.y = 0; fDrawPoint.y = 0;
+1 -1
View File
@@ -65,7 +65,7 @@ dummy_label:
} }
theRect.Set(0,0,15,15); 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 = new BBitmap(theRect, B_CMAP8);
fCenter->SetBits(picH, len, 0, B_CMAP8); fCenter->SetBits(picH, len, 0, B_CMAP8);
free(picH); free(picH);
+15 -14
View File
@@ -25,6 +25,7 @@
#include <TextControl.h> #include <TextControl.h>
#include <TextView.h> #include <TextView.h>
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include <TranslatorFormats.h>
#include <stdlib.h> #include <stdlib.h>
@@ -772,7 +773,7 @@ ImageView::ImageView(BRect rect, DataEditor &editor)
fBitmap(NULL), fBitmap(NULL),
fScaleSlider(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 #ifdef HAIKU_TARGET_PLATFORM_HAIKU
|| editor.Type() == B_VECTOR_ICON_TYPE || editor.Type() == B_VECTOR_ICON_TYPE
#endif #endif
@@ -878,7 +879,7 @@ ImageView::UpdateImage()
return; 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... // optimize icon update...
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
fEditor.SetViewSize(viewSize); fEditor.SetViewSize(viewSize);
@@ -899,12 +900,12 @@ ImageView::UpdateImage()
fBitmap = NULL; fBitmap = NULL;
switch (fEditor.Type()) { switch (fEditor.Type()) {
case 'MICN': case B_MINI_ICON_TYPE:
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8); fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
if (fBitmap->InitCheck() == B_OK) if (fBitmap->InitCheck() == B_OK)
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
break; break;
case 'ICON': case B_LARGE_ICON_TYPE:
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8); fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
if (fBitmap->InitCheck() == B_OK) if (fBitmap->InitCheck() == B_OK)
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8); fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
@@ -921,13 +922,13 @@ ImageView::UpdateImage()
} }
break; break;
#endif #endif
case 'PNG ': case B_PNG_FORMAT:
{ {
BMemoryIO stream(data, fEditor.FileSize()); BMemoryIO stream(data, fEditor.FileSize());
fBitmap = BTranslationUtils::GetBitmap(&stream); fBitmap = BTranslationUtils::GetBitmap(&stream);
break; break;
} }
case 'MSGG': case B_MESSAGE_TYPE:
{ {
BMessage message; BMessage message;
// ToDo: this could be problematic if the data is not large // ToDo: this could be problematic if the data is not large
@@ -950,17 +951,17 @@ ImageView::UpdateImage()
char buffer[256]; char buffer[256];
const char *type = "Unknown Type"; const char *type = "Unknown Type";
switch (fEditor.Type()) { switch (fEditor.Type()) {
case 'MICN': case B_MINI_ICON_TYPE:
case 'ICON': case B_LARGE_ICON_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU #ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE: case B_VECTOR_ICON_TYPE:
#endif #endif
type = "Icon"; type = "Icon";
break; break;
case 'PNG ': case B_PNG_FORMAT:
type = "PNG Format"; type = "PNG Format";
break; break;
case 'MSGG': case B_MESSAGE_TYPE:
type = "Flattened Bitmap"; type = "Flattened Bitmap";
break; break;
default: default:
@@ -1083,10 +1084,10 @@ GetTypeEditorFor(BRect rect, DataEditor &editor)
case B_OFF_T_TYPE: case B_OFF_T_TYPE:
case B_POINTER_TYPE: case B_POINTER_TYPE:
return new NumberEditor(rect, editor); return new NumberEditor(rect, editor);
case 'MICN': case B_MINI_ICON_TYPE:
case 'ICON': case B_LARGE_ICON_TYPE:
case 'PNG ': case B_PNG_FORMAT:
case 'MSGG': case B_MESSAGE_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU #ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE: case B_VECTOR_ICON_TYPE:
#endif #endif
+4 -4
View File
@@ -2140,13 +2140,13 @@ FSGetDeskDir(BDirectory *deskDir, dev_t dev)
size_t size; size_t size;
const void* data = GetTrackerResources()-> const void* data = GetTrackerResources()->
LoadResource('ICON', kResDeskIcon, &size); LoadResource(B_LARGE_ICON_TYPE, kResDeskIcon, &size);
if (data) if (data)
deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size); deskDir->WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
data = GetTrackerResources()-> data = GetTrackerResources()->
LoadResource('MICN', kResDeskIcon, &size); LoadResource(B_MINI_ICON_TYPE, kResDeskIcon, &size);
if (data) if (data)
deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size); deskDir->WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, data, size);
@@ -2639,13 +2639,13 @@ FSCreateTrashDirs()
if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) { if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) {
size_t size; size_t size;
const void* data = GetTrackerResources()-> const void* data = GetTrackerResources()->
LoadResource('ICON', kResTrashIcon, &size); LoadResource(B_LARGE_ICON_TYPE, kResTrashIcon, &size);
if (data) { if (data) {
trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0, trashDir.WriteAttr(kAttrLargeIcon, B_COLOR_8_BIT_TYPE, 0,
data, size); data, size);
} }
data = GetTrackerResources()-> data = GetTrackerResources()->
LoadResource('MICN', kResTrashIcon, &size); LoadResource(B_MINI_ICON_TYPE, kResTrashIcon, &size);
if (data) { if (data) {
trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0, trashDir.WriteAttr(kAttrMiniIcon, B_COLOR_8_BIT_TYPE, 0,
data, size); data, size);
+2 -2
View File
@@ -51,9 +51,9 @@ get_type(type_code type)
case B_DOUBLE_TYPE: case B_DOUBLE_TYPE:
return "Double"; return "Double";
case 'MICN': case B_MINI_ICON_TYPE:
return "Mini Icon"; return "Mini Icon";
case 'ICON': case B_LARGE_ICON_TYPE:
return "Icon"; return "Icon";
default: default:
+2 -2
View File
@@ -49,9 +49,9 @@ get_type(type_code type)
case B_DOUBLE_TYPE: case B_DOUBLE_TYPE:
return "Double"; return "Double";
case 'MICN': case B_MINI_ICON_TYPE:
return "Mini Icon"; return "Mini Icon";
case 'ICON': case B_LARGE_ICON_TYPE:
return "Icon"; return "Icon";
default: default:
+1 -1
View File
@@ -1073,7 +1073,7 @@ IconView::ShowIconHeap(bool show)
if (data == NULL) { if (data == NULL) {
// no vector icon or failed to get bitmap // no vector icon or failed to get bitmap
// try bitmap icon // try bitmap icon
data = resources->LoadResource('ICON', "icon heap", NULL); data = resources->LoadResource(B_LARGE_ICON_TYPE, "icon heap", NULL);
if (data != NULL) { if (data != NULL) {
fHeapIcon = Icon::AllocateBitmap(B_LARGE_ICON, B_CMAP8); fHeapIcon = Icon::AllocateBitmap(B_LARGE_ICON, B_CMAP8);
memcpy(fHeapIcon->Bits(), data, fHeapIcon->BitsLength()); memcpy(fHeapIcon->Bits(), data, fHeapIcon->BitsLength());
+1 -1
View File
@@ -443,7 +443,7 @@ ConfigWindow::MakeHowToView()
BResources *resources = BApplication::AppResources(); BResources *resources = BApplication::AppResources();
if (resources) { if (resources) {
size_t length; size_t length;
char *buffer = (char *)resources->FindResource('ICON', 101, &length); char *buffer = (char *)resources->FindResource(B_LARGE_ICON_TYPE, 101, &length);
if (buffer) { if (buffer) {
BBitmap *bitmap = new BBitmap(BRect(0, 0, 63, 63), B_CMAP8); BBitmap *bitmap = new BBitmap(BRect(0, 0, 63, 63), B_CMAP8);
if (bitmap && bitmap->InitCheck() == B_OK) { if (bitmap && bitmap->InitCheck() == B_OK) {
+1 -1
View File
@@ -130,7 +130,7 @@ BBitmap* MediaAlert::InitIcon()
// Load the raw icon data // Load the raw icon data
size_t size; size_t size;
const void* rawIcon = const void* rawIcon =
Resources.LoadResource('ICON', iconName, &size); Resources.LoadResource(B_LARGE_ICON_TYPE, iconName, &size);
if (rawIcon) if (rawIcon)
{ {
+2 -2
View File
@@ -96,8 +96,8 @@ MouseView::MouseView(BRect rect, const MouseSettings &settings)
fMouseDownBitmap->SetBits(kMouseDownBits, sizeof(kMouseDownBits), 0, kMouseDownColorSpace); fMouseDownBitmap->SetBits(kMouseDownBits, sizeof(kMouseDownBits), 0, kMouseDownColorSpace);
// ToDo: move these images to the resources as well // ToDo: move these images to the resources as well
//fMouseBitmap = BTranslationUtils::GetBitmap('PNG ', "mouse_bmap"); //fMouseBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "mouse_bmap");
//fMouseDownBitmap = BTranslationUtils::GetBitmap('PNG ', "pressed_mouse_bmap"); //fMouseDownBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "pressed_mouse_bmap");
if (fMouseDownBitmap != NULL) if (fMouseDownBitmap != NULL)
fMouseDownBounds = fMouseDownBitmap->Bounds(); fMouseDownBounds = fMouseDownBitmap->Bounds();
+1 -1
View File
@@ -144,7 +144,7 @@ AlertView::InitIcon()
&& resources.SetTo(&file) == B_OK) { && resources.SetTo(&file) == B_OK) {
// Load the raw icon data // Load the raw icon data
size_t size; size_t size;
const void* data = resources.LoadResource('ICON', "warn", &size); const void* data = resources.LoadResource(B_LARGE_ICON_TYPE, "warn", &size);
if (data) { if (data) {
// Now build the bitmap // Now build the bitmap
icon = new BBitmap(BRect(0, 0, 31, 31), 0, B_CMAP8); icon = new BBitmap(BRect(0, 0, 31, 31), 0, B_CMAP8);
+4 -4
View File
@@ -51,10 +51,10 @@ DeviceWatcher::DeviceWatcher()
size_t size; size_t size;
const void* bits; 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); 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); miniIcon->SetBits(bits, size, 0, B_CMAP8);
} }
} }
@@ -132,10 +132,10 @@ void DeviceWatcher::SetIcons(BMidiEndpoint* endp)
BMessage msg; BMessage msg;
msg.AddData( msg.AddData(
"be:large_icon", 'ICON', largeIcon->Bits(), largeIcon->BitsLength()); "be:large_icon", B_LARGE_ICON_TYPE, largeIcon->Bits(), largeIcon->BitsLength());
msg.AddData( msg.AddData(
"be:mini_icon", 'MICN', miniIcon->Bits(), miniIcon->BitsLength()); "be:mini_icon", B_MINI_ICON_TYPE, miniIcon->Bits(), miniIcon->BitsLength());
endp->SetProperties(&msg); endp->SetProperties(&msg);
} }