* Minor cleanup.
* Removed non-Haiku compatibility code - it's just no longer needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42780 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -39,9 +39,7 @@ All rights reserved.
|
|||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include "ContainerWindow.h"
|
#include "ContainerWindow.h"
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
#include <IconUtils.h>
|
||||||
# include <IconUtils.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
@@ -163,7 +161,8 @@ DisallowMetaKeys(BTextView *textView)
|
|||||||
|
|
||||||
|
|
||||||
PeriodicUpdatePoses::PeriodicUpdatePoses()
|
PeriodicUpdatePoses::PeriodicUpdatePoses()
|
||||||
: fPoseList(20, true)
|
:
|
||||||
|
fPoseList(20, true)
|
||||||
{
|
{
|
||||||
fLock = new Benaphore("PeriodicUpdatePoses");
|
fLock = new Benaphore("PeriodicUpdatePoses");
|
||||||
}
|
}
|
||||||
@@ -235,6 +234,7 @@ PeriodicUpdatePoses::DoPeriodicUpdate(bool forceRedraw)
|
|||||||
|
|
||||||
PeriodicUpdatePoses gPeriodicUpdatePoses;
|
PeriodicUpdatePoses gPeriodicUpdatePoses;
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
@@ -471,13 +471,13 @@ OffscreenBitmap::View() const
|
|||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
/** Changes the alpha value of the given bitmap to create a nice
|
/*! Changes the alpha value of the given bitmap to create a nice
|
||||||
* horizontal fade out in the specified region.
|
horizontal fade out in the specified region.
|
||||||
* "from" is always transparent, "to" opaque.
|
"from" is always transparent, "to" opaque.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32 to)
|
FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from,
|
||||||
|
int32 to)
|
||||||
{
|
{
|
||||||
// check parameters
|
// check parameters
|
||||||
if (width < 0 || height < 0 || from < 0 || to < 0)
|
if (width < 0 || height < 0 || from < 0 || to < 0)
|
||||||
@@ -505,13 +505,13 @@ FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Changes the alpha value of the given bitmap to create a nice
|
/*! Changes the alpha value of the given bitmap to create a nice
|
||||||
* vertical fade out in the specified region.
|
vertical fade out in the specified region.
|
||||||
* "from" is always transparent, "to" opaque.
|
"from" is always transparent, "to" opaque.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to)
|
FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from,
|
||||||
|
int32 to)
|
||||||
{
|
{
|
||||||
// check parameters
|
// check parameters
|
||||||
if (width < 0 || height < 0 || from < 0 || to < 0)
|
if (width < 0 || height < 0 || from < 0 || to < 0)
|
||||||
@@ -541,6 +541,7 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
@@ -550,7 +551,8 @@ FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to
|
|||||||
DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType,
|
DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType,
|
||||||
icon_size size, const BMessage *message, BMessenger target,
|
icon_size size, const BMessage *message, BMessenger target,
|
||||||
uint32 resizeMask, uint32 flags)
|
uint32 resizeMask, uint32 flags)
|
||||||
: BView(rect, name, resizeMask, flags),
|
:
|
||||||
|
BView(rect, name, resizeMask, flags),
|
||||||
fMessage(*message),
|
fMessage(*message),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
@@ -593,7 +595,7 @@ void
|
|||||||
DraggableIcon::AttachedToWindow()
|
DraggableIcon::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView *parent = Parent();
|
BView *parent = Parent();
|
||||||
if (parent) {
|
if (parent != NULL) {
|
||||||
SetViewColor(parent->ViewColor());
|
SetViewColor(parent->ViewColor());
|
||||||
SetLowColor(parent->LowColor());
|
SetLowColor(parent->LowColor());
|
||||||
}
|
}
|
||||||
@@ -641,12 +643,8 @@ DraggableIcon::DragStarted(BMessage *)
|
|||||||
void
|
void
|
||||||
DraggableIcon::Draw(BRect)
|
DraggableIcon::Draw(BRect)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||||
#else
|
|
||||||
SetDrawingMode(B_OP_OVER);
|
|
||||||
#endif
|
|
||||||
DrawBitmap(fBitmap);
|
DrawBitmap(fBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +654,8 @@ DraggableIcon::Draw(BRect)
|
|||||||
|
|
||||||
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
||||||
const char *text, uint32 resizeFlags, uint32 flags)
|
const char *text, uint32 resizeFlags, uint32 flags)
|
||||||
: BStringView(bounds, name, text, resizeFlags, flags),
|
:
|
||||||
|
BStringView(bounds, name, text, resizeFlags, flags),
|
||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fOrigBitmap(NULL)
|
fOrigBitmap(NULL)
|
||||||
{
|
{
|
||||||
@@ -665,7 +664,8 @@ FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
|||||||
|
|
||||||
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name,
|
||||||
const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags)
|
const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags)
|
||||||
: BStringView(bounds, name, text, resizeFlags, flags),
|
:
|
||||||
|
BStringView(bounds, name, text, resizeFlags, flags),
|
||||||
fBitmap(NULL),
|
fBitmap(NULL),
|
||||||
fOrigBitmap(inBitmap)
|
fOrigBitmap(inBitmap)
|
||||||
{
|
{
|
||||||
@@ -715,10 +715,8 @@ FlickerFreeStringView::Draw(BRect)
|
|||||||
edge_info eInfo;
|
edge_info eInfo;
|
||||||
switch (Alignment()) {
|
switch (Alignment()) {
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
case B_ALIGN_HORIZONTAL_UNSET:
|
case B_ALIGN_HORIZONTAL_UNSET:
|
||||||
case B_ALIGN_USE_FULL_WIDTH:
|
case B_ALIGN_USE_FULL_WIDTH:
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// If the first char has a negative left edge give it
|
// If the first char has a negative left edge give it
|
||||||
// some more room by shifting that much more to the right.
|
// some more room by shifting that much more to the right.
|
||||||
@@ -791,7 +789,8 @@ FlickerFreeStringView::SetLowColor(rgb_color color)
|
|||||||
|
|
||||||
|
|
||||||
TitledSeparatorItem::TitledSeparatorItem(const char *label)
|
TitledSeparatorItem::TitledSeparatorItem(const char *label)
|
||||||
: BMenuItem(label, 0)
|
:
|
||||||
|
BMenuItem(label, 0)
|
||||||
{
|
{
|
||||||
_inherited::SetEnabled(false);
|
_inherited::SetEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -858,7 +857,8 @@ TitledSeparatorItem::Draw()
|
|||||||
|
|
||||||
// first calculate the length of the stub part of the
|
// first calculate the length of the stub part of the
|
||||||
// divider line, so we can use it for secondStartX
|
// divider line, so we can use it for secondStartX
|
||||||
float firstEndX = ((endX - startX) - maxStringWidth) / 2 - kStubToStringSlotX;
|
float firstEndX = ((endX - startX) - maxStringWidth) / 2
|
||||||
|
- kStubToStringSlotX;
|
||||||
if (firstEndX < 0)
|
if (firstEndX < 0)
|
||||||
firstEndX = 0;
|
firstEndX = 0;
|
||||||
|
|
||||||
@@ -902,7 +902,8 @@ TitledSeparatorItem::Draw()
|
|||||||
parent->GetFontHeight(&finfo);
|
parent->GetFontHeight(&finfo);
|
||||||
|
|
||||||
parent->SetLowColor(parent->ViewColor());
|
parent->SetLowColor(parent->ViewColor());
|
||||||
BPoint loc(firstEndX + kStubToStringSlotX, ContentLocation().y + finfo.ascent);
|
BPoint loc(firstEndX + kStubToStringSlotX,
|
||||||
|
ContentLocation().y + finfo.ascent);
|
||||||
|
|
||||||
parent->MovePenTo(loc + BPoint(1, 1));
|
parent->MovePenTo(loc + BPoint(1, 1));
|
||||||
parent->SetHighColor(ShiftMenuBackgroundColor(B_DARKEN_1_TINT));
|
parent->SetHighColor(ShiftMenuBackgroundColor(B_DARKEN_1_TINT));
|
||||||
@@ -921,7 +922,8 @@ TitledSeparatorItem::Draw()
|
|||||||
|
|
||||||
ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier,
|
ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier,
|
||||||
uint32 shortcutWhat, BHandler *target)
|
uint32 shortcutWhat, BHandler *target)
|
||||||
: BMessageFilter(B_KEY_DOWN),
|
:
|
||||||
|
BMessageFilter(B_KEY_DOWN),
|
||||||
fShortcutKey(shortcutKey),
|
fShortcutKey(shortcutKey),
|
||||||
fShortcutModifier(shortcutModifier),
|
fShortcutModifier(shortcutModifier),
|
||||||
fShortcutWhat(shortcutWhat),
|
fShortcutWhat(shortcutWhat),
|
||||||
@@ -965,6 +967,7 @@ ShortcutFilter::Filter(BMessage *message, BHandler **)
|
|||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume)
|
EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume)
|
||||||
{
|
{
|
||||||
@@ -1143,7 +1146,8 @@ bool
|
|||||||
ContainsEntryRef(const BMessage *message, const entry_ref *ref)
|
ContainsEntryRef(const BMessage *message, const entry_ref *ref)
|
||||||
{
|
{
|
||||||
entry_ref match;
|
entry_ref match;
|
||||||
for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK); index++) {
|
for (int32 index = 0; (message->FindRef("refs", index, &match) == B_OK);
|
||||||
|
index++) {
|
||||||
if (*ref == match)
|
if (*ref == match)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1162,8 +1166,8 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
|||||||
typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *);
|
typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *);
|
||||||
|
|
||||||
const entry_ref *
|
const entry_ref *
|
||||||
EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *),
|
EachEntryRef(const BMessage *message,
|
||||||
void *passThru)
|
const entry_ref *(*func)(const entry_ref *, void *), void *passThru)
|
||||||
{
|
{
|
||||||
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
||||||
(EachEntryIteratee)func, passThru, -1);
|
(EachEntryIteratee)func, passThru, -1);
|
||||||
@@ -1179,8 +1183,9 @@ EachEntryRef(BMessage *message, entry_ref *(*func)(entry_ref *, void *),
|
|||||||
|
|
||||||
|
|
||||||
const entry_ref *
|
const entry_ref *
|
||||||
EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *),
|
EachEntryRef(const BMessage *message,
|
||||||
void *passThru, int32 maxCount)
|
const entry_ref *(*func)(const entry_ref *, void *), void *passThru,
|
||||||
|
int32 maxCount)
|
||||||
{
|
{
|
||||||
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
return EachEntryRefCommon(const_cast<BMessage *>(message),
|
||||||
(EachEntryIteratee)func, passThru, maxCount);
|
(EachEntryIteratee)func, passThru, maxCount);
|
||||||
@@ -1229,26 +1234,6 @@ StringToScalar(const char *text)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if B_BEOS_VERSION <= B_BEOS_VERSION_MAUI && !defined(__HAIKU__)
|
|
||||||
|
|
||||||
bool
|
|
||||||
operator==(const rgb_color &a, const rgb_color &b)
|
|
||||||
{
|
|
||||||
return a.red == b.red
|
|
||||||
&& a.green == b.green
|
|
||||||
&& a.blue == b.blue
|
|
||||||
&& a.alpha == b.alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
operator!=(const rgb_color &a, const rgb_color &b)
|
|
||||||
{
|
|
||||||
return !operator==(a, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static BRect
|
static BRect
|
||||||
LineBounds(BPoint where, float length, bool vertical)
|
LineBounds(BPoint where, float length, bool vertical)
|
||||||
@@ -1265,8 +1250,10 @@ LineBounds(BPoint where, float length, bool vertical)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, const char *name)
|
SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical,
|
||||||
: BView(LineBounds(where, length, vertical), name,
|
const char *name)
|
||||||
|
:
|
||||||
|
BView(LineBounds(where, length, vertical), name,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW)
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
@@ -1284,10 +1271,12 @@ SeparatorLine::Draw(BRect)
|
|||||||
BeginLineArray(2);
|
BeginLineArray(2);
|
||||||
if (vertical) {
|
if (vertical) {
|
||||||
AddLine(bounds.LeftTop(), bounds.LeftBottom(), hiliteColor);
|
AddLine(bounds.LeftTop(), bounds.LeftBottom(), hiliteColor);
|
||||||
AddLine(bounds.LeftTop() + BPoint(1, 0), bounds.LeftBottom() + BPoint(1, 0), kWhite);
|
AddLine(bounds.LeftTop() + BPoint(1, 0),
|
||||||
|
bounds.LeftBottom() + BPoint(1, 0), kWhite);
|
||||||
} else {
|
} else {
|
||||||
AddLine(bounds.LeftTop(), bounds.RightTop(), hiliteColor);
|
AddLine(bounds.LeftTop(), bounds.RightTop(), hiliteColor);
|
||||||
AddLine(bounds.LeftTop() + BPoint(0, 1), bounds.RightTop() + BPoint(0, 1), kWhite);
|
AddLine(bounds.LeftTop() + BPoint(0, 1),
|
||||||
|
bounds.RightTop() + BPoint(0, 1), kWhite);
|
||||||
}
|
}
|
||||||
EndLineArray();
|
EndLineArray();
|
||||||
}
|
}
|
||||||
@@ -1503,7 +1492,8 @@ EachMenuItem(BMenu *menu, bool recursive, BMenuItem *(*func)(BMenuItem *))
|
|||||||
|
|
||||||
|
|
||||||
extern const BMenuItem *
|
extern const BMenuItem *
|
||||||
EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuItem *))
|
EachMenuItem(const BMenu *menu, bool recursive,
|
||||||
|
BMenuItem *(*func)(const BMenuItem *))
|
||||||
{
|
{
|
||||||
int32 count = menu->CountItems();
|
int32 count = menu->CountItems();
|
||||||
for (int32 index = 0; index < count; index++) {
|
for (int32 index = 0; index < count; index++) {
|
||||||
@@ -1525,14 +1515,15 @@ EachMenuItem(const BMenu *menu, bool recursive, BMenuItem *(*func)(const BMenuIt
|
|||||||
|
|
||||||
PositionPassingMenuItem::PositionPassingMenuItem(const char *title,
|
PositionPassingMenuItem::PositionPassingMenuItem(const char *title,
|
||||||
BMessage *message, char shortcut, uint32 modifiers)
|
BMessage *message, char shortcut, uint32 modifiers)
|
||||||
: BMenuItem(title, message, shortcut, modifiers)
|
:
|
||||||
|
BMenuItem(title, message, shortcut, modifiers)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu,
|
PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, BMessage *message)
|
||||||
BMessage *message)
|
:
|
||||||
: BMenuItem(menu, message)
|
BMenuItem(menu, message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1639,7 +1630,8 @@ ComputeTypeAheadScore(const char *text, const char *match, bool wordMode)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ThrowOnError(status_t error, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
_ThrowOnError(status_t error, const char *DEBUG_ONLY(file),
|
||||||
|
int32 DEBUG_ONLY(line))
|
||||||
{
|
{
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
PRINT(("failing %s at %s:%d\n", strerror(error), file, (int)line));
|
PRINT(("failing %s at %s:%d\n", strerror(error), file, (int)line));
|
||||||
@@ -1649,7 +1641,8 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(lin
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file), int32 DEBUG_ONLY(line))
|
_ThrowIfNotSize(ssize_t size, const char *DEBUG_ONLY(file),
|
||||||
|
int32 DEBUG_ONLY(line))
|
||||||
{
|
{
|
||||||
if (size < B_OK) {
|
if (size < B_OK) {
|
||||||
PRINT(("failing %s at %s:%d\n", strerror(size), file, (int)line));
|
PRINT(("failing %s at %s:%d\n", strerror(size), file, (int)line));
|
||||||
@@ -1669,4 +1662,5 @@ _ThrowOnError(status_t error, const char *DEBUG_ONLY(debugString),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|||||||
Reference in New Issue
Block a user