[haiku-development] Re: Final Set*UIColor Patch, Version 3e

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 22 Nov 2015 22:59:59 +0100

Hi,

Am 22.11.2015 um 02:40 schrieb looncraz:

My final patch, located here: http://files.looncraz.net/svc/ , includes
style corrections even for code that I did not create. I have tried to
be as patient as I can be, and have addressed every concern presented to
me in a timely and, I hope, courteous manner. I have done this for
almost exactly two months now, and have effectively rewritten this patch
twice (much of the fault of that is certainly my own).

diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp
index aab0cf5..698777e 100644
--- a/src/apps/haikudepot/ui/PackageInfoView.cpp
+++ b/src/apps/haikudepot/ui/PackageInfoView.cpp

@@ -981,8 +999,8 @@ public:
:
BGridView("rating summary view", B_USE_HALF_ITEM_SPACING, 0.0f)
{
- SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
- kContentTint - 0.1));
+ float tint = kContentTint - 0.1;
+ SetViewUIColor(B_PANEL_BACKGROUND_COLOR, tint);

BLayoutBuilder::Grid<> layoutBuilder(this);

@@ -995,7 +1013,7 @@ public:
label.SetToFormat("%" B_PRId32, 5 - i);
fLabelViews[i] = new BStringView("", label);
fLabelViews[i]->SetFont(&smallFont);
- fLabelViews[i]->SetHighColor(kLightBlack);
+ fLabelViews[i]->SetViewUIColor(ViewUIColor(&tint),
tint);
layoutBuilder.Add(fLabelViews[i], 0, i);

fDiagramBarViews[i] = new DiagramBarView();
@@ -1003,7 +1021,7 @@ public:

fCountViews[i] = new BStringView("", "");
fCountViews[i]->SetFont(&smallFont);
- fCountViews[i]->SetHighColor(kLightBlack);
+ fCountViews[i]->SetViewUIColor(ViewUIColor(&tint),
tint);
fCountViews[i]->SetAlignment(B_ALIGN_RIGHT);
layoutBuilder.Add(fCountViews[i], 2, i);
}

Could you elaborate on the two

fCountViews[i]->SetViewUIColor(ViewUIColor(&tint), tint);

? I am relatively sure that the C++ standard does not define an order in which expressions used as parameters to method invocations are evaluated. If "tint" is actually supposed to be constant throughout its scope, then the code should be:

fCountViews[i]->SetViewUIColor(ViewUIColor(NULL), tint);

Otherwise, if you rely on ViewUIColor(&tint) being evaluated first, you should need to split this up into two lines of code.

Best regards,
-Stephan




Other related posts: