Opened 11 years ago

Closed 11 years ago

#3731 closed enhancement (fixed)

Font preflet using Layout engine

Reported by: stpere Owned by: stippi
Priority: normal Milestone: R1
Component: Preferences Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


I experienced some bug/bad behaviour using the font preflet and decided to fix it.

Here are the changes that I made :

  • It's now using the layout engine (there was some clipping when using big fonts that prevented going back to a smaller font)
  • The "Defaults" button wouldn't be activated here by changing the menu font. I fixed that. The function to get the default for menu font was wrong, it did return a BAD_VALUE (that font isn't like the others).
  • The Revert wouldn't work in all cases. The fSavedFont (it's used to know what to revert to) was saved too soon. We were saving the saved font at the view creation, but it was changed right after that and used the changed one for display (but still had the old one saved).. I did move the saving right after the modification and it works now.

Attachments (1)

patch (20.7 KB ) - added by stpere 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by stpere, 11 years ago

I updated the patch to do/correct those extra things :

  • The revert function didn't revert the menu fonts.
  • The window wasn't centered at startup. It seems to be a common issue with the layout engine. The Frame() function returns a rect 1x1 (the size specified in the BWindow constructor) in the constructor of the BWindow... and since we also call the _Center function at this time, we don't really center the window, the top left corner of the window will be at screen center. I noticed that issue with other apps using the layout engine.

Is there a way to force the window to compute its size before Show()? I had to call Hide(); Show(); in the constructor to force the computation of the size. Yes, it's ugly..

comment:2 by stpere, 11 years ago

Okay, my trick of hiding and showing again the window seemed good, but isn't. It made the preflet crash (randomly?) on subsequent startups. I don't know why. So I rather did hook the Show method. Works better, and doesn't crash randomly.

by stpere, 11 years ago

Attachment: patch added

comment:3 by stpere, 11 years ago

I updated my patch to merge the fixes made by Maxime Simon (hrev30181 - ticket #3759)! It's building again.

comment:4 by stippi, 11 years ago

Owner: changed from axeld to stippi
Status: newassigned

comment:5 by stippi, 11 years ago

Awesome work! I applied the patch with some changes in hrev30194. Thanks a lot!

comment:6 by stpere, 11 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.