Tracker: Style fixes only

... including whitespace, brackets, rename loc to where or
location, add a pragma.

Replace min_c with std::min.
Replace BPoint(0, 0) with B_ORIGIN
Use make_color() function to make static rgb_color objects.

Change-Id: I47a4e5e5f0e7038643baca7539d211350bbb8f20
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6404
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
John Scipione
2023-05-03 07:30:59 +00:00
committed by Axel Dörfler
parent dc3f8c631a
commit b7dd18b22c
11 changed files with 60 additions and 51 deletions
+12 -7
View File
@@ -116,7 +116,7 @@ class DraggableContainerIcon : public BView {
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint);
virtual void MouseMoved(BPoint point, uint32, const BMessage*);
virtual void MouseMoved(BPoint where, uint32, const BMessage*);
virtual void Draw(BRect updateRect);
private:
@@ -1362,7 +1362,7 @@ BContainerWindow::SetLayoutState(BNode* node, const BMessage* message)
for (int32 globalIndex = 0; ;) {
#if B_BEOS_VERSION_DANO
const char* name;
const char* name;
#else
char* name;
#endif
@@ -1845,8 +1845,9 @@ BContainerWindow::SetCutItem(BMenu* menu)
{
BMenuItem* item;
if ((item = menu->FindItem(B_CUT)) == NULL
&& (item = menu->FindItem(kCutMoreSelectionToClipboard)) == NULL)
&& (item = menu->FindItem(kCutMoreSelectionToClipboard)) == NULL) {
return;
}
item->SetEnabled(PoseView()->SelectionList()->CountItems() > 0
|| PoseView() != CurrentFocus());
@@ -2075,6 +2076,7 @@ BContainerWindow::AddFileMenu(BMenu* menu)
new BMessage(B_PASTE), 'V');
menu->AddItem(pasteItem);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
new BMessage(kIdentifyEntry)));
}
@@ -2543,7 +2545,7 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu* navMenu, uint32 what,
menu->SetNavDir(model.EntryRef());
menu->SetShowParent(true);
BMenuItem* item = new SpecialModelMenuItem(&model,menu);
BMenuItem* item = new SpecialModelMenuItem(&model, menu);
item->SetMessage(new BMessage((uint32)what));
navMenu->AddItem(item);
@@ -2558,7 +2560,7 @@ BContainerWindow::PopulateMoveCopyNavMenu(BNavMenu* navMenu, uint32 what,
BMenu* menu = new RecentsMenu(B_TRANSLATE("Recent folders"),
kRecentFolders, what, this);
BMenuItem* item = new SpecialModelMenuItem(&model,menu);
BMenuItem* item = new SpecialModelMenuItem(&model, menu);
item->SetMessage(new BMessage((uint32)what));
navMenu->AddItem(item);
@@ -2715,9 +2717,9 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent)
uint32
BContainerWindow::ShowDropContextMenu(BPoint loc)
BContainerWindow::ShowDropContextMenu(BPoint where)
{
BPoint global(loc);
BPoint global(where);
PoseView()->ConvertToScreen(&global);
PoseView()->CommitActivePose();
@@ -3380,6 +3382,9 @@ BContainerWindow::LoadAddOn(BMessage* message)
}
// #pragma mark - BContainerWindow private methods
void
BContainerWindow::_UpdateSelectionMIMEInfo()
{
+4 -4
View File
@@ -74,8 +74,8 @@ BCountView::BCountView(BPoseView* view)
fTypeAheadString(""),
fFilterString("")
{
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE,
R_BarberPoleBitmap, &fBarberPoleMap);
GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE,
R_BarberPoleBitmap, &fBarberPoleMap);
}
@@ -233,9 +233,9 @@ BCountView::Draw(BRect updateRect)
if (IsTypingAhead()) {
// use a muted gray for the typeahead
SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
SetHighUIColor(B_DOCUMENT_TEXT_COLOR);
} else
SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
SetHighUIColor(B_PANEL_TEXT_COLOR);
MovePenTo(textRect.LeftBottom());
DrawString(itemString.String());
+12 -9
View File
@@ -637,12 +637,13 @@ TFilePanel::AdjustButton()
// selection mode then we don't disable button ever
if ((modelFlavor == B_DIRECTORY_NODE
|| linkFlavor == B_DIRECTORY_NODE)
&& count == 1)
break;
&& count == 1) {
break;
}
if ((fNodeFlavors & modelFlavor) == 0
&& (fNodeFlavors & linkFlavor) == 0) {
enabled = false;
enabled = false;
break;
}
}
@@ -978,11 +979,13 @@ TFilePanel::AddFileContextMenus(BMenu* menu)
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"),
new BMessage(kMoveToTrash), 'T'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
new BMessage(B_CUT), 'X'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
@@ -1227,13 +1230,13 @@ TFilePanel::MessageReceived(BMessage* message)
break;
}
// send handler a message and close
// send handler a message and close
BMessage openMessage(*fMessage);
for (int32 index = 0; ; index++) {
if (message->FindRef("refs", index, &ref) != B_OK)
if (message->FindRef("refs", index, &ref) != B_OK)
break;
openMessage.AddRef("refs", &ref);
}
}
OpenSelectionCommon(&openMessage);
}
}
@@ -1411,8 +1414,8 @@ TFilePanel::OpenParent()
PoseView()->SwitchDir(&ref);
SwitchDirMenuTo(&ref);
// make sure the child get's selected in the new view once it
// shows up
// Make sure the child gets selected in the new view
// once it shows up.
fTaskLoop->RunLater(NewMemberFunctionObjectWithResult
(&TFilePanel::SelectChildInParent, this,
const_cast<const entry_ref*>(&ref),
@@ -1871,7 +1874,7 @@ BFilePanelPoseView::AdaptToVolumeChange(BMessage* message)
monitorMsg.AddInt64("directory", model.EntryRef()->directory);
monitorMsg.AddString("name", model.EntryRef()->name);
TrackerSettings().SetShowDisksIcon(showDisksIcon);
if (Window())
if (Window() != NULL)
Window()->PostMessage(&monitorMsg, this);
}
+4 -5
View File
@@ -108,9 +108,9 @@ public:
protected:
BPoseView* NewPoseView(Model* model, uint32);
virtual void Init(const BMessage* message = NULL);
virtual void SaveState(bool hide = true);
virtual void SaveState(BMessage &) const;
virtual void Init(const BMessage* message = NULL);
virtual void SaveState(bool hide = true);
virtual void SaveState(BMessage &) const;
virtual void RestoreState();
virtual void RestoreWindowState(AttributeStreamNode*);
virtual void RestoreWindowState(const BMessage&);
@@ -138,8 +138,7 @@ private:
bool CanOpenParent() const;
void SwitchDirMenuTo(const entry_ref* ref);
void AdjustButton();
bool SelectChildInParent(const entry_ref* parent,
const node_ref* child);
bool SelectChildInParent(const entry_ref* parent, const node_ref* child);
void OpenSelectionCommon(BMessage*);
bool IsOpenButtonAlwaysEnabled() const;
+5 -5
View File
@@ -157,18 +157,18 @@ public:
protected:
virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
virtual bool ShouldAddMenus() const;
virtual void ShowContextMenu(BPoint, const entry_ref*, BView*);
virtual bool ShouldAddMenus() const;
virtual void ShowContextMenu(BPoint, const entry_ref*, BView*);
virtual void AddShortcuts();
virtual void NewAttributeMenu(BMenu*);
virtual void RestoreState();
virtual void RestoreState(const BMessage&);
virtual void RestoreState(const BMessage&);
virtual void RestoreWindowState(AttributeStreamNode*);
virtual void RestoreWindowState(const BMessage&);
virtual bool NeedsDefaultStateSetup();
virtual void SaveState(bool hide = true);
virtual void SaveState(BMessage&) const;
virtual void SaveState(bool hide = true);
virtual void SaveState(BMessage&) const;
virtual void SetUpDefaultState();
virtual bool IsShowing(const node_ref*) const;
+4 -4
View File
@@ -520,15 +520,15 @@ BPose::PointInPose(const BPoseView* poseView, BPoint where) const
bool
BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
BPose::PointInPose(BPoint where, const BPoseView* poseView, BPoint point,
BTextWidget** hitWidget) const
{
if (hitWidget != NULL)
*hitWidget = NULL;
// check intersection with icon
BRect rect = _IconRect(poseView, loc);
if (rect.Contains(where))
BRect rect = _IconRect(poseView, where);
if (rect.Contains(point))
return true;
for (int32 index = 0; ; index++) {
@@ -538,7 +538,7 @@ BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget != NULL
&& widget->CalcClickRect(loc, column, poseView).Contains(where)) {
&& widget->CalcClickRect(where, column, poseView).Contains(point)) {
if (hitWidget != NULL)
*hitWidget = widget;
+2 -2
View File
@@ -598,8 +598,8 @@ ClearViewOriginOne(const char* DEBUG_ONLY(name), uint32 type, off_t size,
return false;
// this is why we are here - zero out
viewstate->SetListOrigin(BPoint(0, 0));
viewstate->SetIconOrigin(BPoint(0, 0));
viewstate->SetListOrigin(B_ORIGIN);
viewstate->SetIconOrigin(B_ORIGIN);
stream.Seek(0, SEEK_SET);
viewstate->ArchiveToStream(&stream);
+8 -8
View File
@@ -643,9 +643,9 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
drawView->SetHighColor(highColor);
}
BPoint loc;
loc.y = textRect.bottom - view->FontInfo().descent;
loc.x = textRect.left + 1;
BPoint location;
location.y = textRect.bottom - view->FontInfo().descent;
location.x = textRect.left + 1;
const char* fittingText = fText->FittingText(view);
@@ -677,14 +677,14 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
glowColor.alpha = 30;
drawView->SetHighColor(glowColor);
drawView->DrawString(fittingText, loc);
drawView->DrawString(fittingText, location);
font.SetFalseBoldWidth(1.0);
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
glowColor.alpha = 65;
drawView->SetHighColor(glowColor);
drawView->DrawString(fittingText, loc);
drawView->DrawString(fittingText, location);
font.SetFalseBoldWidth(0.0);
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
@@ -697,7 +697,7 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
outlineColor.alpha = 30;
drawView->SetHighColor(outlineColor);
drawView->DrawString(fittingText, loc);
drawView->DrawString(fittingText, location);
font.SetFalseBoldWidth(0.0);
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
@@ -705,14 +705,14 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
outlineColor.alpha = 200;
drawView->SetHighColor(outlineColor);
drawView->DrawString(fittingText, loc + BPoint(1, 1));
drawView->DrawString(fittingText, location + BPoint(1, 1));
}
drawView->SetDrawingMode(B_OP_OVER);
drawView->SetHighColor(textColor);
}
drawView->DrawString(fittingText, loc);
drawView->DrawString(fittingText, location);
if (fSymLink && (fAttrHash == view->FirstColumn()->AttrHash())) {
// TODO:
+1 -1
View File
@@ -185,7 +185,7 @@ BTextWidget::Draw(BRect widgetRect, BRect widgetTextRect, float width,
BPoseView* view, bool selected, uint32 clipboardMode)
{
Draw(widgetRect, widgetTextRect, width, view, (BView*)view, selected,
clipboardMode, BPoint(0, 0), true);
clipboardMode, B_ORIGIN, true);
}
} // namespace BPrivate
+2 -2
View File
@@ -70,8 +70,8 @@ class BPoseView;
class Model;
// global variables
static const rgb_color kBlack = {0, 0, 0, 255};
static const rgb_color kWhite = {255, 255, 255 ,255};
static const rgb_color kBlack = make_color(0, 0, 0, 255);
static const rgb_color kWhite = make_color(255, 255, 255 ,255);
const int64 kHalfKBSize = 512;
const int64 kKBSize = 1024;
+6 -4
View File
@@ -35,6 +35,8 @@ All rights reserved.
#include "HeaderView.h"
#include <algorithm>
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
@@ -93,7 +95,7 @@ HeaderView::HeaderView(Model* model)
fTitleRect.left = fIconRect.right + labelSpacing;
fTitleRect.top = 0;
fTitleRect.bottom = fontMetrics.ascent + 1;
fTitleRect.right = min_c(
fTitleRect.right = std::min(
fTitleRect.left + currentFont.StringWidth(fModel->Name()),
Bounds().Width() - labelSpacing);
// Offset so that it centers with the icon
@@ -309,8 +311,8 @@ HeaderView::Draw(BRect)
MovePenTo(BPoint(fIconRect.right + 6, lineBase));
// Recalculate the rect width
fTitleRect.right = min_c(
fTitleRect.left + currentFont.StringWidth(fModel->Name()),
fTitleRect.right = std::min(fTitleRect.left
+ currentFont.StringWidth(fModel->Name()),
Bounds().Width() - 5);
// Check for possible need of truncation
if (StringWidth(fModel->Name()) > fTitleRect.Width()) {
@@ -440,7 +442,7 @@ HeaderView::MouseMoved(BPoint where, uint32, const BMessage* dragMessage)
float height = CurrentFontHeight()
+ fIconRect.Height() + 8;
BRect rect(0, 0, min_c(fIconRect.Width()
BRect rect(0, 0, std::min(fIconRect.Width()
+ font.StringWidth(fModel->Name()) + 4,
fIconRect.Width() * 3), height);
BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true);