Opened 11 years ago

Closed 11 years ago

#3735 closed enhancement (fixed)

Patch for using layouts in the preferences window of Mail

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

Description

With this patch, the Preferences window of Mail now uses Layouts instead of hardcoded positions.

Attachments (2)

pref3.jpg (47.8 KB ) - added by fcr 11 years ago.
Screenshot of the form.
mailPref.patch (11.4 KB ) - added by fcr 11 years ago.
The patch.

Download all attachments as: .zip

Change History (5)

by fcr, 11 years ago

Attachment: pref3.jpg added

Screenshot of the form.

by fcr, 11 years ago

Attachment: mailPref.patch added

The patch.

comment:1 by stippi, 11 years ago

Owner: changed from bga to stippi
Status: newassigned

Thanks a lot for the patch! You've done everything right, only two coding style hints:

button_ok -> buttonOk.

interfaceGrid->SetInsets(r.left+10, r.top+10, r.right+10, r.bottom+10); 
->
interfaceGrid->SetInsets(r.left + 10, r.top + 10, r.right + 10, r.bottom + 10); 

Also, there is a way to make the two grid layouts use the same alignment. Unfortunately we duplicated work, as I've also made the Mail prefs window use layout some time ago, but I didn't commit this yet, since I wanted to ask Axel how he liked the menu fields that used the full available width... I have the patch at home. The only difference to your patch is that I kept Mail compiling for BeOS and that I reduced some code duplication by using a small helper function that adds a BMenuField to the grid and increments the row.

Again, thanks a lot! I will merge our patches and commit when I am back home on Tuesday.

comment:2 by humdinger, 11 years ago

While you're working on the E-Mal preferences...
The left list of email accounts is a bit too narrow for my taste. How about making it ~50 pixel wider. Also, now that the layout manager is used: let's have the window resizable, the left account-list growing proportionally.

comment:3 by stippi, 11 years ago

Resolution: fixed
Status: assignedclosed

I've had a closer look at our two patches. I've now commited my version of the patch in hrev30202. The main reason being that I kept it possible to build a BeOS R5 version of Mail.

Here are some small improvements possible with your patch (but you can see from the changeset that what we did is pretty similar):

  • When creating the BBox objects, you should use the new constructor that doesn't take a BRect at all. You did this for the other controls. When using layout-management, it needs to be done for all controls in the hierarchy, or they won't have the correct flags (B_SUPPORTS_LAYOUT), and some initial setup may be different.
  • This part of the patch is weird:
    177	        BRect r = interfaceBox->InnerFrame();
    178	        interfaceGrid->SetInsets(r.left+10, r.top+10, r.right+10, r.bottom+10);
    

The inner frame of the box is in absolute (view relative) coordinates, but insets are given as distance to the outer frame. So this should not have worked at all, unless the inner frame happened to be very small.

  • I've made a small helper function to avoid a lot of the code duplication when adding the BMenuFields.
  • I wanted to keep the labels aligned across the two sections, and this is indeed possible:
    interfaceLayout->AlignLayoutWith(mailLayout, B_HORIZONTAL);
    

Again, thanks a lot for your work!

Note: See TracTickets for help on using tickets.