This fixes all the issues mentioned in #1207
* improved alignment of controls * removed last separator from icon bar * moved separator in sending mode so grouping of trash icon is like in reading mode * adjust window size constraints according to icon bar width * fixed follow modes of menufields when resizing window (even on BeOS, though a custom menu field is needed to take care of invalidation) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -104,33 +104,31 @@ void ButtonBar::Arrange(bool fixedWidth)
|
||||
}
|
||||
|
||||
// Arrange buttons
|
||||
for (i = 0; (button = (BmapButton *)fButtonList.ItemAt(i)) != NULL; i++)
|
||||
{
|
||||
for (i = 0; (button = (BmapButton *)fButtonList.ItemAt(i)) != NULL; i++) {
|
||||
button->MoveTo(fNextXOffset, fVMargin);
|
||||
if (fixedWidth) {
|
||||
button->ResizeTo(fMaxWidth, fMaxHeight);
|
||||
fNextXOffset += fMaxWidth+fHMargin;
|
||||
fNextXOffset += fMaxWidth + fHMargin;
|
||||
} else {
|
||||
button->GetPreferredSize(&width, &height);
|
||||
button->ResizeTo(width, fMaxHeight);
|
||||
fNextXOffset += width+fHMargin;
|
||||
fNextXOffset += width + fHMargin;
|
||||
}
|
||||
}
|
||||
|
||||
// Move dividers to match
|
||||
for(i = 0; i < fDividers; i++)
|
||||
{
|
||||
for(i = 0; i < fDividers; i++) {
|
||||
if (fDividerArray[i].button)
|
||||
fDividerArray[i].where = fDividerArray[i].button->Frame().right + floor(fHMargin/2);
|
||||
else
|
||||
fDividerArray[i].where = floor(fHMargin/2);
|
||||
fDividerArray[i].where = floor(fHMargin / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonBar::GetPreferredSize(float *width, float *height)
|
||||
{
|
||||
*width = fNextXOffset+fHMargin;
|
||||
*height = fMaxHeight+(2*fVMargin);
|
||||
*width = fNextXOffset + fHMargin;
|
||||
*height = fMaxHeight + (2 * fVMargin);
|
||||
}
|
||||
|
||||
void ButtonBar::AttachedToWindow(void)
|
||||
|
||||
+25
-22
@@ -156,15 +156,16 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
MDR_DIALECT_CHOICE ("Enclosures: ","添付ファイル:")) + 9;
|
||||
float y = TO_FIELD_V;
|
||||
|
||||
float menuFieldHeight;
|
||||
BMenuBar* dummy = new BMenuBar(BRect(0, 0, 100, 15), "Dummy");
|
||||
AddChild(dummy);
|
||||
float width;
|
||||
dummy->GetPreferredSize(&width, &menuFieldHeight);
|
||||
menuFieldHeight += floorf(be_plain_font->Size() / 1.15);
|
||||
float width, menuBarHeight;
|
||||
dummy->GetPreferredSize(&width, &menuBarHeight);
|
||||
dummy->RemoveSelf();
|
||||
delete dummy;
|
||||
|
||||
float menuFieldHeight = menuBarHeight + 6;
|
||||
float controlHeight = menuBarHeight + floorf(be_plain_font->Size() / 1.15);
|
||||
|
||||
if (!fIncoming) {
|
||||
InitEmailCompletion();
|
||||
InitGroupCompletion();
|
||||
@@ -242,7 +243,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
// Set up the character set pop-up menu on the right of "To" box.
|
||||
r.Set (windowRect.Width() - widestCharacterSet -
|
||||
StringWidth (DECODING_TEXT) - 2 * SEPARATOR_MARGIN, y - 2,
|
||||
windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight + 2);
|
||||
windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
|
||||
field = new BMenuField (r, "decoding", DECODING_TEXT, fEncodingMenu,
|
||||
true /* fixedSize */,
|
||||
B_FOLLOW_TOP | B_FOLLOW_RIGHT,
|
||||
@@ -258,7 +259,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
string[0] = 0;
|
||||
}
|
||||
|
||||
y += menuFieldHeight;
|
||||
y += controlHeight;
|
||||
fTo = new TTextControl(r, string, new BMessage(TO_FIELD), fIncoming,
|
||||
resending, B_FOLLOW_LEFT_RIGHT);
|
||||
fTo->SetFilter(mail_to_filter);
|
||||
@@ -278,10 +279,10 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
|
||||
if (!fIncoming || resending) {
|
||||
r.right = r.left - 5;
|
||||
r.left = r.right - be_plain_font->StringWidth(TO_TEXT) - 15;
|
||||
r.left = r.right - ceilf(be_plain_font->StringWidth(TO_TEXT) + 25);
|
||||
r.top -= 1;
|
||||
fToMenu = new QPopupMenu(TO_TEXT);
|
||||
field = new BMenuField(r, "", "", fToMenu,
|
||||
field = new BMenuField(r, "", "", fToMenu, true,
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
field->SetDivider(0.0);
|
||||
field->SetEnabled(true);
|
||||
@@ -293,7 +294,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
// Put the character set box on the right of the From field.
|
||||
r.Set(windowRect.Width() - widestCharacterSet -
|
||||
StringWidth(ENCODING_TEXT) - 2 * SEPARATOR_MARGIN,
|
||||
y - 2, windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight + 2);
|
||||
y - 2, windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
|
||||
field = new BMenuField (r, "encoding", ENCODING_TEXT, fEncodingMenu,
|
||||
true /* fixedSize */,
|
||||
B_FOLLOW_TOP | B_FOLLOW_RIGHT,
|
||||
@@ -347,7 +348,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
}
|
||||
}
|
||||
r.Set(SEPARATOR_MARGIN, y - 2,
|
||||
field->Frame().left - SEPARATOR_MARGIN, y + menuFieldHeight + 2);
|
||||
field->Frame().left - SEPARATOR_MARGIN, y + menuFieldHeight);
|
||||
field = new BMenuField(r, "account", FROM_TEXT, fAccountMenu,
|
||||
true /* fixedSize */,
|
||||
B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT,
|
||||
@@ -355,9 +356,11 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
AddChild(field);
|
||||
field->SetDivider(x - 12 - SEPARATOR_MARGIN + kMenuFieldDividerOffset);
|
||||
field->SetAlignment(B_ALIGN_RIGHT);
|
||||
// field->MenuBar()->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT);
|
||||
#ifndef __HAIKU__
|
||||
field->MenuBar()->SetResizingMode(B_FOLLOW_LEFT_RIGHT);
|
||||
#endif
|
||||
|
||||
y += menuFieldHeight;
|
||||
y += controlHeight;
|
||||
} else {
|
||||
// To: account
|
||||
bool account = count_pop_accounts() > 0;
|
||||
@@ -378,13 +381,13 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
fAccount->SetEnabled(false);
|
||||
AddChild(fAccount);
|
||||
}
|
||||
y += menuFieldHeight;
|
||||
y += controlHeight;
|
||||
}
|
||||
|
||||
--y;
|
||||
r.Set(SEPARATOR_MARGIN, y,
|
||||
windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
|
||||
y += menuFieldHeight;
|
||||
y += controlHeight;
|
||||
fSubject = new TTextControl(r, SUBJECT_TEXT, new BMessage(SUBJECT_FIELD),
|
||||
fIncoming, false, B_FOLLOW_LEFT_RIGHT);
|
||||
AddChild(fSubject);
|
||||
@@ -408,10 +411,10 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
fCc->SetModificationMessage(msg);
|
||||
|
||||
r.right = r.left - 5;
|
||||
r.left = r.right - be_plain_font->StringWidth(CC_TEXT) - 15;
|
||||
r.left = r.right - ceilf(be_plain_font->StringWidth(CC_TEXT) + 25);
|
||||
r.top -= 1;
|
||||
fCcMenu = new QPopupMenu(CC_TEXT);
|
||||
field = new BMenuField(r, "", "", fCcMenu,
|
||||
field = new BMenuField(r, "", "", fCcMenu, true,
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
|
||||
field->SetDivider(0.0);
|
||||
@@ -420,7 +423,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
|
||||
r.Set(BCC_FIELD_H + be_plain_font->StringWidth(BCC_TEXT), y,
|
||||
windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
|
||||
y += menuFieldHeight;
|
||||
y += controlHeight;
|
||||
fBcc = new TTextControl(r, "", new BMessage(BCC_FIELD),
|
||||
fIncoming, false, B_FOLLOW_LEFT_RIGHT);
|
||||
fBcc->SetFilter(mail_to_filter);
|
||||
@@ -431,29 +434,29 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming,
|
||||
fBcc->SetModificationMessage(msg);
|
||||
|
||||
r.right = r.left - 5;
|
||||
r.left = r.right - be_plain_font->StringWidth(BCC_TEXT) - 15;
|
||||
r.left = r.right - ceilf(be_plain_font->StringWidth(BCC_TEXT) + 25);
|
||||
r.top -= 1;
|
||||
fBccMenu = new QPopupMenu(BCC_TEXT);
|
||||
field = new BMenuField(r, "", "", fBccMenu,
|
||||
field = new BMenuField(r, "", "", fBccMenu, true,
|
||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
field->SetDivider(0.0);
|
||||
field->SetEnabled(true);
|
||||
AddChild(field);
|
||||
} else {
|
||||
y -= SEPARATOR_MARGIN;
|
||||
r.Set(SEPARATOR_MARGIN, y, x - 12 - 1, y + menuFieldHeight + 1);
|
||||
r.Set(SEPARATOR_MARGIN, y, x - 12 - 1, y + menuFieldHeight);
|
||||
fDateLabel = new BStringView(r, "", kDateLabel);
|
||||
fDateLabel->SetAlignment(B_ALIGN_RIGHT);
|
||||
AddChild(fDateLabel);
|
||||
fDateLabel->SetHighColor(0, 0, 0);
|
||||
|
||||
r.Set(r.right + 9, y, windowRect.Width() - SEPARATOR_MARGIN,
|
||||
y + menuFieldHeight + 1);
|
||||
y + menuFieldHeight);
|
||||
fDate = new BStringView(r, "", "");
|
||||
AddChild(fDate);
|
||||
fDate->SetHighColor(0, 0, 0);
|
||||
|
||||
y += menuFieldHeight + 5;
|
||||
y += controlHeight + 5;
|
||||
|
||||
LoadMessage(mail);
|
||||
}
|
||||
|
||||
@@ -506,10 +506,6 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
fHeaderView->fTo->SetText(to);
|
||||
}
|
||||
|
||||
SetSizeLimits(WIND_WIDTH, RIGHT_BOUNDARY,
|
||||
fHeaderView->Bounds().Height() + ENCLOSURES_HEIGHT + height + 60,
|
||||
RIGHT_BOUNDARY);
|
||||
|
||||
AddShortcut('n', B_COMMAND_KEY, new BMessage(M_NEW));
|
||||
|
||||
//
|
||||
@@ -566,6 +562,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, TMailApp* app,
|
||||
|
||||
if (fRef)
|
||||
SetTitleForMessage();
|
||||
|
||||
_UpdateSizeLimits();
|
||||
}
|
||||
|
||||
|
||||
@@ -578,26 +576,21 @@ TMailWindow::BuildButtonBar()
|
||||
bbar->AddButton(MDR_DIALECT_CHOICE ("New","新規"), 28, new BMessage(M_NEW));
|
||||
bbar->AddDivider(5);
|
||||
|
||||
if (fResending)
|
||||
{
|
||||
if (fResending) {
|
||||
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8, new BMessage(M_SEND_NOW));
|
||||
bbar->AddDivider(5);
|
||||
}
|
||||
else if (!fIncoming)
|
||||
{
|
||||
} else if (!fIncoming) {
|
||||
fSendButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Send","送信"), 8, new BMessage(M_SEND_NOW));
|
||||
fSendButton->SetEnabled(false);
|
||||
fSigButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Signature","署名"), 4, new BMessage(M_SIG_MENU));
|
||||
fSigButton->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||
fSaveButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Save","保存"), 44, new BMessage(M_SAVE_AS_DRAFT));
|
||||
fSaveButton->SetEnabled(false);
|
||||
bbar->AddDivider(5);
|
||||
fPrintButton = bbar->AddButton(MDR_DIALECT_CHOICE ("Print","印刷"), 16, new BMessage(M_PRINT));
|
||||
fPrintButton->SetEnabled(false);
|
||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Trash","削除"), 0, new BMessage(M_DELETE));
|
||||
}
|
||||
else
|
||||
{
|
||||
bbar->AddDivider(5);
|
||||
} else {
|
||||
BmapButton *button = bbar->AddButton(MDR_DIALECT_CHOICE ("Reply","返信"), 12, new BMessage(M_REPLY));
|
||||
button->InvokeOnButton(B_SECONDARY_MOUSE_BUTTON);
|
||||
button = bbar->AddButton(MDR_DIALECT_CHOICE ("Forward","転送"), 40, new BMessage(M_FORWARD));
|
||||
@@ -614,7 +607,6 @@ TMailWindow::BuildButtonBar()
|
||||
}
|
||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Inbox","受信箱"), 36, new BMessage(M_OPEN_MAIL_BOX));
|
||||
bbar->AddButton(MDR_DIALECT_CHOICE ("Mail","メール"), 32, new BMessage(M_OPEN_MAIL_FOLDER));
|
||||
bbar->AddDivider(5);
|
||||
|
||||
bbar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
bbar->Hide();
|
||||
@@ -660,6 +652,8 @@ TMailWindow::UpdateViews()
|
||||
BRect bounds(Bounds());
|
||||
fContentView->MoveTo(0, nextY-1);
|
||||
fContentView->ResizeTo(bounds.right-bounds.left, bounds.bottom-nextY+1);
|
||||
|
||||
_UpdateSizeLimits();
|
||||
}
|
||||
|
||||
|
||||
@@ -2788,3 +2782,28 @@ TMailWindow::FrontmostWindow()
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
TMailWindow::_UpdateSizeLimits()
|
||||
{
|
||||
float minWidth, maxWidth, minHeight, maxHeight;
|
||||
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||
|
||||
float height;
|
||||
fMenuBar->GetPreferredSize(&minWidth, &height);
|
||||
|
||||
minHeight = height;
|
||||
|
||||
if (fButtonBar) {
|
||||
fButtonBar->GetPreferredSize(&minWidth, &height);
|
||||
minHeight += height;
|
||||
} else {
|
||||
minWidth = WIND_WIDTH;
|
||||
}
|
||||
|
||||
minHeight += fHeaderView->Bounds().Height() + ENCLOSURES_HEIGHT + 60;
|
||||
|
||||
SetSizeLimits(minWidth, RIGHT_BOUNDARY, minHeight, RIGHT_BOUNDARY);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,8 @@ class TMailWindow : public BWindow {
|
||||
status_t TrainMessageAs(const char* commandWord);
|
||||
|
||||
private:
|
||||
void _UpdateSizeLimits();
|
||||
|
||||
TMailApp* fApp;
|
||||
|
||||
BEmailMessage* fMail;
|
||||
|
||||
Reference in New Issue
Block a user