Author: axeld Date: 2011-09-30 00:45:58 +0200 (Fri, 30 Sep 2011) New Revision: 42780 Changeset: https://dev.haiku-os.org/changeset/42780 Modified: haiku/trunk/src/kits/tracker/Utilities.cpp Log: * Minor cleanup. * Removed non-Haiku compatibility code - it's just no longer needed. Modified: haiku/trunk/src/kits/tracker/Utilities.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.cpp 2011-09-29 22:42:58 UTC (rev 42779) +++ haiku/trunk/src/kits/tracker/Utilities.cpp 2011-09-29 22:45:58 UTC (rev 42780) @@ -39,9 +39,7 @@ #include "Utilities.h" #include "ContainerWindow.h" -#ifdef __HAIKU__ -# include <IconUtils.h> -#endif +#include <IconUtils.h> #include <Bitmap.h> #include <Catalog.h> @@ -163,7 +161,8 @@ PeriodicUpdatePoses::PeriodicUpdatePoses() - : fPoseList(20, true) + : + fPoseList(20, true) { fLock = new Benaphore("PeriodicUpdatePoses"); } @@ -235,6 +234,7 @@ PeriodicUpdatePoses gPeriodicUpdatePoses; + } // namespace BPrivate @@ -471,13 +471,13 @@ namespace BPrivate { -/** Changes the alpha value of the given bitmap to create a nice - * horizontal fade out in the specified region. - * "from" is always transparent, "to" opaque. - */ - +/*! Changes the alpha value of the given bitmap to create a nice + horizontal fade out in the specified region. + "from" is always transparent, "to" opaque. +*/ 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 if (width < 0 || height < 0 || from < 0 || to < 0) @@ -505,13 +505,13 @@ } -/** Changes the alpha value of the given bitmap to create a nice - * vertical fade out in the specified region. - * "from" is always transparent, "to" opaque. - */ - +/*! Changes the alpha value of the given bitmap to create a nice + vertical fade out in the specified region. + "from" is always transparent, "to" opaque. +*/ 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 if (width < 0 || height < 0 || from < 0 || to < 0) @@ -541,6 +541,7 @@ } } + } // namespace BPrivate @@ -550,7 +551,8 @@ DraggableIcon::DraggableIcon(BRect rect, const char *name, const char *mimeType, icon_size size, const BMessage *message, BMessenger target, uint32 resizeMask, uint32 flags) - : BView(rect, name, resizeMask, flags), + : + BView(rect, name, resizeMask, flags), fMessage(*message), fTarget(target) { @@ -593,7 +595,7 @@ DraggableIcon::AttachedToWindow() { BView *parent = Parent(); - if (parent) { + if (parent != NULL) { SetViewColor(parent->ViewColor()); SetLowColor(parent->LowColor()); } @@ -641,12 +643,8 @@ void DraggableIcon::Draw(BRect) { -#ifdef __HAIKU__ SetDrawingMode(B_OP_ALPHA); SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); -#else - SetDrawingMode(B_OP_OVER); -#endif DrawBitmap(fBitmap); } @@ -656,7 +654,8 @@ FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, const char *text, uint32 resizeFlags, uint32 flags) - : BStringView(bounds, name, text, resizeFlags, flags), + : + BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), fOrigBitmap(NULL) { @@ -665,7 +664,8 @@ FlickerFreeStringView::FlickerFreeStringView(BRect bounds, const char *name, const char *text, BBitmap *inBitmap, uint32 resizeFlags, uint32 flags) - : BStringView(bounds, name, text, resizeFlags, flags), + : + BStringView(bounds, name, text, resizeFlags, flags), fBitmap(NULL), fOrigBitmap(inBitmap) { @@ -715,10 +715,8 @@ edge_info eInfo; switch (Alignment()) { case B_ALIGN_LEFT: -#ifdef HAIKU_TARGET_PLATFORM_HAIKU case B_ALIGN_HORIZONTAL_UNSET: case B_ALIGN_USE_FULL_WIDTH: -#endif { // If the first char has a negative left edge give it // some more room by shifting that much more to the right. @@ -791,7 +789,8 @@ TitledSeparatorItem::TitledSeparatorItem(const char *label) - : BMenuItem(label, 0) + : + BMenuItem(label, 0) { _inherited::SetEnabled(false); } @@ -858,7 +857,8 @@ // first calculate the length of the stub part of the // 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) firstEndX = 0; @@ -902,7 +902,8 @@ parent->GetFontHeight(&finfo); 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->SetHighColor(ShiftMenuBackgroundColor(B_DARKEN_1_TINT)); @@ -921,7 +922,8 @@ ShortcutFilter::ShortcutFilter(uint32 shortcutKey, uint32 shortcutModifier, uint32 shortcutWhat, BHandler *target) - : BMessageFilter(B_KEY_DOWN), + : + BMessageFilter(B_KEY_DOWN), fShortcutKey(shortcutKey), fShortcutModifier(shortcutModifier), fShortcutWhat(shortcutWhat), @@ -965,6 +967,7 @@ namespace BPrivate { + void EmbedUniqueVolumeInfo(BMessage *message, const BVolume *volume) { @@ -1143,7 +1146,8 @@ ContainsEntryRef(const BMessage *message, const entry_ref *ref) { 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) return true; } @@ -1162,8 +1166,8 @@ typedef entry_ref *(*EachEntryIteratee)(entry_ref *, void *); const entry_ref * -EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *), - void *passThru) +EachEntryRef(const BMessage *message, + const entry_ref *(*func)(const entry_ref *, void *), void *passThru) { return EachEntryRefCommon(const_cast<BMessage *>(message), (EachEntryIteratee)func, passThru, -1); @@ -1179,8 +1183,9 @@ const entry_ref * -EachEntryRef(const BMessage *message, const entry_ref *(*func)(const entry_ref *, void *), - void *passThru, int32 maxCount) +EachEntryRef(const BMessage *message, + const entry_ref *(*func)(const entry_ref *, void *), void *passThru, + int32 maxCount) { return EachEntryRefCommon(const_cast<BMessage *>(message), (EachEntryIteratee)func, passThru, maxCount); @@ -1229,27 +1234,7 @@ 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 LineBounds(BPoint where, float length, bool vertical) { @@ -1265,8 +1250,10 @@ } -SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, const char *name) - : BView(LineBounds(where, length, vertical), name, +SeparatorLine::SeparatorLine(BPoint where, float length, bool vertical, + const char *name) + : + BView(LineBounds(where, length, vertical), name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -1284,10 +1271,12 @@ BeginLineArray(2); if (vertical) { 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 { 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(); } @@ -1503,7 +1492,8 @@ 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(); for (int32 index = 0; index < count; index++) { @@ -1525,14 +1515,15 @@ PositionPassingMenuItem::PositionPassingMenuItem(const char *title, BMessage *message, char shortcut, uint32 modifiers) - : BMenuItem(title, message, shortcut, modifiers) + : + BMenuItem(title, message, shortcut, modifiers) { } -PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, - BMessage *message) - : BMenuItem(menu, message) +PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu, BMessage *message) + : + BMenuItem(menu, message) { } @@ -1639,7 +1630,8 @@ 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) { PRINT(("failing %s at %s:%d\n", strerror(error), file, (int)line)); @@ -1649,7 +1641,8 @@ 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) { PRINT(("failing %s at %s:%d\n", strerror(size), file, (int)line)); @@ -1669,4 +1662,5 @@ } } + } // namespace BPrivate