Ticket #3735: mailPref.patch
File mailPref.patch, 11.4 KB (added by , 16 years ago) |
---|
-
Prefs.cpp
51 51 #include <CharacterSet.h> 52 52 #include <CharacterSetRoster.h> 53 53 54 #include <GridLayout.h> 55 #include <GridView.h> 56 #include <GroupLayout.h> 57 #include <GroupLayoutBuilder.h> 58 54 59 using namespace BPrivate; 55 60 56 61 #include "MailApp.h" … … 115 120 bool* spellCheckStartOn, uint8* buttonBar) 116 121 : 117 122 BWindow(rect, MDR_DIALECT_CHOICE ("Mail Preferences", "Mailの設定"), 118 B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE), 123 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | 124 B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), 119 125 120 126 fNewWrap(wrap), 121 127 fWrap(*fNewWrap), … … 154 160 { 155 161 strcpy(fSignature, *fNewSignature); 156 162 157 BMenuField* menu; 163 BMenuField *menu; 164 int pos = 0; 158 165 159 BRect r = Bounds(); 160 BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_FRAME_EVENTS); 161 view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 162 AddChild(view); 166 // create the main dummy layout 167 SetLayout(new BGroupLayout(B_HORIZONTAL)); 163 168 164 // determine font height165 font_height fontHeight;166 view->GetFontHeight(&fontHeight);167 int32 height = (int32)(fontHeight.ascent + fontHeight.descent168 + fontHeight.leading) + 6;169 int32 labelWidth = (int32)view->StringWidth(SPELL_CHECK_START_ON_TEXT)170 + SEPARATOR_MARGIN;171 172 169 // group boxes 173 170 174 r.Set(8,4,Bounds().right - 8,4 + 6 * (height + ITEM_SPACE)); 175 BBox *interfaceBox = new BBox(r , NULL,B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); 171 BBox *interfaceBox = new BBox(BRect(0, 0, 1, 1), NULL); 176 172 interfaceBox->SetLabel(MDR_DIALECT_CHOICE ("User Interface", 177 173 "ユーザーインターフェース")); 178 view->AddChild(interfaceBox); 174 BGridLayout *interfaceGrid = new BGridLayout(10, 5); 175 interfaceBox->SetLayout(interfaceGrid); 176 interfaceBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 177 BRect r = interfaceBox->InnerFrame(); 178 interfaceGrid->SetInsets(r.left+10, r.top+10, r.right+10, r.bottom+10); 179 179 180 r.top = r.bottom + 8; r.bottom = r.top + 9 * (height + ITEM_SPACE); 181 BBox *mailBox = new BBox(r,NULL,B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); 180 BBox *mailBox = new BBox(BRect(0, 0, 1, 1), NULL); 182 181 mailBox->SetLabel(MDR_DIALECT_CHOICE ("Mailing", "メール関係")); 183 view->AddChild(mailBox); 182 BGridLayout *mailGrid = new BGridLayout(10, 5); 183 mailBox->SetLayout(mailGrid); 184 mailBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 185 r = mailBox->InnerFrame(); 186 mailGrid->SetInsets(r.left+10, r.top+10, r.right+10, r.bottom+10); 187 mailGrid->SetColumnWeight(2, 0.0); 184 188 185 189 // revert, ok & cancel 186 190 187 r.top = r.bottom + 10; r.bottom = r.top + height; 188 r.left = OK_BUTTON_X1; r.right = OK_BUTTON_X2; 189 BButton *button = new BButton(r, "ok", OK_BUTTON_TEXT, new BMessage(P_OK)); 190 button->MakeDefault(true); 191 view->AddChild(button); 191 BButton *button_ok = new BButton("ok", OK_BUTTON_TEXT, 192 new BMessage(P_OK)); 193 button_ok->MakeDefault(true); 192 194 193 r.OffsetBy(-(OK_BUTTON_X2 - OK_BUTTON_X1 + 10), 0); 194 button = new BButton(r, "cancel", CANCEL_BUTTON_TEXT, 195 BButton *button_cancel = new BButton("cancel", CANCEL_BUTTON_TEXT, 195 196 new BMessage(P_CANCEL)); 196 view->AddChild(button);197 197 198 r.left = REVERT_BUTTON_X1; r.right = REVERT_BUTTON_X2; 199 fRevert = new BButton(r, "revert", REVERT_BUTTON_TEXT, 198 fRevert = new BButton("revert", REVERT_BUTTON_TEXT, 200 199 new BMessage(P_REVERT)); 201 200 fRevert->SetEnabled(false); 202 view->AddChild(fRevert);203 201 204 202 // User Interface 205 203 206 r = interfaceBox->Bounds();207 r.left += 8;208 r.right -= 8;209 r.top = height;210 r.bottom = r.top + height - 3;211 204 fButtonBarMenu = _BuildButtonBarMenu(*buttonBar); 212 menu = new BMenuField(r, "bar", BUTTONBAR_TEXT, fButtonBarMenu, 213 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 214 menu->SetDivider(labelWidth); 205 menu = new BMenuField("bar", BUTTONBAR_TEXT, fButtonBarMenu, NULL); 215 206 menu->SetAlignment(B_ALIGN_RIGHT); 216 interfaceBox->AddChild(menu); 207 interfaceGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 208 interfaceGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos); 209 pos++; 217 210 218 r.OffsetBy(0, height + ITEM_SPACE);219 211 fFontMenu = _BuildFontMenu(font); 220 menu = new BMenuField(r, "font", FONT_TEXT, fFontMenu, 221 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 222 menu->SetDivider(labelWidth); 212 menu = new BMenuField("font", FONT_TEXT, fFontMenu, NULL); 223 213 menu->SetAlignment(B_ALIGN_RIGHT); 224 interfaceBox->AddChild(menu); 214 interfaceGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 215 interfaceGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos); 216 pos++; 225 217 226 r.OffsetBy(0, height + ITEM_SPACE);227 218 fSizeMenu = _BuildSizeMenu(font); 228 menu = new BMenuField(r, "size", SIZE_TEXT, fSizeMenu, 229 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 230 menu->SetDivider(labelWidth); 219 menu = new BMenuField("size", SIZE_TEXT, fSizeMenu, NULL); 231 220 menu->SetAlignment(B_ALIGN_RIGHT); 232 interfaceBox->AddChild(menu); 221 interfaceGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 222 interfaceGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos); 223 pos++; 233 224 234 r.OffsetBy(0, height + ITEM_SPACE);235 225 fColoredQuotesMenu = _BuildColoredQuotesMenu(fColoredQuotes); 236 menu = new BMenuField(r, "cquotes", QUOTES_TEXT, fColoredQuotesMenu, 237 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 238 menu->SetDivider(labelWidth); 226 menu = new BMenuField("cquotes", QUOTES_TEXT, fColoredQuotesMenu, NULL); 239 227 menu->SetAlignment(B_ALIGN_RIGHT); 240 interfaceBox->AddChild(menu); 228 interfaceGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 229 interfaceGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos); 230 pos++; 241 231 242 r.OffsetBy(0, height + ITEM_SPACE);243 232 fSpellCheckStartOnMenu = _BuildSpellCheckStartOnMenu(fSpellCheckStartOn); 244 menu = new BMenuField(r, "spellCheckStartOn", SPELL_CHECK_START_ON_TEXT, 245 fSpellCheckStartOnMenu, B_FOLLOW_ALL, 246 B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 247 menu->SetDivider(labelWidth); 233 menu = new BMenuField("spellCheckStartOn", SPELL_CHECK_START_ON_TEXT, 234 fSpellCheckStartOnMenu, NULL); 248 235 menu->SetAlignment(B_ALIGN_RIGHT); 249 interface Box->AddChild(menu);250 236 interfaceGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 237 interfaceGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos); 251 238 252 239 // Mail Accounts 240 pos = 0; 253 241 254 r = mailBox->Bounds();255 r.left += 8;256 r.right -= 8;257 r.top = height;258 r.bottom = r.top + height - 3;259 242 fAccountMenu = _BuildAccountMenu(fAccount); 260 menu = new BMenuField(r, "account", ACCOUNT_TEXT, fAccountMenu, 261 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 262 menu->SetDivider(labelWidth); 243 menu = new BMenuField("account", ACCOUNT_TEXT, fAccountMenu, NULL); 263 244 menu->SetAlignment(B_ALIGN_RIGHT); 264 mailBox->AddChild(menu); 245 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 246 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 247 pos++; 265 248 266 r.OffsetBy(0, height + ITEM_SPACE);267 249 fReplyToMenu = _BuildReplyToMenu(fReplyTo); 268 menu = new BMenuField(r, "replyTo", REPLYTO_TEXT, fReplyToMenu, 269 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 270 menu->SetDivider(labelWidth); 250 menu = new BMenuField("replyTo", REPLYTO_TEXT, fReplyToMenu, NULL); 271 251 menu->SetAlignment(B_ALIGN_RIGHT); 272 mailBox->AddChild(menu); 252 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 253 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 254 pos++; 273 255 274 256 // Mail Contents 275 257 276 r.OffsetBy(0, height + ITEM_SPACE); 277 r.right -= 25; 278 fReplyPreamble = new BTextControl(r, "replytext", REPLY_PREAMBLE_TEXT, 279 *preamble, new BMessage(P_REPLY_PREAMBLE), B_FOLLOW_ALL, 280 B_WILL_DRAW | B_NAVIGABLE); 281 fReplyPreamble->SetDivider(labelWidth); 258 fReplyPreamble = new BTextControl("replytext", REPLY_PREAMBLE_TEXT, 259 *preamble, new BMessage(P_REPLY_PREAMBLE)); 282 260 fReplyPreamble->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); 283 mailBox->AddChild(fReplyPreamble);284 261 285 BRect popRect = r;286 popRect.left = r.right + 6;287 r.right += 25;288 popRect.right = r.right;289 262 fReplyPreambleMenu = _BuildReplyPreambleMenu(); 290 menu = new BMenuField(popRect, "replyPreamble", B_EMPTY_STRING, 291 fReplyPreambleMenu, B_FOLLOW_ALL, 292 B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 293 menu->SetDivider(0); 294 mailBox->AddChild(menu); 295 296 r.OffsetBy(0, height + ITEM_SPACE); 263 menu = new BMenuField("replyPreamble", NULL, 264 fReplyPreambleMenu, NULL); 265 menu->SetAlignment(B_ALIGN_RIGHT); 266 267 mailGrid->AddItem(fReplyPreamble->CreateLabelLayoutItem(), 0, pos); 268 mailGrid->AddItem(fReplyPreamble->CreateTextViewLayoutItem(), 1, pos); 269 mailGrid->AddView(menu, 2, pos); 270 pos++; 271 297 272 fSignatureMenu = _BuildSignatureMenu(*sig); 298 menu = new BMenuField(r, "sig", SIGNATURE_TEXT, fSignatureMenu, 299 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 300 menu->SetDivider(labelWidth); 273 menu = new BMenuField("sig", SIGNATURE_TEXT, fSignatureMenu, NULL); 301 274 menu->SetAlignment(B_ALIGN_RIGHT); 302 mailBox->AddChild(menu); 275 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 276 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 277 pos++; 303 278 304 r.OffsetBy(0, height + ITEM_SPACE);305 279 fEncodingMenu = _BuildEncodingMenu(fEncoding); 306 menu = new BMenuField(r, "enc", ENCODING_TEXT, fEncodingMenu, 307 B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 308 menu->SetDivider(labelWidth); 280 menu = new BMenuField("enc", ENCODING_TEXT, fEncodingMenu, NULL); 309 281 menu->SetAlignment(B_ALIGN_RIGHT); 310 mailBox->AddChild(menu); 282 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 283 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 284 pos++; 311 285 312 r.OffsetBy(0, height + ITEM_SPACE);313 286 fWarnUnencodableMenu = _BuildWarnUnencodableMenu(fWarnUnencodable); 314 menu = new BMenuField(r, "warnUnencodable", WARN_UNENCODABLE_TEXT, 315 fWarnUnencodableMenu, B_FOLLOW_ALL, 316 B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 317 menu->SetDivider(labelWidth); 287 menu = new BMenuField("warnUnencodable", WARN_UNENCODABLE_TEXT, 288 fWarnUnencodableMenu, NULL); 318 289 menu->SetAlignment(B_ALIGN_RIGHT); 319 mailBox->AddChild(menu); 290 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 291 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 292 pos++; 320 293 321 r.OffsetBy(0, height + ITEM_SPACE);322 294 fWrapMenu = _BuildWrapMenu(*wrap); 323 menu = new BMenuField(r, "wrap", WRAP_TEXT, fWrapMenu, B_FOLLOW_ALL, 324 B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 325 menu->SetDivider(labelWidth); 295 menu = new BMenuField("wrap", WRAP_TEXT, fWrapMenu, NULL); 326 296 menu->SetAlignment(B_ALIGN_RIGHT); 327 mailBox->AddChild(menu); 297 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 298 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 299 pos++; 328 300 329 r.OffsetBy(0, height + ITEM_SPACE);330 301 fAttachAttributesMenu = _BuildAttachAttributesMenu(*attachAttributes); 331 menu = new BMenuField(r, "attachAttributes", ATTACH_ATTRIBUTES_TEXT, 332 fAttachAttributesMenu, B_FOLLOW_ALL, 333 B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); 334 menu->SetDivider(labelWidth); 302 menu = new BMenuField("attachAttributes", ATTACH_ATTRIBUTES_TEXT, 303 fAttachAttributesMenu, NULL); 335 304 menu->SetAlignment(B_ALIGN_RIGHT); 336 mailBox->AddChild(menu); 337 338 ResizeTo(Frame().Width(), fRevert->Frame().bottom + 8); 305 mailGrid->AddItem(menu->CreateLabelLayoutItem(), 0, pos); 306 mailGrid->AddItem(menu->CreateMenuBarLayoutItem(), 1, pos, 2); 307 308 AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) 309 .Add(interfaceBox) 310 .AddGlue() 311 .Add(mailBox) 312 .AddGlue() 313 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) 314 .Add(fRevert, 0) 315 .AddGlue(1) 316 .Add(button_cancel, 0) 317 .AddGlue(0) 318 .Add(button_ok, 0) 319 ) 320 .SetInsets(5, 5, 5, 5)); 321 339 322 Show(); 340 323 } 341 324