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:
committed by
Axel Dörfler
parent
dc3f8c631a
commit
b7dd18b22c
@@ -116,7 +116,7 @@ class DraggableContainerIcon : public BView {
|
|||||||
|
|
||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseUp(BPoint);
|
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);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1845,8 +1845,9 @@ BContainerWindow::SetCutItem(BMenu* menu)
|
|||||||
{
|
{
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
if ((item = menu->FindItem(B_CUT)) == NULL
|
if ((item = menu->FindItem(B_CUT)) == NULL
|
||||||
&& (item = menu->FindItem(kCutMoreSelectionToClipboard)) == NULL)
|
&& (item = menu->FindItem(kCutMoreSelectionToClipboard)) == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
item->SetEnabled(PoseView()->SelectionList()->CountItems() > 0
|
item->SetEnabled(PoseView()->SelectionList()->CountItems() > 0
|
||||||
|| PoseView() != CurrentFocus());
|
|| PoseView() != CurrentFocus());
|
||||||
@@ -2075,6 +2076,7 @@ BContainerWindow::AddFileMenu(BMenu* menu)
|
|||||||
new BMessage(B_PASTE), 'V');
|
new BMessage(B_PASTE), 'V');
|
||||||
menu->AddItem(pasteItem);
|
menu->AddItem(pasteItem);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
|
||||||
new BMessage(kIdentifyEntry)));
|
new BMessage(kIdentifyEntry)));
|
||||||
}
|
}
|
||||||
@@ -2715,9 +2717,9 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent)
|
|||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
BContainerWindow::ShowDropContextMenu(BPoint loc)
|
BContainerWindow::ShowDropContextMenu(BPoint where)
|
||||||
{
|
{
|
||||||
BPoint global(loc);
|
BPoint global(where);
|
||||||
|
|
||||||
PoseView()->ConvertToScreen(&global);
|
PoseView()->ConvertToScreen(&global);
|
||||||
PoseView()->CommitActivePose();
|
PoseView()->CommitActivePose();
|
||||||
@@ -3380,6 +3382,9 @@ BContainerWindow::LoadAddOn(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - BContainerWindow private methods
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BContainerWindow::_UpdateSelectionMIMEInfo()
|
BContainerWindow::_UpdateSelectionMIMEInfo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -233,9 +233,9 @@ BCountView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
if (IsTypingAhead()) {
|
if (IsTypingAhead()) {
|
||||||
// use a muted gray for the typeahead
|
// use a muted gray for the typeahead
|
||||||
SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
|
SetHighUIColor(B_DOCUMENT_TEXT_COLOR);
|
||||||
} else
|
} else
|
||||||
SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
|
SetHighUIColor(B_PANEL_TEXT_COLOR);
|
||||||
|
|
||||||
MovePenTo(textRect.LeftBottom());
|
MovePenTo(textRect.LeftBottom());
|
||||||
DrawString(itemString.String());
|
DrawString(itemString.String());
|
||||||
|
|||||||
@@ -637,8 +637,9 @@ TFilePanel::AdjustButton()
|
|||||||
// selection mode then we don't disable button ever
|
// selection mode then we don't disable button ever
|
||||||
if ((modelFlavor == B_DIRECTORY_NODE
|
if ((modelFlavor == B_DIRECTORY_NODE
|
||||||
|| linkFlavor == B_DIRECTORY_NODE)
|
|| linkFlavor == B_DIRECTORY_NODE)
|
||||||
&& count == 1)
|
&& count == 1) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ((fNodeFlavors & modelFlavor) == 0
|
if ((fNodeFlavors & modelFlavor) == 0
|
||||||
&& (fNodeFlavors & linkFlavor) == 0) {
|
&& (fNodeFlavors & linkFlavor) == 0) {
|
||||||
@@ -978,11 +979,13 @@ TFilePanel::AddFileContextMenus(BMenu* menu)
|
|||||||
new BMessage(kGetInfo), 'I'));
|
new BMessage(kGetInfo), 'I'));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
|
||||||
new BMessage(kEditItem), 'E'));
|
new BMessage(kEditItem), 'E'));
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
|
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
|
||||||
? B_TRANSLATE("Delete")
|
? B_TRANSLATE("Delete")
|
||||||
: B_TRANSLATE("Move to Trash"),
|
: B_TRANSLATE("Move to Trash"),
|
||||||
new BMessage(kMoveToTrash), 'T'));
|
new BMessage(kMoveToTrash), 'T'));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),
|
||||||
new BMessage(B_CUT), 'X'));
|
new BMessage(B_CUT), 'X'));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Copy"),
|
||||||
@@ -1411,8 +1414,8 @@ TFilePanel::OpenParent()
|
|||||||
PoseView()->SwitchDir(&ref);
|
PoseView()->SwitchDir(&ref);
|
||||||
SwitchDirMenuTo(&ref);
|
SwitchDirMenuTo(&ref);
|
||||||
|
|
||||||
// make sure the child get's selected in the new view once it
|
// Make sure the child gets selected in the new view
|
||||||
// shows up
|
// once it shows up.
|
||||||
fTaskLoop->RunLater(NewMemberFunctionObjectWithResult
|
fTaskLoop->RunLater(NewMemberFunctionObjectWithResult
|
||||||
(&TFilePanel::SelectChildInParent, this,
|
(&TFilePanel::SelectChildInParent, this,
|
||||||
const_cast<const entry_ref*>(&ref),
|
const_cast<const entry_ref*>(&ref),
|
||||||
@@ -1871,7 +1874,7 @@ BFilePanelPoseView::AdaptToVolumeChange(BMessage* message)
|
|||||||
monitorMsg.AddInt64("directory", model.EntryRef()->directory);
|
monitorMsg.AddInt64("directory", model.EntryRef()->directory);
|
||||||
monitorMsg.AddString("name", model.EntryRef()->name);
|
monitorMsg.AddString("name", model.EntryRef()->name);
|
||||||
TrackerSettings().SetShowDisksIcon(showDisksIcon);
|
TrackerSettings().SetShowDisksIcon(showDisksIcon);
|
||||||
if (Window())
|
if (Window() != NULL)
|
||||||
Window()->PostMessage(&monitorMsg, this);
|
Window()->PostMessage(&monitorMsg, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,8 +138,7 @@ private:
|
|||||||
bool CanOpenParent() const;
|
bool CanOpenParent() const;
|
||||||
void SwitchDirMenuTo(const entry_ref* ref);
|
void SwitchDirMenuTo(const entry_ref* ref);
|
||||||
void AdjustButton();
|
void AdjustButton();
|
||||||
bool SelectChildInParent(const entry_ref* parent,
|
bool SelectChildInParent(const entry_ref* parent, const node_ref* child);
|
||||||
const node_ref* child);
|
|
||||||
void OpenSelectionCommon(BMessage*);
|
void OpenSelectionCommon(BMessage*);
|
||||||
bool IsOpenButtonAlwaysEnabled() const;
|
bool IsOpenButtonAlwaysEnabled() const;
|
||||||
|
|
||||||
|
|||||||
@@ -520,15 +520,15 @@ BPose::PointInPose(const BPoseView* poseView, BPoint where) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
|
BPose::PointInPose(BPoint where, const BPoseView* poseView, BPoint point,
|
||||||
BTextWidget** hitWidget) const
|
BTextWidget** hitWidget) const
|
||||||
{
|
{
|
||||||
if (hitWidget != NULL)
|
if (hitWidget != NULL)
|
||||||
*hitWidget = NULL;
|
*hitWidget = NULL;
|
||||||
|
|
||||||
// check intersection with icon
|
// check intersection with icon
|
||||||
BRect rect = _IconRect(poseView, loc);
|
BRect rect = _IconRect(poseView, where);
|
||||||
if (rect.Contains(where))
|
if (rect.Contains(point))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int32 index = 0; ; index++) {
|
for (int32 index = 0; ; index++) {
|
||||||
@@ -538,7 +538,7 @@ BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
|
|||||||
|
|
||||||
BTextWidget* widget = WidgetFor(column->AttrHash());
|
BTextWidget* widget = WidgetFor(column->AttrHash());
|
||||||
if (widget != NULL
|
if (widget != NULL
|
||||||
&& widget->CalcClickRect(loc, column, poseView).Contains(where)) {
|
&& widget->CalcClickRect(where, column, poseView).Contains(point)) {
|
||||||
if (hitWidget != NULL)
|
if (hitWidget != NULL)
|
||||||
*hitWidget = widget;
|
*hitWidget = widget;
|
||||||
|
|
||||||
|
|||||||
@@ -598,8 +598,8 @@ ClearViewOriginOne(const char* DEBUG_ONLY(name), uint32 type, off_t size,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// this is why we are here - zero out
|
// this is why we are here - zero out
|
||||||
viewstate->SetListOrigin(BPoint(0, 0));
|
viewstate->SetListOrigin(B_ORIGIN);
|
||||||
viewstate->SetIconOrigin(BPoint(0, 0));
|
viewstate->SetIconOrigin(B_ORIGIN);
|
||||||
|
|
||||||
stream.Seek(0, SEEK_SET);
|
stream.Seek(0, SEEK_SET);
|
||||||
viewstate->ArchiveToStream(&stream);
|
viewstate->ArchiveToStream(&stream);
|
||||||
|
|||||||
@@ -643,9 +643,9 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
|
|||||||
drawView->SetHighColor(highColor);
|
drawView->SetHighColor(highColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
BPoint loc;
|
BPoint location;
|
||||||
loc.y = textRect.bottom - view->FontInfo().descent;
|
location.y = textRect.bottom - view->FontInfo().descent;
|
||||||
loc.x = textRect.left + 1;
|
location.x = textRect.left + 1;
|
||||||
|
|
||||||
const char* fittingText = fText->FittingText(view);
|
const char* fittingText = fText->FittingText(view);
|
||||||
|
|
||||||
@@ -677,14 +677,14 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
|
|||||||
glowColor.alpha = 30;
|
glowColor.alpha = 30;
|
||||||
drawView->SetHighColor(glowColor);
|
drawView->SetHighColor(glowColor);
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc);
|
drawView->DrawString(fittingText, location);
|
||||||
|
|
||||||
font.SetFalseBoldWidth(1.0);
|
font.SetFalseBoldWidth(1.0);
|
||||||
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
||||||
glowColor.alpha = 65;
|
glowColor.alpha = 65;
|
||||||
drawView->SetHighColor(glowColor);
|
drawView->SetHighColor(glowColor);
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc);
|
drawView->DrawString(fittingText, location);
|
||||||
|
|
||||||
font.SetFalseBoldWidth(0.0);
|
font.SetFalseBoldWidth(0.0);
|
||||||
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
||||||
@@ -697,7 +697,7 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
|
|||||||
outlineColor.alpha = 30;
|
outlineColor.alpha = 30;
|
||||||
drawView->SetHighColor(outlineColor);
|
drawView->SetHighColor(outlineColor);
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc);
|
drawView->DrawString(fittingText, location);
|
||||||
|
|
||||||
font.SetFalseBoldWidth(0.0);
|
font.SetFalseBoldWidth(0.0);
|
||||||
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
|
||||||
@@ -705,14 +705,14 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView* view,
|
|||||||
outlineColor.alpha = 200;
|
outlineColor.alpha = 200;
|
||||||
drawView->SetHighColor(outlineColor);
|
drawView->SetHighColor(outlineColor);
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc + BPoint(1, 1));
|
drawView->DrawString(fittingText, location + BPoint(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
drawView->SetDrawingMode(B_OP_OVER);
|
drawView->SetDrawingMode(B_OP_OVER);
|
||||||
drawView->SetHighColor(textColor);
|
drawView->SetHighColor(textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc);
|
drawView->DrawString(fittingText, location);
|
||||||
|
|
||||||
if (fSymLink && (fAttrHash == view->FirstColumn()->AttrHash())) {
|
if (fSymLink && (fAttrHash == view->FirstColumn()->AttrHash())) {
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ BTextWidget::Draw(BRect widgetRect, BRect widgetTextRect, float width,
|
|||||||
BPoseView* view, bool selected, uint32 clipboardMode)
|
BPoseView* view, bool selected, uint32 clipboardMode)
|
||||||
{
|
{
|
||||||
Draw(widgetRect, widgetTextRect, width, view, (BView*)view, selected,
|
Draw(widgetRect, widgetTextRect, width, view, (BView*)view, selected,
|
||||||
clipboardMode, BPoint(0, 0), true);
|
clipboardMode, B_ORIGIN, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ class BPoseView;
|
|||||||
class Model;
|
class Model;
|
||||||
|
|
||||||
// global variables
|
// global variables
|
||||||
static const rgb_color kBlack = {0, 0, 0, 255};
|
static const rgb_color kBlack = make_color(0, 0, 0, 255);
|
||||||
static const rgb_color kWhite = {255, 255, 255 ,255};
|
static const rgb_color kWhite = make_color(255, 255, 255 ,255);
|
||||||
|
|
||||||
const int64 kHalfKBSize = 512;
|
const int64 kHalfKBSize = 512;
|
||||||
const int64 kKBSize = 1024;
|
const int64 kKBSize = 1024;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "HeaderView.h"
|
#include "HeaderView.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
@@ -93,7 +95,7 @@ HeaderView::HeaderView(Model* model)
|
|||||||
fTitleRect.left = fIconRect.right + labelSpacing;
|
fTitleRect.left = fIconRect.right + labelSpacing;
|
||||||
fTitleRect.top = 0;
|
fTitleRect.top = 0;
|
||||||
fTitleRect.bottom = fontMetrics.ascent + 1;
|
fTitleRect.bottom = fontMetrics.ascent + 1;
|
||||||
fTitleRect.right = min_c(
|
fTitleRect.right = std::min(
|
||||||
fTitleRect.left + currentFont.StringWidth(fModel->Name()),
|
fTitleRect.left + currentFont.StringWidth(fModel->Name()),
|
||||||
Bounds().Width() - labelSpacing);
|
Bounds().Width() - labelSpacing);
|
||||||
// Offset so that it centers with the icon
|
// Offset so that it centers with the icon
|
||||||
@@ -309,8 +311,8 @@ HeaderView::Draw(BRect)
|
|||||||
MovePenTo(BPoint(fIconRect.right + 6, lineBase));
|
MovePenTo(BPoint(fIconRect.right + 6, lineBase));
|
||||||
|
|
||||||
// Recalculate the rect width
|
// Recalculate the rect width
|
||||||
fTitleRect.right = min_c(
|
fTitleRect.right = std::min(fTitleRect.left
|
||||||
fTitleRect.left + currentFont.StringWidth(fModel->Name()),
|
+ currentFont.StringWidth(fModel->Name()),
|
||||||
Bounds().Width() - 5);
|
Bounds().Width() - 5);
|
||||||
// Check for possible need of truncation
|
// Check for possible need of truncation
|
||||||
if (StringWidth(fModel->Name()) > fTitleRect.Width()) {
|
if (StringWidth(fModel->Name()) > fTitleRect.Width()) {
|
||||||
@@ -440,7 +442,7 @@ HeaderView::MouseMoved(BPoint where, uint32, const BMessage* dragMessage)
|
|||||||
|
|
||||||
float height = CurrentFontHeight()
|
float height = CurrentFontHeight()
|
||||||
+ fIconRect.Height() + 8;
|
+ fIconRect.Height() + 8;
|
||||||
BRect rect(0, 0, min_c(fIconRect.Width()
|
BRect rect(0, 0, std::min(fIconRect.Width()
|
||||||
+ font.StringWidth(fModel->Name()) + 4,
|
+ font.StringWidth(fModel->Name()) + 4,
|
||||||
fIconRect.Width() * 3), height);
|
fIconRect.Width() * 3), height);
|
||||||
BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true);
|
BBitmap* dragBitmap = new BBitmap(rect, B_RGBA32, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user