DiskProbe: Clean up old compiler pragmas for BeOS and Dano.

Change-Id: I0c8a4ce6c8d1c8994e2f89a4d35db3ac0ae03117
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4714
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Mikael Konradsson
2022-06-28 16:48:33 +00:00
committed by waddlesplash
parent 63816858af
commit c5702ad4e8
2 changed files with 3 additions and 111 deletions
-96
View File
@@ -50,13 +50,6 @@
#include "TypeEditors.h" #include "TypeEditors.h"
#ifndef __HAIKU__
# define DRAW_SLIDER_BAR
// if this is defined, the standard slider bar is replaced with
// one that looks exactly like the one in the original DiskProbe
// (even in Dano/Zeta)
#endif
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ProbeView" #define B_TRANSLATION_CONTEXT "ProbeView"
@@ -97,10 +90,6 @@ public:
uint32 blockSize); uint32 blockSize);
virtual ~PositionSlider(); virtual ~PositionSlider();
#ifdef DRAW_SLIDER_BAR
virtual void DrawBar();
#endif
off_t Position() const; off_t Position() const;
off_t Size() const { return fSize; } off_t Size() const { return fSize; }
uint32 BlockSize() const { return fBlockSize; } uint32 BlockSize() const { return fBlockSize; }
@@ -282,22 +271,14 @@ void
IconView::UpdateIcon() IconView::UpdateIcon()
{ {
if (fBitmap == NULL) if (fBitmap == NULL)
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32); fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32);
#else
fBitmap = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
#endif
if (fBitmap != NULL) { if (fBitmap != NULL) {
status_t status = B_ERROR; status_t status = B_ERROR;
if (fIsDevice) { if (fIsDevice) {
BPath path(&fRef); BPath path(&fRef);
#ifdef __HAIKU__
status = get_device_icon(path.Path(), fBitmap, B_LARGE_ICON); status = get_device_icon(path.Path(), fBitmap, B_LARGE_ICON);
#else
status = get_device_icon(path.Path(), fBitmap->Bits(), B_LARGE_ICON);
#endif
} else } else
status = BNodeInfo::GetTrackerIcon(&fRef, fBitmap); status = BNodeInfo::GetTrackerIcon(&fRef, fBitmap);
@@ -330,10 +311,8 @@ PositionSlider::PositionSlider(const char* name, BMessage* message,
{ {
Reset(); Reset();
#ifndef DRAW_SLIDER_BAR
rgb_color color = ui_color(B_CONTROL_HIGHLIGHT_COLOR); rgb_color color = ui_color(B_CONTROL_HIGHLIGHT_COLOR);
UseFillColor(true, &color); UseFillColor(true, &color);
#endif
} }
@@ -342,77 +321,6 @@ PositionSlider::~PositionSlider()
} }
#ifdef DRAW_SLIDER_BAR
void
PositionSlider::DrawBar()
{
BView* view = OffscreenView();
BRect barFrame = BarFrame();
BRect frame = barFrame.InsetByCopy(1, 1);
frame.top++;
frame.left++;
frame.right = ThumbFrame().left + ThumbFrame().Width() / 2;
#ifdef HAIKU_TARGET_PLATFORM_BEOS
if (IsEnabled())
view->SetHighColor(102, 152, 203);
else
view->SetHighColor(92, 102, 160);
#else
view->SetHighColor(IsEnabled() ? ui_color(B_CONTROL_HIGHLIGHT_COLOR)
: tint_color(ui_color(B_CONTROL_HIGHLIGHT_COLOR), B_DARKEN_1_TINT));
#endif
view->FillRect(frame);
frame.left = frame.right + 1;
frame.right = barFrame.right - 1;
view->SetHighColor(tint_color(ViewColor(), IsEnabled() ? B_DARKEN_1_TINT : B_LIGHTEN_1_TINT));
view->FillRect(frame);
rgb_color cornerColor = tint_color(ViewColor(), B_DARKEN_1_TINT);
rgb_color darkColor = tint_color(ViewColor(), B_DARKEN_3_TINT);
#ifdef HAIKU_TARGET_PLATFORM_BEOS
rgb_color shineColor = {255, 255, 255};
rgb_color shadowColor = {0, 0, 0};
#else
rgb_color shineColor = ui_color(B_SHINE_COLOR);
rgb_color shadowColor = ui_color(B_SHADOW_COLOR);
#endif
if (!IsEnabled()) {
darkColor = tint_color(ViewColor(), B_DARKEN_1_TINT);
shineColor = tint_color(shineColor, B_DARKEN_2_TINT);
shadowColor = tint_color(shadowColor, B_LIGHTEN_2_TINT);
}
view->BeginLineArray(9);
// the corners
view->AddLine(barFrame.LeftTop(), barFrame.LeftTop(), cornerColor);
view->AddLine(barFrame.LeftBottom(), barFrame.LeftBottom(), cornerColor);
view->AddLine(barFrame.RightTop(), barFrame.RightTop(), cornerColor);
// the edges
view->AddLine(BPoint(barFrame.left, barFrame.top + 1),
BPoint(barFrame.left, barFrame.bottom - 1), darkColor);
view->AddLine(BPoint(barFrame.right, barFrame.top + 1),
BPoint(barFrame.right, barFrame.bottom), shineColor);
barFrame.left++;
barFrame.right--;
view->AddLine(barFrame.LeftTop(), barFrame.RightTop(), darkColor);
view->AddLine(barFrame.LeftBottom(), barFrame.RightBottom(), shineColor);
// the inner edges
barFrame.top++;
view->AddLine(barFrame.LeftTop(), barFrame.RightTop(), shadowColor);
view->AddLine(BPoint(barFrame.left, barFrame.top + 1),
BPoint(barFrame.left, barFrame.bottom - 1), shadowColor);
view->EndLineArray();
}
#endif // DRAW_SLIDER_BAR
void void
PositionSlider::Reset() PositionSlider::Reset()
{ {
@@ -955,10 +863,6 @@ TypeMenuItem::DrawContent()
point.x = Frame().right - 4 - Menu()->StringWidth(fType.String()); point.x = Frame().right - 4 - Menu()->StringWidth(fType.String());
point.y += fontHeight.ascent; point.y += fontHeight.ascent;
#ifdef HAIKU_TARGET_PLATFORM_BEOS
Menu()->SetDrawingMode(B_OP_ALPHA);
#endif
Menu()->DrawString(fType.String(), point); Menu()->DrawString(fType.String(), point);
} }
+3 -15
View File
@@ -853,11 +853,10 @@ ImageView::ImageView(DataEditor &editor)
{ {
if (editor.Type() == B_MINI_ICON_TYPE if (editor.Type() == B_MINI_ICON_TYPE
|| editor.Type() == B_LARGE_ICON_TYPE || editor.Type() == B_LARGE_ICON_TYPE
#ifdef HAIKU_TARGET_PLATFORM_HAIKU || editor.Type() == B_VECTOR_ICON_TYPE) {
|| editor.Type() == B_VECTOR_ICON_TYPE
#endif
)
SetName(B_TRANSLATE("Icon view")); SetName(B_TRANSLATE("Icon view"));
}
fDescriptionView = new BStringView("", fDescriptionView = new BStringView("",
B_TRANSLATE_COMMENT("Could not read image", "Image means " B_TRANSLATE_COMMENT("Could not read image", "Image means "
@@ -979,7 +978,6 @@ ImageView::_UpdateImage()
fEditor.SetViewSize(viewSize); fEditor.SetViewSize(viewSize);
return; return;
} }
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
if (fBitmap != NULL && fEditor.Type() == B_VECTOR_ICON_TYPE if (fBitmap != NULL && fEditor.Type() == B_VECTOR_ICON_TYPE
&& fScaleSlider->Value() * 8 - 1 == fBitmap->Bounds().Width()) { && fScaleSlider->Value() * 8 - 1 == fBitmap->Bounds().Width()) {
if (BIconUtils::GetVectorIcon((const uint8 *)data, if (BIconUtils::GetVectorIcon((const uint8 *)data,
@@ -988,7 +986,6 @@ ImageView::_UpdateImage()
return; return;
} }
} }
#endif
delete fBitmap; delete fBitmap;
fBitmap = NULL; fBitmap = NULL;
@@ -1004,7 +1001,6 @@ ImageView::_UpdateImage()
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;
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE: case B_VECTOR_ICON_TYPE:
fBitmap = new BBitmap(BRect(0, 0, fScaleSlider->Value() * 8 - 1, fBitmap = new BBitmap(BRect(0, 0, fScaleSlider->Value() * 8 - 1,
fScaleSlider->Value() * 8 - 1), B_RGB32); fScaleSlider->Value() * 8 - 1), B_RGB32);
@@ -1015,7 +1011,6 @@ ImageView::_UpdateImage()
fBitmap = NULL; fBitmap = NULL;
} }
break; break;
#endif
case B_PNG_FORMAT: case B_PNG_FORMAT:
{ {
BMemoryIO stream(data, fEditor.FileSize()); BMemoryIO stream(data, fEditor.FileSize());
@@ -1047,9 +1042,7 @@ ImageView::_UpdateImage()
switch (fEditor.Type()) { switch (fEditor.Type()) {
case B_MINI_ICON_TYPE: case B_MINI_ICON_TYPE:
case B_LARGE_ICON_TYPE: case B_LARGE_ICON_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE: case B_VECTOR_ICON_TYPE:
#endif
type = B_TRANSLATE("Icon"); type = B_TRANSLATE("Icon");
break; break;
case B_PNG_FORMAT: case B_PNG_FORMAT:
@@ -1177,9 +1170,6 @@ MessageView::SetTo(BMessage& message)
type_code type; type_code type;
int32 count; int32 count;
#ifdef HAIKU_TARGET_PLATFORM_DANO
const
#endif
char* name; char* name;
for (int32 i = 0; message.GetInfo(B_ANY_TYPE, i, &name, &type, &count) for (int32 i = 0; message.GetInfo(B_ANY_TYPE, i, &name, &type, &count)
== B_OK; i++) { == B_OK; i++) {
@@ -1327,9 +1317,7 @@ GetTypeEditorFor(BRect rect, DataEditor& editor)
case B_MINI_ICON_TYPE: case B_MINI_ICON_TYPE:
case B_LARGE_ICON_TYPE: case B_LARGE_ICON_TYPE:
case B_PNG_FORMAT: case B_PNG_FORMAT:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE: case B_VECTOR_ICON_TYPE:
#endif
return new ImageView(editor); return new ImageView(editor);
} }