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
+9 -4
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:
@@ -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)));
}
@@ -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()
{
+2 -2
View File
@@ -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());
+7 -4
View File
@@ -637,8 +637,9 @@ TFilePanel::AdjustButton()
// selection mode then we don't disable button ever
if ((modelFlavor == B_DIRECTORY_NODE
|| linkFlavor == B_DIRECTORY_NODE)
&& count == 1)
&& count == 1) {
break;
}
if ((fNodeFlavors & modelFlavor) == 0
&& (fNodeFlavors & linkFlavor) == 0) {
@@ -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"),
@@ -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);
}
+1 -2
View File
@@ -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;
+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);