[interfacekit] Re: archiving...
- From: "Marc Flerackers" <mflerackers@xxxxxxxxxx>
- To: <interfacekit@xxxxxxxxxxxxx>
- Date: Fri, 20 Jun 2003 15:43:58 +0200
That's perfectly normal, from the BeBook:
"The sides of the view must be aligned on screen pixels. Therefore, the
frame rectangle should not contain coordinates with fractional values.
Fractional coordinates will be rounded to the first lower whole number (for
example 1.2 will be rounded down to 1.0)."
As long as a view is not connected to a window, it can have float
coordinates. The moment it is attached, the coordinates are rounded and sent
to the app_server. The app_server works with ints for it's window/view
coordinates. If you request things like Bounds/Frame when attached, the
values are requested from the app_server, and thus are rounded values.
We have to follow it, if we want to be backwards compatible. There are nice
side-effects, for example the following code
for (int32 i = 0; i < 10; i++)
view->MoveBy(0.1f, 0.0f);
moves the view by one pixel if not attached, but doesn't move it at all when
attached. This is because when not attached it does
fCachedBounds.MoveBy(0.1f, 0.0f), and when attached it sends 0.1f and 0.0f
as int32's, which means 0 and 0 :).
Marc Flerackers
> -----Original Message-----
> From: interfacekit-bounce@xxxxxxxxxxxxx
> [mailto:interfacekit-bounce@xxxxxxxxxxxxx]On Behalf Of Adi Oanca
> Sent: vrijdag 20 juni 2003 15:29
> To: IK Team
> Subject: [interfacekit] archiving...
>
>
> Hi ALL!
>
>
> Another question for you:
>
> I've instantiated a view with the following frame rectangle:
> const BRect v1Rect(100, 50, 300.75, 100);
>
> I archived the view and printed it to screen:
> BMessage: what = (0x0, or 0)
> entry class, type='CSTR', c=1, size=6, data[0]: "BView"
> entry _name, type='CSTR', c=1, size=6, data[0]: "View1"
> entry _frame, type='RECT', c=1, size=16, data[0]:
> BRect(l:100.0,
> t:50.0, r:301.0, b:100.0)
> entry _mine, type='FLOT', c=1, size= 4, data[0]: 1.2700
>
> NOTE: field "_mine" is added by me.
>
> If you notice, the archived frame coordinates are rounded!!!
> [ the bottom right corner is at (301.0, 100.0) instead of (300.75,
> 100.0)]
>
> I think this is a BAD thing, because when instantiated form
> archive, the
> view would lose its real coordinates!
> And, those, real coordinates are used when printing, isn't it?
>
> [this is from disassembly code]
> BView::Frame(){
> ...
> IsPrinting();
> ...
> }
>
> I think this is a bug, I think we should store the real coordinates!
>
> What do you think???
>
>
> Adi.
>
>
>
- Follow-Ups:
- [interfacekit] Re: archiving...
- From: Adi Oanca
- References:
- [interfacekit] archiving...
- From: Adi Oanca
Other related posts:
- » [interfacekit] archiving...
- » [interfacekit] Re: archiving...
- » [interfacekit] Re: archiving...
- [interfacekit] Re: archiving...
- From: Adi Oanca
- [interfacekit] archiving...
- From: Adi Oanca