comdlg32: Use SetRect() instead of open coding it.

Frédéric Delanoy frederic.delanoy at gmail.com
Wed May 4 06:08:27 CDT 2016


On Wed, May 4, 2016 at 12:36 PM, Dmitry Timoshkov <dmitry at baikal.ru> wrote:
> Frédéric Delanoy <frederic.delanoy at gmail.com> wrote:
>
>> >> -        cancel_rc.left = dialog_rc.right - cancel_width - hspacing;
>> >> -        cancel_rc.top = dialog_rc.bottom - cancel_height - vspacing;
>> >> -        cancel_rc.right = cancel_rc.left + cancel_width;
>> >> -        cancel_rc.bottom = cancel_rc.top + cancel_height;
>> >> +        SetRect(&cancel_rc,
>> >> +                dialog_rc.right - cancel_width - hspacing, dialog_rc.bottom - cancel_height - vspacing,
>> >> +                dialog_rc.right - hspacing               , dialog_rc.bottom - vspacing);
>> >
>> > This is at least very strange and weird formatting of an API call.
>> > I don't see anything like that in the changed file.
>> >
>> > --
>> > Dmitry.
>>
>> It's for increased readability.
>
> I hope that's a joke.

No. Maybe I should have added IMHO?

>> Of course, it doesn't show well in
>> proportional fonts like those used in emails.
>
> I don't use proportional fonts in e-mails and it still looks quite ugly.

Tastes and colours I guess

> What's the reason of inventing new fancy formatting when doing janitorial
> work?

Rationale
1. The whole call is too long to fit on a single line, with long parameters
2. The too lines represent respectively the left-top and right-bottom
points of a rectangle respectively ; placing them vertically lets you
see directly the "distance" between left-right and top-bottom
respectively ;  the 2nd/4th and 3rd/5th are "logically" connected.
Alignment just helps distinguish parameters quicker.

Of course I don't do that if SetRect parameters are short enough, like
e.g. SetRect(foo, x, y, x+1, y-1) where the parameters are quickly
discernable.

Anyway, I could put all parameters on separate lines if that's really
such a tremendous issue for you.

-- 
Frédéric



More information about the wine-devel mailing list